Skip to content

Nextcloud fresh install - Error: Command "upgrade" is not defined. #111175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
afix-space opened this issue Jan 29, 2021 · 25 comments · Fixed by #135958
Closed

Nextcloud fresh install - Error: Command "upgrade" is not defined. #111175

afix-space opened this issue Jan 29, 2021 · 25 comments · Fixed by #135958
Assignees
Labels
0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS

Comments

@afix-space
Copy link

Hi,
I'm testing nextcloud it seem there is an issue.
I'm tying to install a fresh nextcloud and with the minimal example of the man : https://nixos.org/manual/nixos/stable/index.html#module-services-nextcloud

I get :

janv. 29 16:56:31 cloud systemd[1]: Starting nextcloud-setup.service...
janv. 29 16:56:31 cloud nextcloud-setup-start[20532]: Nextcloud is not installed - only a limited number of commands are available
janv. 29 16:56:31 cloud nextcloud-setup-start[20532]:
janv. 29 16:56:31 cloud nextcloud-setup-start[20532]: Command "upgrade" is not defined.

nextcloud-setup-start try to update a new install

same result with :
nixpkgs.config.permittedInsecurePackages = [ "nextcloud-19.0.6" ];
or
package = pkgs.nextcloud20;

  • system: `"x86_64-linux"
  • host os: Linux 5.4.88, NixOS, 21.03pre266581.e5ce05cc1ee (Okapi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.10
  • channels(root): "nixos-20.09.2750.85abeab48b5, nixpkgs-21.03pre266581.e5ce05cc1ee"
  • nixpkgs: /root/.nix-defexpr/channels/nixpkgs

@Ma27 @beardhatcode @Mic92
I may not be calling all the maintainers in case it's a false alarm :-)

@afix-space afix-space added the 0.kind: bug Something is broken label Jan 29, 2021
@veprbl veprbl added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Jan 29, 2021
@IslandUsurper
Copy link
Contributor

I just ran into this too, with nextcloud20 as my package. Running nextcloud-occ list doesn't show an upgrade command.

@IslandUsurper
Copy link
Contributor

I ran the maintenance:install command manually, and now upgrade shows up. Not sure why it didn't install through nix, though.

@afix-space
Copy link
Author

afix-space commented Jan 29, 2021

Thanks, it works for me too.
It must certainly come from the test.
if [[ ! -e /var/lib/nextcloud/config/config.php ]]; then
I'll check that later.

@Ma27 Ma27 self-assigned this Jan 29, 2021
@Ma27
Copy link
Member

Ma27 commented Jan 29, 2021

Cannot reproduce this on latest master and release-20.09. Can you please give me a minmal VM config that I can use to reproduce?

@afix-space
Copy link
Author

Same config works in a test VM.
https://gist.github.com/afix-space/da78514893fc2a614492316e08cb99e9
I'll try to take a closer look next week if it's still relevant.

@DieracDelta
Copy link
Member

DieracDelta commented Jan 30, 2021

I am running into this error as well with about the same config as afix-space. Specifically I'm using this configuration without the nginx stuff (e.g. lines 5 to 27 commented out and services.nextcloud.nginx.enable not set) for nextcloud20 on both nixpkgs master and release-20.09. I'll try it in a VM and report back..

@DieracDelta
Copy link
Member

DieracDelta commented Jan 30, 2021

It doesn't look like the builds of nextcloud and postgres are cleaned up completely, which is where it looks like this problem is coming from. Specifically, I had built nextcloud and postgres several times while I worked out the configuration settings I wanted. It turns out there were nextcloud and postgres folders in /var/lib that still remained after I uninstalled both apps. Removing those two folders, then reinstalling these programs via nix fixed the error for me.

@beardhatcode
Copy link
Contributor

When I've first set up Nextcloud i encountered the same issues @DieracDelta is describing, but since then everything has run smoothly for me.

@eliasp
Copy link
Member

eliasp commented Feb 1, 2021

It might sense to verify the installed: true/false result of status after the maintenance:install block, before executing upgrade, e.g. using --output=json and jq -e '.["installed"], where -e causes jq's returncode to represent the boolean value of installed.

The --output=json of nextcloud-occ is unclean. Instead of returning simply JSON, it also returns an informative message on the same FD:

Nextcloud is not installed - only a limited number of commands are available
{"installed":false,"version":"20.0.5.2","versionstring":"20.0.5","edition":""}

Although this should be fixed upstream in the long term (see also nextcloud/server#23596), it needs to be stripped away for now (e.g. using grep -v ...).

@Ma27
Copy link
Member

Ma27 commented Feb 5, 2021

#112013 may prevent corrupted installations in some cases. But I'm still missing a minimal VM setup to reproduce.

@afix-space
Copy link
Author

I thought I gave one. I 'm very new with nixos but I would be delighted to learn more. maybe you can give me a link or guide me to do this? or pass the assignees to someone that can reproduce it. thanks

@Ma27
Copy link
Member

Ma27 commented Feb 5, 2021

Well, that's the test VM's config that I already checked. Was there any existing state in /var/lib/nextcloud during your install attempt?

@afix-space
Copy link
Author

I don't know I need to reproduce this on the machine in question. i can try

@Ma27
Copy link
Member

Ma27 commented Feb 5, 2021

@eliasp have you checked whether repeated occ:install calls are actually safe? Especially if you want to "work out" your options iteratively.

I don't know I need to reproduce this on the machine in question. i can try

Yeah please do that. You can also answer my question "Was there any existing state in /var/lib/nextcloud during your install attempt?". This is IIRC the main cause for problems like this.

@afix-space
Copy link
Author

I don't have access to the machine but I've just started a vps and the same config works with the same steps.
the problem would not have been solved :-) ?
I'm going to look at the merge for the fun

@afix-space
Copy link
Author

afix-space commented Feb 6, 2021

cool merge :-) I've used adminpass = "abcd1234" on vps may be this is the trick.
And ok I just read other posts.

@afix-space
Copy link
Author

@Ma27 do you really need me to reproduce the problem ? it's really very easy and I know you are active in others post who explain the problem.
If you really need that I have a vps whith the bug.

@Ma27
Copy link
Member

Ma27 commented Feb 6, 2021

Well, I'm trying to check if there are any other causes apart from an existing state. Hence my question whether there was any existing state when you encountered the issue.

@afix-space
Copy link
Author

I don't know in any case, /var/lib/nextcloud/* seems to be the same between the 2 generations

@alarsyo
Copy link
Contributor

alarsyo commented Mar 23, 2021

Hit this too:

I'd misconfigured the postgres database (the nextcloud module doesn't setup a nextcloud user and role on the db, which I'm used to for other modules), so the nextcloud-setup service errored out with a database "role doesn't exist" issue. Once I fixed this, I hit this problem, which went away with a good old rm -rf /var/lib/nextcloud.

@Ma27
Copy link
Member

Ma27 commented Aug 27, 2021

To me it seems as if most of the issues here are because the initial install failed and then the app wasn't properly installed, correct?

Rather than letting this stall here even more, I'd write a few more notes in the documentation.

Ma27 added a commit to Ma27/nixpkgs that referenced this issue Aug 27, 2021
…defined.`

