Zimaboard, Zimablade and CasaOS Troubleshooting - Part 2

Storage and Files

See the used capacity of the storage attached (Human Readable Format):

df -h

Sample Output (Virtualized CasaOS on Debian 12 (Bookworm)):

Filesystem                   Size  Used Avail Use% Mounted on
udev                         3.9G     0  3.9G   0% /dev
tmpfs                        795M  2.5M  792M   1% /run
/dev/mapper/casaos--vg-root   30G  2.8G   26G  10% /
tmpfs                        3.9G     0  3.9G   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
/dev/vda1                    455M   52M  379M  12% /boot
tmpfs                        795M     0  795M   0% /run/user/0
tmpfs                        795M     0  795M   0% /run/user/1000
/dev/vdb1                    9.8G   24K  9.7G   1% /mnt/Storage1_vdb1
/var/lib/casaos/files         30G  2.8G   26G  10% /DATA

See the size of directories and files in your current directory:

du -hsc *

Sample Output:

720K    CHANGELOG.md
4.0K    LICENSE.md
56K     convos
1.5M    heimdall
56K     nginx-proxy
12M     semaphore_2.8.75_linux_amd64.deb
129M    traefik
36M     traefik_v2.10.3_linux_amd64.tar.gz
5.2M    vaultwarden
183M    total

See what is mounted and where:


Sample Output:

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=4045312k,nr_inodes=1011328,mode=755,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=813124k,mode=755,inode64)
/dev/mapper/casaos--vg-root on / type ext4 (rw,relatime,errors=remount-ro)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=721)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
ramfs on /run/credentials/systemd-sysctl.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
ramfs on /run/credentials/systemd-sysusers.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
ramfs on /run/credentials/systemd-tmpfiles-setup-dev.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
/dev/vda1 on /boot type ext2 (rw,relatime)
ramfs on /run/credentials/systemd-tmpfiles-setup.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=813120k,nr_inodes=203280,mode=700,inode64)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=813120k,nr_inodes=203280,mode=700,uid=1000,gid=1000,inode64)
/dev/vdb1 on /mnt/Storage1_vdb1 type ext4 (rw,noatime)
/var/lib/casaos/files on /DATA type fuse.mergerfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
overlay on /var/lib/docker/overlay2/65ad00657112718dddce842f66e6c7ac251c0a1bbccb083b97cdb32137e2e496/merged type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/EPE27J56K5VKLMRQNPSH4QHK5X:/var/lib/docker/overlay2/l/UERQ7FCKB2AEPLI53ZHSTDQVMO:/var/lib/docker/overlay2/l/H2MMQZY3LB2N7DYIGE2RZDQR5N:/var/lib/docker/overlay2/l/GPNTLQWLGSPOY2GFAAU46X5W76:/var/lib/docker/overlay2/l/5A63AB3MUWZ5U5CQ2OHDR5GV26:/var/lib/docker/overlay2/l/E4X4354QYLHH3KDUXZQMNOTL4Z,upperdir=/var/lib/docker/overlay2/65ad00657112718dddce842f66e6c7ac251c0a1bbccb083b97cdb32137e2e496/diff,workdir=/var/lib/docker/overlay2/65ad00657112718dddce842f66e6c7ac251c0a1bbccb083b97cdb32137e2e496/work)
nsfs on /run/docker/netns/1eaed20e369a type nsfs (rw)
overlay on /var/lib/docker/overlay2/ea28905dc80524a81eafc966a37e18120740b70af0be160569c6735fdb8ed909/merged type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/5MMTLWOLHIYN4V7HSUD54KOGXQ:/var/lib/docker/overlay2/l/NKEFOOYMNLWK3IVFDXJNNTRWFH:/var/lib/docker/overlay2/l/JV36IYWAPAJ7PB5BI3DASFM4Q7:/var/lib/docker/overlay2/l/7QKJ2CUGIYODJSGRSMHBYNY2M3:/var/lib/docker/overlay2/l/7P3HEUO5WT63LL2AHBZQQK5EGT:/var/lib/docker/overlay2/l/E724KIQRNPJPVL2YZJV4EFLBF4:/var/lib/docker/overlay2/l/KFAU5PRTP52AETBB2YCKGX5P2W:/var/lib/docker/overlay2/l/7TDQZWWW5SFVO2CVTOP4T5N2Z6,upperdir=/var/lib/docker/overlay2/ea28905dc80524a81eafc966a37e18120740b70af0be160569c6735fdb8ed909/diff,workdir=/var/lib/docker/overlay2/ea28905dc80524a81eafc966a37e18120740b70af0be160569c6735fdb8ed909/work)
nsfs on /run/docker/netns/8101cc515f1d type nsfs (rw)


