2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-11-29 22:02:23 +00:00

Use the root filesystem for grub when an image has no /boot

image2disk only took the boot UUID from a /boot volume. Images captured
from a system without a separate /boot left it unset, and rewriting the
EFI stub grub.cfg failed with "TypeError: sequence item 5: expected str
instance, NoneType found". Fall back to the UUID of the / filesystem,
which holds /boot in that case.
This commit is contained in:
Markus Hilger
2026-11-12 15:17:36 +01:00
parent bec1ed1498
commit 973a340ed7
3 changed files with 3 additions and 3 deletions
@@ -512,7 +512,7 @@ def install_to_disk(imgpath):
sys.stdout.write('\x1b[1K\rDone writing {0}'.format(vol['mount']))
sys.stdout.write('\n')
sys.stdout.flush()
if vol['mount'] == '/boot':
if vol['mount'] == '/boot' or (vol['mount'] == '/' and not bootuuid): # /boot may live on /
tbootuuid = subprocess.check_output(['blkid', vol['targetdisk']])
if b'UUID="' in tbootuuid:
bootuuid = tbootuuid.split(b'UUID="', 1)[1].split(b'"')[0].decode('utf8')
@@ -664,7 +664,7 @@ def install_to_disk(imgpath):
sys.stdout.write('\x1b[1K\rDone writing {0}'.format(vol['mount']))
sys.stdout.write('\n')
sys.stdout.flush()
if vol['mount'] == '/boot':
if vol['mount'] == '/boot' or (vol['mount'] == '/' and not bootuuid): # /boot may live on /
tbootuuid = subprocess.check_output(['blkid', vol['targetdisk']])
if b'UUID="' in tbootuuid:
bootuuid = tbootuuid.split(b'UUID="', 1)[1].split(b'"')[0].decode('utf8')
@@ -454,7 +454,7 @@ def install_to_disk(imgpath):
sys.stdout.write('\x1b[1K\rDone writing {0}'.format(vol['mount']))
sys.stdout.write('\n')
sys.stdout.flush()
if vol['mount'] == '/boot':
if vol['mount'] == '/boot' or (vol['mount'] == '/' and not bootuuid): # /boot may live on /
tbootuuid = subprocess.check_output(['blkid', vol['targetdisk']])
if b'UUID="' in tbootuuid:
bootuuid = tbootuuid.split(b'UUID="', 1)[1].split(b'"')[0].decode('utf8')