Porting ubuntu core stuck on run-init progress


#1

Hi, i am a newer on ubuntu core OS.Now, i am porting the ubuntu core to imx6ull chip.I follow the post to build gaget and kernel from @ogra.Also, i build the image and burn into my sdcard.

And it boot and run into initramfs.After execute some script files, it has stuck on run-init command from serial port output.The error message is below:

Loading, please wait...
starting version 229
random: systemd-udevd urandom read with 79 bits of entropy available
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 ... ext4
done.
initrd: checking filesystem for writable partition
EXT3-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (2c0)
EXT2-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (2c4)
EXT4-fs (mmcblk0p2): recovery complete
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: errors=remount-ro
ext4
squashfs: version 4.0 (2009/01/31) Phillip Lougher
EXT3-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (2c0)
EXT2-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (2c0)
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
initrd: mounting /run
mkdir: can't create directory '/root/writable/system-data//etc/default/keyboard': File exists
mkdir: can't create directory '/root/writable/system-data//etc/hosts': File exists
mkdir: can't create directory '/root/writable/system-data//etc/systemd/timesyncd.conf': File exists
mkdir: can't create directory '/root/writable/system-data//etc/default/swapfile': File exists
mkdir: can't create directory '/root/writable/system-data//etc/environment': File exists
Begin: Running /scripts/local-bottom ... done.
done.
Begin: Running /scripts/nfs-bottom ... done.
Begin: Running /scripts/init-bottom ... done.
request_module: runaway loop modprobe binfmt-464c
run-init: /lib/systemd/systemd: Exec format error
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100

I extract the initrd.img file and found the last part is the source of init file.

348 exec run-init ${drop_caps} ${rootmnt} ${init} "$@" ${recovery:+--startup-event=recovery} <${rootmnt}/dev/ttymxc0 >${rootmnt}/dev/ttymxc0
349 echo "Something went badly wrong in the initramfs."
350 panic "Please file a bug on initramfs-tools."

I add some print lines to debug it, and i found the /lib/systemd/systemd file wasn’t exist.I try to manual execute those commands in initramfs.I found before the /lib/systemd/systemd/ wasn’t exist.

(initramfs) mount 
rootfs on / type rootfs (rw)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=250852k,nr_inodes=62713,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=50672k,mode=755)
/dev/mmcblk0p2 on /root/writable type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/writable type ext4 (rw,relatime,data=ordered)
/dev/loop0 on /root type squashfs (ro,relatime)
/dev/loop1 on /root/lib/modules type squashfs (ro,relatime)
/dev/loop1 on /root/lib/firmware type squashfs (ro,relatime)
tmpfs on /root/run type tmpfs (rw,nosuid,noexec,relatime,mode=755)
tmpfs on /root/etc/fstab type tmpfs (rw,nosuid,noexec,relatime,mode=755)
/dev/mmcblk0p2 on /root/etc/cloud type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/sysctl.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/default/keyboard type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/apparmor.d/cache type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/ssh type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/init type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/writable type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/systemd/system type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/sudoers.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/hosts type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/network/interfaces.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/network/if-up.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/udev/rules.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/dbus-1/system.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/modprobe.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/ppp type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/modules-load.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/systemd/network type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/netplan type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/systemd/system.conf.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/systemd/user.conf.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/systemd/logind.conf.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/iproute2 type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/rc0.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/rc1.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/rc2.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/rc3.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/rc4.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/rc5.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/rc6.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/rcS.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/init.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/rsyslog.d type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/systemd/timesyncd.conf type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/default/swapfile type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/environment type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/systemd/system type ext4 (rw,relatime,data=ordered)
/dev/mmcblk0p2 on /root/etc/machine-id type ext4 (rw,relatime,data=ordered)
(initramfs) ls
dev                 scripts             conf                tmpmnt_writable
root                bin                 var                 tmpmnt_kernel
etc                 run                 sys                 tmpmnt_system-boot
lib                 sbin                proc
usr                 init                tmp
(initramfs) ls /lib/systemd/
network        systemd-udevd
(initramfs) ls /root/lib/systemd/system
system-generators/            systemd-logind
system-preset/                systemd-modules-load
system-shutdown/              systemd-networkd
system-sleep/                 systemd-networkd-wait-online
system/                       systemd-quotacheck
systemd                       systemd-random-seed
systemd-ac-power              systemd-remount-fs
systemd-activate              systemd-reply-password
systemd-backlight             systemd-resolved
systemd-binfmt                systemd-rfkill
systemd-bootchart             systemd-shutdown
systemd-bus-proxyd            systemd-sleep
systemd-cgroups-agent         systemd-socket-proxyd
systemd-cryptsetup            systemd-sysctl
systemd-fsck                  systemd-sysv-install
systemd-fsckd                 systemd-timedated
systemd-hibernate-resume      systemd-timesyncd
systemd-hostnamed             systemd-udevd
systemd-initctl               systemd-update-utmp
systemd-journald              systemd-user-sessions
systemd-localed
(initramfs) ls /root/lib/systemd/systemd
/root/lib/systemd/systemd

