ROCKNIX / distribution

Other
416 stars 76 forks source link

[BUG] RG552: failed to start proc-sys-fs-binfmt_misc.mount during boot #749

Open bennr01 opened 3 weeks ago

bennr01 commented 3 weeks ago

Describe the bug

The proc-sys-fs-binfmt_misc.mount service fails to start during boot, causing binfmt integration to not work correctly.

How to reproduce

On a fresh installation of ROCKNIX using ROCKNIX-RK3399.aarch64-20241029.img on a SD card (leaving the other SD card slot empty), booting the device shows a message that the service fails to start during boot, After boot, sudo systemctl status proc-sys-fs-binfmt_misc.mount confirms that the service failed due to a missing file or directory. Attempting to run any x86/x64 file also shows that the automatic invocation of box86/box64 fails, further confirming that the service is not running correctly.

Information

Log file

sudo systemctl status proc-sys-fs-binfmt_misc.mount

× proc-sys-fs-binfmt_misc.mount - Arbitrary Executable File Formats File System
     Loaded: loaded (/usr/lib/systemd/system/proc-sys-fs-binfmt_misc.mount; disabled; preset: disabled)
     Active: failed (Result: exit-code) since Sun 2024-11-03 14:15:04 CET; 11min ago
TriggeredBy: ○ proc-sys-fs-binfmt_misc.automount
      Where: /proc/sys/fs/binfmt_misc
       What: binfmt_misc
       Docs: https://docs.kernel.org/admin-guide/binfmt-misc.html
             https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems

Nov 03 14:15:04 RK3399 mount[283]: mount: mounting binfmt_misc on /proc/sys/fs/binfmt_misc failed: No such file or directory
Notice: journal has been rotated since unit was started, output may be incomplete.

ls /proc/sys/fs/

aio-max-nr            lease-break-time      pipe-user-pages-hard
aio-nr                leases-enable         pipe-user-pages-soft
dentry-state          mount-max             protected_fifos
epoll                 mqueue                protected_hardlinks
file-max              nfs                   protected_regular
file-nr               nr_open               protected_symlinks
inode-nr              overflowgid           suid_dumpable
inode-state           overflowuid           xfs
inotify               pipe-max-size

Relevant dmesg sections

