kiwi-repart: avoid race between repart and fsck

See issue #1034, this fixes non-booting CentOS-7 OEM images that fail
during repartition / FS resize.
Summary: all parted actions trigger a rescan of partition tables and
this repeatedly starts / stops systemd-fsck-root.service until it
finally fails. The workaround is to mask systemd-fsck-root.service
during repartitioning / FS resize.
This commit is contained in:
Stefan Seyfried 2019-03-29 13:07:34 +01:00
parent 1f9cb702d3
commit 048b5c3eb1

View File

@ -267,6 +267,19 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
setup_debug
# when repartitioning disks, parted and friends might trigger re-reads of
# the partition table, in turn triggering systemd-fsck-root.service
# repeatedly via udev events, which finally can cause booting to fail with
# * start request repeated too quickly for systemd-fsck-root.service
# * Failed to start File System Check on /dev/disk/by-uuid...
# * Dependency failed for /sysroot.
# To avoid this, disable the root fsck (is finished at this point anyway
# *and* the filesystem is brand new ;) by masking it.
# "systemctl disable" does not work here, because it is event driven
# More details: https://github.com/SUSE/kiwi/issues/1034
info "disable systemd-fsck-root.service"
systemctl mask systemd-fsck-root.service
# initialize for disk repartition
initialize
@ -307,5 +320,8 @@ else
resize_filesystem "$(get_root_map)"
fi
info "enabling systemd-fsck-root.service"
systemctl unmask systemd-fsck-root.service
# create swap space
create_swap "$(get_swap_map)"