#1108041 sbuild/unshare: how to mount a shared /dev/shm

Package:
sbuild
Source:
sbuild
Submitter:
Frederic-Emmanuel Picca
Date:
2025-06-20 13:05:01 UTC
Severity:
normal
#1108041#5
Date:
2025-06-19 15:39:42 UTC
From:
To:
Dear Maintainer,

I try to setup sbuild in order to share a few files under /dev/shm between multiple instances.
mostly a local repository and some setup scripts.

It seems that by default a /dev/shm is available in the 'chroot', but It is not the 'host' /dev/shm

So I tryed to mount le 'host' /dev/shm into /dev/shm in the chroot like this

$unshare_bind_mounts = [ { directory => "/dev/shm", mountpoint => "/dev/shm" } ];

root@sbuild:/build/reproducible-path# df
Filesystem     1K-blocks     Used Available Use% Mounted on
tmpfs          131881160 26306308 105574852  20% /
udev           131831348        0 131831348   0% /dev/tty
tmpfs          131881156        0 131881156   0% /dev/shm
efivarfs             128       12       112  10% /sys/firmware/efi/efivars
tmpfs                  4        0         4   0% /sys/kernel

As you can see /dev/shm is empty

But If I mount it like this

$unshare_bind_mounts = [ { directory => "/dev/shm", mountpoint => "/myshm" } ];

then

tmpfs          131881156      268 131880888   1% /myshm

And I can see the /dev/shm content of the 'host'.

What is the proper way to mount the host:'/dev/shm' into unshared:/dev/shm

thanks

Frederic

#1108041#10
Date:
2025-06-20 13:02:20 UTC
From:
To:
What is strange is I create a directory under host:/dev/shm with these
uid:gid

picca@grades-01:~$ ls -l /dev/shm
total 172
drwx------ 2 picca      grp-instrumentation       40 20 juin  14:46
dht-46013085715057
drwx------ 3 picca      grp-instrumentation       80 20 juin  14:46
dht-46013101919192

But the version binmounted shows

root@sbuild:/sharedshm# ls -l
total 172
drwx------ 2 nobody nogroup       40 Jun 20 12:46 dht-46013085715057
drwx------ 3 nobody nogroup       80 Jun 20 12:46 dht-46013101919192


And if I try to list the content of one of these directory...

root@sbuild:/sharedshm# cd dht-46013101919192/
bash: cd: dht-46013101919192/: Permission denied