2>&1 Website under construction!

"Nextcloud" on https://aligot-death.space, available at https://aligot-death.space/wiki/nextcloud-en



Nextcloudtips and notes.

Read it aloud: play pause stop



Basic install#


sudo apt update
sudo apt install nfs-common


sudo mount -t nfs /var/data

fstab :  /var/data   nfs      rw,sync,hard,intr  0     0


sudo systemctl stop apache2
sudo systemctl disable apache2

sudo apt install nginx
sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl enable nginx.service


sudo apt install mariadb-server mariadb-client
sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
sudo mysql_secure_installation
Enter current password for root (enter for none): Just press the Enter
Set root password? [Y/n]: Y
New password: Enter password
Re-enter new password: Repeat password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]:  Y
Reload privilege tables now? [Y/n]:  Y
sudo systemctl restart mariadb.service
sudo apt install php-fpm php-mbstring php-xmlrpc php-soap php-apcu php-smbclient php-ldap php-redis php-gd php-xml php-intl php-json php-imagick php-mysql php-cli php-ldap php-zip php-curl unzip


DEPRECATED. See this issue

sudo mysql -u root -p
CREATE USER '<user>'@'localhost' IDENTIFIED BY 'new_password_here';
GRANT ALL ON nextcloud.* TO '<user>'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;

cd /tmp && wget https://download.nextcloud.com/server/releases/nextcloud-<release>.0.1.zip
unzip nextcloud-17.0.1.zip
sudo mv nextcloud /var/www/html/nextcloud/

sudo chown -R www-data:www-data /var/www/html/nextcloud/
sudo chmod -R 755 /var/www/html/nextcloud/

sudo nano /etc/nginx/sites-available/nextcloud

sudo ln -s /etc/nginx/sites-available/frigg_nemecl /etc/nginx/sites-enabled/

# if network mount:

(select /var/data) (chown /var/data)

Live DNS#


sudo apt update && sudo apt upgrade && sudo apt install unzip python-requests python-args python-simplejson
cd /tmp && git clone https://github.com/cavebeat/gandi-live-dns.git
sudo mv /tmp/gandi-live-dns /opt

# Settings: (https://forum.yunohost.org/t/configuration-nextcloud-php-fpm-pm-max-children/10911) in /etc/php/7.x/fpm/pool.d/www.conf:

pm = static
pm.max_children setting = 8 ; depends on CPU, good on Pi 3


sudo service php7.3-fpm restart


Cannot login, always goes back to login page#

More often than not, that indicates a permission issue, namely in the nextcloud directory. Simply do (adapt it if needed):

sudo chown -R www-data:www-data /var/www/html/nextcloud/

php settings ignored#

If some php settings (typically, memory_limit, as shown in settings > Administration > System) seem to be ignored, you might need to restart the php-fpm service as well. For instance:

sudo service php7.3-fpm restart

Error 423#

sudo -u www-data php occ files:scan --all

Error 504 "Error when assembling chunk"#

If some php settings (typically, memory_limit, as shown in settings > Administration > System) seem to be ignored, you might need to restart the php-fpm service as well. For instance:

in /etc/php/7.x/fpm/pool.d/www.conf, if max_execution_time is low (e.g. 30), raise it to 3600 :

max_execution_time = 3600

Then restart fpm service: .. code:

sudo service php7.3-fpm restart


nextcloud locked files#


You can’t access files because they are locked and you find such errors in your logfile:

{"reqId":"0DijSqEkfOg2iyh9VD8J","remoteAddr":"xx.xx.xx.xx","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 423 \\\"path\\\/file.extension\\\" is locked\",\"Exception\":\"OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Exception\\\\FileLocked\",\"Code\":0,\"Trace\":\"#0

Manually disable locking state:

put Nextcloud in maintenance mode: edit config/config.php and change this line: 'maintenance' => true, Empty table oc_file_locks: Use tools such as phpmyadmin or connect directly to your database and run (the default table prefix is "oc<underscore>", this prefix can be different or even empty): DELETE FROM oc_file_locks WHERE 1 disable maintenance mode (undo first step). Make sure your cron-jobs run properly (you admin page tells you when cron ran the last time): https://docs.nextcloud.org/server/13/admin_manual/configuration_server/background_jobs_configuration.html 1.7k

Permanent solution (if it happens regularly)

on your own server: Use redis for this feature. It is faster and so far no problems have been reported. You can follow the instructions for memory-caching in the docs: https://docs.nextcloud.org/server/13/admin_manual/configuration_server/caching_configuration.html#id4 6.1k Shared hosting (others who can’t install redis): You can disable the file locking, edit your configuration file config/config.php: 'filelocking.enabled' => false, However, disabling is not a good solution. You can run into problems when several processes try to write to a file (especially online editors in the web-interface). In single-user and single-client environments, it’s probably less of a problem.

> sudo service php7.3-fpm restart

In addition to the package nextcloud-desktop, you can search for integrations for file managers. For instance caja-nextcloud for MATE.

Update fails on intergrity and stuck on step 5#

when trying to start update from web interface, updater fails on integrity check, and when page is reloaded it is stuck on "Step 5 is currently in process. Please reload this page later."

Typical root cause#

Check web server logs (for instance, in /var/log/nginx/, do sudo grep -rn "bytes exhausted") if a message "Allowed memory size of xxx bytes exhausted" appears. if so, server ran out of memory when updating and fails to restart updating process.

go into php server setting files (for instance in my case, /etc/php/7.3/fpm/php.ini), and change memory_limit to a higher value, or check php settings ignored

Unlocking updater#

Once the problem is solved, unlock the updater by logging as the owner of the Nextcloud directory (typically www-data), browse to the directory, and launch:

php occ maintenance:repair

The updater should be right back again.

Source: issue #316 on Github

Nextcloud client on Linux#