RHEL 8 keeps auto-mounting /boot everytime the partition is modified

"Nicolas C." <[email protected]> Thu, 9 Jan 2025 20:39:18 +0100
Newsgroups gmane.linux.redhat.general
Message-ID <[email protected]>
Hi,

I'm currently writing a script to convert a VM from BIOS (legacy) to=20
EFI. On my VMs I have a dedicated disk for /boot and I need to perfom=20
some operations *while it's not mounted* on it to make it EFI-capable.

It's working fine on Debian 11 & 12 and OracleLinux/RHEL 9 but on RHEL 8=20
the system keeps automatically mounting /boot each time I make change to=20
the disk or partition (e.g. after running "sfdisk") even though I=20
unmounted it. I see there is a "boot.automount" unit but I can't fine=20
much info about it.

I've tried disabling the "boot.mount" unit, but it keeps getting=20
mounted. The only workaround I found was to comment the entry in my=20
fstab with sed and event with this the system keep trying to mount it=20
(!) but fails.

Any idea why this happens?

Thanks,

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D

Disk /dev/sda: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 =3D 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8e565d9c

Device     Boot Start     End Sectors  Size Id Type
/dev/sda1  *     2048 2097151 2095104 1023M 83 Linux

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D

umount /boot

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D

resize2fs /dev/sda1 987136K

echo ",51200K" | sfdisk --force -N 1 /dev/sda

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D

Result:

Jan  9 20:21:49 rhel8-efi kernel: sda: sda1
Jan  9 20:21:49 rhel8-efi systemd[1]:=20
systemd-fsck@dev-disk-by\x2duuid-a210ff5a\x2de2fb\x2d400d\x2d86b5\x2de19574=
763bf5.service:=20
Succeeded.
Jan  9 20:21:49 rhel8-efi systemd[1]: Stopped File System Check on=20
/dev/disk/by-uuid/a210ff5a-e2fb-400d-86b5-e19574763bf5.
Jan  9 20:21:49 rhel8-efi systemd[1]: Condition check resulted in=20
Virtual_disk being skipped.
Jan  9 20:21:49 rhel8-efi systemd[1]: Condition check resulted in=20
Virtual_disk being skipped.
Jan  9 20:21:49 rhel8-efi systemd[1]: Condition check resulted in=20
Virtual_disk being skipped.
Jan  9 20:21:49 rhel8-efi systemd[1]: Condition check resulted in=20
Virtual_disk being skipped.
Jan  9 20:21:49 rhel8-efi systemd[1]: Condition check resulted in=20
Virtual_disk being skipped.
Jan  9 20:21:49 rhel8-efi systemd[1]: Condition check resulted in=20
Virtual_disk being skipped.
Jan  9 20:21:49 rhel8-efi systemd[1]: Starting File System Check on=20
/dev/disk/by-uuid/a210ff5a-e2fb-400d-86b5-e19574763bf5...
Jan  9 20:21:49 rhel8-efi systemd-fsck[11519]: /dev/sda1=C2=A0: propre,=20
323/65536 fichiers, 57178/246784 blocs
Jan  9 20:21:49 rhel8-efi systemd[1]: Started File System Check on=20
/dev/disk/by-uuid/a210ff5a-e2fb-400d-86b5-e19574763bf5.
Jan  9 20:21:49 rhel8-efi systemd[1]: Mounting /boot...
Jan  9 20:21:49 rhel8-efi kernel: EXT4-fs (sda1): mounted filesystem=20
with ordered data mode. Opts: discard
Jan  9 20:21:49 rhel8-efi systemd[1]: Mounted /boot.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D

systemctl list-units --all boot.automount
   UNIT           LOAD      ACTIVE   SUB  DESCRIPTION=20
=20

=E2=97=8F boot.automount not-found inactive dead boot.automount

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D

systemctl status boot.automount
Unit boot.automount could not be found.

To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].