This error occurs if `nextcloud-occ maintenance:install` fails and the
`upgrade` command is attempted to be executed afterwards.

Due to the nature of the installer we can't do much about it, so I guess
it makes sense to add some notes about it. The other notes in the
`Pitfalls`-section are semantically a list of different topics, so I
changed that accordingly now.

Closes NixOS#111175
github-actions bot pushed a commit that referenced this issue Aug 31, 2021
…defined.`

This error occurs if `nextcloud-occ maintenance:install` fails and the
`upgrade` command is attempted to be executed afterwards.

Due to the nature of the installer we can't do much about it, so I guess
it makes sense to add some notes about it. The other notes in the
`Pitfalls`-section are semantically a list of different topics, so I
changed that accordingly now.

Closes #111175

(cherry picked from commit 561418f)
@poly2it
Copy link

poly2it commented Mar 18, 2025

I'm getting this issue on unstable.

@poly2it
Copy link

poly2it commented Mar 18, 2025

rm -rf /var/lib/nextcloud "worked" for me.

@axelsimon
Copy link

I'm getting it on 24.11:
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"

No luck on removing the /var/lib/nextcloud dir either.

@Ma27
Copy link
Member

Ma27 commented Mar 26, 2025

I'll lock this issue now. It is four years old and the module has changed in a lot of ways, so I doubt that any of this is related to the original problem.

If you encounter this: file a clear & concise bug-report that includes nixpkgs rev, logs, nixos config, things you've tried, whether it's a fresh install. There's even an entire section in the manual for things to check!

I can't help anyone if the bugreports consist of two sentences missing 99% of the information I'd need to give a qualified answer.

@NixOS NixOS locked and limited conversation to collaborators Mar 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants