I need to repair the root partition in an Ubuntu 20.04 server. However, I cannot manage to boot the server into rescue or emergency mode and have the root partition read-only to be able to run the checks.
My Grub2 boot menu Linux command line looks like the following
linux /boot/vmlinuz-... root=/dev/mapper/vgname-lvname ro emergency
I also have tried the
systemd.unit=emergency.target approach, but this also didn't work.
The console greets me with the correct line:
You are in emergency mode. [...] Give root password for maintenance (or press Control-D to continue):
However, entering the root password and checking the root mount point reveals that root is mounted read-write instead of read-only.
/dev/mapper/vgname-lvname on / type ext4 (rw,relatime,errors=remount-ro)
mount -o remount,ro / (or the LVM volume) fails due to the mount point is busy.
How to force read-only mode in the emergency mode?