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

[debian] cobbler expects grub2-mkimage on debian, but debian has grub-mkimage only #3688

Open
klin938 opened this issue May 4, 2024 · 1 comment
Labels
Bug Report Reporting a bug host-os/debian/12 Cobbler is running on Debian 12 main Not a release but referring to the Git main branch

Comments

@klin938
Copy link

klin938 commented May 4, 2024

Describe the bug

cobbler expects grub2-mkimage on debian, but debian has grub-mkimage only. So mkloaders command returns the following:

# cobbler mkloaders
task started: 2024-05-04_153835_Create bootable bootloader images_fd0b338257c34159b4f1781119f18204
task started (id=Create bootable bootloader images, time=Sat May  4 15:38:35 2024)
start_task(mkloaders); event_id(2024-05-04_153835_Create bootable bootloader images_fd0b338257c34159b4f1781119f18204)
grub2-mkimage command not available. Bailing out of GRUB2 generation!
*** TASK COMPLETE ***

Steps to reproduce

  1. install cobbler successfully and run check successfully
  2. run cobbler mkloaders

Expected behavior

/var/lib/cobbler/loaders/grub/grub.0 should be generated by mkloaders.

Cobbler version

# cobbler version
Cobbler 3.4.0
  source: d944986a, Wed Apr 17 07:29:43 2024 +0200
  build time: Wed Sep 21 07:30:00 2022

Operating system

debian 12.5.0 bookworm

Cobbler log

Thread-8 (process_request_thread)] 2024-05-04T15:38:35 - INFO | REMOTE create_task(Create bootable bootloader images); event_id(2024-05-04_153835_Create bootable bootloader images_fd0b338257c34159b4f1781119f18204); user(?)
[2024-05-04_153835_Create bootable bootloader images_fd0b338257c34159b4f1781119f18204] 2024-05-04T15:38:35 - INFO | start_task(mkloaders); event_id(2024-05-04_153835_Create bootable bootloader images_fd0b338257c34159b4f1781119f18204)
[2024-05-04_153835_Create bootable bootloader images_fd0b338257c34159b4f1781119f18204] 2024-05-04T15:38:35 - INFO | grub2-mkimage command not available. Bailing out of GRUB2 generation!
[2024-05-04_153835_Create bootable bootloader images_fd0b338257c34159b4f1781119f18204] 2024-05-04T15:38:35 - INFO | ### TASK COMPLETE ###

Additional information

# apt list | grep installed | grep grub

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

grub-cloud-amd64/stable,now 0.0.5 amd64 [installed]
grub-common/stable,stable-security,now 2.06-13+deb12u1 amd64 [installed,automatic]
grub-efi-amd64-bin/stable,stable-security,now 2.06-13+deb12u1 amd64 [installed,automatic]
grub-efi-amd64-signed/stable,stable-security,now 1+2.06+13+deb12u1 amd64 [installed,automatic]
grub-pc-bin/stable,stable-security,now 2.06-13+deb12u1 amd64 [installed,automatic]
grub2-common/stable,stable-security,now 2.06-13+deb12u1 amd64 [installed,automatic]

I did a hack, created a symlink grub2-mkimage link to /usr/bin/grub-mkimage, it seems to work:

# ls -la /usr/bin/grub*-mkimage
lrwxrwxrwx 1 root root     12 May  4 15:52 /usr/bin/grub2-mkimage -> grub-mkimage
-rwxr-xr-x 1 root root 362696 Oct  3  2023 /usr/bin/grub-mkimage

# cobbler mkloaders
task started: 2024-05-04_155227_Create bootable bootloader images_27995415acaa4cf1a7e47a31e20bd899
task started (id=Create bootable bootloader images, time=Sat May  4 15:52:27 2024)
start_task(mkloaders); event_id(2024-05-04_155227_Create bootable bootloader images_27995415acaa4cf1a7e47a31e20bd899)
GRUB2 modules directory for arch "aarch64" did no exist. Skipping GRUB2 creation
GRUB2 modules directory for arch "arm" did no exist. Skipping GRUB2 creation
GRUB2 modules directory for arch "arm64-efi" did no exist. Skipping GRUB2 creation
GRUB2 modules directory for arch "i386-efi" did no exist. Skipping GRUB2 creation
Successfully built bootloader for arch "i386-pc-pxe"!
GRUB2 modules directory for arch "i686" did no exist. Skipping GRUB2 creation
GRUB2 modules directory for arch "IA64" did no exist. Skipping GRUB2 creation
GRUB2 modules directory for arch "powerpc-ieee1275" did no exist. Skipping GRUB2 creation
Successfully built bootloader for arch "x86_64-efi"!
*** TASK COMPLETE ***
@klin938 klin938 added the Bug Report Reporting a bug label May 4, 2024
@klin938 klin938 changed the title cobbler expects grub2-mkimage on debian, but debian has grub-mkimage only [debian] cobbler expects grub2-mkimage on debian, but debian has grub-mkimage only May 4, 2024
@SchoolGuy SchoolGuy added main Not a release but referring to the Git main branch host-os/debian/12 Cobbler is running on Debian 12 labels May 9, 2024
@SchoolGuy
Copy link
Member

The issue is caused here:

def make_grub(self) -> None:
"""
Create symlink of the GRUB 2 bootloader in case it is available on the system. Additionally build the loaders
for other architectures if the modules to do so are available.
"""
if not utils.command_existing("grub2-mkimage"):
self.logger.info(
"grub2-mkimage command not available. Bailing out of GRUB2 generation!"
)
return

A fix would be to detect the host os and then use the tool that is delivered by the corresponding distribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report Reporting a bug host-os/debian/12 Cobbler is running on Debian 12 main Not a release but referring to the Git main branch
Projects
Status: Todo
Development

No branches or pull requests

2 participants