What is wrong with core snap

i made a ubuntucore myself,i used the orangepi zero gadget, when i run this ubuntu core ,debug info shows

1.466102] mmc0: new high speed SDHC card at address 1234

Loading, please wait…
[ 1.472714] mmcblk0: mmc0:1234 SA08G 7.21 GiB
[ 1.479909] mmcblk0: p1 p2
starting version 229
[ 1.521064] random: systemd-udevd: uninitialized urandom read (16 bytes read)
[ 1.526046] random: udevadm: uninitialized urandom read (16 bytes read)
[ 1.535493] random: systemd-udevd: uninitialized urandom read (16 bytes read)
[ 1.568965] random: udevadm: uninitialized urandom read (16 bytes read)
[ 1.577646] random: udevadm: uninitialized urandom read (16 bytes read)
[ 1.584393] usb 1-1: new high-speed USB device number 2 using ehci-platform
[ 1.592162] random: udevadm: uninitialized urandom read (16 bytes read)
[ 1.599239] random: udevadm: uninitialized urandom read (16 bytes read)
[ 1.606320] random: udevadm: uninitialized urandom read (16 bytes read)
[ 1.613447] random: udevadm: uninitialized urandom read (16 bytes read)
[ 1.621020] random: udevadm: uninitialized urandom read (16 bytes read)
[ 1.793192] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 1.800538] scsi host0: usb-storage 1-1:1.0
Begin: Loading essential drivers … done.
Begin: Running /scripts/init-premount … done.
Begin: Mounting root file system … Begin: Running /scripts/nfs-top … done.
Begin: Running /scripts/nfs-premount … done.
Begin: Running /scripts/local-top … done.
Begin: Running /scripts/local-premount … done.
the requried kernel commandline snap_core is not set

BusyBox v1.22.1 (Ubuntu 1:1.22.0-15ubuntu1) built-in shell (ash)
Enter ‘help’ for a list of built-in commands.

(initramfs) [ 2.881432] scsi 0:0:0:0: Direct-Access JMicron Tech 0227 PQ: 0 ANSI: 6
[ 2.895297] sd 0:0:0:0: [sda] Unit Not Ready
[ 2.899684] sd 0:0:0:0: [sda] Sense Key : 0x4 [current]
[ 2.905088] sd 0:0:0:0: [sda] ASC=0x44 <>ASCQ=0x81
[ 2.991565] random: fast init done

Nothing is wrong with the core snap but your gadget does not set the proper defaults in the bootloader on the kernel cmdline.
when you use a proper gadget ubuntu-image will configure it during image build and set the right bootloader variables in uboot … do you have a url to the source of the gadget you used ?

1 Like

but this gadget is used by orangepi zero,how could it be wrong! but the kernel snap is build by my self,could it be something wrong couse this debug info

you mean something wrong with the bootloader variables.could you refer more clearly which one?

during image build ubuntu-image calls “snap prepare-image” which reads the snap seed file inside the image to put things like snap_kernel and snap_core into the bootloader config … it also checks that the snaps and model assertion are signed by the right entities to make the image valid (assertion and gadget need to be signed by the same store user IIRC).

documentation is here:

https://docs.ubuntu.com/core/en/guides/build-device/image-building

and here:

https://docs.ubuntu.com/core/en/guides/build-device/gadget

where to sign user iirc for gadget

my gadget is download from your github.

there are links from the first url i pasted above pointing to the snapcraft.io page

hmm this is pretty outdated, the orangepi manufacturers claimed the snap in the store, so i stopped working on it… that said, i just looked at uboot.env.in and the variables should all be correct in there (i see snap_kernel and snap_core inside the “snappy_boot” script line being set correctly)

did you get any errors when building the image with ubuntu-image ?

Note that the official image for the orangepi is apparently linked from

https://developer.ubuntu.com/core/get-started/orange-pi-zero

I sadly do not know where the source for the gadget they use in this image is, you probably have to ask Xunlong for it … i can not find a gadget source at their github repo at

no error,this is the building log:
root@UbuntuServer:/home/server/R16/ubuntucore/orangepi_h3_image# makeubuntucore.sh
DEBUG:ubuntu-image:-> [ 0] make_temporary_directories
DEBUG:ubuntu-image:-> [ 1] prepare_gadget_tree
DEBUG:ubuntu-image:-> [ 2] prepare_image
Fetching core
Copying “ftgw-kernel.snap” (ftgw-kernel)
Copying “ftgw.snap” (ftgw)
ftgw-kernel already prepared, skipping
ftgw already prepared, skipping
WARNING: “ftgw-kernel”, “ftgw” were installed from local snaps disconnected from a store and cannot be refreshed subsequently!
DEBUG:ubuntu-image:-> [ 3] load_gadget_yaml
DEBUG:ubuntu-image:-> [ 4] populate_rootfs_contents
DEBUG:ubuntu-image:-> [ 5] populate_rootfs_contents_hooks
DEBUG:ubuntu-image:-> [ 6] calculate_rootfs_size
DEBUG:ubuntu-image:-> [ 7] pre_populate_bootfs_contents
DEBUG:ubuntu-image:-> [ 8] populate_bootfs_contents
DEBUG:ubuntu-image:-> [ 9] prepare_filesystems
DEBUG:ubuntu-image:-> [10] populate_filesystems
DEBUG:ubuntu-image:-> [11] make_disk
DEBUG:ubuntu-image:-> [12] generate_manifests
DEBUG:ubuntu-image:-> [13] finish
DEBUG:ubuntu-image:-> [14] close