[    5.239758] systemd[1]: Failed to find module 'autofs4'
[    5.271743] systemd[1]: systemd 255.8 running in system mode (-PAM -AUDIT -SELINUX -APPARMOR -IMA -SMACK -SECCOMP -GCRYPT -GNUTLS -OPENSSL -ACL +BLKID -CURL -ELFUTILS -FID>
[    5.271772] systemd[1]: Detected architecture arm64.
[    5.510591] systemd[1]: multi-user.target: Wants dependency dropin /usr/lib/systemd/system/multi-user.target.wants/sixaxis@.service target ../sixaxis@.service has differen>
[    5.526511] systemd[1]: Binding to IPv6 address not available since kernel does not support IPv6.
[    5.526531] systemd[1]: Binding to IPv6 address not available since kernel does not support IPv6.
[    5.597169] systemd[1]: Queued start job for default target rocknix.target.
[    5.670765] systemd[1]: Created slice system-modprobe.slice.
[    5.671808] systemd[1]: Created slice system-sixaxis.slice.
[    5.672389] systemd[1]: Created slice user.slice.
[    5.672533] systemd[1]: Started systemd-ask-password-console.path.
[    5.672622] systemd[1]: Started systemd-ask-password-wall.path.
[    5.672708] systemd[1]: proc-sys-fs-binfmt_misc.automount was skipped because of an unmet condition check (ConditionPathExists=/proc/sys/fs/binfmt_misc).
[    5.672768] systemd[1]: Reached target paths.target.
[    5.672811] systemd[1]: Reached target slices.target.
[    5.680349] systemd[1]: Listening on rpcbind.socket.
[    5.680477] systemd[1]: Reached target rpcbind.target.
[    5.680701] systemd[1]: Listening on systemd-initctl.socket.
[    5.681576] systemd[1]: Listening on systemd-journald-dev-log.socket.
[    5.681903] systemd[1]: Listening on systemd-journald.socket.
[    5.682422] systemd[1]: Listening on systemd-udevd-control.socket.
[    5.682635] systemd[1]: Listening on systemd-udevd-kernel.socket.
[    5.686811] systemd[1]: Mounting dev-mqueue.mount...
[    5.686972] systemd[1]: proc-sys-fs-binfmt_misc.mount: Failed to create mount point '/proc/sys/fs/binfmt_misc', ignoring: No such file or directory
[    5.686987] systemd[1]: proc-sys-fs-binfmt_misc.mount: Failed to check directory /proc/sys/fs/binfmt_misc: No such file or directory
[    5.688685] systemd[1]: Mounting proc-sys-fs-binfmt_misc.mount...
[    5.690703] systemd[1]: Mounting sys-kernel-debug.mount...

...

[    5.780561] systemd[1]: Mounted sys-kernel-debug.mount.
[    5.783909] systemd[1]: Starting kernel-overlays.service...
[    5.807015] systemd[1]: proc-sys-fs-binfmt_misc.mount: Mount process exited, code=exited, status=255/EXCEPTION
[    5.807033] systemd[1]: proc-sys-fs-binfmt_misc.mount: Failed with result 'exit-code'.
[    5.807567] systemd[1]: Failed to mount proc-sys-fs-binfmt_misc.mount.
[    5.817982] systemd[1]: Mounted sys-fs-fuse-connections.mount.
[    5.818196] systemd[1]: Mounted sys-kernel-config.mount.
[    5.824803] systemd[1]: Finished show-version.service.

sudo systemctl restart proc-sys-fs-binfmt_misc.mount (fails, followed by journalctl -xe)

Nov 03 14:33:27 ben552 systemd[1]: proc-sys-fs-binfmt_misc.mount: Failed to create mount point '/proc/sys/fs/binfmt_misc', ignoring: No such file or directory
Nov 03 14:33:27 ben552 systemd[1]: proc-sys-fs-binfmt_misc.mount: Failed to check directory /proc/sys/fs/binfmt_misc: No such file or directory
Nov 03 14:33:27 ben552 systemd[1]: Mounting proc-sys-fs-binfmt_misc.mount...
Nov 03 14:33:27 ben552 mount[9821]: mount: mounting binfmt_misc on /proc/sys/fs/binfmt_misc failed: No such file or directory
Nov 03 14:33:27 ben552 systemd[1]: proc-sys-fs-binfmt_misc.mount: Mount process exited, code=exited, status=255/EXCEPTION
Nov 03 14:33:27 ben552 systemd[1]: proc-sys-fs-binfmt_misc.mount: Failed with result 'exit-code'.
Nov 03 14:33:27 ben552 systemd[1]: Failed to mount proc-sys-fs-binfmt_misc.mount

mount

devtmpfs on /dev type devtmpfs (rw,relatime,size=1978484k,nr_inodes=494621,mode=755)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
/dev/mmcblk1p1 on /flash type vfat (ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
/dev/loop0 on / type squashfs (ro,relatime,errors=continue)
/dev/mmcblk1p2 on /storage type ext4 (rw,noatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,size=792112k,nr_inodes=819200,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
tmpfs on /var type tmpfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,size=1980280k,nr_inodes=1048576)
none on /tmp/cores type overlay (rw,relatime,lowerdir=/usr/lib/libretro,upperdir=/storage/cores,workdir=/storage/.tmp/cores-workdir)
none on /tmp/assets type overlay (rw,relatime,lowerdir=/usr/share/retroarch-assets,upperdir=/storage/assets,workdir=/storage/.tmp/assets-workdir)
none on /tmp/database type overlay (rw,relatime,lowerdir=/usr/share/libretro-database,upperdir=/storage/database,workdir=/storage/.tmp/database-workdir)
none on /tmp/joypads type overlay (rw,relatime,lowerdir=/usr/share/libretro/autoconfig,upperdir=/storage/joypads,workdir=/storage/.tmp/joypads-workdir)
none on /tmp/overlays type overlay (rw,relatime,lowerdir=/usr/share/retroarch-overlays,upperdir=/storage/overlays,workdir=/storage/.tmp/overlays-workdir)
none on /tmp/shaders type overlay (rw,relatime,lowerdir=/usr/share/common-shaders:/usr/share/glsl-shaders:/usr/share/slang-shaders,upperdir=/storage/shaders,workdir=/storage/.tmp/shaders-workdir)
/dev/mmcblk1p2 on /storage/roms type ext4 (rw,noatime)

Context

This is my first install of ROCKNIX. No changes have been made to the system. I've tried re-downloading and re-flashing the SD card. I do not know if this is bug was recently added with the new release or if it has been around for a while.

bennr01 commented 3 weeks ago

I've investigated this a bit more and think I may have found a possible fix. Modifying this line by changing it to CONFIG_BINFMT_MISC=y fixes this specific issue with binfmt. Following the change, x86/x64 binaries can be seamlessly executed as the automated invocation of box86 and box64 works properly.

However:

  1. this is an autogenerated file, modifying it is probably not the correct approach. As I am not experienced with working on distributions, could someone with more experience please point me in the right direction?
  2. While binfmt integration works with the change, I am now getting a message saying Starting of proc-sys-fs-binfmt_misc.automount unsupported. This does not seem to have any negative effect on the system as far as I can tell, but I am going to investigate this a bit more. Perhaps this is related to the missing autofs4 module.

Update:

I've tested another build with CONFIG_AUTOFS4_FS=y and CONFIG_AUTOFS_FS=y. Using these parameters, no failure, unsupported or not found message appear during boot and in dmesg. Everything seems to work fine.