Can't execute files on mounted host directory

I must be missing something somewhere but I can’t execute files from inside a VM that are located on a mounted host directory…

 disk-device-2:
    path: /mnt/jetpack
    raw.mount.options: suid,dev,exec
    shift: 'true'
    source: /data1/virt-shared/jetpack
    type: disk

The raw.mount.options and shift parameters were added to see if I could force the mount options but it didn’t help.

 $ mount
...
incus_disk-device-2 on /mnt/jetpack type virtiofs (rw,relatime)

$ cd /mnt/jetpack 
$ ls -al 
total 8
drwxr-xr-x 1 root root   22 Aug 31 14:59 .
drwxr-xr-x 3 root root 4096 Aug 31 14:54 .. 
-rwxr-xr-x 1 root root   27 Aug 31 14:59 testexec.sh
$ ./testexec.sh -bash: ./testexec.sh: /bin/bash: bad interpreter: Bad address

It’s as though the noexec option is being forced somewhere. If I pass the script name to bash it works fine…

$ cat testexec.sh
#!/bin/bash
echo "WORKS"

$ bash ./testexec.sh
WORKS

Host:

Fedora 42

dnf list incus*
Installed packages
incus.x86_64                  6.15-1.fc42         updates
incus-agent.x86_64            6.15-1.fc42         updates
incus-client.x86_64           6.15-1.fc42         updates
incus-doc.noarch              6.15-0.1.fc42       copr:copr.fedorainfracloud.org:ganto:lxc4
incus-selinux.noarch          6.15-1.fc42         updates
incus-tools.x86_64            6.15-1.fc42         updates

VM:

Ubuntu 24.04.03

Can someone point me in the right direction?

Thanks.

Can you show cat /proc/self/mountinfo from both the host and the container?

A bind-mount cannot grant additional permissions compared to the parent, so if the source is somehow noexec, then so will the mount in the container. But it’s not clear that this is what’s going on here. The Bad address also seems odd if that was the issue.

Can you also show stat /bin/bash in the container?

Just to rule out the obvious, what happens if you give the path explicitly, i.e.

/bin/bash testexec.sh

?

(Aside: “Bad address” is EFAULT, but I can’t think why that would happen).

Also you could try this:

strace -f -s 128 ./testexec.sh

and see what the final page or so of output shows.

Host mountinfo:

