4

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?

2
  • 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.
    – Terrance
    May 22, 2019 at 2:12
  • 1
    This might help: spin.atomicobject.com/2015/03/10/…
    – Melebius
    Aug 29, 2019 at 12:37

2 Answers 2

2

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.

4
  • So, the overlayroot-chroot (worth noting that the name in the post should be fixed) works for me. However, the mount command didn't: I did mount | grep lowerdir, and dir turned out to be /media/root-ro. Then I executed mount -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-Angel
    Jun 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...
    – Matthieu
    Jun 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...
    – Matthieu
    Mar 18, 2022 at 19:59
2

My solution to this is as follows. It involves several reboots to bring the system up rw then back to ro once again.

  1. SSH into the system and enter a rw chroot via the following command: sudo overlayroot-chroot
  2. 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=""
  3. 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").
  4. Reboot again, system is once again read-only.
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .