5

In the past when I entered recovery-mode, the root filesystem was read-only and that was perfectly fine.

But now. after pressing enter at the prompt to drop to shell, it is mounted read-write. It is cumbersome to remount as read-only because many processes are accessing files on it.

I need root filesystem read-only when I am in recovery mode. How can I boot into recovery mode and have it read-only?

1
  • This is still an issue as of 18.04.3 in 2020..
    – Jarrad
    Feb 13, 2020 at 22:57

2 Answers 2

5

This happens because systemd (specifically, systemd-remount-fs.service) by design ignores your kernel parameter of ro. Whether this is a good or harebrained design is a matter of opinion, but for an objective workaround, you can add systemd.mask=systemd-remount-fs.service to your kernel parameters in grub, along with ro:

... systemd.mask=systemd-remount-fs.service ro
0
1

At initrd stage the root fs is in ro mode. And after systemd starts and remounts root fs into rw mode. I don't know guts of systemd well. So I tell you how to stop booting right before systemd. You need to add this line:

break=init

to the end of the kernel parameters. You'll get a command line and the root fs will be in ro mode.

1
  • This causes me to enter to initramfs shell which is fine for my purposes. Before I mark is correct, I will wait if somebody comes up with a solution which brings back original recovery console functionality with read-only root partition. Thanks!
    – yurtesen
    Oct 31, 2017 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.