Skip to content

Commit

Permalink
core-services, shutdown.d: force legacy mount iface for remount
Browse files Browse the repository at this point in the history
With util-linux>=2.40, filesystems that do not support remounting with
different options fail because the new kernel mount interface is used.
This breaks booting an overlayfs (like live ISOs).

By setting `LIBMOUNT_FORCE_MOUNT2=always`, we force `mount(8)` to use
the old kernel mount interface, which ignores changed options.

see also:
* util-linux/util-linux#2576
* void-linux/void-mklive#369
  • Loading branch information
classabbyamp committed Jun 10, 2024
1 parent 10bd617 commit 2c71a88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core-services/03-filesystems.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[ -n "$VIRTUALIZATION" ] && return 0

msg "Remounting rootfs read-only..."
mount -o remount,ro / || emergency_shell
LIBMOUNT_FORCE_MOUNT2=always mount -o remount,ro / || emergency_shell

if [ -x /sbin/dmraid -o -x /bin/dmraid ]; then
msg "Activating dmraid devices..."
Expand Down Expand Up @@ -74,7 +74,7 @@ if [ -z "$FASTBOOT" ]; then
fi

msg "Mounting rootfs read-write..."
mount -o remount,rw / || emergency_shell
LIBMOUNT_FORCE_MOUNT2=always mount -o remount,rw / || emergency_shell

msg "Mounting all non-network filesystems..."
mount -a -t "nosysfs,nonfs,nonfs4,nosmbfs,nocifs" -O no_netdev || emergency_shell
2 changes: 1 addition & 1 deletion shutdown.d/80-filesystems.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if [ -z "$VIRTUALIZATION" ]; then
swapoff -a
umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs
msg "Remounting rootfs read-only..."
mount -o remount,ro /
LIBMOUNT_FORCE_MOUNT2=always mount -o remount,ro /
fi

sync
Expand Down

0 comments on commit 2c71a88

Please sign in to comment.