115 2 0:36 / / rw,noatime shared:1 - btrfs /dev/nvme2n1p4 rw,seclabel,ssd,discard=async,space_cache=v2,commit=5,subvolid=5,subvol=/
120 115 0:34 / /var/lib/nfs/rpc_pipefs rw,relatime shared:2 - rpc_pipefs rpc_pipefs rw
71 115 0:6 / /dev rw,nosuid shared:3 - devtmpfs devtmpfs rw,seclabel,size=32816772k,nr_inodes=8204193,mode=755,inode64
72 71 0:25 / /dev/shm rw,nosuid,nodev shared:4 - tmpfs tmpfs rw,seclabel,inode64
73 71 0:26 / /dev/pts rw,nosuid,noexec,relatime shared:5 - devpts devpts rw,seclabel,gid=5,mode=620,ptmxmode=000
74 115 0:24 / /sys rw,nosuid,nodev,noexec,relatime shared:6 - sysfs sysfs rw,seclabel
75 74 0:7 / /sys/kernel/security rw,nosuid,nodev,noexec,relatime shared:7 - securityfs securityfs rw
76 74 0:28 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:8 - cgroup2 cgroup2 rw,seclabel
77 74 0:29 / /sys/fs/pstore rw,nosuid,nodev,noexec,relatime shared:9 - pstore none rw,seclabel
78 74 0:30 / /sys/firmware/efi/efivars rw,nosuid,nodev,noexec,relatime shared:10 - efivarfs efivarfs rw
79 74 0:31 / /sys/fs/bpf rw,nosuid,nodev,noexec,relatime shared:11 - bpf bpf rw,mode=700
80 74 0:35 / /sys/kernel/config rw,nosuid,nodev,noexec,relatime shared:12 - configfs configfs rw
81 115 0:23 / /proc rw,nosuid,nodev,noexec,relatime shared:15 - proc proc rw
82 115 0:27 / /run rw,nosuid,nodev shared:16 - tmpfs tmpfs rw,seclabel,size=13147656k,nr_inodes=819200,mode=755,inode64
26 74 0:21 / /sys/fs/selinux rw,nosuid,noexec,relatime shared:14 - selinuxfs selinuxfs rw
28 81 0:33 / /proc/sys/fs/binfmt_misc rw,relatime shared:17 - autofs systemd-1 rw,fd=40,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=3583
29 74 0:13 / /sys/kernel/tracing rw,nosuid,nodev,noexec,relatime shared:18 - tracefs tracefs rw,seclabel
32 71 0:20 / /dev/mqueue rw,nosuid,nodev,noexec,relatime shared:19 - mqueue mqueue rw,seclabel
33 71 0:38 / /dev/hugepages rw,nosuid,nodev,relatime shared:20 - hugetlbfs hugetlbfs rw,seclabel,pagesize=2M
34 74 0:8 / /sys/kernel/debug rw,nosuid,nodev,noexec,relatime shared:21 - debugfs debugfs rw,seclabel
99 82 0:39 / /run/credentials/systemd-journald.service ro,nosuid,nodev,noexec,relatime,nosymfollow shared:22 - tmpfs tmpfs rw,seclabel,size=1024k,nr_inodes=1024,mode=700,inode64,noswap
38 74 0:41 / /sys/fs/fuse/connections rw,nosuid,nodev,noexec,relatime shared:24 - fusectl fusectl rw
35 115 0:40 / /data1 rw,relatime shared:23 - autofs systemd-1 rw,fd=61,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18071
39 115 0:42 / /data3 rw,relatime shared:25 - autofs systemd-1 rw,fd=67,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18074
40 115 0:43 / /data5 rw,relatime shared:26 - autofs systemd-1 rw,fd=73,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18076
41 115 0:44 / /home/gtjoseph/Documents rw,relatime shared:27 - autofs systemd-1 rw,fd=75,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18078
42 115 0:45 / /home/gtjoseph/Downloads rw,relatime shared:28 - autofs systemd-1 rw,fd=76,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18080
43 115 0:46 / /home/gtjoseph/Pictures rw,relatime shared:29 - autofs systemd-1 rw,fd=77,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18082
44 115 0:47 / /media/media rw,relatime shared:30 - autofs systemd-1 rw,fd=80,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18084
45 115 0:48 / /usr/src rw,relatime shared:31 - autofs systemd-1 rw,fd=84,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18086
46 115 0:49 / /var/lib/incus rw,relatime shared:32 - autofs systemd-1 rw,fd=86,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18089
48 81 0:50 / /proc/fs/nfsd rw,relatime shared:57 - nfsd nfsd rw
51 115 259:4 / /boot rw,noatime shared:69 - ext4 /dev/nvme2n1p2 rw,seclabel,stripe=32
53 115 0:51 / /tmp rw,nosuid,nodev shared:71 - tmpfs tmpfs rw,seclabel,nr_inodes=1048576,inode64
55 115 0:51 / /var/tmp rw,nosuid,nodev shared:71 - tmpfs tmpfs rw,seclabel,nr_inodes=1048576,inode64
57 51 259:3 / /boot/efi rw,relatime shared:74 - vfat /dev/nvme2n1p1 rw,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro
59 40 0:52 / /data5 rw,noatime shared:76 - btrfs /dev/nvme1n1 rw,seclabel,ssd,discard=async,space_cache=v2,commit=5,subvolid=5,subvol=/
61 35 0:53 / /data1 rw,noatime shared:78 - btrfs /dev/sdb rw,seclabel,ssd,discard=async,space_cache,user_subvol_rm_allowed,commit=5,subvolid=5,subvol=/
67 45 0:52 /src /usr/src rw,noatime shared:76 - btrfs /dev/nvme1n1 rw,seclabel,ssd,discard=async,space_cache=v2,commit=5,subvolid=5,subvol=/
69 67 0:56 / /usr/src/archive rw,relatime shared:81 - autofs systemd-1 rw,fd=91,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=26181
70 59 0:56 / /data5/src/archive rw,relatime shared:81 - autofs systemd-1 rw,fd=91,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=26181
85 28 0:58 / /proc/sys/fs/binfmt_misc rw,nosuid,nodev,noexec,relatime shared:86 - binfmt_misc binfmt_misc rw
415 82 0:80 / /run/credentials/systemd-networkd.service ro,nosuid,nodev,noexec,relatime,nosymfollow shared:331 - tmpfs tmpfs rw,seclabel,size=1024k,nr_inodes=1024,mode=700,inode64,noswap
823 115 0:88 / /var/cache/fontconfig rw,nosuid,nodev,relatime shared:1051 - tmpfs tmpfs rw,seclabel,size=32000k,mode=755,inode64
1389 82 0:94 / /run/credentials/serial-getty@ttyS0.service ro,nosuid,nodev,noexec,relatime,nosymfollow shared:1182 - tmpfs tmpfs rw,seclabel,size=1024k,nr_inodes=1024,mode=700,inode64,noswap
1165 39 0:95 / /data3 rw,noatime shared:1357 - btrfs /dev/nvme2n1p5 rw,seclabel,ssd,discard=async,space_cache=v2,commit=5,subvolid=5,subvol=/
1188 41 0:53 /Documents /home/gtjoseph/Documents rw,noatime shared:78 - btrfs /dev/sdb rw,seclabel,ssd,discard=async,space_cache,user_subvol_rm_allowed,commit=5,subvolid=5,subvol=/
1202 42 0:53 /Downloads /home/gtjoseph/Downloads rw,noatime shared:78 - btrfs /dev/sdb rw,seclabel,ssd,discard=async,space_cache,user_subvol_rm_allowed,commit=5,subvolid=5,subvol=/
1416 43 0:53 /Pictures /home/gtjoseph/Pictures rw,noatime shared:78 - btrfs /dev/sdb rw,seclabel,ssd,discard=async,space_cache,user_subvol_rm_allowed,commit=5,subvolid=5,subvol=/
1436 44 0:52 /media /media/media rw,noatime shared:76 - btrfs /dev/nvme1n1 rw,seclabel,ssd,discard=async,space_cache=v2,commit=5,subvolid=5,subvol=/
1524 46 0:53 /incus /var/lib/incus rw,noatime shared:78 - btrfs /dev/sdb rw,seclabel,ssd,discard=async,space_cache,user_subvol_rm_allowed,commit=5,subvolid=5,subvol=/
1548 82 0:97 / /run/user/1004 rw,nosuid,nodev,relatime shared:1464 - tmpfs tmpfs rw,seclabel,size=6573828k,nr_inodes=1643457,mode=700,uid=1004,gid=1004,inode64
1574 69 0:52 /src.archive /usr/src/archive rw,noatime shared:76 - btrfs /dev/nvme1n1 rw,seclabel,ssd,discard=async,space_cache=v2,commit=5,subvolid=5,subvol=/
1575 70 0:52 /src.archive /data5/src/archive rw,noatime shared:76 - btrfs /dev/nvme1n1 rw,seclabel,ssd,discard=async,space_cache=v2,commit=5,subvolid=5,subvol=/
1625 1548 0:98 / /run/user/1004/gvfs rw,nosuid,nodev,relatime shared:1539 - fuse.gvfsd-fuse gvfsd-fuse rw,user_id=1004,group_id=1004
30 1548 0:87 / /run/user/1004/doc rw,nosuid,nodev,relatime shared:1010 - fuse.portal portal rw,user_id=1004,group_id=1004
1112 82 0:101 / /run/user/0 rw,nosuid,nodev,relatime shared:1228 - tmpfs tmpfs rw,seclabel,size=6573828k,nr_inodes=1643457,mode=700,inode64
1228 82 0:27 /netns /run/netns rw,nosuid,nodev shared:16 - tmpfs tmpfs rw,seclabel,size=13147656k,nr_inodes=819200,mode=755,inode64
1114 61 0:53 /podman/btrfs /data1/podman/btrfs rw,noatime - btrfs /dev/sdb rw,seclabel,ssd,discard=async,space_cache,user_subvol_rm_allowed,commit=5,subvolid=5,subvol=/
1230 61 0:102 / /data1/podman/btrfs-containers/11e206cf976c054edeb70e5a61f4c3b6a81942c58ae70158e0d6d4814633f082/userdata/shm rw,nosuid,nodev,noexec,relatime shared:1608 - tmpfs shm rw,context="system_u:object_r:container_file_t:s0:c1022,c1023",size=64000k,inode64
1528 1228 0:4 net:[4026534181] /run/netns/netns-fc44f403-350a-c63b-b3c8-400b0469df9b rw shared:1632 - nsfs nsfs rw
1553 82 0:4 net:[4026534181] /run/netns/netns-fc44f403-350a-c63b-b3c8-400b0469df9b rw shared:1632 - nsfs nsfs rw
1121 61 0:303 / /data1/podman/btrfs-containers/cd4518ba89070b8a8c038a5cbaf5d6654f6148f20395ff44bda91b9d4970bb51/userdata/shm rw,nosuid,nodev,noexec,relatime shared:1104 - tmpfs shm rw,context="system_u:object_r:container_file_t:s0:c1022,c1023",size=64000k,inode64
1684 1228 0:4 net:[4026534287] /run/netns/netns-2f62a9b9-8db6-b1f1-27dc-8443741e34cf rw shared:1996 - nsfs nsfs rw
1685 82 0:4 net:[4026534287] /run/netns/netns-2f62a9b9-8db6-b1f1-27dc-8443741e34cf rw shared:1996 - nsfs nsfs rw
842 1112 0:348 / /run/user/0/gvfs rw,nosuid,nodev,relatime shared:1070 - fuse.gvfsd-fuse gvfsd-fuse rw,user_id=0,group_id=0
1847 61 0:351 / /data1/podman/btrfs-containers/c8ea9e6d7add828189ef86a91aaef06287767dd8ee86ee812166b20787bcf672/userdata/shm rw,nosuid,nodev,noexec,relatime shared:1338 - tmpfs shm rw,context="system_u:object_r:container_file_t:s0:c583,c607",size=64000k,inode64
2099 1228 0:4 net:[4026534426] /run/netns/netns-25960c0a-8087-899c-022b-6dcb721e404b rw shared:2426 - nsfs nsfs rw
2100 82 0:4 net:[4026534426] /run/netns/netns-25960c0a-8087-899c-022b-6dcb721e404b rw shared:2426 - nsfs nsfs rw
2634 61 0:367 / /data1/podman/btrfs-containers/b0b1cba84090051917e2c2fbf450279e3a3a0e36e96b373c2f5a4f1d7d901cee/userdata/shm rw,nosuid,nodev,noexec,relatime shared:1444 - tmpfs shm rw,context="system_u:object_r:container_file_t:s0:c1022,c1023",size=64000k,inode64
2666 1228 0:4 net:[4026534759] /run/netns/netns-2cf91e50-bca2-643c-6706-4063937818dd rw shared:2497 - nsfs nsfs rw
2667 82 0:4 net:[4026534759] /run/netns/netns-2cf91e50-bca2-643c-6706-4063937818dd rw shared:2497 - nsfs nsfs rw
2668 115 0:403 / /var/lib/lxcfs rw,nosuid,nodev,relatime shared:1140 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other
2771 1524 0:405 / /var/lib/incus/shmounts rw,relatime shared:1567 - tmpfs tmpfs rw,seclabel,size=100k,mode=711,inode64
2772 61 0:405 / /data1/incus/shmounts rw,relatime shared:1567 - tmpfs tmpfs rw,seclabel,size=100k,mode=711,inode64
2820 1524 0:406 / /var/lib/incus/guestapi rw,relatime shared:2397 - tmpfs tmpfs rw,seclabel,size=100k,mode=755,inode64
2821 61 0:406 / /data1/incus/guestapi rw,relatime shared:2397 - tmpfs tmpfs rw,seclabel,size=100k,mode=755,inode64
2959 1524 0:53 /incus/storage-pools/default /var/lib/incus/storage-pools/default rw,noatime shared:78 - btrfs /dev/sdb rw,seclabel,ssd,discard=async,space_cache,user_subvol_rm_allowed,commit=5,subvolid=9137,subvol=/incus/storage-pools/default
2960 61 0:53 /incus/storage-pools/default /data1/incus/storage-pools/default rw,noatime shared:78 - btrfs /dev/sdb rw,seclabel,ssd,discard=async,space_cache,user_subvol_rm_allowed,commit=5,subvolid=9137,subvol=/incus/storage-pools/default
3009 1524 0:53 /virt-shared/jetpack /var/lib/incus/devices/jetpack/disk.disk--device--2.mnt-jetpack rw,noatime master:78 - btrfs /dev/sdb rw,seclabel,ssd,discard=async,space_cache,user_subvol_rm_allowed,commit=5,subvolid=5,subvol=/
3038 61 0:53 /virt-shared/jetpack /data1/incus/devices/jetpack/disk.disk--device--2.mnt-jetpack rw,noatime shared:78 - btrfs /dev/sdb rw,seclabel,ssd,discard=async,space_cache,user_subvol_rm_allowed,commit=5,subvolid=5,subvol=/
3106 1524 0:52 /src /var/lib/incus/devices/jetpack/disk.disk--device--1.usr-src-hostsrc rw,noatime master:76 - btrfs /dev/nvme1n1 rw,seclabel,ssd,discard=async,space_cache=v2,commit=5,subvolid=5,subvol=/
3107 61 0:52 /src /data1/incus/devices/jetpack/disk.disk--device--1.usr-src-hostsrc rw,noatime shared:76 - btrfs /dev/nvme1n1 rw,seclabel,ssd,discard=async,space_cache=v2,commit=5,subvolid=5,subvol=/
3156 1524 0:53 /incus/storage-pools/default/virtual-machines/jetpack/config /var/lib/incus/devices/jetpack/config.mount ro,noatime master:78 - btrfs /dev/sdb rw,seclabel,ssd,discard=async,space_cache,user_subvol_rm_allowed,commit=5,subvolid=9695,subvol=/incus/storage-pools/default/virtual-machines/jetpack
3159 61 0:53 /incus/storage-pools/default/virtual-machines/jetpack/config /data1/incus/devices/jetpack/config.mount rw,noatimeshared:78 - btrfs /dev/sdb rw,seclabel,ssd,discard=async,space_cache,user_subvol_rm_allowed,commit=5,subvolid=9695,subvol=/incus/storage-pools/default/virtual-machines/jetpack


