Skip to contentSkip to conversation

older Fedora releases might not have /usr/sbin/update-grub2 ?

PATCH In review Chuck Lever III 3 participants 5 messages May 18, 2024 – May 20, 2024

lore
Share & tools
lore
#0 lore raw

Hi -

Recent changes to bringup_guestfs.sh seem to break older releases of Fedora:

[ 155.0] Editing: /etc/default/grub
[ 155.0] Running: /usr/sbin/update-grub2
Fedora 35 - x86_64 3.3 MB/s | 79 MB 00:23
Fedora 35 openh264 (From Cisco) - x86_64 4.6 kB/s | 2.5 kB 00:00
Fedora Modular 35 - x86_64 2.5 MB/s | 3.3 MB 00:01
Fedora 35 - x86_64 - Updates 11 MB/s | 34 MB 00:03
Fedora Modular 35 - x86_64 - Updates 3.9 MB/s | 3.9 MB 00:00
Last metadata expiration check: 0:00:01 ago on Sat May 18 12:14:40 2024.
Package sudo-1.9.7p2-2.fc35.x86_64 is already installed.
Package python3-3.10.4-1.fc35.x86_64 is already installed.
Package bash-5.1.8-2.fc35.x86_64 is already installed.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
qemu-guest-agent x86_64 2:6.1.0-16.fc35 updates 195 k
Installing dependencies:
liburing x86_64 2.0-2.fc35 fedora 26 kTransaction Summary
================================================================================
Install 2 PackagesTotal download size: 221 k
Installed size: 586 k
Downloading Packages:
(1/2): liburing-2.0-2.fc35.x86_64.rpm 213 kB/s | 26 kB 00:00
(2/2): qemu-guest-agent-6.1.0-16.fc35.x86_64.rp 871 kB/s | 195 kB 00:00
--------------------------------------------------------------------------------
Total 348 kB/s | 221 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : liburing-2.0-2.fc35.x86_64 1/2
Installing : qemu-guest-agent-2:6.1.0-16.fc35.x86_64 2/2
Running scriptlet: qemu-guest-agent-2:6.1.0-16.fc35.x86_64 2/2
Created symlink /etc/systemd/system/dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants/qemu-guest-agent.service -> /usr/lib/systemd/system/qemu-guest-agent.service. Unit /usr/lib/systemd/system/qemu-guest-agent.service is added as a dependency to a non-existent unit dev-virtio\x2dports-org.qemu.guest_agent.0.device. Verifying : liburing-2.0-2.fc35.x86_64 1/2 Verifying : qemu-guest-agent-2:6.1.0-16.fc35.x86_64 2/2 Installed:
liburing-2.0-2.fc35.x86_64 qemu-guest-agent-2:6.1.0-16.fc35.x86_64 Complete!
/bin/sh: line 4: /usr/sbin/update-grub2: No such file or directory
virt-builder: error: /usr/sbin/update-grub2: command exited with an errorIf reporting bugs, run virt-builder with debugging enabled and include the complete output: virt-builder -v -x [...] Failed to build custom image /var/lib/libvirt/images/kdevops/guestfs/base_images/fedora-35.raw
make: *** [scripts/guestfs.Makefile:81: bringup_guestfs] Error 1
program finished with exit code 2
elapsedTime=155.745034

Reverting 7eacfee9a817 ("guestfs: modify grub prompt before first bring up") seems to alleviate the problem. I have some test runners that use Fedora 33 as well, I can check those soon.

--
Chuck Lever

#1 lore raw
Quoted 57 lines · Chuck Lever III

Hi -

Recent changes to bringup_guestfs.sh seem to break older releases of Fedora:

