User accounts in Nextcloud gone

Nextcloud version (eg, 20.0.5): 22.2.2.0
Operating system and version (eg, Ubuntu 20.04): NextCloudPi version v1.50.0, NextCloudPi image NextCloudPi_docker_09-20-21, OS Debian GNU/Linux 10. 5.10.11-v8+ (aarch64)

The issue you are facing:
Today I noticed that my nextcloud clients did not want to login anymore. I tried the webinterface then and got the message that there were too many failed login attempts from my network. Digging a bit into my nextcloud instance showed, that all user accounts seem to be gone. Also, oc_users database table contains only ncp admin-user from nextcloudpi. ncp is the only user I can log in with anymore. The data of all the users seems to be still there in the data folder.

I have no idea how this might have happened. Can anyone advise me how I can recover from this state? I have a file base backup of my nextcloudpi docker volume.

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:
I have no idea.

The output of your Nextcloud log in Admin > Logging:

Level	App	Nachricht		Zeit
Info	core	Bruteforce attempt from "172.18.0.1" detected for action "login".	
2022-09-26T00:57:08+0200
Warning	no app in context	Login failed: username-private (Remote IP: 172.18.0.1)	
2022-09-26T00:57:08+0200
Error	core	RedisException: NOAUTH Authentication required.	
2022-09-26T00:56:58+0200
Error	core	RedisException: NOAUTH Authentication required.	
2022-09-26T00:56:58+0200
Error	index	RedisException: NOAUTH Authentication required.	
2022-09-26T00:56:58+0200
Error	core	RedisException: NOAUTH Authentication required.	
2022-09-26T00:56:58+0200
Error	core	RedisException: NOAUTH Authentication required.	
2022-09-26T00:56:58+0200
Error	index	RedisException: NOAUTH Authentication required.	
2022-09-26T00:56:58+0200
Error	core	RedisException: NOAUTH Authentication required.	
2022-09-26T00:56:57+0200

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

root@rpi4:/mnt/usb1/nextcloudpi/nextcloud/config# cat config.php
<?php
$CONFIG = array (
  'passwordsalt' => 'xyxyxyxyx',
  'secret' => 'ccxcxcxcxcx',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    11 => 'x.y.z',
    1 => 'x.y.z',
    2 => '192.168.155.73',
    5 => 'nextcloudpi.local',
    7 => 'nextcloudpi',
    8 => 'nextcloudpi.lan',
    20 => 'rpi4',
    21 => 'foo.barduckdns.org',
    3 => 'e6a4f5c39917',
    22 => 'dab7a66179b7',
    14 => 'e6a4f5c39917',
    '' => 'localhost',
  ),
  'forwarded_for_headers' =>
  array (
    0 => 'HTTP_X_FORWARDED',
    1 => 'HTTP_X_FORWARDED_FOR',
  ),
  'datadirectory' => '/data/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '22.2.2.0',
  'overwrite.cli.url' => 'https://e6a4f5c39917/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'ncadmin',
  'dbpassword' => 'X1+91ZbQQpqOOTlbKRvKjocdT2VQQHprJ2c+sSiFhz0=',
  'installed' => true,
  'instanceid' => 'ocof344kq2sc',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => 'ohcfq8SlC43mrrGtYPPdHZTYpK1t1EpuGxc1k6G58BI=',
  ),
  'tempdirectory' => '/var/www/nextcloud/data/tmp',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'xyz',
  'mail_domain' => 'dsd.sad',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'overwriteprotocol' => 'https',
  'overwritehost' => 'dsaddsada.dsn.de:4444',
  'maintenance' => false,
  'loglevel' => '1',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'xxx',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'xxx,
  'mail_smtppassword' => 'txx',
  'theme' => '',
  'trusted_proxies' =>
  array (
    11 => '127.0.0.1',
    12 => '::1',
    13 => 'localhost',
    14 => '127.0.0.1',
  ),
);

Yes this have been discussed in a couple topics :slightly_smiling_face: the docker image isn’t updated yet on docker hub so we shouldn’t update the container yet, most likely an automatic update caused this for you, best to turn these off when using the docker image. You can read more info in these topics and on the test workflow I did in a GitHub issue, linked within the topics