VM mountinfo:

23 29 0:22 / /sys rw,nosuid,nodev,noexec,relatime shared:7 - sysfs sysfs rw
24 29 0:23 / /proc rw,nosuid,nodev,noexec,relatime shared:13 - proc proc rw
25 29 0:5 / /dev rw,nosuid,relatime shared:2 - devtmpfs udev rw,size=16389344k,nr_inodes=4097336,mode=755,inode64
26 25 0:24 / /dev/pts rw,nosuid,noexec,relatime shared:3 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
27 29 0:25 / /run rw,nosuid,nodev,noexec,relatime shared:5 - tmpfs tmpfs rw,size=3285852k,mode=755,inode64
28 23 0:26 / /sys/firmware/efi/efivars rw,nosuid,nodev,noexec,relatime shared:8 - efivarfs efivarfs rw
29 1 8:2 / / rw,relatime shared:1 - ext4 /dev/sda2 rw
30 23 0:6 / /sys/kernel/security rw,nosuid,nodev,noexec,relatime shared:9 - securityfs securityfs rw
31 25 0:27 / /dev/shm rw,nosuid,nodev shared:4 - tmpfs tmpfs rw,inode64
32 27 0:28 / /run/lock rw,nosuid,nodev,noexec,relatime shared:6 - tmpfs tmpfs rw,size=5120k,inode64
33 23 0:29 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:10 - cgroup2 cgroup2 rw,nsdelegate,memory_recursiveprot
34 23 0:30 / /sys/fs/pstore rw,nosuid,nodev,noexec,relatime shared:11 - pstore pstore rw
35 23 0:31 / /sys/fs/bpf rw,nosuid,nodev,noexec,relatime shared:12 - bpf bpf rw,mode=700
36 24 0:32 / /proc/sys/fs/binfmt_misc rw,relatime shared:14 - autofs systemd-1 rw,fd=32,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=3138
37 25 0:33 / /dev/hugepages rw,nosuid,nodev,relatime shared:15 - hugetlbfs hugetlbfs rw,pagesize=2M
38 25 0:19 / /dev/mqueue rw,nosuid,nodev,noexec,relatime shared:16 - mqueue mqueue rw
39 23 0:7 / /sys/kernel/debug rw,nosuid,nodev,noexec,relatime shared:17 - debugfs debugfs rw
40 23 0:12 / /sys/kernel/tracing rw,nosuid,nodev,noexec,relatime shared:18 - tracefs tracefs rw
41 23 0:34 / /sys/fs/fuse/connections rw,nosuid,nodev,noexec,relatime shared:19 - fusectl fusectl rw
42 23 0:20 / /sys/kernel/config rw,nosuid,nodev,noexec,relatime shared:20 - configfs configfs rw
64 24 0:35 / /proc/fs/nfsd rw,relatime shared:21 - nfsd nfsd rw
44 27 0:36 / /run/lxd_agent rw,nosuid,nodev,noatime shared:31 - tmpfs tmpfs rw,size=51200k,mode=700,inode64
46 29 0:37 / /mnt/jetpack rw,relatime shared:48 - virtiofs incus_disk-device-2 rw
48 29 0:38 / /usr/src/hostsrc rw,relatime shared:50 - virtiofs incus_disk-device-1 rw
50 29 8:1 / /boot/efi rw,relatime shared:52 - vfat /dev/sda1 rw,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
52 36 0:39 / /proc/sys/fs/binfmt_misc rw,nosuid,nodev,noexec,relatime shared:54 - binfmt_misc binfmt_misc rw
54 27 0:40 / /run/rpc_pipefs rw,relatime shared:56 - rpc_pipefs sunrpc rw
139 27 0:51 / /run/user/0 rw,nosuid,nodev,relatime shared:205 - tmpfs tmpfs rw,size=3285848k,nr_inodes=821462,mode=700,inode64

