Beginner in danger Media storage maybe - RESOLVED

Hey guys i’m a begginer on Nextcloud and linux.
I install next cloud on my raspberry with NextcloudPi from ownyourbits tutorial.

Everything was configured and worked fine and then like 1 month after I got that:

ERROR on the webpage
Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

I did a sudo ncp-report that you will find below.

However from what I understand Nextcloud can’t access to the external storage I plug ( a simple 500go Hard drive).
I don’t know if i unmount it or not and i don’t know how to do it.

I find it when I did a

lsusb

Bus 001 Device 006: ID 04e8:61b6 Samsung Electronics Co., Ltd M3 Portable Hard Drive 1TB
Bus 001 Device 004: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I don’t find it when i do

cat /etc/mtab
/dev/root / ext4 rw,noatime 0 0
devtmpfs /dev devtmpfs rw,relatime,size=469540k,nr_inodes=117385,mode=755 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup2 /sys/fs/cgroup/unified cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,name=systemd 0 0
bpf /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/net_cls cgroup rw,nosuid,nodev,noexec,relatime,net_cls 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=34,pgrp=1,timeout=0,minproto=5,maxproto=5,direct 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
sunrpc /run/rpc_pipefs rpc_pipefs rw,relatime 0 0
mqueue /dev/mqueue mqueue rw,relatime 0 0
configfs /sys/kernel/config configfs rw,relatime 0 0
/dev/mmcblk0p1 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 0
tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=94828k,mode=700,uid=1000,gid=1000 0 0
/dev/sda1 /media/myCloudDrive btrfs rw,nosuid,nodev,relatime,space_cache,subvolid=5,subvol=/ 0 0

Or
cat /etc/mtab

/dev/root / ext4 rw,noatime 0 0
devtmpfs /dev devtmpfs rw,relatime,size=469540k,nr_inodes=117385,mode=755 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup2 /sys/fs/cgroup/unified cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,name=systemd 0 0
bpf /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/net_cls cgroup rw,nosuid,nodev,noexec,relatime,net_cls 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=34,pgrp=1,timeout=0,minproto=5,maxproto=5,direct 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
sunrpc /run/rpc_pipefs rpc_pipefs rw,relatime 0 0
mqueue /dev/mqueue mqueue rw,relatime 0 0
configfs /sys/kernel/config configfs rw,relatime 0 0
/dev/mmcblk0p1 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 0
tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=94828k,mode=700,uid=1000,gid=1000 0 0

Anyway thnak a lot for your help! =)

the *ncp-report *

NextCloudPi diagnostics

PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"htjatc0lRwENAUNb2TQn","level":3,"time":"2020-05-02T00:26:59+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/myCloudDrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#140","userAgent":"--","version":"16.0.9.2"}
{"reqId":"htjatc0lRwENAUNb2TQn","level":2,"time":"2020-05-02T00:26:59+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory \/media\/myCloudDrive\/ncdata\/tmp is not present or writable","userAgent":"--","version":"16.0.9.2"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"htjatc0lRwENAUNb2TQn","level":3,"time":"2020-05-02T00:27:01+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"file_get_contents(\/media\/myCloudDrive\/ncdata\/news\/config\/config.ini): failed to open stream: No such file or directory at \/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Local.php#217","userAgent":"--","version":"16.0.9.2"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"htjatc0lRwENAUNb2TQn","level":3,"time":"2020-05-02T00:27:01+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/myCloudDrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#140","userAgent":"--","version":"16.0.9.2"}
{"reqId":"htjatc0lRwENAUNb2TQn","level":2,"time":"2020-05-02T00:27:01+00:00","remoteAddr":"","user":"--","app":"news","method":"","url":"--","message":"Configuration invalid. Ignoring values.","userAgent":"--","version":"16.0.9.2"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"htjatc0lRwENAUNb2TQn","level":3,"time":"2020-05-02T00:27:01+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"mkdir(): Permission denied at \/var\/www\/nextcloud\/apps\/news\/lib\/AppInfo\/Application.php#142","userAgent":"--","version":"16.0.9.2"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"htjatc0lRwENAUNb2TQn","level":3,"time":"2020-05-02T00:27:01+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/myCloudDrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#140","userAgent":"--","version":"16.0.9.2"}
{"reqId":"htjatc0lRwENAUNb2TQn","level":3,"time":"2020-05-02T00:27:01+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"chmod(): No such file or directory at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#141","userAgent":"--","version":"16.0.9.2"}
NextCloudPi version  v1.25.0
NextCloudPi image    NextCloudPi_07-21-19
distribution         Raspbian GNU/Linux 10 \n \l
automount            yes
USB devices          none
datadir              /media/myCloudDrive/ncdata (doesn't exist)
rootfs usage         2.1G/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                   ***REMOVED SENSITIVE VALUE***
gateway              ***REMOVED SENSITIVE VALUE***
interface            eth0
certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         yes
uptime               18days

Nextcloud configuration

PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"HgTEhjpiNDk0eDTacXKx","level":3,"time":"2020-05-02T00:27:07+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/myCloudDrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#140","userAgent":"--","version":"16.0.9.2"}
{"reqId":"HgTEhjpiNDk0eDTacXKx","level":2,"time":"2020-05-02T00:27:07+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory \/media\/myCloudDrive\/ncdata\/tmp is not present or writable","userAgent":"--","version":"16.0.9.2"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"HgTEhjpiNDk0eDTacXKx","level":3,"time":"2020-05-02T00:27:08+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"file_get_contents(\/media\/myCloudDrive\/ncdata\/news\/config\/config.ini): failed to open stream: No such file or directory at \/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Local.php#217","userAgent":"--","version":"16.0.9.2"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"HgTEhjpiNDk0eDTacXKx","level":3,"time":"2020-05-02T00:27:08+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/myCloudDrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#140","userAgent":"--","version":"16.0.9.2"}
{"reqId":"HgTEhjpiNDk0eDTacXKx","level":2,"time":"2020-05-02T00:27:08+00:00","remoteAddr":"","user":"--","app":"news","method":"","url":"--","message":"Configuration invalid. Ignoring values.","userAgent":"--","version":"16.0.9.2"}
PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"HgTEhjpiNDk0eDTacXKx","level":3,"time":"2020-05-02T00:27:08+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"mkdir(): Permission denied at \/var\/www\/nextcloud\/apps\/news\/lib\/AppInfo\/Application.php#142","userAgent":"--","version":"16.0.9.2"}
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 webserver write access to the root directory. See https://docs.nextcloud.com/server/16/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:166
Stack trace:
#0 /var/www/nextcloud/console.php(96): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#2 {main}PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 140
{"reqId":"HgTEhjpiNDk0eDTacXKx","level":3,"time":"2020-05-02T00:27:08+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for \/media\/myCloudDrive\/ncdata\/nextcloud.log at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#140","userAgent":"--","version":"16.0.9.2"}
{"reqId":"HgTEhjpiNDk0eDTacXKx","level":3,"time":"2020-05-02T00:27:08+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"chmod(): No such file or directory at \/var\/www\/nextcloud\/lib\/private\/Log\/File.php#141","userAgent":"--","version":"16.0.9.2"}

HTTPd logs

[Sat May 02 00:00:04.343978 2020] [ssl:warn] [pid 871:tid 1996116496] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Sat May 02 00:00:04.346462 2020] [mpm_event:notice] [pid 871:tid 1996116496] AH00489: Apache/2.4.38 (Raspbian) OpenSSL/1.1.1d configured -- resuming normal operations
[Sat May 02 00:00:04.346529 2020] [core:notice] [pid 871:tid 1996116496] AH00094: Command line: '/usr/sbin/apache2'

Database logs


Nextcloud logs

tail: cannot open '/media/myCloudDrive/ncdata/nextcloud.log' for reading: No such file or directory

Looks like it is no longer connected or mounted.
Did you use nc-automount originally?
If so maybe unintentially turned it of, if so just turn it back on and run:

sudo ls -lh /media

To check if its mounted again.
If not, You can also mount it manually by adding it to fstab, read how to in section on mounting on this doc page.

1 Like

Hey thank a lot for you answer!

I found my mistake!
I simply have plugged my HDD in another usb port that i mount originaly.
I plug it back in in the old one again and it works perfectly!

Best regards!!!

1 Like