containers / bubblewrap

Low-level unprivileged sandboxing tool used by Flatpak and similar projects
Other
3.91k stars 237 forks source link

No such file or directory when qemu-binfmt is needed in gentoo. #508

Closed sergiotarxz closed 2 years ago

sergiotarxz commented 2 years ago

Notes

This issue was first noted in https://forums.gentoo.org/viewtopic-t-1149456.html

And further discussion happened in https://bugs.gentoo.org/show_bug.cgi?id=841506

kernel_config.txt

How to reproduce.

This instructions are thought to be used in a non-aarch64 machine, if you want to reproduce in a aarch64 machine change aarch64 by x86_64 in the instructions.

sudo rc-service qemu-binfmt start
git clone https://gitea.sergiotarxz.freemyip.com/sergiotarxz/mangareader
cd mangareader
flatpak --user remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo 
flatpak --user install org.gnome.Sdk/aarch64/master
flatpak --user install org.gnome.Platform/aarch64/master
flatpak-builder  --force-clean --arch=aarch64 --install --user build me.sergiotarxz.openmg.json me.sergiotarxz.openmg

Output:

Emptying app dir 'build'
Downloading sources
Starting build of me.sergiotarxz.openmg
Cache miss, checking out last cache hit
========================================================================
Building module openmg in /home/sergio/mangareader/.flatpak-builder/build/openmg-24
========================================================================
F: Unexpected filesystem suffix reset, ignoring
bwrap: execvp meson: No such file or directory
Error: module openmg: Child process exited with code 1
smcv commented 2 years ago