Below info is manual execute run-init command

(initramfs) exec run-init ${drop_caps} ${rootmnt} ${init} "$@" ${recovery:+--sta
rtup-event=recovery} <${rootmnt}/dev/console >${rootmnt}/dev/console
run-init: /lib/systemd/systemd: Exec format error
/init: line 3: wait-for-root: not found
/init: line 3: tail: not found
/init: line 3: chvt: not found
cannot find 'writable' partition
/init: line 3: modprobe: not found
/init: line 3: modprobe: not found
/init: line 3: modprobe: not found
/init: line 3: modprobe: not found
/init: line 3: modprobe: not found
/init: line 3: modprobe: not found
/init: line 3: modprobe: not found
/init: line 3: modprobe: not foundinitrd: checking filesystem for writable partition

When i dig here, i am confuse about the /lib/systemd/systemd file.Could everyone support some hints for me to dig more deep? Thanks.


#2

your kernel seems to be missing features (iirc the systemd binary uses some stackprotector features, without them you get that exec format error), is this a self built kernel snap ?


#3

Yes.I use my custom linux kernel, the version is 4.1.15.Is it has some documents to mention me? I can follow it to enable those features and builtin into kernel image.


#4

try this doc … (yet a bit old, most of it should still apply, especially the konfig and the 5 parts it is assembled from)


#5

I just noticed, the imx6ull-14x14-evk.dtb is in my linux-generic-allwinner snap in the edge channel, that kernel is built with the multi_v7_defconfig and all default options the ubuntu linux-generic kernel has (along with the latest apparmor), you could try to add “linux-generic-allwinner” to your model (not sure if ubuntu-image gets along with the foreign signature of the kernel snap, but might be worth a try).


#6

Thanks again.The dtb has more difference on different board.I always thinking about the /lib/systemd/systemd file is exist.Is this wrong way?


#7

run-init switches its / to /root before executing whatever is in init= of your kernel commandline.
your above listing shows that /root/lib/systemd/systemd does exist.

the error “run-init: /lib/systemd/systemd: Exec format error” also indicates that it tried to execute it (it would say something like “not found” if the file was not there) but that the execution fails.


#8

You are right.Maybe i found the reason about problem.I got a stupid mistake on build image step.Cause the ubuntu-image always download the core.snap, so i use “snap download core.snap” to get it.While the core.snap is x86 architecture not for armhf platform.
Now, i have another question.Is the ubuntu-image download the defined architecture from model file? And does anyway to download the core.snap armhf version?


About findfs: unable to resolve 'LABEL=writable'
#9

yes, ubuntu-image will always download the architecture defined in the model …


#10

Thanks for your help.I have enter into ubuntu core on my imx6ull board.:smiley: