snapcore / pi-gadget

Universal pi (pi2,pi3,pi4,cm3,cm4 and future) gadget snap for Ubuntu Core and classic systems.
30 stars 60 forks source link

Ubuntu Core 20 support on CM4 #68

Closed RuhanSA079 closed 2 years ago

RuhanSA079 commented 3 years ago

Hello.

After I built a gadget from this source (20-armhf), it seems like the boot process hangs on booting UC20 on the CM4. Is the CM4 supported? Here is the output: `U-Boot 2020.10+dfsg-1ubuntu0~20.04.2 (Jan 08 2021 - 13:03:11 +0000)

DRAM: 1.9 GiB RPI: Board rev 0x14 outside known range RPI Unknown model (0xb03140) MMC: mmcnr@7e300000: 1, emmc2@7e340000: 0 Loading Environment from FAT... *** Warning - bad CRC, using default environment

In: serial Out: serial Err: serial Net: eth0: ethernet@7d580000 starting USB... No working controllers found Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0(part 0) is current device Scanning mmc 0:1... Found U-Boot script /boot.scr 4638 bytes read in 30 ms (150.4 KiB/s)

Executing script at 02400000

4096 bytes read in 27 ms (147.5 KiB/s) 7586304 bytes read in 603 ms (12 MiB/s) halfword at 0x00080000 (0x8b1f) != halfword at 0x02700000 (0x5a4d) Total of 0 halfword(s) were the same Copying kernel... 16937018 bytes read in 1287 ms (12.6 MiB/s) Booting Ubuntu (with bootz) from mmc 0:... Kernel image @ 0x080000 [ 0x000000 - 0x73c200 ]

Flattened Device Tree blob at 02600000

Booting using the fdt blob at 0x2600000 Using Device Tree in place at 02600000, end 0260f08c

Starting kernel ...

[ 0.675281] kvm [1]: Error, CPU 0 not supported! [ 1.510313] spi-bcm2835 fe204000.spi: could not get clk: -517 [ 2.118705] systemd-modules-load[169]: Inserted module 'i2c_bcm2708' [ 2.136826] systemd-modules-load[169]: Inserted module 'nvme' [ 2.154427] systemd-modules-load[169]: Inserted module 'usbhid' [ 2.173146] systemd-modules-load[169]: Inserted module 'hid_generic' [ 2.185480] systemd-modules-load[169]: Module 'squashfs' is built in [ 2.193556] systemd-modules-load[169]: Failed to find module 'ahci' [ 2.208841] systemd-modules-load[169]: Inserted module 'libahci' [ 2.224835] systemd-modules-load[169]: Inserted module 'usb_storage' [ 2.236308] systemd-modules-load[169]: Inserted module 'nls_iso8859_1' [ 2.252797] systemd-modules-load[169]: Inserted module 'virtio_scsi' [ 2.268876] systemd-modules-load[169]: Module 'sdhci' is built in [ 2.284641] systemd-modules-load[169]: Failed to find module 'sdhci-pci' [ 2.300719] systemd-modules-load[169]: Failed to find module 'sdhci-acpi' [ 2.316780] systemd-modules-load[169]: Module 'mmc_block' is built in [ 2.332771] systemd-modules-load[169]: Failed to find module 'hv_storvsc' [ 2.348599] systemd-modules-load[169]: Failed to find module 'hv_vmbus' [ 2.364703] systemd-modules-load[169]: Inserted module 'virtio_blk' [ 2.380838] journalctl[198]: No items in catalog. [ 2.396349] systemd-modules-load[169]: Inserted module 'algif_skcipher' [ 2.412688] systemd-modules-load[169]: Inserted module 'dm_crypt' [ 2.428514] systemd-modules-load[169]: Module 'dm_mod' is built in [ 2.444293] systemd-modules-load[169]: Inserted module 'aes_arm' [ 2.464356] systemd-modules-load[169]: Module 'cbc' is built in [ 2.480316] systemd-modules-load[169]: Inserted module 'echainiv' [ 2.496271] systemd-modules-load[169]: Module 'cryptomgr' is built in [ 2.516279] systemd[1]: Starting Flush Journal to Persistent Storage... [ 2.536364] systemd-modules-load[169]: Inserted module 'sha256_arm' [ 2.556299] systemd-modules-load[169]: Module 'xts' is built in [ 2.576331] systemd-modules-load[169]: Failed to find module 'aesni-intel' [ 2.592304] systemd[1]: Started udev Kernel Device Manager. [ 2.608394] systemd-modules-load[169]: Inserted module 'phy_generic' [ 2.628347] systemd-modules-load[169]: Module 'sdhci_iproc' is built in [ 2.644340] systemd-modules-load[169]: Module 'fixed' is built in [ 2.660354] systemd-modules-load[169]: Module 'gpio_regulator' is built in [ 2.676663] systemd-modules-load[169]: Module 'genet' is built in [ 2.692550] systemd[1]: Finished Load Kernel Modules. [ 2.708609] systemd[1]: Mounting FUSE Control File System... [ 2.724359] systemd[1]: Mounting Kernel Configuration File System... [ 2.740387] systemd[1]: Starting Apply Kernel Variables... [ 2.756402] systemd[1]: Finished Flush Journal to Persistent Storage. [ 2.772387] systemd[1]: Mounted FUSE Control File System. [ 2.788374] systemd[1]: Starting Create Volatile Files and Directories... [ 2.804545] systemd-sysctl[193]: Not setting net/ipv4/conf/all/promote_secondaries (explicit setting exists). [ 2.824349] systemd-sysctl[193]: Not setting net/ipv4/conf/default/promote_secondaries (explicit setting exists). [ 2.844406] systemd[1]: Mounted Kernel Configuration File System. [ 2.860429] systemd-sysctl[193]: Couldn't write 'fq_codel' to 'net/core/default_qdisc', ignoring: No such file or directory [ 2.880332] systemd[1]: Finished Apply Kernel Variables. [ 2.896548] systemd-tmpfiles[195]: Failed to copy files to /etc/nsswitch.conf: No such file or directory [ 2.916367] systemd-tmpfiles[195]: Failed to copy files to /etc/pam.d: No such file or directory [ 2.936361] systemd-tmpfiles[195]: Failed to copy files to /etc/issue: No such file or directory [ 2.956299] systemd[1]: Finished Create Volatile Files and Directories. [ 2.972349] systemd[1]: Starting Rebuild Journal Catalog... [ 2.988373] systemd[1]: Finished Rebuild Journal Catalog. [ 3.004364] systemd[1]: Starting Update is Completed... [ 3.020374] systemd[1]: Finished Update is Completed. [ 3.037022] systemd-udevd[201]: Using default interface naming scheme 'v245'. [ 3.056379] systemd[1]: Finished udev Coldplug all Devices. [ 3.072926] systemd[1]: Starting udev Wait for Complete Device Initialization... [ 3.096376] systemd[1]: Finished udev Wait for Complete Device Initialization. [ 3.116564] udevadm[216]: systemd-udev-settle.service is deprecated. [ 3.495496] systemd[1]: Reached target System Initialization. [ 3.512402] systemd[1]: Started Daily Cleanup of Temporary Directories. [ 3.528492] systemd[1]: Reached target Basic System. [ 3.544566] systemd[1]: Reached target Timers. [ 3.560406] systemd[1]: Condition check resulted in Wait for the Ubuntu Core chooser trigger being skipped. [ 3.584391] systemd[1]: Starting the-tool.service... [ 3.585247] systemd[1]: Created slice system-systemd\x2dfsck.slice. [ 3.585502] systemd[1]: Listening on fsck to fsckd communication Socket. [ 3.585758] systemd[1]: Starting File System Check on /dev/mmcblk0p1... [ 3.590672] systemd[1]: Started File System Check Daemon to report status. [ 3.617690] systemd-fsck[230]: CP437: Invalid argument [ 4.226388] systemd-fsck[230]: fsck.fat 4.1 (2017-01-24) [ 4.226687] systemd-fsck[230]: /dev/mmcblk0p1: 312 files, 1171346/2419758 clusters [ 4.253715] systemd[1]: Finished File System Check on /dev/mmcblk0p1. [ 4.272380] systemd[1]: Mounting /run/mnt/ubuntu-seed... [ 4.291119] systemd[1]: Mounted /run/mnt/ubuntu-seed. [ 4.384767] the-tool[220]: 2019/11/19 12:24:27.555751 secboot_tpm.go:196: cannot open TPM connection: no TPM2 device is available [ 4.408301] the-tool[[220]: FAILEDerror: cannot load metadata and verify essential bootstrap snaps [base kernel snapd gadget]: cannot accept some assertions:] Failed to start the-tool.service. [ 4.408977] the-tool[220]: - assertion is signed with expired public key "SY4gB2ohu-" from "jjNCJ [ 4.468368] systemd[1]: the-tool.service: Main process exited, code=exited, status=1/FAILURE [ 4.488341] systemd[1]: the-tool.service: Failed with result 'exit-code'. [ 4.504258] systemd[1]: Failed to start the-tool.service. [ 4.520225] systemd[1]: Startup finished in 1.826s (kernel) + 0 (initrd) + 2.613s (userspace) = 4.440s. [ 4.540218] systemd[1]: the-tool.service: Triggering OnFailure= dependencies. [ 4.556215] systemd[1]: systemd-ask-password-console.path: Succeeded. [ 4.572208] systemd[1]: Stopped Dispatch Password Requests to Console Directory Watch. [ 4.592199] systemd[1]: systemd-tmpfiles-clean.timer: Succeeded. [ 4.608227] systemd[1]: Stopped Daily Cleanup of Temporary Directories. [ 4.624213] systemd[1]: Stopped target Basic System. [ 4.640198] systemd[1]: Stopped target System Initialization. [ 4.656192] systemd[1]: emergency.service: Starting requested but asserts failed. [ 4.672190] systemd[1]: Assertion failed for Emergency Shell. [ 4.688215] systemd[1]: Dependency failed for Emergency Mode. [ 4.704198] systemd[1]: emergency.target: Job emergency.target/start failed with result 'dependency'. [ 34.263284] systemd[1]: systemd-fsckd.service: Succeeded.` The boot process just hangs there...

