UC20 and uboot.env

Snapcraft.yaml file with build-base: core20 is giving below issue.

EXPERIMENTAL --target-arch for core20 enabled.
Setting target machine to ‘arm64’
Loaded local plugin for kernel
The plugin used by part ‘kernel’ does not support snaps using base ‘core20’.

Then I tried snapcraft.yaml build-base: core18 and kernel-initrd-core-base: core20.I was able to generate kernel snap and tried UC20 boot on hardware. I am not seeing the scripts folder, So i believe it shot shipped with right initrd (Not sure).but I am with bad luck again.Observing few issues like Dependency failed for Emergency Mode,Assertion failed for Emergency Shell,initrd-root-fs.target/start failed… etc and then Boot got stopped as below.

Is it okay to use build-base:core18 in snapcraft to generate UC20 binary? if not okay, I wont consider below log and try to understand the above mentioned issues.

[ 5.316940] systemd[1]: Condition check resulted in FUSE Control File System being skipped.
[ 5.332700] systemd[1]: Mounting Kernel Configuration File System…
[ 5.348618] systemd[1]: Condition check resulted in Store a System Token in an EFI Variable being skipped.
[ 5.368629] systemd[1]: Starting Flush Journal to Persistent Storage…
[ 5.384520] systemd[1]: Condition check resulted in Commit a transient machine-id on disk being skipped.
[ 5.404581] systemd[1]: Starting Apply Kernel Variables…
[ 5.420752] systemd-sysctl[186]: Not setting net/ipv4/conf/all/promote_secondaries (explicit setting exists).
[ 5.440475] systemd-sysctl[186]: Not setting net/ipv4/conf/default/promote_secondaries (explicit setting exists).
[ OK ] Finished udev Wait for Complete Device Initialization.
[ 5.465463] udevadm[190]: systemd-udev-settle.service is deprecated.
[ OK ] Reached target System Initialization.
[ 5.504756] systemd-sysctl[186]: Couldn’t write ‘fq_codel’ to ‘net/core/default_qdisc’, ignoring: No such file or directory
[ OK ] Started Daily Cleanup of Temporary Directories.
[ 5.540777] systemd[1]: Starting Create Static Device Nodes in /dev…
[ OK ] Reached target Basic System.
[ 5.572535] systemd[1]: Mounted Kernel Configuration File System.
[ OK ] Reached target Timers.
[ 5.604583] systemd[1]: Finished Flush Journal to Persistent Storage.
Starting Wait for the Ubuntu Core chooser trigger…
[ 5.637134] systemd[1]: Finished Apply Kernel Variables.
Starting the-tool.service…
[ 5.669322] systemd[1]: Finished udev Coldplug all Devices.
[ 5.702087] snap-bootstrap[219]: cmd_recovery_chooser_trigger.go:80: trigger wait timeout 10s
[ 5.721020] snap-bootstrap[219]: cmd_recovery_chooser_trigger.go:81: marker file /run/snapd-recovery-chooser-triggered
[ OK ] Created slice system-systemd\x2dfsck.slice.
[ 5.740752] systemd[1]: Finished Create Static Device Nodes in /dev.
[ OK ] Listening on fsck to fsckd communication Socket.
[ 5.773510] systemd[1]: Starting Create Volatile Files and Directories…
Starting File System Check on /dev/mmcblk1p1…
[ 5.796254] snap-bootstrap[219]: cmd_recovery_chooser_trigger.go:96: no matching input devices
[ OK ] Finished Wait for the Ubuntu Core chooser trigger.
[ 5.824899] systemd-tmpfiles[189]: Failed to copy files to /etc/nsswitch.conf: No such file or directory
[ 5.826080] systemd-tmpfiles[189]: Failed to copy files to /etc/pam.d: No such file or directory
[ 5.826878] systemd-tmpfiles[189]: Failed to copy files to /etc/issue: No such file or directory
[ 5.827367] systemd[1]: Starting udev Wait for Complete Device Initialization…
[ 5.827815] systemd[1]: Starting udev Kernel Device Manager…
[ 5.828427] systemd[1]: Finished Create Volatile Files and Directories.
[ 5.830416] systemd-udevd[192]: Network interface NamePolicy= disabled on kernel command line, ignoring.
[ 5.831044] systemd[1]: Started udev Kernel Device Manager.
[ 5.831496] systemd[1]: Starting Rebuild Journal Catalog…
[ 5.831927] systemd[1]: Finished Rebuild Journal Catalog.
[ 5.834107] systemd-udevd[194]: Using default interface naming scheme ‘v245’.
[ 5.834673] systemd[1]: Starting Update is Completed…
[ 5.835171] systemd[1]: Finished Update is Completed.
[ OK ] Started File System Check Daemon to report status.
[ 5.838084] systemd[1]: Finished udev Wait for Complete Device Initialization.
[ 5.839072] systemd[1]: Reached target System Initialization.
[ 5.839503] systemd[1]: Started Daily Cleanup of Temporary Directories.
[ 5.839824] systemd[1]: Reached target Basic System.
[ 5.840180] systemd[1]: Reached target Timers.
[ 5.840508] systemd[1]: Starting Wait for the Ubuntu Core chooser trigger…
[ 5.840759] systemd[1]: Starting the-tool.service…
[ 5.840971] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[ 5.841177] systemd[1]: Listening on fsck to fsckd communication Socket.
[ 5.841411] systemd[1]: Starting File System Check on /dev/mmcblk1p1…
[ 5.841599] systemd[1]: Finished Wait for the Ubuntu Core chooser trigger.
[ 5.841757] systemd[1]: Started File System Check Daemon to report status.
[ 5.917996] systemd-fsck[235]: CP437: Invalid argument
[ 6.647367] systemd-fsck[235]: fsck.fat 4.1 (2017-01-24)
[ 6.647855] systemd-fsck[235]: 0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
[ 6.648119] systemd-fsck[235]: Automatically removing dirty bit.
[ 6.648381] systemd-fsck[235]: There are differences between boot sector and its backup.
[ 6.648560] systemd-fsck[235]: This is mostly harmless. Differences: (offset:original/backup)
[ 6.648724] systemd-fsck[235]: 67:49/d1, 68:f2/68, 69:84/e2, 70:3d/e6
[ 6.648875] systemd-fsck[235]: Not automatically fixing this.
[ 6.649042] systemd-fsck[235]: Performing changes.
[ 6.649188] systemd-fsck[235]: /dev/mmcblk1p1: 25 files, 280408/1290522 clusters
[ OK ] Finished File System Check on /dev/mmcblk1p1.
[ 6.722361] systemd[1]: Finished File System Check on /dev/mmcblk1p1.
Mounting /run/mnt/ubuntu-seed…
[ 6.756950] systemd[1]: Mounting /run/mnt/ubuntu-seed…
[ OK ] Mounted /run/mnt/ubuntu-seed.
[ 6.925421] systemd[1]: Mounted /run/mnt/ubuntu-seed.
Mounting /run/mnt/snapd…
[ 13.476546] systemd[1]: Mounting /run/mnt/snapd…
[ OK ] Mounted /run/mnt/snapd.
[ 13.526827] systemd[1]: Mounted /run/mnt/snapd.
Mounting /run/mnt/kernel…
[ 13.578614] systemd[1]: Mounting /run/mnt/kernel…
[ OK ] Mounted /run/mnt/kernel.
[ 13.661369] systemd[1]: Mounted /run/mnt/kernel.
Mounting /run/mnt/base…
[ 13.710585] systemd[1]: Mounting /run/mnt/base…
[ OK ] Mounted /run/mnt/base.
[ 13.769092] systemd[1]: Mounted /run/mnt/base.
Mounting /sysroot…
[ 13.800725] systemd[1]: Mounting /sysroot…
[ OK ] Mounted /sysroot.
[ 13.829053] systemd[1]: Mounted /sysroot.
[ 13.861432] Mounting /run/mnt/data…systemd
[1]: Mounting /run/mnt/data…
[ OK ] Mounted /run/mnt/data.
[ 13.881129] systemd[1]: Mounted /run/mnt/data.
[ 13.916692] the-tool[225]: 2021/05/04 11:30:26.486474 secboot_tpm.go:222: cannot open TPM connection: no TPM2 device is available
[ OK ] Finished the-tool.service.
[ 13.936732] systemd[1]: Finished the-tool.service.
Mounting /sysroot/writable…
[ 13.968615] systemd[1]: Mounting /sysroot/writable…
[ OK ] Mounted /sysroot/writable.
[ 13.996737] systemd[1]: Mounted /sysroot/writable.
Starting populate-writable.service…
[ 14.029145] systemd[1]: Starting populate-writable.service…
[ 15.256095] systemd[1]: run-mnt-base-run-fstab.mount: Succeeded.
[ 15.272767] systemd[1]: sysroot-run-fstab.mount: Succeeded.
[ 15.289101] systemd[1]: run-mnt-base-run.mount: Succeeded.
[ 15.305349] systemd[1]: sysroot-run.mount: Succeeded.
[ OK ] Reached target Initrd Root Device.
[ 15.320512] systemd[1]: Reached target Initrd Root Device.
Mounting /sysroot/usr/lib/firmware…
[ 15.353054] systemd[1]: Condition check resulted in FUSE Control File System being skipped.
Mounting /sysroot/usr/lib/modules…
[ 15.385068] systemd[1]: Condition check resulted in Kernel Trace File System being skipped.
Stopping File System Check Daemon to report status…
[ 15.413833] mount[561]: mount: /sysroot/usr/lib/firmware: special device /run/mnt/kernel/firmware does not exist.
[ OK ] Stopped File System Check Daemon to report status.
[ 15.448906] systemd[1]: Mounting /sysroot/usr/lib/firmware…
[FAILED] Failed to mount /sysroot/usr/lib/firmware.
See ‘systemctl status sysroot-usr-lib-firmware.mount’ for details.[ 15.481475]
systemd[1]: Mounting /sysroot/usr/lib/modules…
[DEPEND] Dependency failed for Initrd Root File System.
[[ 15.516763] DEPENDsystemd] [1]: Dependency failed for Relo�…figuration from the Real Root.Condition check resulted in Create list of static device nodes for the current kernel being skipped.