Yeah, that’s what I thought.

$ stat /bin/bash
  File: /bin/bash
  Size: 1446024   	Blocks: 2832       IO Block: 4096   regular file
Device: 8,2	Inode: 12714451    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2025-08-30 23:27:06.415368821 +0000
Modify: 2024-03-31 08:41:03.000000000 +0000
Change: 2025-08-30 23:26:23.611369419 +0000
 Birth: 2025-08-30 23:26:23.588369419 +0000

$ ls -li /bin/bash /usr/bin/bash
12714451 -rwxr-xr-x 1 root root 1446024 Mar 31  2024 /bin/bash
12714451 -rwxr-xr-x 1 root root 1446024 Mar 31  2024 /usr/bin/bash

$ which bash
/usr/bin/bash

/bin/bash and /usr/bin/bash are hardlinked.

$ /bin/bash ./testexec.sh
WORKS
$ /usr/bin/bash ./testexec.sh
WORKS

Also tried changing the shebang to #!bash, #!/usr/bin/bash but neither helped

$ strace -f -s 128 ./testexec.sh
execve("./testexec.sh", ["./testexec.sh"], 0x7ffc7cb3a058 /* 23 vars */) = -1 EFAULT (Bad address)
strace: exec: Bad address
+++ exited with 1 +++

