> root@Noble:/# sudo ls

You're already running as root.

$ schroot -c testing-arm64 -- sudo
sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 
'nosuid' option set or an NFS file system without root privileges?

$ cat /proc/sys/fs/binfmt_misc/qemu-aarch64
enabled
interpreter /usr/libexec/qemu-binfmt/aarch64-binfmt-P
flags: POF
offset 0
magic 7f454c460201010000000000000000000200b700
mask ffffffffffffff00fffffffffffffffffeffffff

$ ls -lat /usr/libexec/qemu-binfmt/aarch64-binfmt-P
lrwxrwxrwx 1 root root 29 Apr 22 10:24 
/usr/libexec/qemu-binfmt/aarch64-binfmt-P -> ../../bin/qemu-aarch64-static

$ qemu-aarch64-static --version
qemu-aarch64 version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.17)
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

I switched loong64 to my compiled version and that works.

$ schroot -c test -- sudo
expected one of these actions: --help, --version, --remove-timestamp, 
--validate, --list, --edit, --login, --shell, a command as a positional 
argument, --reset-timestamp
usage: sudo -h | -K | -k | -V
usage: sudo [-ABbknS] [-p prompt] [-D directory] [-g group] [-u user] [-i | -s] 
[command [arg ...]]
usage: sudo -v [-ABknS] [-p prompt] [-g group] [-u user]
usage: sudo -l [-ABknS] [-p prompt] [-U user] [-g group] [-u user] [command 
[arg ...]]
usage: sudo -e [-ABknS] [-p prompt] [-D directory] [-g group] [-u user] file ...

$ cat /proc/sys/fs/binfmt_misc/qemu-loongarch64 
enabled
interpreter /opt/qemu/bin/qemu-loongarch64
flags: OCF
offset 0
magic 7f454c4602010100000000000000000002000201
mask ffffffffffffff00fffffffffffffffffeffffff

$ ls -lat /opt/qemu/bin/qemu-loongarch64 
-rwxr-xr-x 1 root root 29368584 Jun 28 14:28 /opt/qemu/bin/qemu-loongarch64

$ /opt/qemu/bin/qemu-loongarch64 --version
qemu-loongarch64 version 11.0.1
Copyright (c) 2003-2026 Fabrice Bellard and the QEMU Project developers

$ apt-cache policy qemu-user-static
qemu-user-static:
  Installed: 1:8.2.2+ds-0ubuntu1.17
  Candidate: 1:8.2.2+ds-0ubuntu1.17
  Version table:
 *** 1:8.2.2+ds-0ubuntu1.17 500
        500 http://gb.archive.ubuntu.com/ubuntu noble-updates/universe amd64 
Packages
        100 /var/lib/dpkg/status
     1:8.2.2+ds-0ubuntu1.16 500
        500 http://security.ubuntu.com/ubuntu noble-security/universe amd64 
Packages
     1:8.2.2+ds-0ubuntu1 500
        500 http://gb.archive.ubuntu.com/ubuntu noble/universe amd64 Packages

I cannot install qemu-user-binfmt:

The following additional packages will be installed:
  qemu-user
The following packages will be REMOVED
  qemu-user-static

Unless things have changed, the static binaries are needed to run
debootstrap as it copies the binary into the chroot.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2158567

Title:
  sudo fails in a foreign chroot

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2158567/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to