[ OK ] Mounted /sysroot/usr/lib/modules.
[ 15.552944] systemd[1]: Condition check resulted in Store a System Token in an EFI Variable being skipped.
[ OK ] Stopped Dispatch Password �…ts to Console Directory Watch.
[ 15.592649] systemd[1]: [Stopping File System Check Daemon to report status… OK
] Stopped Daily Cleanup of Temporary Directories.
[ OK [ 15.609499] ] systemdReached target Initrd File Systems.[1]:
Condition check resulted in Rebuild Hardware Database being skipped.
[ OK ] Stopped Wait for the Ubuntu Core chooser trigger.
[ 15.656833] systemd[1]: Condition check resulted in Commit a transient machine-id on disk being skipped.
[ OK ] Stopped populate-writable.service.
[ 15.692574] systemd[1]: systemd-fsckd.service: Succeeded.
[[ 15.724796] OK systemd] [1]: Stopped target Basic System.Stopped File System Check Daemon to report status.

[ OK ] Stopped target System Initialization.
[[ 15.752582] ASSERTsystemd] [1]: Assertion failed for Emergency Shell.sysroot-usr-lib-firmware.mount: Mount process exited, code=exited, status=32/n/a

[DEPEND] Dependency failed for Emergency Mode.
[ 15.792939] systemd[1]: sysroot-usr-lib-firmware.mount: Failed with result ‘exit-code’.
[ 15.824463] systemd[1]: Failed to mount /sysroot/usr/lib/firmware.
[ 15.840748] systemd[1]: Dependency failed for Initrd Root File System.
[ 15.856630] systemd[1]: Dependency failed for Reload Configuration from the Real Root.
[ 15.872674] systemd[1]: initrd-parse-etc.service: Job initrd-parse-etc.service/start failed with result ‘dependency’.
[ 15.892615] systemd[1]: initrd-parse-etc.service: Triggering OnFailure= dependencies.
[ 15.908604] systemd[1]: initrd-root-fs.target: Job initrd-root-fs.target/start failed with result ‘dependency’.
[ 15.928653] systemd[1]: Mounted /sysroot/usr/lib/modules.
[ 15.944630] systemd[1]: systemd-ask-password-console.path: Succeeded.
[ 15.960304] systemd[1]: Stopped Dispatch Password Requests to Console Directory Watch.
[ 15.976343] systemd[1]: systemd-tmpfiles-clean.timer: Succeeded.
[ 15.992641] systemd[1]: Stopped Daily Cleanup of Temporary Directories.
[ 16.008331] systemd[1]: Reached target Initrd File Systems.
[ 16.024654] systemd[1]: snapd.recovery-chooser-trigger.service: Succeeded.
[ 16.040606] systemd[1]: Stopped Wait for the Ubuntu Core chooser trigger.
[ 16.056731] systemd[1]: populate-writable.service: Succeeded.
[ 16.072663] systemd[1]: Stopped populate-writable.service.
[ 16.088615] systemd[1]: Stopped target Basic System.
[ 16.104673] systemd[1]: Stopped target System Initialization.
[ 16.120629] systemd[1]: emergency.service: Starting requested but asserts failed.
[ 16.136643] systemd[1]: Assertion failed for Emergency Shell.
[ 16.152617] systemd[1]: Dependency failed for Emergency Mode.
[ 16.168320] systemd[1]: emergency.target: Job emergency.target/start failed with result ‘dependency’.
[ 16.184310] systemd[1]: Startup finished in 3.427s (kernel) + 0 (initrd) + 12.401s (userspace) = 15.828s.

