Skip to content

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

@Bart-van-Ingen

Description

@Bart-van-Ingen

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions