Package: mmdebstrap
Version: 1.3.8-3
Severity: normal

The code for --format=tar/squashfs/ext2/null creates a temporary
directory in the $TMP dir. When libpam-tmpdir is being used, $TMP
is set to a directory that the current user can access but no other
user can access. Consequently because mmdebstrap uses a separate user
namespace(?) it cannot access the temporary dir it just created. In
addition, it fails to clean up that temporary dir after the error.

This does not happen when TMP is set to /tmp with libpam-tmpdir off.

Probably the solution would be to reset TMP to /tmp when the current
value isn't usable after the namespace change, or to create the
temporary dir in the same directory as the output if there is one.

The same should happen to the TMPDIR/TEMP/TEMPDIR variables,
since usage of TMP is not universal across all packages.

$ env | grep -E 'TE?MP'
TEMPDIR=/tmp/user/1000
TMPDIR=/tmp/user/1000
TEMP=/tmp/user/1000
TMP=/tmp/user/1000

$ ls -ld /tmp /tmp/user /tmp/user/1000
drwxrwxrwt 25 root root  16K Sep 22 23:39 /tmp/
drwx--x--x  7 root root 4.0K Sep 16 13:22 /tmp/user/
drwx------ 16 pabs root 4.0K Sep 22 23:51 /tmp/user/1000/

$ mmdebstrap unstable /dev/null
I: automatically chosen mode: unshare
I: chroot architecture amd64 is equal to the host's architecture
I: finding correct signed-by value...
done
I: automatically chosen format: null
I: using /tmp/user/1000/mmdebstrap.mAT11ELelW as tempdir
E: cannot create /tmp/user/1000/mmdebstrap.mAT11ELelW: Permission denied; 
cannot create /tmp/user/1000/mmdebstrap.mAT11ELelW//etc: Permission denied; 
cannot create /tmp/user/1000/mmdebstrap.mAT11ELelW//etc/apt: Permission denied; 
cannot create /tmp/user/1000/mmdebstrap.mAT11ELelW//etc/apt/apt.conf.d: 
Permission denied
I: main() received signal PIPE: waiting for setup...
I: removing tempdir /tmp/user/1000/mmdebstrap.mAT11ELelW...
env: cannot change directory to '/tmp/user/1000/mmdebstrap.mAT11ELelW': 
Permission denied
E: rm failed: 32000
E: remove_tree failed

$ echo $?
29

$ find /tmp/user/1000/mmdebstrap.mAT11ELelW
/tmp/user/1000/mmdebstrap.mAT11ELelW

$ ls -ld /tmp/user/1000/mmdebstrap.mAT11ELelW
drwxr-xr-x 2 296608 296608 4.0K Sep 22 23:54 
/tmp/user/1000/mmdebstrap.mAT11ELelW

$ rmdir /tmp/user/1000/mmdebstrap.mAT11ELelW

-- System Information:
Debian Release: trixie/sid
  APT prefers testing-debug
  APT policy: (900, 'testing-debug'), (900, 'testing'), (800, 
'unstable-debug'), (800, 'unstable'), (790, 'buildd-unstable'), (700, 
'experimental-debug'), (700, 'experimental'), (690, 'buildd-experimental')
merged-usr: no
Architecture: amd64 (x86_64)

Kernel: Linux 6.5.0-1-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8), LANGUAGE=en_AU:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages mmdebstrap depends on:
ii  apt      2.7.3
ii  perl     5.36.0-9
ii  python3  3.11.4-5+b1

Versions of packages mmdebstrap recommends:
ii  arch-test            0.21-1
ii  fakechroot           2.20.1+ds-15
ii  fakeroot             1.32.1-1
ii  gpg                  2.2.40-1.1
ii  libdistro-info-perl  1.5
ii  libdpkg-perl         1.22.0
ii  mount                2.39.2-1
ii  pseudo [fakeroot]    1.9.0+git20230301+ec6151a2b057-1
ii  uidmap               1:4.13+dfsg1-1+b1

Versions of packages mmdebstrap suggests:
ii  apt-transport-tor  0.5
ii  apt-utils          2.7.3
ii  binfmt-support     2.2.2-2
ii  ca-certificates    20230311
ii  debootstrap        1.0.132
ii  distro-info-data   0.58
ii  dpkg-dev           1.22.0
ii  genext2fs          1.5.0-3
ii  perl-doc           5.36.0-9
pn  qemu-user          <none>
ii  qemu-user-static   1:8.1.0+ds-6
ii  squashfs-tools-ng  1.2.0-1
ii  systemd            254.1-3

-- no debconf information

-- 
bye,
pabs

https://wiki.debian.org/PaulWise

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to