nils-werner / raspi-overlayroot

Protect your SD card against wear and tear
MIT License
117 stars 21 forks source link

Does "startx" still fail using this method? #13

Closed vileperson closed 4 years ago

vileperson commented 4 years ago

Once I set the / filesystem to read only, in the fstab, "startx" yields "error in locking authority file ~/.Xauthority". It is also unable to move the Xorg.0.log file to Xorg.0.log.old

nils-werner commented 4 years ago

That sounds like your overlayroot is not working. Everything should be writable.

Do you see an overlayroot warning message when you log in?

vileperson commented 4 years ago

Yes, and up until I add “ro” to my “/“ line of my fstab, everything seems to work like it should. I can make changes, add/delete files, and after a reboot, none of the changes are there. I can even run the readwrite app to enter a root console in the lower and make persistent changes. And running “startx” gives me no problems... all until I add “ro” to my “/“ line of fstab. Then I get the Xauthrority and Xorg.0.log issues.

Sent with GitHawk

nils-werner commented 4 years ago

That is weird. Also, why do you mount / in your fstab? As far as I can remember, it is usually mounted using the kernel commandline arguments.

Can you post your /etc/fstab, and the output of mount?

vileperson commented 4 years ago

Edit - to answer the "why" question... the fstab is just the way it came, from archlinuxarm. minus the additions of some tmpfs mounts that I added, trying to achieve "readonly" without breaking things.

# Static information about the filesystems.
# <file system> <dir> <type> <options> <dump> <pass>
#/dev/mmcblk0p1  /boot   vfat    defaults,ro,errors=remount-ro        0       0
#/dev/mmcblk0p2  /  ext4    defaults,ro,errors=remount-ro        0       0
tmpfs   /tmp    tmpfs   nodev,nosuid    0   0
tmpfs   /var/log    tmpfs   nodev,nosuid    0   0
tmpfs   /var/tmp    tmpfs   nodev,nosuid    0   0
/dev/mmcblk0p1  /boot   vfat    defaults,ro,        0       0
/dev/mmcblk0p2  /   ext4    defaults,ro,noatime 0   0
/dev/sda1   /home/mai/usb   vfat    user,rw,umask=111,dmask=000 0   0
vileperson commented 4 years ago
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=343076k,nr_inodes=85769,mode=755)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
overlay on / type overlay (ro,noatime,lowerdir=/overlay/lower,upperdir=/overlay/upper,workdir=/overlay/work)
overlayroot on /overlay type tmpfs (rw,relatime)
/dev/mmcblk0p2 on /overlay/lower type ext4 (ro,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=11193)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
/dev/sda1 on /home/user/usb type vfat (rw,nosuid,nodev,noexec,relatime,fmask=0111,dmask=0000,allow_utime=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro,user)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime)
tmpfs on /var/log type tmpfs (rw,nosuid,nodev,relatime)
tmpfs on /var/tmp type tmpfs (rw,nosuid,nodev,relatime)
/dev/mmcblk0p1 on /boot type vfat (ro,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=95560k,mode=700,uid=1000,gid=985)
vileperson commented 4 years ago

It looks like the overlay is read only once I add the "ro" to fstab.

nils-werner commented 4 years ago

Can you please fix the formatting of your last posts?

And can you check whether the root= prameter is set in the kernel commandline. If it is, you can try removing the / line from /etc/fstab and see if the root FS still mounts correctly.

vileperson commented 4 years ago

Sorry about the formatting. I think it should be fixed now. Removing the "/" line, now.

vileperson commented 4 years ago

Once I did that and also removed the unneeded tmpfs mounts, everything works as expected. Sorry for the confusion and unneeded "issue". Thanks for your help!

nils-werner commented 4 years ago

Interesting. Does stock ArchLinuxARM come with this line

/dev/mmcblk0p2  /   ext4    defaults,errors=remount-ro        0       0

in /etc/fstab? If that's the case, a warning and a message to remove it in the README.md may be necessary.

PS. I have fixed your post formatting. Take a look.

vileperson commented 4 years ago

Setting up a brand new pi3, now with the latest archlinuxarm, to verify.

(formatting) Ahh... the wrapping. my bad.

vileperson commented 4 years ago

The "/" line is not there on a stock image. Maybe it was a long time ago. (I have been running custom images that I built over a year ago), or maybe I added it for some reason along the line, and just forgot about it. Sorry to waste your time. Thanks for helping me figure it out. Cheers!

nils-werner commented 4 years ago

Alright, no worries!