below is the uboot.env ,apparently the snap_core value has been appropriatelly set.
arch=arm baudrate=115200 board=sunxi board_name=sunxi
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script};
source ${scriptaddr} boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi;
if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};
fi boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
boot_net_usb_start=usb start boot_prefixes=/ /boot/ boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr boot_targets=fel mmc0 usb0 pxe dhcp bootcmd=run snappy_boot
bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr};
fi;setenv efi_fdtfile ${fdtfile}; if test -z “${fdtfile}” -a -n “${soc}”; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb;
fi; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00010:UNDI:003000;
setenv bootp_arch 0xa;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r};
then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;
setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;
bootcmd_fel=if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then echo ‘(FEL boot)’; source ${fel_scriptaddr};
fi bootcmd_mmc0=setenv devnum 0; run mmc_boot bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot;
fi bootcmd_usb0=setenv devnum 0; run usb_boot bootdelay=2 bootm_size=0xa000000 console=ttyS0,115200
cpu=armv7 dfu_alt_info_ram=kernel ram 0x42000000 0x1000000;fdt ram 0x43000000 0x100000;
ramdisk ram 0x43300000 0x4000000 distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/ eth1addr=12:42:20:3b:f4:2e ethaddr=02:42:20:3b:f4:2e fdt_addr=0x43000000
fdt_addr_r=0x43000000 fdt_file=sun8i-h3-orangepi-plus2e.dtb fdtcontroladdr=5bf3cee8 fdtfile=sun8i-h3-orangepi-plus2e.dtb
initrd_file=initrd.img kernel_addr_r=0x42000000 kernel_file=kernel.img
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadaddr=0x42000000 loadfdt=fatload mmc 0:1 ${fdt_addr} ${snap_kernel}/dtbs/${fdt_file} loadfiles=run loadkernel;
run loadinitrd; run loadfdt loadinitrd=fatload mmc 0:1 ${ramdiskaddr} ${snap_kernel}/${initrd_file};
setenv initrd_size ${filesize} loadkernel=fatload mmc 0:1 ${loadaddr} ${snap_kernel}/${kernel_file}
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
mmcargs=setenv bootargs “console=ttyS0,115200 console=tty0 root=${mmcroot}” preboot=usb start
pxefile_addr_r=0x43200000 ramdisk_addr_r=0x43300000 ramdiskaddr=0x43300000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}…;
for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts;
done;run scan_dev_for_efi; scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist;
env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist};
do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi;
done scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z “${fdtfile}” -a -n “${soc}”;
then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efi_dtb_prefixes};
do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb;
fi;done;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootarm.efi;
then echo Found EFI removable media binary efi/boot/bootarm.efi; run boot_efi_binary;
echo EFI LOAD FAILED: continuing…; fi; setenv efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf;
then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing…;
fi scan_dev_for_scripts=for script in ${boot_scripts};
do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script};
run boot_a_script; echo SCRIPT FAILED: continuing…; fi; done scriptaddr=0x43100000 snap_core=core_4916.snap
snap_kernel=ftgw-kernel_x1.snap snappy_boot=if test “${snap_mode}” = “try”;
then setenv snap_mode “trying”; saveenv; if test “${snap_try_core}” != “”; then setenv snap_core “${snap_try_core}”;
fi; if test “${snap_try_kernel}” != “”; then setenv snap_kernel “${snap_try_kernel}”; fi;
elif test “${snap_mode}” = “trying”; then setenv snap_mode “”; saveenv; fi; run loadfiles;
setenv mmcroot “/dev/disk/by-label/writable ${snappy_cmdline} snap_core=${snap_core} snap_kernel=${snap_kernel}”;
run mmcargs; bootz ${loadaddr} ${ramdiskaddr}:${initrd_size} ${fdt_addr}
snappy_cmdline=rng_core.default_quality=700 net.ifnames=0 init=/lib/systemd/systemd ro panic=-1 fixrtc
soc=sunxi stderr=serial stdin=serial,usbkbd stdout=serial usb_boot=usb start; if usb dev ${devnum};
then setenv devtype usb; run scan_dev_for_boot_part; fi

hmm, this looks all fine, how was the kernel snap built ? also … can you capture the output of:

cat /proc/cmdline

as well as mount and cat /proc/partitions from the initramfs shell ?

Hi, I am seeing similar messages during boot up and entering into initramfs shell.

initramfs)
(initramfs) cat /proc/cmdline
console=ttymxc3 root=/dev/mmcblk2p1 rootwait rw
(initramfs) cat /proc/partitions
major minor #blocks name

1 0 65536 ram0
1 1 65536 ram1
1 2 65536 ram2
1 3 65536 ram3
1 4 65536 ram4
1 5 65536 ram5
1 6 65536 ram6
1 7 65536 ram7
1 8 65536 ram8
1 9 65536 ram9
1 10 65536 ram10
1 11 65536 ram11
1 12 65536 ram12
1 13 65536 ram13
1 14 65536 ram14
1 15 65536 ram15
179 0 15267840 mmcblk2
179 1 15259648 mmcblk2p1

Can you help me to understand what I am missing?