In many cases, quite a few issues and problems stems from wrongly set permissions.
To view what the permissions of the files in a directory is the following command can be issued:

ls -alh

Sample Output:

drwxr-x--- 9 kris kris 4.0K Oct 16 19:12 .
drwxr-xr-x 5 root root 4.0K Aug 25 07:47 ..
-rw------- 1 kris kris 2.2K Oct 18 10:43 .bash_history
-rw-r--r-- 1 kris kris  220 Jan  6  2022 .bash_logout
-rw-r--r-- 1 kris kris 3.7K Jan  6  2022 .bashrc
drwx------ 2 kris kris 4.0K May 19 12:23 .cache
drwxrwxr-x 5 kris kris 4.0K Aug 25 14:26 .config
-rw------- 1 kris kris   20 May 20 10:16 .lesshst
-rw-r--r-- 1 kris kris  807 Jan  6  2022 .profile
drwx------ 2 kris kris 4.0K May 19 12:31 .ssh
-rw-r--r-- 1 kris kris    0 May 19 12:24 .sudo_as_admin_successful
-rw------- 1 kris kris 3.5K Oct 16 19:12 .viminfo
-rw-rw-r-- 1 kris kris  165 Jul 15 17:04 .wget-hsts
-rw-rw-r-- 1 kris kris 719K Jun 19 16:16 CHANGELOG.md
-rw-rw-r-- 1 kris kris 1.1K Jun 19 16:16 LICENSE.md
drwxrwxr-x 3 kris kris 4.0K Jun 29 13:20 convos
drwxrwxr-x 3 kris kris 4.0K Oct  5 18:26 heimdall
drwxrwxr-x 3 kris kris 4.0K Oct  5 19:42 nginx-proxy
-rw-r--r-- 1 root root  12M Nov 19  2022 semaphore_2.8.75_linux_amd64.deb
-rwxrwxr-x 1 kris kris 129M Jun 19 16:22 traefik
-rw-rw-r-- 1 kris kris  36M Jun 19 16:41 traefik_v2.10.3_linux_amd64.tar.gz
drwxr-xr-x 3 root root 4.0K Oct 16 19:21 vaultwarden

As can be seen above there is quite a bit of information which is helpful.
The first column shows the actual permissions, d means directory,r means read, w means write, x means executable.
The 3rd column shows the User who owns the directory/file while the 4th column shows which Group owns it.
After these, we have size, last changed data and time, then the directory or filename.
when looking at the filenames, notice that some starts with ., this means that they are hidden.

Now that we have a working example of the output, we can then move over to changing these permissions.
Let start with chown (change owner), which allows you to change the User and Group a file or directory belongs to.
As we can see in the example above, there is a directory called “convos” which is owned by User kris and Group kris.
If a change is needed, you can as root or via sudo change this with: chown -R : convos
chown -R root:root convos
This changes it from drwxrwxr-x 3 kris kris 4.0K Jun 29 13:20 convos to drwxrwxr-x 3 root root 4.0K Jun 29 13:20 convos

Further we have the tool called chmod (change mode), this deals with the permissions noted in the first column shown above.
700 = rwx------
770 = rwxrwx—
777 = rwxrwxrwx
(these are just short examples, as there are many more numeric values that can be applied, but 7 is the most privileged one)

This is divided into 3 groupings which reads like:
user group other
And we can deal with this in a slightly more human readable way where you e.g do:
chmod u+rwx,g+rx,o+r <file/directory you change permissions for>
This will then allow:
User owning the file to read,write and execute.
Group owning the file to read and execute.
Others (not owning) to only read.