I am trying to load a Ubuntu Core image with a modified kernel.
Boot fails with:
error: file `/system-data/var/lib/snapd/snaps/1000kernel_x1.snap’ not found.
error: no server is specified.
error: you need to load the kernel first.
Press any key to continue…
When I unzip my img file on the build machine I see following:
system-data\var\lib\snapd\snaps
My system-data\var\lib\snapd\seed\snaps looks like this:
Thanks for that, note that you have in your grubenv
snap_kernel=1000kernel_5.snap
so grub should try to load 1000kernel_5.snap when it boots. While the kernel in your system appears to be 1000kernel_x1.snap. Did you try to install a new kernel snap on the device when it was booted?
The o/p that I gave was for your reference from a device that boots with our store image which is built by pulling all the snaps like gadget, kernel and others from the store and finally using ‘ubuntu-image’ command. Hence you see a different kernel name.
While my issue happens when I try to load an image that is built with modified kernel. After building the kernel snap, I rename the snap to 1000kernel_x1.snap and then do following (please note the - $ubuntu_image_extra_args):
I am sure the grub related settings are modified accordingly during build process. But as of now I do not know how and where this happens in build process. I am trying to figure that out.
My seed.manifest for the kernel part looks like this:
1000kernel x1
FS1:\EFI\ubuntu\> cat grub.cfg
set default=0
set timeout=3
insmod part_gpt
insmod ext2
if [ -s $prefix/grubenv ]; then
load_env
fi
# allow customizing the menu entry via grubenv
if [ -z "$snap_menuentry" ]; then
set snap_menuentry="Ubuntu Core 16"
fi
if [ "$snap_mode" = "try" ]; then
# a new core or kernel got installed
set snap_mode="trying"
save_env snap_mode
if [ x"$snap_try_core" != x"" ]; then
set snap_core="$snap_try_core"
fi
if [ x"$snap_try_kernel" != x"" ]; then
set snap_kernel="$snap_try_kernel"
fi
elif [ "$snap_mode" = "trying" ]; then
# nothing cleared the "trying snap" so the boot failed
# we clear the mode and boot normally
set snap_mode=""
save_env snap_mode
fi
set label="writable"
set cmdline="root=LABEL=$label snap_core=$snap_core snap_kernel=$snap_kernel ro net.ifnames=0 init=/lib/systemd/systemd console=
ttyS0 console=tty1 panic=-1"
menuentry "$snap_menuentry" {
search --label $label --set=writable
loopback loop ($writable)/system-data/var/lib/snapd/snaps/$snap_kernel
linux (loop)/kernel.img $cmdline console=ttyS0,9600 acpi_osi="Linux" tpm_tis.interrupts=0 tpm_tis.force=1
initrd (loop)/initrd.img
}
FS1:\EFI\ubuntu\>