xnox commented 3 years ago

You did boot =) as in kernel started fine.

snapd is refusing assertions that you used to build your complete image. Because the keys / timestamps used are newer than what the system clock is.

This is being fixed in a few ways. Newer pi-kernel snaps will automatically set system clock to the time when said pi-kernel snap was created. Separately snapd is implementing a sliding scale to accept reality that if it sees an assertion from the future, it means that system clock needs to be advanced.

May I ask why are you rebuilding the gadget? Does the stock gadget not good enough for you? As it does work out of the box on CM4.

Separately, please wait for the next revision of pi-kernel as that one will advance clock far enough for you to boot successfully with your existing keys.

RuhanSA079 commented 3 years ago

You did boot =) as in kernel started fine.

snapd is refusing assertions that you used to build your complete image. Because the keys / timestamps used are newer than what the system clock is.

This is being fixed in a few ways. Newer pi-kernel snaps will automatically set system clock to the time when said pi-kernel snap was created. Separately snapd is implementing a sliding scale to accept reality that if it sees an assertion from the future, it means that system clock needs to be advanced.

May I ask why are you rebuilding the gadget? Does the stock gadget not good enough for you? As it does work out of the box on CM4.

Separately, please wait for the next revision of pi-kernel as that one will advance clock far enough for you to boot successfully with your existing keys.

Thank you for your reply. The reason why I build my own gadget is, that my snap package require access to USB serial ports (4+ serial ports) and is being populated by the kernel as /dev/ttyUSBx, as well as other interfaces not available in the "stock" gadget snap. I cannot install my snap in devmode, as we use this in production.

I will wait for the next revision of the kernel, where this system-clock datetime is fixed.

dbruno74 commented 3 years ago

@RuhanSA079 , please also have a look on this: https://forum.snapcraft.io/t/custom-uc20-image-for-rpi4-fails/22952/15 The fix is integrated as today and will be part of next snapd release which comes in a few weeks.

sil2100 commented 2 years ago

No movement here since a long time and the attached discourse thread mentions everything working as expected. Please re-open in case this is not the case.