Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to move datadir to USBdrive even on clean fresh install NCP 1.55.2 #1989

Closed
Knubbel opened this issue Sep 28, 2024 · 5 comments
Closed

Comments

@Knubbel
Copy link

Knubbel commented Sep 28, 2024

So now I have tried setting up a fresh NCP instance on a 8GB Raspi 4 about 12-15 times using the image https://github.com/nextcloud/nextcloudpi/releases/download/v1.55.2/NextcloudPi_RaspberryPi4_v1.55.2.zip
And I have isolated two key problems of which I describe one here, because that is a severe roadblock for me currently to use NCP productively.

Scenario to reproduce:

  1. 8GB Raspi 4 + 32GB sdcard + frshly downloaded NCP 1.55.2 image
  2. boot and start set-up wizard
  3. configure to not move datadir anywhere so it stays on sdcard at /opt/ncdata/data, dbdir stays at /var/lib/mysql
  4. NCP is running ok; when logging into NC as admin user "ncp" and uploading a test file via web UI this works fine.
  5. shut down
  6. plug in a USB stick with 128GB, preformatted as ext4
  7. reboot Raspi 4 and mount USB stick
  8. via NCP webUI change data dir to a new location on the USB stick
  9. the script runs through and gives a green traffic light, but I see errors in the log window in the webUI - but also exits with a "succesful" text.
    1. looking at the system info the new data dir is beeing confirmed at the USB stick location as if it worked fine
  10. BUT: it doesnt
  11. when I log in to NC using the admin "ncp" user and again try to upload a test file via web UI I get erros and it doesnt work.

For me as a noob user the NCP instance is fully und unrecoverbly broken from here on.

This same problem seems to happen even plugging in a completely fresh (not partitions) USB stick prior to starting the Setup-Wizard and then letting the setup wizard format it with a fresh BTRFS file system.

I have also tried it with a manual chmod 777 on the mounted USBstick location, but that did help either.

Please, please help me move my data dir to a USB stick.
If there is any manual sequence of commands to run so I can move the data dir and not kill my NCP instance in the process that would be great.

I am happy to provide any additional info you may request.

Error when uploading via webUI reads:
"Fehler beim Hochladen: Erwartete Dateigröße von 835644 bytes, aber 8192 bytes gelesen (vom Nextcloud-Client) und geschrieben (in den Nextcloud-Speicher). Dies kann entweder ein Netzwerkproblem auf der sendenden Seite oder ein Problem beim Schreiben in den Speicher auf der Serverseite sein."

Errors in log while trying to move data dir reads:

[ nc-datadir ] (Wed Sep 25 05:21:36 UTC 2024)
Maintenance mode enabled
moving data directory from /opt/ncdata/data to /media/SDD1/ncdata...
{"reqId":"empEsuPrfzPi0dj2eeET","level":2,"time":"2024-09-25T05:21:39+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory /opt/ncdata/data/tmp is not present or writable","userAgent":"--","version":"29.0.4.1","data":[]}
Nextcloud is in maintenance mode, no apps are loaded.
Commands provided by apps are unavailable.
**Your data directory is invalid.
Ensure there is a file called ".ocdata" in the root of the data directory.
Cannot create "data" directory.
This can usually be fixed by giving the web server write access to the root directory. See https://docs.nextcloud.com/server/29/go.php?to=admin-dir_permissions
An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /var/www/nextcloud/lib/private/Console/Application.php:167
Stack trace:
#0 /var/www/nextcloud/console.php(101): OC\Console\Application->loadCommands()
#1 /var/www/nextcloud/occ(11): require_once('...')
#2 {main}**
Nextcloud is in maintenance mode, no apps are loaded.
Commands provided by apps are unavailable.
System config value logfile set to string /media/SDD1/ncdata/data/nextcloud.log
Nextcloud is in maintenance mode, no apps are loaded.
Commands provided by apps are unavailable.
System config value tempdirectory set to string /media/SDD1/ncdata/data/tmp
Installing template 'php/opcache.ini.sh'...
Maintenance mode disabled
Installing template 'ncp-metrics.cfg.sh'...
The NC data directory has been moved successfully.
@pikzim
Copy link

pikzim commented Sep 29, 2024

same problem

@theCalcaholic
Copy link
Collaborator

Hi @Knubbel Thanks for your report. Could you run the following command and afterward run nc-datadir again and share its output?

sudo sed 's/set -e -o pipefail/set -ex -o pipefail/' -i /usr/local/bin/ncp/CONFIG/nc-datadir.sh

That would be very helpful to identify the issue.

@Knubbel
Copy link
Author

Knubbel commented Sep 29, 2024

Hi @Knubbel Thanks for your report. Could you run the following command and afterward run nc-datadir again and share its output?

sudo sed 's/set -e -o pipefail/set -ex -o pipefail/' -i /usr/local/bin/ncp/CONFIG/nc-datadir.sh

That would be very helpful to identify the issue.

I did issue your command on the shell and then started the datadir change again in the webui.
On the shell there was no output.
In the log window in the webUI this time there also was zero outout (very unusual) and then the traffic light turned green.
In the WebUI log windows the attached log was found. I hope that helps.

Afterwards my NC instance is broken again with the typical symptom of not being able to upload anything even though the system info now shows me the "new" datadir.

Fehler beim Hochladen: Der Server konnte die Anfrage nicht fertig stellen. Sollte dies erneut auftreten, sende bitte die nachfolgenden technischen Einzelheiten an deinen Server-Administrator. Weitere Details können im Server-Protokoll gefunden werden.

datadir error ncp.log

PS: After a reboot NC doesnt come back up, it stops at a white screen internal server error. So it is not just the failing uploads, the whole thing is broken after the tried datadir move.

@theCalcaholic
Copy link
Collaborator

Ah, I suppose it was in a broken state after the previous attempt... 🤔

I'll try to reproduce the issue later this week (right now I'm not at home and lack the required hardware for testing).

@theCalcaholic
Copy link
Collaborator

I'll close this for now. Feel free to reopen if you still have the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants