[SOLVED] Attempting to erase and reinstall. (Update - Command updater undefined)

Server version: Apache/2.4.38 (Unix)

PHP Version: PHP 7.3.3 (cli) (built: Mar 6 2019 18:03:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.3, Copyright (c) 1999-2018, by Zend Technologies

OS: Linux archlinux 5.0.0-arch1-1-ARCH #1 S

Nextcloud: 15.0.5

Disclosure: I am new to Linux let alone Nextcloud. I learned it over the weekened so I have less than a weeks worth of experience. Please be considerate. Thank you.

Hello. I have been having so much trouble I decided to remove the application and reinstall it.

I removed it with

sudo pacman -Rns nextcloud

Installed it with

sudo Pacman -S nextcloud

I receive the following error in my install logs

Total Installed Size: 219.53 MiB

:: Proceed with installation? [Y/n]
(23/23) checking keys in keyring [#############################################################################] 100%
(23/23) checking package integrity [#############################################################################] 100%
(23/23) loading package files [#############################################################################] 100%
(23/23) checking for file conflicts [#############################################################################] 100%
(23/23) checking available disk space [#############################################################################] 100%
:: Processing package changesā€¦
( 1/23) installing libpng [#############################################################################] 100%
( 2/23) installing graphite [#############################################################################] 100%
( 3/23) installing harfbuzz [#############################################################################] 100%
Optional dependencies for harfbuzz
cairo: hb-view program
( 4/23) installing freetype2 [#############################################################################] 100%
( 5/23) installing fontconfig [#############################################################################] 100%

Fontconfig configuration is done via /etc/fonts/conf.avail and conf.d.
Read /etc/fonts/conf.d/README for more information.

Configuration via /etc/fonts/local.conf is still possible,
but is no longer recommended for options available in conf.avail.

Main systemwide configuration should be done by symlinks
(especially for autohinting, sub-pixel and lcdfilter):

cd /etc/fonts/conf.d
ln -s ā€¦/conf.avail/XX-foo.conf

Check also Font configuration - ArchWiki
and https://wiki.archlinux.org/index.php/Fonts.

Rebuilding fontconfig cacheā€¦ done.
( 6/23) installing xorgproto [#############################################################################] 100%
( 7/23) installing libice [#############################################################################] 100%
( 8/23) installing libsm [#############################################################################] 100%
( 9/23) installing xcb-proto [#############################################################################] 100%
(10/23) installing libxdmcp [#############################################################################] 100%
(11/23) installing libxau [#############################################################################] 100%
(12/23) installing libxcb [#############################################################################] 100%
(13/23) installing libx11 [#############################################################################] 100%
(14/23) installing libxt [#############################################################################] 100%
(15/23) installing libxext [#############################################################################] 100%
(16/23) installing libxpm [#############################################################################] 100%
(17/23) installing libjpeg-turbo [#############################################################################] 100%
(18/23) installing libtiff [#############################################################################] 100%
Optional dependencies for libtiff
freeglut: for using tiffgt
(19/23) installing giflib [#############################################################################] 100%
(20/23) installing libwebp [#############################################################################] 100%
Optional dependencies for libwebp
freeglut: vwebp viewer
(21/23) installing gd [#############################################################################] 100%
Optional dependencies for gd
perl: bdftogd script [installed]
(22/23) installing php-gd [#############################################################################] 100%
(23/23) installing nextcloud [#############################################################################] 100%
Optional dependencies for nextcloud
php-apache: to use the Apache web server [installed]
php-sqlite: to use the SQLite database backend
php-pgsql: to use the PostgreSQL database backend
php-ldap: LDAP authentication [installed]
php-intl [installed]
php-apcu [installed]
mariadb: to use the MySQL database backend [installed]
smbclient: to mount SAMBA shares
php-mcrypt
ffmpeg: file preview
libreoffice: file preview
:: Running post-transaction hooksā€¦
(1/2) Update Nextcloud installation
Nextcloud is not installed - only a limited number of commands are available
Cannot write into ā€œappsā€ directory
This can usually be fixed by giving the webserver write access to the apps directory or disabling the appstore in the config file. See https://docs.nextcloud.com/server/15/go.php?to=admin-dir_permissions

An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /usr/share/webapps/nextcloud/lib/private/Console/Application.php:166
Stack trace:
#0 /usr/share/webapps/nextcloud/console.php(95): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /usr/share/webapps/nextcloud/occ(11): require_once(ā€˜/usr/share/webaā€¦ā€™)
#2 {main}PHP Warning: fileperms(): stat failed for /usr/share/webapps/nextcloud/data/nextcloud.log in /usr/share/webapps/nextcloud/lib/private/Log/File.php on line 140
{ā€œreqIdā€:ā€œiDMj0Goz4eX66JnBvmknā€,ā€œlevelā€:3,ā€œtimeā€:ā€œ2019-03-12T07:07:50+00:00ā€,ā€œremoteAddrā€:ā€œā€,ā€œuserā€:ā€œā€“ā€,ā€œappā€:ā€œPHPā€,ā€œmethodā€:ā€œā€,ā€œurlā€:ā€œā€“ā€,ā€œmessageā€:ā€œfileperms(): stat failed for /usr/share/webapps/nextcloud/data/nextcloud.log at /usr/share/webapps/nextcloud/lib/private/Log/File.php#140ā€,ā€œuserAgentā€:ā€œpacman/5.1.3 (Linux x86_64) libalpm/11.0.3ā€,ā€œversionā€:ā€œā€}
{ā€œreqIdā€:ā€œiDMj0Goz4eX66JnBvmknā€,ā€œlevelā€:3,ā€œtimeā€:ā€œ2019-03-12T07:07:50+00:00ā€,ā€œremoteAddrā€:ā€œā€,ā€œuserā€:ā€œā€“ā€,ā€œappā€:ā€œPHPā€,ā€œmethodā€:ā€œā€,ā€œurlā€:ā€œā€“ā€,ā€œmessageā€:ā€œYou are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at /usr/share/webapps/nextcloud/3rdparty/patchwork/utf8/src/Patchwork/Utf8/Bootup/intl.php#18ā€,ā€œuserAgentā€:ā€œpacman/5.1.3 (Linux x86_64) libalpm/11.0.3ā€,ā€œversionā€:ā€œā€}
error: command failed to execute correctly
(2/2) Arming ConditionNeedsUpdateā€¦

I have read that some of these are just warning rather than errors. If thatā€™s the case, then what needs to be done to either resolve or further isolate the problem. Iā€™m new to this so it would be good to know how you guys draw the conslusions you doā€¦

Resolution

Uninstall with

sudo pacman -Rcn nextcloud

Remove both nextcloud folders in /var/ and /usr/. If you are using arch, remove the pacman hook.

sudo rm /etc/pacman.d/hooks/nextcloud.hook

Reinstall

Update

Ok guys, so here is what I did.

First I started by changing the memory limit in pho.ini

sudo nano /etc/php/php.ini

memory_limit = 512M

Deleted directories

sudo rm -rf /usr/share/webapps/nextcloud;

sudo rm -rf /etc/webapps/nextcloud;

Deleted databases that I created EXCLUSIVELY for this purpose

select user,host
from mysql.user
where user = ā€˜anonā€™;

delete from mysql.user
where user=ā€˜anonā€™
and host = ā€˜localhostā€™;
flush privileges;

drop database nextcloud;

Next, I stopped MariaDB and Apache

sudo systemctl stop mariadb.service;

sudo systemctl stop httpd.service;

Reinstalled Nextcloud

sudo pacman -Rcn nextcloud;

sudo pacman -S nextcloud;

I received the old ā€œapp needs write permissionsā€ error again. So I ran the following

sudo mkdir -p /usr/share/webapps/nextcloud/data;
sudo chown http:http /usr/share/webapps/nextcloud/data;
sudo chown -R http:http /usr/share/webapps/nextcloud/apps;
sudo chown http:http /usr/share/webapps/nextcloud/occ;
sudo chmod 750 /usr/share/webapps/nextcloud/data;
sudo chmod 755 /usr/share/webapps/nextcloud/apps;

Installed Nextcloud again.

sudo pacman -S nextcloud

This is where I am at and I have no idea what to do.

Packages (1) nextcloud-15.0.5-1

Total Installed Size: 182.99 MiB
Net Upgrade Size: 0.00 MiB

:: Proceed with installation? [Y/n]
(1/1) checking keys in keyring [#############################################################################] 100%
(1/1) checking package integrity [#############################################################################] 100%
(1/1) loading package files [#############################################################################] 100%
(1/1) checking for file conflicts [#############################################################################] 100%
(1/1) checking available disk space [#############################################################################] 100%
:: Processing package changesā€¦
(1/1) reinstalling nextcloud [#############################################################################] 100%
:: Running post-transaction hooksā€¦
(1/2) Update Nextcloud installation
Nextcloud is not installed - only a limited number of commands are available

Command ā€œupgradeā€ is not defined.

error: command failed to execute correctly
(2/2) Arming ConditionNeedsUpdateā€¦

Here are my permissions for the nextcloud folder

drwxr-xr-x 14 root http 4096 Mar 12 18:32 .
drwxr-xr-x 4 root root 4096 Mar 12 17:51 ā€¦
-rw-rā€“r-- 1 root http 2836 Mar 3 03:32 .htaccess
-rw-rā€“r-- 1 root http 163 Mar 3 03:32 .user.ini
drwxr-xr-x 32 root http 4096 Mar 12 18:32 3rdparty
-rw-rā€“r-- 1 root http 12063 Mar 3 03:32 AUTHORS
-rw-rā€“r-- 1 root http 34520 Mar 3 03:32 COPYING
drwxr-xr-x 38 http http 4096 Mar 12 17:51 apps
lrwxrwxrwx 1 root http 29 Mar 3 03:32 config ā†’ /etc/webapps/nextcloud/config
-rw-rā€“r-- 1 root http 3650 Mar 3 03:32 console.php
drwxr-xr-x 18 root http 4096 Mar 12 18:32 core
-rw-rā€“r-- 1 root http 4979 Mar 3 03:32 cron.php
drwxr-xā€” 2 http http 4096 Mar 12 17:52 data
-rw-rā€“r-- 1 root http 156 Mar 3 03:32 index.html
-rw-rā€“r-- 1 root http 3172 Mar 3 03:32 index.php
drwxr-xr-x 6 root http 4096 Mar 12 18:32 lib
-rwxr-xr-x 1 root http 283 Mar 3 03:32 occ
drwxr-xr-x 2 root http 4096 Mar 12 18:32 ocm-provider
drwxr-xr-x 2 root http 4096 Mar 12 18:32 ocs
drwxr-xr-x 2 root http 4096 Mar 12 18:32 ocs-provider
-rw-rā€“r-- 1 root http 2951 Mar 3 03:32 public.php
-rw-rā€“r-- 1 root http 5139 Mar 3 03:32 remote.php
drwxr-xr-x 4 root http 4096 Mar 12 18:32 resources
-rw-rā€“r-- 1 root http 26 Mar 3 03:32 robots.txt
drwxr-xr-x 12 root http 4096 Mar 12 18:32 settings
-rw-rā€“r-- 1 root http 2232 Mar 3 03:32 status.php
drwxr-xr-x 3 root http 4096 Mar 12 18:32 themes
drwxr-xr-x 2 root http 4096 Mar 12 18:32 updater
-rw-rā€“r-- 1 root http 362 Mar 3 03:32 version.php

After some thread browsing it appears that Nextcloud is trying to take advantage of ooc. I tried running OOC

sudo -u http php occ maintenance:upgrade --on

Command ā€œmaintenance:upgradeā€ is not defined.

Did you mean this?
maintenance:install

sudo -u http php occ maintenance:repair

Command ā€œmaintenance:repairā€ is not defined.

Did you mean this?
maintenance:install

sudo -u http php occ maintenance:install

Command ā€œmaintenance:upgradeā€ is not defined.

Did you mean this?
maintenance:install

And of course, I ran the install command

sudo -u http php occ maintenance:install

In Install.php line 122:
Database is not supported

Im not using sqlite. Iā€™m using MariaDB. I donā€™t just want to randomly edit files so Iā€™ll let you guys decide what to do.

Ubdate

Someone on Reddit suggested I use docker to remove and install. Is this a good idea? Or will it break things? It appears supported but I donā€™t know if my current situation will cause conflicts.

https://hub.docker.com/_/nextcloud/

When i said you won a reinstall i meant the OS.

If you put apart the engine of your car, and then fail to put it together again because you cannot remember what you did -> learn how to do it -> get a new engine.

did you ever read the following when loging in a linux system? Maybe you shoud practice some zen over this lines:

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

Thatā€™s the reason Iā€™m using Arch. That way I can learn how Linux works. I could format the operating system an do it all over again but I feel like I wouldnā€™t learn anything. I would like to learn the actual cause behind my problem. I would like to understand the reason why I canā€™t simply uninstall nextcloud an reinstall it like every other price of software I have used so far. Uninstalling and reinstalling is a standard practice. Iā€™m genuinely concerned that attempting such practices leads to irreversible damage.

Maybe i sounded harsh. Could be that your ā€œurgentā€ tag in your first thread made me switch off a little bit. I now read your whole post and update, and realize i could be a little more constructive here. So lets try.

did you chown -R the nextcloud directory? i always di chown -R https:httpd /path so pewrmissions apply to the user and the group, but i use debianoids, and im not 100% sure if necessary.

seems that the occ command on itself works. I never install it via occ but via browser. there you can specify the database specifics like DB/ DB user and so on.

Can you please post your config.php?

check this link out for command line installation:
https://docs.nextcloud.com/server/15/admin_manual/configuration_server/occ_command.html?highlight=occ#command-line-installation

And never forget. Rome wasnt built on a weekend :wink:

My spine shivers when i think back on my frustration when trying out linux for the first time. Later it was pure awesomness.

After i was confident in Linux and Nextcloud it really took me a while to wrap my head around mysql/mariadb.

keep it up

Update

Once I uninstalled nextcloud, I deleted the directories in /usr/ and /etc/. I decided to install and run the mlocate tool to see if anything else was missing.

locate nextcloud

Sure enough, there was a pacman.hook file left over which was responsible for automatic upgrades. I just deleted the file and the install logs look clean. This does not mean that it is fixed yet. I still need to rebuild permissions and recreate the database. Iā€™m going to play with it further later tonight. I will close the thread once I am able to log in to the main webpage on apache over my local IP address.

Update

Good news everyone. I can confirm it has been fixed. I recreated the pacman hook, SQL databaseā€™s and set the correct folder permissions as specified in the Arch Nextcloud docs. Once I was done, I restarted apache.

I can now successfully log in over HTTP.

Thank you for your help.

Resolution

Uninstall with

sudo pacman -Rcn nextcloud

Remove both nextcloud folders in /var/ and /usr/. If you are using arch, remove the pacman hook.

sudo rm /etc/pacman.d/hooks/nextcloud.hook

Reinstall