I have a remote computer protected with overlayroot. Currently, I write "overlayroot=disabled" in grub boot to disable it until it is rebooted, but sometimes I want to make changes using SSH. Is there a way to disable overlayroot remotely?
-
The only way that I am aware of that you would be able to do that is to have some sort of serial console connection to the host that can monitor a reboot like how server hardware will have a management console connection through the network that is on a different IP that will allow you to monitor and fix a reboot. Other than that, the OS would be protected until you reboot and since you are not physically there it would be impossible to adjust the grub menu remotely during a reboot.– TerranceMay 22, 2019 at 2:12
-
1This might help: spin.atomicobject.com/2015/03/10/…– MelebiusAug 29, 2019 at 12:37
Add a comment
|
2 Answers
You can run overlayroot-chroot
to remount the root as rw, or bind-mount the lowerdir elsewhere as rw with something like mount --bind <lowerdir> /mnt/rootrw
and modify on /mnt/rootrw
(potentially chrooting to it if needed).
Check the link @Melebius gave, it (at least partially) answers the question.
-
So, the
overlayroot-chroot
(worth noting that the name in the post should be fixed) works for me. However, themount
command didn't: I didmount | grep lowerdir
, and dir turned out to be/media/root-ro
. Then I executedmount -o remount,rw /media/root-ro
, but upon reboot all changes to the system are gone. So the idea with remounting doesn't work.– Hi-AngelJun 18, 2021 at 12:05 -
1@Hi-Angel thanks, I fixed the typo. For the "mount" option, I guess changes were lost because they were made in the upperdir: even though the lowerdir is mounted rw, if a file exists in both upper anb lower, the upper one will be used (and modified); and if the upperdir is not persisted (e.g. in tmpfs), its changes will be lost upon reboot. Anyway, the way to do it is with
overlayroot-chroot
indeed; the mount thing is kind of hacky...– MatthieuJun 19, 2021 at 11:04 -
Could you please provide a working example for disabling overlayroot on Ubuntu using overlayroot-chroot command? Mar 18, 2022 at 14:49
-
1@AhmedEissa where are you stuck?
sudo overlayroot-chroot
pretty much gives you a shell in the lower dir mounted rw...– MatthieuMar 18, 2022 at 19:59
My solution to this is as follows. It involves several reboots to bring the system up rw then back to ro once again.
- SSH into the system and enter a rw chroot via the following command:
sudo overlayroot-chroot
- Modify the /etc/overlayroot.local.conf (docs mention that you should create a .local. rather than the default overlayroot.conf file to avoid conflict if overlayroot package ever gets updated.)
overlayroot=""
- Reboot, system is now mounted rw, make changes to system. edit /etc/overlayroot.local.conf overlayroot= line back to the enabled
value (in my case:
overlayroot="tmpfs:swap=1,recurse=0"
). - Reboot again, system is once again read-only.