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

unable to create functioning debos image for "generic" x86_64 machine #525

Open
Bart-van-Ingen opened this issue Dec 17, 2024 · 5 comments

Comments

@Bart-van-Ingen
Copy link

Bart-van-Ingen commented Dec 17, 2024

Hello!

I am experimenting with the creation of slim linux images to use on a robotic platform and think that debos can fulfill this requirement for me. Note that I am very much out of my depth on this subject, so bear with me. I write this post hoping to get an answer, but also as a starting point for other novices trying out debos for a similar application!

I am trying to create an image using debos to run on a ODYSSEY - X86J4125, that has a Intel Celeron J4125. I also want to be able to use this on systems running any intel core series chips (i3 - i7).

I created the image using the debos docker image; running the following command in terminal

docker run --rm --interactive --tty     --device /dev/kvm     --user $(id -u)     --workdir /recipes     --mount "type=bind,source=$(pwd),destination=/recipes"     --security-opt label=disable     --tmpfs /dev/shm:rw,exec     godebos/debos simple.yaml

and using the following as my debos configuration yaml file:

{{- $architecture := or .architecture "amd64" -}}
{{- $suite := or .suite "bullseye" -}}
{{- $kernel := or .kernel (printf "linux-image-%s" $architecture) -}}
{{if eq $architecture "i386"}}
    {{ $kernel = or .kernel "linux-image-686" }}
{{end}}
{{- $grubtarget := (printf "grub-efi-%s-bin" $architecture) -}}
{{if eq $architecture "amd64"}}
    {{ $grubtarget = "x86_64-efi" }}
{{end}}
{{ $image := or .image (printf "debian-%s-%s.img" $suite $architecture) }}
{{- $username := or .username "user" -}}
{{- $password := or .password "1234" -}}

architecture: {{ $architecture }}

actions:
  - action: debootstrap
    suite: {{ $suite }}
    components:
      - main
    mirror: https://deb.debian.org/debian
    variant: minbase

  - action: apt
    description: Install packages
    packages: [ {{ $kernel }}, grub-efi, sudo ]

  - action: run
    description: Add user
    chroot: true
    command: sh -c "adduser --gecos {{ $username }} --disabled-password --shell /bin/bash {{ $username }};
      adduser {{ $username }} sudo;
      echo "{{ $username }}:{{ $password }}" | chpasswd"

  - action: image-partition
    imagename: "adi-debian.img"
    imagesize: 4GB
    partitiontype: gpt
    mountpoints:
      - mountpoint: /
        partition: root
        options: [ x-systemd.automount ]
      - mountpoint: /boot/efi
        partition: efi
        options: [ x-systemd.automount ]
    partitions:
      - name: efi
        fs: vfat
        start: 0%
        end: 512MB
        flags: [ boot, esp ]
      - name: root
        fs: ext4
        start: 512MB
        end: 100%

  - action: filesystem-deploy
    description: Deploy filesystem onto image

  - action: run
    description: Install GRUB
    chroot: true
    command: sh -c "update-grub;
      grub-install --target={{ $grubtarget }} --efi-directory=/boot/efi"

The main source of this configuration is an unmerged MR in debos-recipes.

I have attached the complete terminal output to this post as an attachment, since it is quite long.
debos_log.txt

As can be seen from the logs, the recipe completes successfully.

I wipe the drive of the odyssey computer using

sudo dd if=/dev/zero of=/dev/sda bs=1M status=progress

and then used dd to flash this image onto the drive of the odyssey computer

sudo dd if=adi-debian.img of=/dev/sda bs=1M status=progress

removing all USBs from the device, I boot up an am greeted with the following text showing up on the attached screen

Welcome to GRUB!

error: no such device: 12fdea73-3424-4aba-86d9-3782391a16c9.
error: unknown filesystem.
grub rescue>

I think the relevant part of the terminal output is

2024/12/17 10:59:47 ==== image-partition ====
2024/12/17 10:59:49 Formatting partition 1 | mkfs.fat: Warning: lowercase labels might not work properly on some systems
2024/12/17 10:59:49 Formatting partition 1 | mkfs.fat 4.2 (2021-01-31)
2024/12/17 10:59:49 Formatting partition 2 | mke2fs 1.47.0 (5-Feb-2023)
2024/12/17 10:59:51 Formatting partition 2 | Discarding device blocks: done                            
2024/12/17 10:59:51 Formatting partition 2 | Creating filesystem with 851558 4k blocks and 212992 inodes
2024/12/17 10:59:51 Formatting partition 2 | Filesystem UUID: 12fdea73-3424-4aba-86d9-3782391a16c9
2024/12/17 10:59:51 Formatting partition 2 | Superblock backups stored on blocks: 
2024/12/17 10:59:51 Formatting partition 2 |    32768, 98304, 163840, 229376, 294912, 819200
2024/12/17 10:59:51 Formatting partition 2 | 
2024/12/17 10:59:51 Formatting partition 2 | Allocating group tables: done                            
2024/12/17 10:59:51 Formatting partition 2 | Writing inode tables: done                            
2024/12/17 10:59:51 Formatting partition 2 | Creating journal (16384 blocks): done
2024/12/17 10:59:52 Formatting partition 2 | Writing superblocks and filesystem accounting information: done 
2024/12/17 10:59:52 Formatting partition 2 | 
2024/12/17 10:59:52 ==== Deploy filesystem onto image ====
2024/12/17 10:59:56 Setting up fstab
2024/12/17 10:59:56 Setting up /etc/kernel/cmdline
2024/12/17 10:59:56 ==== Install GRUB ====
2024/12/17 10:59:56 sh -c "update-grub; grub-install --targe... | Generating grub configuration file ...
2024/12/17 10:59:57 sh -c "update-grub; grub-install --targe... | Found linux image: /boot/vmlinuz-5.10.0-32-amd64
2024/12/17 10:59:57 sh -c "update-grub; grub-install --targe... | Found initrd image: /boot/initrd.img-5.10.0-32-amd64
2024/12/17 10:59:58 sh -c "update-grub; grub-install --targe... | done
2024/12/17 10:59:58 sh -c "update-grub; grub-install --targe... | Installing for x86_64-efi platform.
2024/12/17 10:59:59 sh -c "update-grub; grub-install --targe... | grub-install: warning: EFI variables are not supported on this system..
2024/12/17 10:59:59 sh -c "update-grub; grub-install --targe... | Installation finished. No error reported.
2024/12/17 11:00:00 ==== Recipe done ====

