Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_disk: Explicitly unmount partitions and fsck /boot #1452

Closed
wants to merge 1 commit into from

Conversation

cgwalters
Copy link
Member

For reasons I don't fully understand, trying to use
tune2fs -U random /dev/disk/by-label/boot fails without
this explicit fsck step, even though the filesystem appears
cleanly unmounted.

This is for coreos/fedora-coreos-config#354
to regenerate the UUID of /boot on firstboot.

Anyways, explicitly unmounting things seems better than relying
on umount -R to sort it, and having a fsck on /boot is
cheap.

For reasons I don't fully understand, trying to use
`tune2fs -U random /dev/disk/by-label/boot` fails without
this explicit fsck step, even though the filesystem appears
cleanly unmounted.

This is for coreos/fedora-coreos-config#354
to regenerate the UUID of `/boot` on firstboot.

Anyways, explicitly unmounting things seems better than relying
on `umount -R` to sort it, and having a `fsck` on `/boot` is
cheap.
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cgwalters
Copy link
Member Author

It relates to this bit


		if (!ext2fs_has_feature_csum_seed(fs->super) &&
		    (ext2fs_has_feature_metadata_csum(fs->super) ||
		     ext2fs_has_feature_ea_inode(fs->super))) {
			check_fsck_needed(fs,
				_("Setting the UUID on this "
				  "filesystem could take some time."));
			rewrite_checksums = REWRITE_ALL;
		}

Calling into here.

which hmm...I guess the UUID is somehow entangled into the metadata checksums? That kind of rains on the parade if so...

@cgwalters
Copy link
Member Author

Ah OK we probably really want

walters@toolbox ~/s/g/c/coreos-assembler> git diff
diff --git a/src/create_disk.sh b/src/create_disk.sh
index 6a2f0110..fa514094 100755
--- a/src/create_disk.sh
+++ b/src/create_disk.sh
@@ -205,9 +205,12 @@ bootargs=
 if [ "${boot_verity}" = 1 ]; then
     # Need blocks to match host page size; TODO
     # really mkfs.ext4 should know this.
-    bootargs="-b $(getconf PAGE_SIZE) -O verity"
+    bootargs="-b $(getconf PAGE_SIZE)"
+    bootopts="verity,"
+else
+    bootopts=""
 fi
-mkfs.ext4 ${bootargs} "${disk}${BOOTPN}" -L boot -U "${bootfs_uuid}"
+mkfs.ext4 ${bootargs} -O "${bootopts}"metadata_csum_seed "${disk}${BOOTPN}" -L boot -U "${bootfs_uuid}"
 if [ ${EFIPN:+x} ]; then
        mkfs.fat "${disk}${EFIPN}" -n EFI-SYSTEM
        # partition $BIOPN has no FS, its for bios grub
walters@toolbox ~/s/g/c/coreos-assembler> 

except it looks like grub2 needs patching to know about that feature flag 😢

grub2-install: error: ../grub-core/kern/fs.c:120:unknown filesystem.

@cgwalters
Copy link
Member Author

OK I changed coreos/fedora-coreos-config#354 to just explicitly fsck first for now, though at some point we should patch grub.

@cgwalters cgwalters closed this May 13, 2020
@dustymabe
Copy link
Member

except it looks like grub2 needs patching to know about that feature flag

related issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants