Reinstalling nextcloud on Nethserver: troubles

NethServer Version: 7.9.2009

Hello :slight_smile:
I am happily using Nextcloud since 2020 more or less, but I needed to do a full reinstallation on another VM recently
All good for Nethserver and Nextcloud at start.
After a while Nextcloud started giving me headaches with users not recognized so I (wrongly) decided to reinstall nextcloud. And this is when the troubles starts.
I followed the guide to reinstall nextcloud from scratch. But I got an error when I tried to delete mariadb with this error "Can’t connect to local MySQL server through socket ‘/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock’
Now if I try to reinstall nextcloud it simply refuses to do so. I managed to install it but I dont know why it installed with sql lite and in any case it wasn’t working. Now I’m stucked and can’t nor uninstall nor install nextcloud.
I beg your help :frowning: Thank you a lot in any case

Check if anything from this whole conversation helps: Database error after reinstalling Nextcloud - #2 by dnutan

Hello and thank you for the quick reply
I followed the link you provided and I repeated exaclty the same steps as the user who was having the almost same issue but with no luck. After resuming the steps from the point 3, deleting and reinstalling, I have the same situation with nextcloud asking to create an admin user and SQLite as database. I noticed that before that procedure, my mariadb service was installed but not enabled, now is enabled also but still nextcloud not working as expected :frowning: what can I do? thank you a lot again

this is my mariadb sort

Blockquote
rpm -qa mariadb|sort
mariadb-libs-5.5.68-1.el7.x86_64
nethserver-rh-mariadb105-1.0.0-1.ns7.noarch
rh-mariadb105-3.7-1.el7.x86_64
rh-mariadb105-mariadb-10.5.16-2.el7.x86_64
rh-mariadb105-mariadb-common-10.5.16-2.el7.x86_64
rh-mariadb105-mariadb-config-10.5.16-2.el7.x86_64
rh-mariadb105-mariadb-errmsg-10.5.16-2.el7.x86_64
rh-mariadb105-mariadb-libs-10.5.16-2.el7.x86_64
rh-mariadb105-mariadb-server-10.5.16-2.el7.x86_64
rh-mariadb105-mariadb-server-utils-10.5.16-2.el7.x86_64
rh-mariadb105-runtime-3.7-1.el7.x86_64

Do you want a clean install (without previous users/data)?

Yes, exaclty!
Thank you

it comes from default nextcloud settings from a config file without the nethserver customizations (maybe also when there’s no config file?)

Mainly same steps as before. Report any error to go step by step solving each problem.

Make sure mariadb service for nextcloud is running (to be able to delete database and user if they still exists):

systemctl is-active --quiet rh-mariadb105-mariadb@nextcloud.service || systemctl start rh-mariadb105-mariadb@nextcloud.service
systemctl -l status rh-mariadb105-mariadb@nextcloud.service

As root:

# list databases (to search for nextcloud database):
/opt/rh/rh-mariadb105/root/bin/mysqlshow --socket="/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock"

# If nextcloud database is present, remove it:
/opt/rh/rh-mariadb105/root/bin/mysql --socket="/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock" -e "drop database nextcloud;"

# If nextcloud user is present, delete it from database:
/opt/rh/rh-mariadb105/root/bin/mysql --socket="/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock" -e "DROP USER IF EXISTS nextcloud;" 

# Remove rpm packages and related files:
yum remove *nextcloud*

# delete nextcloud config from e-smith database:
config delete nextcloud

# delete leftover files:
rm -rf /usr/share/nextcloud/
rm -rf /var/lib/nethserver/nextcloud  # WARNING: it removes users files
cat /var/lib/nethserver/secrets/nextcloud # optional, to know the password
rm -f /var/lib/nethserver/secrets/nextcloud

It’s possible for some leftover files to remain (webserver redirection…) but I believe they should do no harm.

# reinstall nextcloud:
yum install nethserver-nextcloud

Thank you for the reply and patience
Here it comes the first issue:
Can’t connect to local MySQL server through socket ‘/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock’ (2)

If i launch the second command, it says the directory or file is not existant, sadly
My bad, even with second and third command the same error as above: Can’t connect to local MySQL server through socket ‘/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock’

This is the result of systemctl on mariadb service:

