nils-werner / raspi-overlayroot

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

cannot write new files #1

Closed nagualcode closed 7 years ago

nagualcode commented 7 years ago

Hello, I just installed this in my arch pi, it seems everything went fine. But if I got it right, I should be able to touch, write the files in / , without getting a "read-only"warning. Because changes would go to ram (tempfs), is this it? As of now I cannot touch new file, or nano edit any file at all, I get read only warning. I can edit /etc/resolv.conf So is this set to overlay only some specific files? Thank you.

nils-werner commented 7 years ago

That is strange. (as root) you should be able to create files in /. Can you post the error you are seeing when touching a file, and the output of

cat /boot/config.txt
cat /boot/cmdline.txt
cat /etc/fstab
mount
nagualcode commented 7 years ago

Hello, after a couple reboots it is working just fine. I guess that Idid wrong on the last step, were it says to first add overlayroot to cmdline.txt, reboot, and then add "ro" to cmdline.txt . In my case, I went straight to adding both overlayroot and ro at the same time. Anyway, it is working fine now. One last question: Is it possible to keep uploading the raspberry firmware? Of course we are talking about making it rw again first. I ask this because there now there is "initramfs initrd followkernel" instead of "initramfs initramfs-linux.img followkernel". Thank you.

nils-werner commented 7 years ago

after a couple reboots it is working just fine.

OK great

Is it possible to keep uploading the raspberry firmware? [...] I ask this because there now there is "initramfs initrd followkernel" instead of "initramfs initramfs-linux.img followkernel".

what do you mean? The default config.txt should not have an initramfs line. And the filename you give in

mkinitcpio -g /boot/custom-initrd-filename

must simply be the same as you set in config.txt

initramfs custom-initrd-filename followkernel

Be aware though that post_install and post_upgrade by default rebuild the /boot/initrd file.

nagualcode commented 7 years ago

Ok, understood. How do I remove /boot from this overlay setup? I do need /boot to be RW all the time.

nils-werner commented 7 years ago

The RW /boot/ should be in /overlay/lower/boot/

nagualcode commented 7 years ago

Strange, my /overlay/lower/boot/ is read-only, and ls shows no files.

This is my fstab:

/dev/mmcblk0p1  /boot           vfat    defaults,rw          0       0
/dev/mmcblk0p3  /mnt/memory1               ext4    defaults,noatime,nodiratime  0       0
/dev/mmcblk0p4  /mnt/memory2               ext4    defaults,noatime,nodiratime  0       0
tmpfs           /tmp            tmpfs   nodev,nosuid          0 0

(My sd card has a total of 4 partitions, I have 2 RW partitions, memory1 and memory2)

this is my config.txt:

dtparam=audio=on
disable_splash=1
hdmi_force_hotplug=1
hdmi_drive=2
hdmi_group=1
hdmi_mode=16
gpu_mem=400
initramfs initrd followkernel

and this is my cmdline:

root=/dev/mmcblk0p2 ro rootwait console=ttyAMA0,115200 console=tty3 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 elevator=noop loglevel=3 vt.global_cursor_default=0 noswap logo.nologo overlayroot
nils-werner commented 7 years ago

To be honest I never checked whether /overlay/lower/boot/ was there...

It may have to do with the bind mount I am doing not properly recursively binding subvolumes...

nagualcode commented 7 years ago

Strangely my /boot seems to be rw (as intended) now, my fstab is: /dev/mmcblk0p1 /boot vfat defaults,rw and I can freely write files to it, they persist over reboots. So overlay root seems to be not present over my boot. I dont know what happened, but I guess my /boot became "overlayed" after I tried the "rwrootfs" command.

nils-werner commented 7 years ago

Remember that rwrootfs opens a new shell in the RW filesystems. You need to exit that shell to return to the overlayed FS.

nagualcode commented 7 years ago

Hello. I am trying to remove it. I removed from cmdline, removed the initdr live from config.txt and removed from HOOKS in /etc/mkinitcpio.conf when I command: mkinitcpio -g /boot/initrd I get ==> ERROR: '/lib/modules/4.9.15-1-ARCH' is not a valid kernel module directory Is this ok?

nils-werner commented 7 years ago

You only need to change cmdline.txt to disable it, change config.txt to remove the initrd. No need to recompile /boot/initrd or change HOOKS.

I think the other issue you are seeing is unrelated to this project.