NCP: Your data directory is not writable

I am running the last version of Nextcloudpi. It’s using an external hd as data directory. I often encounter the following error when calling my URL:

Your data directory is not writable

Permissions can usually be fixed by giving the webserver write access to the root directory

A temporary solution is to reboot the raspberry pi. After a few hours, the error message reappears. Running nc-fix-permissions did not help.

This is the output of nc-info in “error state”, i.e. before rebooting:

Running nc-info
Gathering information…
{“reqId”:“JnNJtJUojxlMO2H8JuG5”,“level”:2,“time”:“2020-09-23T18:13:52+00:00”,“remoteAddr”:“”,“user”:“–”,“app”:“no app in context”,“method”:“”,“url”:“–”,“message”:“Temporary directory /media/nc_data/ncdata/tmp is not present or writable”,“userAgent”:“–”,“version”:“19.0.2.2”}
{“reqId”:“JnNJtJUojxlMO2H8JuG5”,“level”:3,“time”:“2020-09-23T18:13:54+00:00”,“remoteAddr”:“”,“user”:“–”,“app”:“PHP”,“method”:“”,“url”:“–”,“message”:“fopen(/media/nc_data/ncdata/data_dir_writability_test_5f6b9062ed14a.tmp): failed to open stream: Read-only file system at /var/www/nextcloud/lib/private/legacy/OC_Util.php#790”,“userAgent”:“–”,“version”:“19.0.2.2”}
{“reqId”:“JnNJtJUojxlMO2H8JuG5”,“level”:3,“time”:“2020-09-23T18:13:54+00:00”,“remoteAddr”:“”,“user”:“–”,“app”:“PHP”,“method”:“”,“url”:“–”,“message”:“fopen(/media/nc_data/ncdata/nextcloud.log): failed to open stream: Read-only file system at /var/www/nextcloud/lib/private/Log/File.php#84”,“userAgent”:“–”,“version”:“19.0.2.2”}
NextCloudPi version v1.30.0
NextCloudPi image NextCloudPi_09-05-20
distribution Raspbian GNU/Linux 10 \n \l
automount yes
USB devices sda
datadir /media/nc_data/ncdata
data in SD no
data filesystem ext2/ext3
data disk usage 2.3G/293G
rootfs usage 2.2G/15G
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.20
gateway 192.168.178.1
interface eth0
certificates xxxx
NAT loopback yes
uptime 1day

Any idea on a remedy?

I’d check output of dmesg for errors, could be bad cable or low power supply. Is the external hd usb powered? If so try a powered usb hub.

Ports closed is a bug which has been reported to github already, most likely unrelated to your issue.

1 Like

Excerpt from dmesg. Power supply might be the reason. The HD is indeed usb powered.

[ 315.356945] EXT4-fs (sda1): error count since last fsck: 4
[ 315.356981] EXT4-fs (sda1): initial error at time 1600452902: ext4_journal_check_start:61
[ 315.357012] EXT4-fs (sda1): last error at time 1600541101: ext4_journal_check_start:61
[10278.520380] Voltage normalised (0x00000000)
[10282.680431] Under-voltage detected! (0x00050005)
[10291.000434] Voltage normalised (0x00000000)
[10313.880532] Under-voltage detected! (0x00050005)
[10318.040548] Voltage normalised (0x00000000)
[10343.000734] Under-voltage detected! (0x00050005)
[10588.441823] rpi_firmware_get_throttled: 10 callbacks suppressed
[10588.441832] Voltage normalised (0x00000000)
[10590.521861] rpi_firmware_get_throttled: 10 callbacks suppressed
[10590.521870] Under-voltage detected! (0x00050005)
[10596.761876] Voltage normalised (0x00000000)
[10613.401955] Under-voltage detected! (0x00050005)
[10617.561991] Voltage normalised (0x00000000)
[10642.522175] Under-voltage detected! (0x00050005)
[10912.923528] rpi_firmware_get_throttled: 8 callbacks suppressed
[10912.923539] Under-voltage detected! (0x00050005)
[10919.163538] rpi_firmware_get_throttled: 9 callbacks suppressed
[10919.163548] Voltage normalised (0x00000000)
[10944.123755] Under-voltage detected! (0x00050005)
[10952.443703] Voltage normalised (0x00000000)
[10973.243804] Under-voltage detected! (0x00050005)
[10979.483840] Voltage normalised (0x00000000)
[11214.524973] rpi_firmware_get_throttled: 7 callbacks suppressed
[11214.524982] Under-voltage detected! (0x00050005)
[11243.645149] Under-voltage detected! (0x00050005)
[11251.965140] rpi_firmware_get_throttled: 8 callbacks suppressed
[11251.965149] Voltage normalised (0x00000000)
[11262.365276] Under-voltage detected! (0x00050005)
[11279.005248] Voltage normalised (0x00000000)
[11308.125401] Voltage normalised (0x00000000)
[11543.166543] rpi_firmware_get_throttled: 9 callbacks suppressed
[11543.166554] Under-voltage detected! (0x00050005)
[11574.366605] Under-voltage detected! (0x00050005)
[11578.526627] rpi_firmware_get_throttled: 9 callbacks suppressed
[11578.526637] Voltage normalised (0x00000000)
[11597.246725] Under-voltage detected! (0x00050005)
[11601.406727] Voltage normalised (0x00000000)
[11607.646761] Voltage normalised (0x00000000)
[11873.887959] rpi_firmware_get_throttled: 9 callbacks suppressed
[11873.887968] Under-voltage detected! (0x00050005)
[11903.008089] Under-voltage detected! (0x00050005)
[11909.248126] rpi_firmware_get_throttled: 9 callbacks suppressed
[11909.248135] Voltage normalised (0x00000000)
[11913.408137] Under-voltage detected! (0x00050005)
[11917.568145] Voltage normalised (0x00000000)
[11938.368227] Voltage normalised (0x00000000)
[12202.529456] rpi_firmware_get_throttled: 11 callbacks suppressed
[12202.529467] Under-voltage detected! (0x00050005)
[12233.729530] Under-voltage detected! (0x00050005)
[12237.889557] rpi_firmware_get_throttled: 11 callbacks suppressed
[12237.889567] Voltage normalised (0x00000000)
[12252.449688] Under-voltage detected! (0x00050005)
[12258.689639] Voltage normalised (0x00000000)
[12275.329726] Voltage normalised (0x00000000)
[12504.130844] rpi_firmware_get_throttled: 8 callbacks suppressed
[12504.130853] Under-voltage detected! (0x00050005)
[12533.250926] Under-voltage detected! (0x00050005)
[12539.490971] rpi_firmware_get_throttled: 8 callbacks suppressed
[12539.490980] Voltage normalised (0x00000000)
[12564.451095] Under-voltage detected! (0x00050005)
[12568.611113] Voltage normalised (0x00000000)
[12574.851131] Voltage normalised (0x00000000)
[12832.772310] rpi_firmware_get_throttled: 9 callbacks suppressed
[12832.772322] Under-voltage detected! (0x00050005)
[12863.972394] Under-voltage detected! (0x00050005)
[12868.132398] rpi_firmware_get_throttled: 9 callbacks suppressed
[12868.132406] Voltage normalised (0x00000000)
[12893.092533] Under-voltage detected! (0x00050005)
[12899.332530] Voltage normalised (0x00000000)
[12928.452669] Voltage normalised (0x00000000)
[13134.373552] rpi_firmware_get_throttled: 8 callbacks suppressed
[13134.373561] Under-voltage detected! (0x00050005)
[13163.493671] Under-voltage detected! (0x00050005)
[13169.733803] Under-voltage detected! (0x00050005)
[13178.053640] rpi_firmware_get_throttled: 9 callbacks suppressed
[13178.053649] Voltage normalised (0x00000000)
[13198.853721] Voltage normalised (0x00000000)
[13227.973850] Voltage normalised (0x00000000)
[13266.427878] sd 0:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08
[13266.427901] sd 0:0:0:0: [sda] tag#0 Sense Key : 0xb [current]
[13266.427918] sd 0:0:0:0: [sda] tag#0 ASC=0x47 ASCQ=0x3
[13266.427938] sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 12 84 2e 20 00 00 c8 00
[13266.427960] blk_update_request: I/O error, dev sda, sector 310652448 op 0x1:(WRITE) flags 0x800 phys_seg 25 prio class 0
[13266.428172] Aborting journal on device sda1-8.
[13266.428214] EXT4-fs error (device sda1) in add_dirent_to_buf:2029: Journal has aborted
[13266.614810] sd 0:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08
[13266.614835] sd 0:0:0:0: [sda] tag#0 Sense Key : 0xb [current]
[13266.614852] sd 0:0:0:0: [sda] tag#0 ASC=0x47 ASCQ=0x3
[13266.614872] sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 12 84 08 00 00 00 08 00

Thanks a lot!