this is the issue in your boot, does your kernel snap have a /firmware directory in it? if not, just create an empty directory there

otherwise you do seem to indeed have a uc20 initrd booting here, I can see the uc20 specific bits running (specifically mounting /run/mnt/ubuntu-seed and friends)

1 Like

yeah, what @ijohnson said, the boot itself looks good … i’d just add linux-firmware to the stage-packages of your kernel, that way you will also be sure firmware for potential USB devices you plug in is available …

1 Like

@ijohnson and @ogra I tried below in snapcaft.yaml and tried. UC20 boots successfully on my imx8 platform and able to connect store. Thank you for comments. :clap: :clap:

firmware: plugin: nil override-build: | mkdir -p $SNAPCRAFT_PART_INSTALL/firmware

I used LXC shell environment and used build-base: core18, But when I am using build-base: core20, not able to generate snap and getting “The plugin used by part ‘kernel’ does not support snaps using base ‘core20’.” messages. I am curious to know why does build-base: core 20 not working for me.Does it support kernel snap part plugin?

1 Like

this would be a question to @ondra, who maintains the kernel plugin … i guess as long as the toolchain works for the kernel version you use everything is fine though, it is just a kernel after all, not shipping any user space binaries …

I’m trying to build a arm64 UC20 image for a amlogic board, and got almost the same issues:

according to the kernel-building guide, the output initrd.img was boot hang at booting as the same with @jithcr, because the initrd is an UC18 initrd, so i refered to @ogra rockpi repo and build an UC20 initrd with custom kernel plugin, and bootup successfully.

The custom kernel plugin download a initrd snap package from https://people.canonical.com/~okubik/uc-initrds/uc-initrd_20_arm64.snap, this is actually a raspi initrd build.

i’m confused about the kernel-building guide in ubuntu core official docs, why the build-base can’t set to core20, I tried this and failed with error “Failed to load plugin: unknown plugin: ‘kernel’”, either on real host or lxd. so i have to set build-base: core18 for building, is this the reason that the output initrd.img is an UC18 initrd?

Thanks

Hello, just make sure that the kernel-initrd-core-base: core20 property is set. But, I have another problem, and it seems that the current initrd from https://people.canonical.com/~okubik/uc-initrds/uc-initrd_20_arm64.snap is currently not booting on my i.MX8 platform, just like @jithcr mentioned on his post.

My model assertion is from 2023-04-01, and the thetool.service still reports a date of 2021-xx-xx. It fails with the signatures not being valid. Seems like that the time is not advanced properly, or the initrd does not look at the time properly? My signature key is valid since 2022, so probably time bound?

I removed the unit’s RTC, to avoid the system time to be set to 2000, or whatever that time is. (RTC does not have a battery, using smaller coin cell I can’t find right now)

Any solutions? Seems hacky to use a Raspberry Pi’s initrd for arm64, other than Raspberry Pi.

[    6.320147] the-tool[290]: 2021/05/04 11:30:18.465492 secboot_tpm.go:222: cannot open TPM connection: no TPM2 device is available
[    6.340296] the-tool[290]: error: cannot load metadata and verify essential bootstrap snaps [base kernel snapd gadget]: cannot accept some assertions:
[FAILED] Failed to start the-tool.service.
See 'systemctl status the-tool.service' for details.
[    6.340607] the-tool[290]:  - assertion is signed with expired public key "<removed>" from "<removed>"
[    6.405024] systemd[1]: the-tool.service: Main process exited, code=exited, status=1/FAILURE
[    6.414130] systemd[1]: the-tool.service: Failed with result 'exit-code'.