where we see the partition 2 has the UUID indicated in the grub rescue error.

What I gather from this is:

  • grub has installed correctly
  • grub is unable to find the other partition

My questions therefore are:

  • how can i get grub to find the debian partition?
  • what am i missing in my configuration file to make this work properly?
@obbardc
Copy link
Member

obbardc commented Dec 17, 2024

You may need to also call update-grub to generate the menu entries!

@Bart-van-Ingen
Copy link
Author

@obbardc

in my config I have:

  - action: run
    description: Install GRUB
    chroot: true
    command: sh -c "update-grub;
      grub-install --target={{ $grubtarget }} --efi-directory=/boot/efi"

where i already have update-grub. Are you suggesting I run it here again?

@obbardc
Copy link
Member

obbardc commented Dec 17, 2024

Sorry, I should have been more clear. You may need to run update-grub after grub-install.

@Bart-van-Ingen
Copy link
Author

Thanks for responding! I appreciate it 🙏

I have change the configuration to the following

  - action: run
    description: Install GRUB
    chroot: true
    command: sh -c "update-grub;
      grub-install --target={{ $grubtarget }} --efi-directory=/boot/efi; update-grub"

I now no longer get the grub error! But now I am stuck on a black screen with just an underscore in the top left corner that doesn't react to any input from the usb attached keyboard....

Any suggestions ? 😓

@Bart-van-Ingen
Copy link
Author

Update: I had made a mistake with flashing the new image onto the drive of the computer. Sorry!

Now after having done that correctly, I am back to the grub rescue screen:

Welcome to GRUB!

error: no such device: 70237f1f-a715-44b1-ac2d-ebaedb5bcc62.
error: unknown filesystem.
grub rescue>

with the terminal output of the image generation being:

2024/12/17 11:59:52 ==== image-partition ====
2024/12/17 11:59:53 Formatting partition 1 | mkfs.fat: Warning: lowercase labels might not work properly on some systems
2024/12/17 11:59:53 Formatting partition 1 | mkfs.fat 4.2 (2021-01-31)
2024/12/17 11:59:53 Formatting partition 2 | mke2fs 1.47.0 (5-Feb-2023)
2024/12/17 11:59:54 Formatting partition 2 | Discarding device blocks: done                            
2024/12/17 11:59:54 Formatting partition 2 | Creating filesystem with 851558 4k blocks and 212992 inodes
2024/12/17 11:59:54 Formatting partition 2 | Filesystem UUID: 70237f1f-a715-44b1-ac2d-ebaedb5bcc62
2024/12/17 11:59:54 Formatting partition 2 | Superblock backups stored on blocks: 
2024/12/17 11:59:54 Formatting partition 2 |    32768, 98304, 163840, 229376, 294912, 819200
2024/12/17 11:59:54 Formatting partition 2 | 
2024/12/17 11:59:54 Formatting partition 2 | Allocating group tables: done                            
2024/12/17 11:59:54 Formatting partition 2 | Writing inode tables: done                            
2024/12/17 11:59:54 Formatting partition 2 | Creating journal (16384 blocks): done
2024/12/17 11:59:54 Formatting partition 2 | Writing superblocks and filesystem accounting information: done 
2024/12/17 11:59:54 Formatting partition 2 | 
2024/12/17 11:59:55 ==== Deploy filesystem onto image ====
2024/12/17 11:59:58 Setting up fstab
2024/12/17 11:59:58 Setting up /etc/kernel/cmdline
2024/12/17 11:59:58 ==== Install GRUB ====
2024/12/17 11:59:59 sh -c "update-grub; grub-install --targe... | Generating grub configuration file ...
2024/12/17 11:59:59 sh -c "update-grub; grub-install --targe... | Found linux image: /boot/vmlinuz-5.10.0-32-amd64
2024/12/17 11:59:59 sh -c "update-grub; grub-install --targe... | Found initrd image: /boot/initrd.img-5.10.0-32-amd64
2024/12/17 12:00:01 sh -c "update-grub; grub-install --targe... | done
2024/12/17 12:00:01 sh -c "update-grub; grub-install --targe... | Installing for x86_64-efi platform.
2024/12/17 12:00:01 sh -c "update-grub; grub-install --targe... | grub-install: warning: EFI variables are not supported on this system..
2024/12/17 12:00:01 sh -c "update-grub; grub-install --targe... | Installation finished. No error reported.
2024/12/17 12:00:01 sh -c "update-grub; grub-install --targe... | Generating grub configuration file ...
2024/12/17 12:00:02 sh -c "update-grub; grub-install --targe... | Found linux image: /boot/vmlinuz-5.10.0-32-amd64
2024/12/17 12:00:02 sh -c "update-grub; grub-install --targe... | Found initrd image: /boot/initrd.img-5.10.0-32-amd64
2024/12/17 12:00:03 sh -c "update-grub; grub-install --targe... | done
2024/12/17 12:00:03 ==== Recipe done ====

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

No branches or pull requests

2 participants