I also installed zsh and changed the shebang but that didn’t help either.

Oh, selinux is Permissive on the host and I added apparmor=0 to the VM kernel command line but that didn’t help.

There’s nothing of note in dmesg, journalctl, auth.log, etc. either.

Anything interesting in /var/log/incus/ on the host? virtiofsd should have a log file in there (disk.XYZ.log) which maybe will have something.

$ cat disk.disk-device-1.log
[2025-08-31T19:36:05Z INFO  virtiofsd] Waiting for vhost-user socket connection...
[2025-08-31T19:36:05Z INFO  virtiofsd] Client connected, servicing requests
$ cat disk.disk-device-2.log
[2025-08-31T19:36:05Z INFO  virtiofsd] Waiting for vhost-user socket connection...
[2025-08-31T19:36:05Z INFO  virtiofsd] Client connected, servicing requests

Nothing of interest.

Well, this is interesting. The VM in question was created from the standard Ubuntu Server ISO. I just created a second VM but used the “Ubuntu oracular amd64 (20250903_07:42)” VM image this time and I have no problem executing scripts in directories mounted from the host.

Not sure what the deal is but it’s working now.

OK so much for being solved. Because oracular is EOL I created a new VM going back to noble and I now have the same issue again. In fact, none of the noble or jammy images allow execution of files on directories mounted from the host. Even worse, the jammy desktop image doesn’t even mount them let allow execution of files on them. Here are the images I’ve tried.

