Comment 1 for bug 2046557

Revision history for this message
Jacopo Rota (r00ta) wrote :

managed to reproduce locally.
The ephemeral image to install debian is fetched properly

```
2023-12-15 15:10:42 provisioningserver.rackdservices.tftp: [info] bootx64.efi requested by 172.0.2.7
2023-12-15 15:10:42 provisioningserver.rackdservices.tftp: [info] bootx64.efi requested by 172.0.2.7
2023-12-15 15:10:43 provisioningserver.rackdservices.tftp: [info] grubx64.efi requested by 172.0.2.7
2023-12-15 15:10:45 provisioningserver.rackdservices.tftp: [info] /grub/x86_64-efi/command.lst requested by 172.0.2.7
2023-12-15 15:10:45 provisioningserver.rackdservices.tftp: [info] /grub/x86_64-efi/fs.lst requested by 172.0.2.7
2023-12-15 15:10:45 provisioningserver.rackdservices.tftp: [info] /grub/x86_64-efi/crypto.lst requested by 172.0.2.7
2023-12-15 15:10:45 provisioningserver.rackdservices.tftp: [info] /grub/x86_64-efi/terminal.lst requested by 172.0.2.7
2023-12-15 15:10:45 provisioningserver.rackdservices.tftp: [info] /grub/grub.cfg requested by 172.0.2.7
2023-12-15 15:10:45 provisioningserver.rackdservices.tftp: [info] /grub/grub.cfg-40:01:7a:cb:80:ac requested by 172.0.2.7
2023-12-15 15:10:45 provisioningserver.rackdservices.http: [info] /images/ubuntu/amd64/ga-20.04/focal/stable/boot-kernel requested by 172.0.2.7
2023-12-15 15:10:46 provisioningserver.rackdservices.http: [info] /images/ubuntu/amd64/ga-20.04/focal/stable/boot-initrd requested by 172.0.2.7
2023-12-15 15:11:01 provisioningserver.rackdservices.http: [info] /images/ubuntu/amd64/ga-20.04/focal/stable/squashfs requested by 172.0.2.7
2023-12-15 15:12:04 provisioningserver.rackdservices.http: [info] /images/custom/amd64/generic/debian-12/uploaded/root-tgz requested by 172.0.2.7
```

but then when the machine reboots the grub configuration returned by MAAS is wrong
```
$ curl localhost:5248/grub/grub.cfg-40:01:7a:cb:80:ac
set default="0"
set timeout=0

menuentry 'Ephemeral' {
    echo 'Booting under MAAS direction...'
    linux /images/custom/amd64/ga-20.04/debian-12/no-such-image/boot-kernel nomodeset ro root=squash:http://127.0.0.1:5248/images/custom/amd64/ga-20.04/debian-12/no-such-image/squashfs ip=::::ciscom4:BOOTIF ip6=off overlayroot=tmpfs overlayroot_cfgdisk=disabled cc:\{'datasource_list': ['MAAS']\}end_cc cloud-config-url=http://127.0.0.1:5248/MAAS/metadata/latest/by-id/cqs6rd/?op=get_preseed log_host=127.0.0.1 log_port=5247 --- BOOTIF=01-${net_default_mac}
    initrd /images/custom/amd64/ga-20.04/debian-12/no-such-image/boot-initrd
}
```

It should return the config to boot from the local disk instead
```
set default="0"
set timeout=0

menuentry 'Local' {
    echo 'Booting local disk...'
    # The bootloader paths list for secure boot is shortened because of LP:2022084
    for bootloader in \
            boot/bootx64.efi \
            ubuntu/shimx64.efi \
            ubuntu/grubx64.efi \
            Microsoft/Boot/bootmgfw.efi; do
        search --set=root --file /efi/$bootloader
        if [ $? -eq 0 ]; then
            chainloader /efi/$bootloader
            boot
        fi
    done

    if [ "${shim_lock}" != "y" ]; then
        echo 'Secure boot is disabled, trying chainloader...'
        for bootloader in \
                centos/shimx64.efi \
                centos/grubx64.efi \
                redhat/shimx64.efi \
                redhat/grubx64.efi \
                rhel/shimx64.efi \
                rhel/grubx64.efi \
                suse/shim.efi \
                suse/grubx64.efi \
                red/grubx64.efi; do
            search --set=root --file /efi/$bootloader
            if [ $? -eq 0 ]; then
                chainloader /efi/$bootloader
                boot
            fi
        done
    fi

    # If no bootloader is found exit and allow the next device to boot.
    exit 1
}
```