Next Cloud Pi completely lost?

Hey guys,

after setting up a ncp in february or so, i have used it without problems. my pictures from android are uploaded every day and all is fine. i could connect to nextcloud using the android or windows app and using the ip adress or dyndns. until now.

today i wanted to look up a recipe in the nc cookbook app. the list with preview pictures was there, but i could not load any recipe on chrome for android.
I went to the pc, wanted to see if it is possible here. No recies, just previews.
I logged into the admin, to see if there were updates. because i have not logged in here for a few months, i clicked through every single menu, but i changed nothing. i rebooted the pi and restartet the hard drive. Somehow this made everything worse. I can not log into nextcloud via my dyndns or via the ip locally any more, only into myip:4443 into the admin.

when i try to ssh to the pi, i can not log in to any user. it asks for the password, but does not accept the pw (permission denied, try again)

System Info

‣ You should open your ports for Lets Encrypt and external access (NOTE: fritz.box router has ports 80 and 443 open for the NCP ip)

NextCloudPi version v1.25.0
distribution Raspbian GNU/Linux 10 \n \l
automount yes
USB devices sda
datadir /media/myCloudDrive/ncdata
data in SD no
data filesystem btrfs
data disk usage 132G/1.9T
rootfs usage 2.4G/14G
swapfile /var/swap
dbdir /var/lib/mysql
Nextcloud check error
HTTPD service up
PHP service up
MariaDB service up
Redis service up
Postfix service up
internet check ok
port check 80 closed
port check 443 closed
IP 192.168.178.21
gateway 192.168.178.1
interface eth0
certificates xxx.spdns.org
NAT loopback no
uptime 14min

First. Nextcloud is a not a backup. For data security you must backup your data or Nextcloud.
Second. Nextcloud is a not a backup. For data security you must backup your data or Nextcloud.

For backup you must use the functions of NextcloudPi or make an own backup.
If your NextcloudPi really crashes and you have no backup you can not restore a backup.

In NextcloudPi (:4443) you must activate SSH. Is it activated?
I think in NextcloudPi you can manage the users (ssh not nextcloud) and set the passwords.

Please reactivate in the first part your ssh account for a user.

https://pant.github.io/nextcloudpi-test-docs/en_How-to-enable-SSH-using-ncp-config-or-ncp-web.html

1 Like

Thank you for your time. I know it is not a backup. I meant to say “I don´t have a backup or snapshot, so i can not just go back to an older instance of NCP”. Sorry if that was confusing.

I have enabled SSH now.

Ok now you can login with “ssh” with a normal user and switch to root:
sudo -s

Now you shoud copy your files (nextcloud and your data) to another storage and dump your database. You can use shell-access or perhaps the admin-tool (:4443).

Please post your next step.

datadir /media/myCloudDrive/ncdata

If your data are more important than your nextcloud-configuration (user, shares, …) you can copy in the first step all your data from /media/myCloudDrive/ncdata to a location on the internet or an additional external device. You can mount an usb-drive with shell or admin-tool (:4443).

1 Like

I am using Windows PowerShell for this, and I tried copy&paste as well as entering the PW manually.

ssh 192.168.178.21
dennis@192.168.178.21's password:
Permission denied, please try again.

Same for every other user.

You must reset the ssh-user-password (not nextcloud-user-password) in the admin-tool (:4443).

If it is not possible, read

https://www.raspberrypi-spy.co.uk/2014/08/how-to-reset-a-forgotten-raspberry-pi-password/

Sorry. I do not use a Pi and/or NextcloudPi.

1 Like

still the same “permission denied” for every user including the users ncp and pi.

ssh to the wrong server?
wrong characters in your keyboard (z/y, caps, …)
Can you test from a real terminal (linux client)?
Or install putty.exe .

1 Like

The ip is correct, and i have now tried it with putty, inserting the password using strg-rightclick -> paste.

Still "access denied" for my main user, the one that get´s prompted when i use ssh [ip] instead of ssh [user]@[ip].

I tried user pi, and although i already changed the standard pw for pi, i was asked to change the standard PW again. I did as asked, and now i have access and went into root withsudo -s.