The sandbox opened by flatpak-builder won't have qemu's x86_64 dependencies in it (assuming aarch64 container on x86_64 host, please adjust as necessary for other architecture pairs). If your distribution provides a statically-linked version of qemu (like Debian's qemu-user-static package), try using that.

(This is not unique to Flatpak or bubblewrap, entering a traditional chroot in a cross-architecture way has the same problem.)

sergiotarxz commented 2 years ago

Hi, smcv.

In first place I would like to thanks your fast response.

In fact I do have a aarch64 chroot working under the same setup.

In gentoo there is not such thing as a qemu-user-static package but you ask the qemu package to be compiled with user-static support which I already did.

I hope that helps further to diagnose the issue.

I can create a Gentoo qemu image containing the setup to reproduce if you think this can help.

sergio@bahdder ~ $ emerge --info qemu
Portage 3.0.30 (python 3.9.12-final-0, default/linux/amd64/17.1/desktop/gnome, gcc-11.2.1, glibc-2.34-r10, 5.17.5-gentoo-x86_64 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.17.5-gentoo-x86_64-x86_64-Intel-R-_Core-TM-_i3-7020U_CPU_@_2.30GHz-with-glibc2.34
KiB Mem:     8042692 total,    499376 free
KiB Swap:    4196348 total,   3740668 free
Timestamp of repository gentoo: Mon, 02 May 2022 06:30:01 +0000
Head commit of repository gentoo: f8a32402b91f5588cd7a7dd11f6b8814eea7558c
Head commit of repository sergiotarxz: 29e2700911f1dc345321d92c6981be62c212e378

sh bash 5.1_p16
ld GNU ld (Gentoo 2.37_p1 p2) 2.37
app-misc/pax-utils:        1.3.3::gentoo
app-shells/bash:           5.1_p16::gentoo
dev-lang/perl:             5.34.0-r9::gentoo
dev-lang/python:           3.9.12::gentoo, 3.10.4::gentoo
dev-lang/rust-bin:         1.59.0::gentoo
dev-util/cmake:            3.22.2::gentoo
dev-util/meson:            0.60.3::gentoo
sys-apps/baselayout:       2.7-r3::gentoo
sys-apps/openrc:           0.44.10::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.13-r1::gentoo, 2.71-r1::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.37_p1-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/clang:           13.0.1::gentoo
sys-devel/gcc:             11.2.1_p20220115::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.6-r6::gentoo
sys-devel/lld:             13.0.1::gentoo
sys-devel/llvm:            13.0.1::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/glibc:            2.34-r10::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1

sergiotarxz
    location: /var/db/repos/sergiotarxz
    sync-type: git
    sync-uri: https://gitea.sergiotarxz.freemyip.com/sergiotarxz/sergiotarxz-overlay.git
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -mtune=native -O2"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/grs/systems.conf /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -mtune=native -O2"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=native -mtune=native -O2"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -mtune=native -O2"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j1"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr cli colord crypt cups dbus dri dts dvd dvdr eds elogind encode evo exif flac fortran gdbm gif gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk gui iconv icu introspection ipv6 jpeg lcms libglvnd libnotify libsecret libtirpc mad mng mp3 mp4 mpeg multilib nautilus ncurses networkmanager nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio qt5 readline screencast sdl seccomp spell split-usr ssl startup-notification svg sysprof tiff tracker truetype udev udisks unicode upower usb vorbis wayland wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" QEMU_SOFTMMU_TARGETS="aarch64 x86_64 arm" QEMU_USER_TARGETS="aarch64 x86_64" RUBY_TARGETS="ruby26 ruby27" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

app-emulation/qemu-6.2.0::gentoo was built with the following:
USE="aio alsa bzip2 caps curl doc fdt filecaps gnutls gtk jpeg ncurses nls opengl oss pin-upstream-blobs png pulseaudio sdl seccomp slirp udev usb vhost-net vnc xattr -accessibility -bpf (-capstone) -debug -fuse -glusterfs -infiniband -io-uring -iscsi -jack -jemalloc -lzo -multipath -nfs -numa -plugins -python -rbd -sasl -sdl-image (-selinux) -smartcard -snappy -spice -ssh -static -static-user -systemtap -test -usbredir -vde -vhost-user-fs -virgl -virtfs -vte -xen -xfs -zstd" ABI_X86="(64)" PYTHON_TARGETS="python3_9 -python3_10 -python3_8" QEMU_SOFTMMU_TARGETS="aarch64 arm x86_64 -alpha -avr -cris -hppa -i386 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -nios2 -or1k -ppc -ppc64 -riscv32 -riscv64 -rx -s390x -sh4 -sh4eb -sparc -sparc64 -tricore -xtensa -xtensaeb" QEMU_USER_TARGETS="aarch64 x86_64 -aarch64_be -alpha -arm -armeb -cris -hexagon -hppa -i386 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -mipsn32 -mipsn32el -nios2 -or1k -ppc -ppc64 -ppc64abi32 -ppc64le -riscv32 -riscv64 -s390x -sh4 -sh4eb -sparc -sparc32plus -sparc64 -xtensa -xtensaeb"
FEATURES="distlocks binpkg-logs strict unmerge-logs protect-owned unmerge-orphans xattr usersandbox binpkg-docompress pid-sandbox usersync unknown-features-warn parallel-fetch sandbox sfperms ipc-sandbox buildpkg-live qa-unresolved-soname-deps ebuild-locks preserve-libs assume-digests userpriv network-sandbox binpkg-dostrip fixlafiles multilib-strict merge-sync config-protect-if-modified binpkg-multi-instance userfetch news"

>>> Attempting to run pkg_info() for 'app-emulation/qemu-6.2.0'
Using:

  sys-firmware/edk2-ovmf-202105-r2
    USE=binary
  sys-firmware/ipxe-1.21.1
  sys-firmware/seabios-1.14.0-r2
    USE=binary
  sys-firmware/sgabios-0.1_pre10
sergiotarxz commented 2 years ago

Would be good to have a list of expected kernel config options for bubblewrap to work correctly. (Assuming it may be a kernel issue.)

sergiotarxz commented 2 years ago

This isn't a bubblewrap issue.