From 9a34034db4250991ba98a5fce8be6a3a85eb8907 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Wed, 26 Aug 2020 21:31:19 -0400 Subject: [PATCH] Refresh patches for fixing bootloader config for btrfs --- ...-and-bootloader-configuration-for-Bt.patch | 50 +++++++++++++------ ...ionedfs-Ensure-__getuuid-actually-ge.patch | 29 +++++++++++ appliance-tools.spec | 6 ++- 3 files changed, 69 insertions(+), 16 deletions(-) create mode 100644 0002-appcreate-partitionedfs-Ensure-__getuuid-actually-ge.patch diff --git a/0001-Populate-fstab-5-and-bootloader-configuration-for-Bt.patch b/0001-Populate-fstab-5-and-bootloader-configuration-for-Bt.patch index 74e247d..82e4063 100644 --- a/0001-Populate-fstab-5-and-bootloader-configuration-for-Bt.patch +++ b/0001-Populate-fstab-5-and-bootloader-configuration-for-Bt.patch @@ -1,19 +1,19 @@ -From 27119bc104b3a7d5835a570987f9f1f1d7b011c3 Mon Sep 17 00:00:00 2001 +From 4d7c81f7b4ff4ca7b2a84632f2f0b89d5af58bbf Mon Sep 17 00:00:00 2001 From: Neal Gompa -Date: Wed, 26 Aug 2020 16:43:58 -0400 -Subject: [PATCH] Populate fstab(5) and bootloader configuration for Btrfs +Date: Wed, 26 Aug 2020 20:53:20 -0400 +Subject: [PATCH 1/2] Populate fstab(5) and bootloader configuration for Btrfs subvolumes In order for an image to be setup fully on boot, we need to populate fstab(5) configuration and ensure the bootloader has the right references for where the Btrfs filesystems are located on the disk. --- - appcreate/appliance.py | 42 +++++++++++++++++++++++++++++++++----- - appcreate/partitionedfs.py | 15 ++++++++++---- - 2 files changed, 48 insertions(+), 9 deletions(-) + appcreate/appliance.py | 46 ++++++++++++++++++++++++++++++++------ + appcreate/partitionedfs.py | 15 +++++++++---- + 2 files changed, 50 insertions(+), 11 deletions(-) diff --git a/appcreate/appliance.py b/appcreate/appliance.py -index a1a0a67..863083a 100644 +index a1a0a67..03d119a 100644 --- a/appcreate/appliance.py +++ b/appcreate/appliance.py @@ -76,23 +76,36 @@ class ApplianceImageCreator(ImageCreator): @@ -58,14 +58,21 @@ index a1a0a67..863083a 100644 def _create_mkinitrd_config(self): #write to tell which modules to be included in initrd -@@ -298,6 +311,16 @@ class ApplianceImageCreator(ImageCreator): +@@ -282,6 +295,7 @@ class ApplianceImageCreator(ImageCreator): + cfg.close() + + def _get_grub_boot_config(self): ++ btrfsboot = False + bootdevnum = None + rootdevnum = None + rootdev = None +@@ -298,8 +312,17 @@ class ApplianceImageCreator(ImageCreator): else: rootdev = "LABEL=_/" + for s in self.__instloop.subvolumes: + if s['mountpoint'] == "/boot": -+ bootdevnum = s['num'] - 1 -+ elif s['mountpoint'] == "/" and bootdevnum is None: ++ btrfsboot = True + bootdevnum = s['num'] - 1 + + if s['mountpoint'] == "/": @@ -73,24 +80,37 @@ index a1a0a67..863083a 100644 + rootdev = s['UUID'] + prefix = "" - if bootdevnum == rootdevnum: +- if bootdevnum == rootdevnum: ++ if bootdevnum == rootdevnum and not btrfsboot: prefix = "/boot" -@@ -358,6 +381,15 @@ class ApplianceImageCreator(ImageCreator): + + return (bootdevnum, rootdevnum, rootdev, prefix) +@@ -343,6 +366,7 @@ class ApplianceImageCreator(ImageCreator): + cfg.close() + + def _get_extlinux_boot_config(self): ++ btrfsboot = False + bootdevnum = None + rootdevnum = None + rootdev = None +@@ -358,8 +382,16 @@ class ApplianceImageCreator(ImageCreator): rootdev = p['UUID'] else: rootdev = "LABEL=_/" + for s in self.__instloop.subvolumes: + if s['mountpoint'] == "/boot": -+ bootdevnum = s['num'] - 1 -+ elif s['mountpoint'] == "/" and bootdevnum is None: ++ btrfsboot = True + bootdevnum = s['num'] - 1 + + if s['mountpoint'] == "/": + rootdevnum = s['num'] - 1 + rootdev = s['UUID'] prefix = "" - if bootdevnum == rootdevnum: +- if bootdevnum == rootdevnum: ++ if bootdevnum == rootdevnum and not btrfsboot: prefix = "/boot" + + return (bootdevnum, rootdevnum, rootdev, prefix) diff --git a/appcreate/partitionedfs.py b/appcreate/partitionedfs.py index 50206c4..9e81d2e 100644 --- a/appcreate/partitionedfs.py diff --git a/0002-appcreate-partitionedfs-Ensure-__getuuid-actually-ge.patch b/0002-appcreate-partitionedfs-Ensure-__getuuid-actually-ge.patch new file mode 100644 index 0000000..69b7339 --- /dev/null +++ b/0002-appcreate-partitionedfs-Ensure-__getuuid-actually-ge.patch @@ -0,0 +1,29 @@ +From 18f0b3a4712823cf90c4af7541f678a69ca53adb Mon Sep 17 00:00:00 2001 +From: Neal Gompa +Date: Wed, 26 Aug 2020 21:10:30 -0400 +Subject: [PATCH 2/2] appcreate/partitionedfs: Ensure __getuuid() actually gets + the UUID + +With Btrfs, UUID and UUID_SUB are both provided by blkid(8). In order +for the right value to be selected, we need to be a tiny bit stricter to +ensure we get the right UUID value. +--- + appcreate/partitionedfs.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/appcreate/partitionedfs.py b/appcreate/partitionedfs.py +index 9e81d2e..1e9fdde 100644 +--- a/appcreate/partitionedfs.py ++++ b/appcreate/partitionedfs.py +@@ -398,7 +398,7 @@ class PartitionedMount(Mount): + devdata = subprocess.Popen(["/sbin/blkid", partition], stdout=subprocess.PIPE) + devdataout = devdata.communicate()[0].decode("utf-8").split() + for data in devdataout: +- if data.startswith("UUID"): ++ if data.startswith("UUID="): + UUID = data.replace('"', '') + continue + return UUID +-- +2.26.2 + diff --git a/appliance-tools.spec b/appliance-tools.spec index 50f86ca..66832a0 100644 --- a/appliance-tools.spec +++ b/appliance-tools.spec @@ -27,8 +27,9 @@ URL: https://pagure.io/appliance-tools Source0: https://releases.pagure.org/%{name}/%{name}-%{version}.tar.bz2 -# Patch proposed to fix rhbz#1855034 +# Patches proposed to fix rhbz#1855034 Patch0001: 0001-Populate-fstab-5-and-bootloader-configuration-for-Bt.patch +Patch0002: 0002-appcreate-partitionedfs-Ensure-__getuuid-actually-ge.patch # Ensure system deps are installed (rhbz#1409536) Requires: python%{python_pkgversion}-imgcreate %{?min_imgcrate_evr:>= %{min_imgcreate_evr}} @@ -76,6 +77,9 @@ rm -rf %{buildroot}%{_datadir}/doc/%{name} %{python_sitelib}/ec2convert/ %changelog +* Wed Aug 26 2020 Neal Gompa - 010-2-3 +- Refresh patches for fixing bootloader config for btrfs + * Wed Aug 26 2020 Neal Gompa - 010.2-2 - Add proposed patch to fix configuring fstab and grub for btrfs (#1855034)