[ 155.0] Editing: /etc/default/grub
[ 155.0] Running: /usr/sbin/update-grub2
Fedora 35 - x86_64 3.3 MB/s | 79 MB 00:23
Fedora 35 openh264 (From Cisco) - x86_64 4.6 kB/s | 2.5 kB 00:00
Fedora Modular 35 - x86_64 2.5 MB/s | 3.3 MB 00:01
Fedora 35 - x86_64 - Updates 11 MB/s | 34 MB 00:03
Fedora Modular 35 - x86_64 - Updates 3.9 MB/s | 3.9 MB 00:00
Last metadata expiration check: 0:00:01 ago on Sat May 18 12:14:40 2024.
Package sudo-1.9.7p2-2.fc35.x86_64 is already installed.
Package python3-3.10.4-1.fc35.x86_64 is already installed.
Package bash-5.1.8-2.fc35.x86_64 is already installed.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
qemu-guest-agent x86_64 2:6.1.0-16.fc35 updates 195 k
Installing dependencies:
liburing x86_64 2.0-2.fc35 fedora 26 kTransaction Summary
================================================================================
Install 2 PackagesTotal download size: 221 k
Installed size: 586 k
Downloading Packages:
(1/2): liburing-2.0-2.fc35.x86_64.rpm 213 kB/s | 26 kB 00:00
(2/2): qemu-guest-agent-6.1.0-16.fc35.x86_64.rp 871 kB/s | 195 kB 00:00
--------------------------------------------------------------------------------
Total 348 kB/s | 221 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : liburing-2.0-2.fc35.x86_64 1/2
Installing : qemu-guest-agent-2:6.1.0-16.fc35.x86_64 2/2
Running scriptlet: qemu-guest-agent-2:6.1.0-16.fc35.x86_64 2/2
Created symlink /etc/systemd/system/dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants/qemu-guest-agent.service -> /usr/lib/systemd/system/qemu-guest-agent.service. Unit /usr/lib/systemd/system/qemu-guest-agent.service is added as a dependency to a non-existent unit dev-virtio\x2dports-org.qemu.guest_agent.0.device. Verifying : liburing-2.0-2.fc35.x86_64 1/2 Verifying : qemu-guest-agent-2:6.1.0-16.fc35.x86_64 2/2 Installed:
liburing-2.0-2.fc35.x86_64 qemu-guest-agent-2:6.1.0-16.fc35.x86_64 Complete!
/bin/sh: line 4: /usr/sbin/update-grub2: No such file or directory
virt-builder: error: /usr/sbin/update-grub2: command exited with an errorIf reporting bugs, run virt-builder with debugging enabled and include the complete output: virt-builder -v -x [...] Failed to build custom image /var/lib/libvirt/images/kdevops/guestfs/base_images/fedora-35.raw
make: *** [scripts/guestfs.Makefile:81: bringup_guestfs] Error 1
program finished with exit code 2
elapsedTime=155.745034

Quoted 3 lines

Reverting 7eacfee9a817 ("guestfs: modify grub prompt before first bring up") seems to alleviate the problem. I have some test runners that use Fedora 33 as well, I can check those soon.

Looking like /no/ Fedora releases have update-grub2. My F39 system doesn't seem to have it, and "dnf provides */update-grub2" says "huh?"

--
Chuck Lever

#2 lore raw

PATCH 1/1 guestfs: make pre_install_customizations() work on RHEL/Fedora/CentOS

These all use grub2-mkconfig.

Fixes 7eacfee ("guestfs: modify grub prompt before first bring up")
---
 scripts/bringup_guestfs.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
scripts/bringup_guestfs.sh +6 -1
index 9238888..806abc6 100755
@@ -191,12 +191,17 @@ _EOT
 
 pre_install_customizations()
 {
+	if echo $OS_VERSION | grep -qE "^(rhel|fedora|centos)"; then
+		UPDATE_GRUB_CMD="/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg"
+	else
+		UPDATE_GRUB_CMD="/usr/sbin/update-grub2"
+	fi
 	cat <<_EOT >>$cmdfile
 install sudo,qemu-guest-agent,python3,bash
 run-command useradd -m kdevops -s /bin/bash
 append-line /etc/sudoers.d/kdevops:kdevops   ALL=(ALL)       NOPASSWD: ALL
 edit /etc/default/grub:s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"/
-run-command /usr/sbin/update-grub2
+run-command $UPDATE_GRUB_CMD
 root-password password:kdevops
 _EOT
 }
Signature · 1 line
2.43.0
author Reviewed-by on v1 1/1
#3 lore raw

Re: [PATCH] guestfs: make pre_install_customizations() work on RHEL/Fedora/CentOS

Quoted 34 lines · Scott Mayhew

These all use grub2-mkconfig.

Fixes 7eacfee ("guestfs: modify grub prompt before first bring up")
---
 scripts/bringup_guestfs.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
scripts/bringup_guestfs.sh +6 -1
index 9238888..806abc6 100755
@@ -191,12 +191,17 @@ _EOT
 
 pre_install_customizations()
 {
+	if echo $OS_VERSION | grep -qE "^(rhel|fedora|centos)"; then
+		UPDATE_GRUB_CMD="/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg"
+	else
+		UPDATE_GRUB_CMD="/usr/sbin/update-grub2"
+	fi
 	cat <<_EOT >>$cmdfile
 install sudo,qemu-guest-agent,python3,bash
 run-command useradd -m kdevops -s /bin/bash
 append-line /etc/sudoers.d/kdevops:kdevops   ALL=(ALL)       NOPASSWD: ALL
 edit /etc/default/grub:s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"/
-run-command /usr/sbin/update-grub2
+run-command $UPDATE_GRUB_CMD
 root-password password:kdevops
 _EOT
 }
Signature · 1 line
2.43.0

LGTM

Signature · 1 line
Chuck Lever