I am sorry, but can you specify these steps? English is not my first language, and I don´t know what you mean.

Now you shoud copy your files (nextcloud and your data) to another storage and dump your database. You can use shell-access or perhaps the admin-tool (:4443).

Can you help me with a guide?

Please post your next step.

datadir /media/myCloudDrive/ncdata

What do you mean with these two lines above?

If your data are more important than your nextcloud-configuration (user, shares, …) you can copy in the first step all your data from /media/myCloudDrive/ncdata to a location on the internet or an additional external device. You can mount an usb-drive with shell or admin-tool (:4443).

I don´t care about user´s and shares, but if possible i´d like to keep my data.

First get a external storage medium (flash drive/usb hdd)

Plug it in windows. Rename the drive/partition to something. (So you can easily identify it in linux).

Connect it to pi. SSH to pi. Then sudo -s

Check if it is mounted :
lsblk -o name,mountpoint,label,size,uuid

In the output look under label and remember the corresponding mountpoint (eg : /media/somefolder). If mountpoint is empty then note the name (eg : sda1, sdc3, etc).

If mounted then skip this step :
To mount : Create a mount folder
mkdir -p /mnt/usb
Then mount your partition
Replace sdz0 with the name (from previous step. Eg : sda1, sdc3, etc)
mount /dev/sdz0 /mnt/usb/
Your mountpoint is /mnt/usb

Follow the “Making backup including your data” section :
In the below guide replace DESTDIR with your mountpoint and make sure INCLUDE DATA is set to YES

https://docs.nextcloudpi.com/en/how-to-backup-and-restore-a-nextcloudpi-instance-using-ncp-config/

1 Like

Thank you, i will follow this now, just had to get a second external hdd.


This is what I get when trying in [ip]:4443.
And when I use putty and ssh, I log into user pi@[ip] and run sudo ncp-config I can start nc-backup, but i get:

image
Running nc-backup sudo: Account or password is expired, reset your password and try again Current password:

Once i enter the password fo user pi, I get:
image
sudo: unable to change expired password: Authentication token manipulation error Error reading data directory. Is NextCloud running and configured? Done. Press any key...

And then i am back in the nc-config tool.

Do cat /var/www/nextcloud/config/config.php (Do not post the output of this command here. It contains sensitive info)

Note the datadirectory.

Then run (substitue appropriate values in " ")
tar -cf "Your hdd mountpoint/nextcloud-bkp.tar" "datadirectory obtained previously" "/var/www/nextcloud"

mysqldump -u root --single-transaction nextcloud > "your hdd mountpoint/nextcloud-sqlbkp.bak"

Note that if you try to restore nextcloud pi from this backup using the default tools (nc-restore ?) it might not work as we have created it manually. You will have to restore manually.

Once you have a backup, try to figure out why nextcloud is not working.

1 Like

So i opened putty, connectetd to pi@[ip] and pasted cat /var/www/nextcloud/config/config.php.
The answer: permission denied
I switched to root with sudo -s and did try again, now i got the wanted output. The datadirectory is /media/myCloudDrive/ncdata just like it says on the system info landing page of [ip]:4443 in nextcloud pi web gui.

I guess i dont need to type out the “” but can just type tar -cf /media/myCloudDrive/nextcloud-bkp.tar /media/myCloudDrive/ncdata /var/www/nextcloud ?

Yes you can try.

1 Like

I now get
tar: Removing leading '/' from member names
tar: Removing leading '/' from hard link targets

Is your data stored on an external hdd or sdcard ?

On an external 2-tb hdd with usb 3.0 and external power supply. i also managed to get an exactly same to do this backup. Original NC hdd is formatted as btrfs and the backup disk is still in ntfs, i think.

image

I need to run tar first to make a zip-like file, and then i make a copy of the mysql database, right? I don´t run both commands in the same command?

Yes. You run both commands separately.

Try with -P flag.
tar -Pcf /media/myCloudDrive/nextcloud-bkp.tar /media/myCloudDrive/ncdata /var/www/nextcloud

1 Like