https://help.nextcloud.com/t/semi-functional-instance-after-container-upgrade/145821/9?u=zendaiowl

https://help.nextcloud.com/t/ncp-update-to-v-1-50-0-fails-to-503/146128/16?u=zendaiowl

1 Like

Thanks a lot for your reply. Unfortunately no ncp-backup was created during update:( I have an rsync backup of the docket host though, so I have all volumes, databases etc. as files. Can you please advise how to recover from this state? Is there any way I can fix the current broken version or do I have to try to restore my backup?

Thanks mate!!!

I have tried to go back to NCP 1.49.1 usig docker, and restore my database folder from the backup. Unfortunately, Nextcloud seems not to be able to access the database anymore:

mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/run/mysqld/mysqld.sock' exists!
Starting PHP-fpm
Starting Apache
bash: /usr/local/etc/ncp-templates/mysql/90-ncp.cnf.sh: No such file or directory
/usr/local/etc/library.sh: line 220: ${3:}: bad substitution
Starting Redis
Starting Cron
Starting Postfix
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)

Does anyone have a hint for me how this can be fixed?

TIA!

First stop the running container
sudo docker stop nextcloudpi

Remove container
sudo docker rm nextcloudpi

Remove image
sudo docker rmi nextcloudpi


Edit: If the image won’t be recognized by the name, you can check for its ID using sudo docker images ls then remove it by the ID instead of the name using the command above.
(Writing from memory, it could also be image, without the ‘s’, it can also be just images without the ls. Check using --help)

If it’s still associated with a container you might need to append the --force flag, however the docker engine will tell you this in the terminal if that is the case


Check for volume id
sudo docker volume ls

Remove volume
sudo docker volume rm {volume id}

Start it up again with the usual run, it will pull the image anew and start everything up again with a new volume. Then you can start to restore it using the backup, after that you can move your files back in and scan them using the ncc or occ command

Remember that removing the volume removes all data with it that’s in there and if you move your files back in before you’ve restored the backup tar holding your configurations, your files will also be deleted.

Use care :pray:

Thank you for your help! Unfortunately I was not successful :frowning:

I did what you advised: I completely removed the container and image, and pulled the latest image. After that, I replaced the data-volumes-content with the content from my backup of that folder.

Nextcloud does not come up though:

2022-09-28 22:20:01 0 [Note] mysqld (mysqld 10.5.15-MariaDB-0+deb11u1) starting as process 111 ...
2022-09-28 22:20:01 0 [Warning] The parameter innodb_file_format is deprecated and has no effect. It may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/
2022-09-28 22:20:01 0 [Warning] The parameter innodb_buffer_pool_instances is deprecated and has no effect.
2022-09-28 22:20:01 0 [Note] InnoDB: Uses event mutexes
2022-09-28 22:20:01 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-09-28 22:20:01 0 [Note] InnoDB: Number of pools: 1
2022-09-28 22:20:01 0 [Note] InnoDB: Using generic crc32 instructions
2022-09-28 22:20:01 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2022-09-28 22:20:01 0 [Note] InnoDB: Using Linux native AIO
2022-09-28 22:20:01 0 [Note] InnoDB: Initializing buffer pool, total size = 268435456, chunk size = 134217728
2022-09-28 22:20:01 0 [Note] InnoDB: Completed initialization of buffer pool
2022-09-28 22:20:01 0 [ERROR] InnoDB: Upgrade after a crash is not supported. The redo log was created with MariaDB 10.3.36.
2022-09-28 22:20:01 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2022-09-28 22:20:01 0 [Note] InnoDB: Starting shutdown...
2022-09-28 22:20:01 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-09-28 22:20:01 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-09-28 22:20:01 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-09-28 22:20:01 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2022-09-28 22:20:01 0 [ERROR] Aborting

Basically, what is most important to me is the current config (which user accounts exist) and their data. If I start fresh, can I replace just the relevant files to take over the configuration and the data from the users from the backup?

I appreciate your help, thanks!

best regards