overlayroot icon indicating copy to clipboard operation
overlayroot copied to clipboard

on an read-only root

Open chengjianwen opened this issue 5 years ago • 6 comments

My pi boot by nfs from a piserver, and I want to use overlayroot to set root writable. I succeed on the os from piserver (kernel version: 4.19.97-v7+), but failed on the latest raspberry pi os (kernel version: 5.4.51-v7l+). I set debug option on cmdline.txt to see the initramfs debug, and found the error occurred on init-bottom-overlay script from line 64: mount -t overlay overlay -olowerdir=/overlay/lower,upperdir=/overlay/upper,workdir=/overlay/work ${rootmnt} mount: mount overlay on /root failed: No such device. cp: can't stat '/root/etc/fstab': No such file or directory. /script/init-bottom/init-bottom-overlay: line 71: can't create /root/etc/fstab: nonexistent directory. /script/init-bottom/init-bottom-overlay: line 72: can't create /root/etc/fstab: nonexistent directory.

chengjianwen avatar Nov 12 '20 12:11 chengjianwen

It drops you into a busybox shell? The only thing I can suggest is to look around and find where the read-only nfs root is mounted, if it's mounted, maybe it's not mounted yet?

chesty avatar Nov 14 '20 06:11 chesty

It is mounted on ${rootmnt} already. It seems the script want to move the mount point to another directory (/overlay/lower), but failed.

chengjianwen avatar Nov 16 '20 08:11 chengjianwen

oh, because it's read-only. You'll need to comment out lines 70, 71 and 72. They are trying to write to ${rootmnt}

edit: no, that's not it. I guess you'll have to look into why moving the mount point doesn't work, or maybe you can modify the script so it doesn't need to move it.

chesty avatar Nov 16 '20 08:11 chesty

I think the problem was line 64: mount -t overlay overlay -olowerdir=/overlay/lower,upperdir=/overlay/upper,workdir=/overlay/work ${rootmnt} error msg: mount: mounting overlay on /root failed: no such device.

chengjianwen avatar Nov 16 '20 12:11 chengjianwen

mount -o move worked, and mount -t overlay overlay ..... failed.

chengjianwen avatar Nov 16 '20 13:11 chengjianwen

If you want help you need to give move information. xxx failed isn't enough. what is the exact command you ran and what is the exact error message.

chesty avatar Nov 16 '20 13:11 chesty