4d04329563807062bf4757faec02c315133c85258cd25bcbb639bb6db0a10b1b
Ubuntu noble amd64 (20250911_07:42)

350244c69b44cd7216bdfa3706249b9330f75c0aa21181165fe94cd0150ce358
Ubuntu noble amd64 (20250911_07:42)

07df9920030243286f02cb0ca89ceeae2b4bcb2a48734b9418d5bb2946b8c4a8
Ubuntu jammy amd64 (20250911_07:42)

578485307bbd4d77d6ad62a9f7c97f2a8c3dc38d9f5316a82511e07aed81c8d8
Ubuntu jammy amd64 (20250911_07:42)

3b2068fe54489554155e1f3c80055cf8f3f74d785b99a3467716180566522934
Ubuntu jammy amd64 (20250911_07:42)

9d415713c7b957d6b41d66473173dcf35956b43ab8655330f31b3ca7de692e6b
Ubuntu oracular amd64 (20250911_07:42)

Only the last (oracular) works.

I’ve looked at the yaml config s, the generated qemu.conf files and the qemu command lines on the host. Except the some ordering and whitespace, the ones that fail are the same as the one that works. I thought apparmor might be the cause but the one that works has apparmor turned on.

I don’t get it.

I just tried the “Ubuntu plucky amd64 (20250911_07:42)” and it worked fine but it’s also not a LTS release.

Apparently the issue is kernel related. The default kernel in the noble images is 6.8.0-79-generic. When I upgraded my noble VM to 6.11.0-29-generic which is the oracular default kernel, i was able to run executable files located on host-mounted directories.

What a process.