Blockquote
systemctl -l status rh-mariadb105-mariadb@nextcloud.service
● rh-mariadb105-mariadb@nextcloud.service - MariaDB 10.5 database server
Loaded: loaded (/etc/systemd/system/rh-mariadb105-mariadb@.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/rh-mariadb105-mariadb@nextcloud.service.d
└─nethserver.conf
Active: active (running) since lun 2024-09-23 00:47:37 CEST; 19s ago
Docs: man:mysqld(8)
systemd - MariaDB Knowledge Base
Process: 711 ExecStartPost=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED – /opt/rh/rh-mariadb105/root/usr/libexec/mysql-check-upgrade --defaults-group-suffix=.%I (code=exited, status=0/SUCCESS)
Process: 587 ExecStartPre=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED – /opt/rh/rh-mariadb105/root/usr/libexec/mysql-prepare-db-dir --defaults-group-suffix=.%I %n (code=exited, status=0/SUCCESS)
Process: 553 ExecStartPre=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED – /opt/rh/rh-mariadb105/root/usr/libexec/mysql-check-socket --defaults-group-suffix=.%I (code=exited, status=0/SUCCESS)
Process: 545 ExecStartPre=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED – /usr/bin/scl_enabled rh-mariadb105 (code=exited, status=0/SUCCESS)
Main PID: 688 (mysqld)
Status: “Taking your SQL requests now…”
CGroup: /system.slice/system-rh\x2dmariadb105\x2dmariadb.slice/rh-mariadb105-mariadb@nextcloud.service
└─688 /opt/rh/rh-mariadb105/root/usr/libexec/mysqld --defaults-group-suffix=.nextcloud --basedir=/opt/rh/rh-mariadb105/root/usr
mysqld-scl-helper[688]: 2024-09-23 0:47:37 0 [Note] InnoDB: 10.5.16 started; log sequence number 45106; transaction id 20
set 23 00:47:37 mysqld-scl-helper[688]: 2024-09-23 0:47:37 0 [Note] InnoDB: Loading buffer pool(s) from /var/opt/rh/rh-mariadb105/lib/mysql/ib_buffer_pool
set 23 00:47:37 mysqld-scl-helper[688]: 2024-09-23 0:47:37 0 [Note] InnoDB: Buffer pool(s) load completed at 240923 0:47:37
set 23 00:47:37 mysqld-scl-helper[688]: 2024-09-23 0:47:37 0 [Note] Plugin ‘FEEDBACK’ is disabled.
set 23 00:47:37 mysqld-scl-helper[688]: 2024-09-23 0:47:37 0 [Note] Server socket created on IP: ‘::’.
set 23 00:47:37 mysqld-scl-helper[688]: 2024-09-23 0:47:37 0 [Note] Reading of all Master_info entries succeeded
set 23 00:47:37 mysqld-scl-helper[688]: 2024-09-23 0:47:37 0 [Note] Added new Master_info ‘’ to hash table
set 23 00:47:37 mysqld-scl-helper[688]: 2024-09-23 0:47:37 0 [Note] /opt/rh/rh-mariadb105/root/usr/libexec/mysqld: ready for connections.
set 23 00:47:37 mysqld-scl-helper[688]: Version: ‘10.5.16-MariaDB’ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306 MariaDB Server
set 23 00:47:37 l systemd[1]: Started MariaDB 10.5 database server.

mysql --socket="/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock" -e "SHOW GRANTS FOR 'nextcloud'@'localhost'"

does password obtained from command above match the one in /var/lib/nethserver/secrets/nextcloud

It says “command not found”
bash:mysql: command not found

lets try if this quicker workaround works:

yum reinstall nethserver-nextcloud nethserver-rh-mariadb105
signal-event nethserver-nextcloud-update

otherwise I should leave it for today.

Do I have to reinstall nextcloud from software center after launching the command above to reinstall mariadb?

no need, it’s the same that does the (re)install of nethserver-nextcloud package

It’s still on “verifying: nethserver-nextcloud…”
I will update you and this thread as soon as I will have new infos
In the meantime, big thanks to you!!

Hello again,
The reinstallation ended up with an error and the situation was like before, so I restored a backup of the VM of 3 days ago with nextcloud working but with one of the issues that makes me to try the reinstallation of nextcloud:
Screenshot 2024-09-23 at 18-22-52 Accedi – Nextcloud

This is the local nextcloud admin which is the only administrator of nextcloud.
All the domain users and administrators does’t have the admin panel of nextcloud so I can’t do anything on nextcloud.
How can I enable back the local admin?
I tried to follow the guides I found, but no luck again

thanks again for any help or tip

P.s: since it’s a new issue, if I have to open another topic, I will.

sorry, still at workplace, no hands free to answer sooner.
to reset admin password:

occ user:resetpassword admin

Thank you Marc again
I tried it with no luck
I tried the user enable as well, since the local admin user is disabled.
Just to be sure: do I have to run those commands from nethserver shell directly? No directory whatsoever?
Sorry for the question, I only have little knowledge of Linux shell

Thank you

Hi @Jacks
maybe this can be a solution for your problem:

runagent -m nextcloud1 occ user:enable user admin

Regards…

Uwe

ns7 if I didn’t misread it

1 Like