#998239 fai-make-nfsroot fails with libpam-.tmpdir installed (and activated)

#998239#5
Date:
2021-11-01 13:23:11 UTC
From:
To:
Package: fai-server
Version: 5.10.3
Severity: normal

Hi,

I just tried to run fai-make-nfsroot on a Debian Edu system. Debian
Edu systems have libpam-tmpdir installed by default.

This tmpdir hack gets obviously propagated into the created chroot and
in there, I get failures while ca-certificates gets configured:

```
[...]

Setting up openssh-server (1:8.4p1-5) ...
mktemp: failed to create file via template
'/tmp/user/0/tmp.XXXXXXXXXX': No such file or directory
dpkg: error processing package openssh-server (--configure):
  installed openssh-server package post-installation script subprocess
returned error exit status 1
Setting up python3 (3.9.2-3) ...
Setting up nmap (7.91+dfsg1+really7.80+dfsg1-2) ...
Setting up grub-common (2.04-20) ...
Setting up xfsprogs (5.10.0-4) ...
Running in chroot, ignoring command 'daemon-reload'
Setting up grub-efi-amd64-bin (2.04-20) ...
dpkg: dependency problems prevent configuration of ssh:
  ssh depends on openssh-server (>= 1:8.4p1-5); however:
   Package openssh-server is not configured yet.

dpkg: error processing package ssh (--configure):
  dependency problems - leaving unconfigured
Setting up grub2-common (2.04-20) ...
Setting up grub-pc-bin (2.04-20) ...
Setting up grub-pc (2.04-20) ...
mktemp: failed to create file via template
'/tmp/user/0/grub.XXXXXXXXXX': No such file or directory
dpkg: error processing package grub-pc (--configure):
  installed grub-pc package post-installation script subprocess
returned error exit status 1

[...]

Errors were encountered while processing:
  linux-image-amd64
  ca-certificates
  openssh-server
  ssh
  grub-pc
ERROR: 256 256
ERROR: chroot /srv/fai/nfsroot dpkg --configure --pending return code 1
install_packages: executing chroot /srv/fai/nfsroot dpkg -C
The following packages have been unpacked but not yet configured.
They must be configured using dpkg --configure or the configure
menu option in dselect for them to work:
  linux-image-amd64    Linux for 64-bit PCs (meta-package)
  ssh                  secure shell client and server (metapackage)

The following packages are only half configured, probably due to problems
configuring them the first time.  The configuration should be retried using
dpkg --configure <package> or the configure menu option in dselect:
  ca-certificates      Common CA certificates
  grub-pc              GRand Unified Bootloader, version 2 (PC/BIOS version)
  openssh-server       secure shell (SSH) server, for secure access from remote

install_packages: executing chroot /srv/fai/nfsroot apt-get clean
2 errors during executing of install_packages
ERROR: install_packages had exit code: 3
Log file written to /var/log/fai/fai-make-nfsroot.log
Log file written to /var/log/fai/fai-make-nfsroot.log and
/srv/fai/nfsroot/var/tmp
```

Greets,
Mike

#998239#10
Date:
2021-12-17 09:51:53 UTC
From:
To:
    > This tmpdir hack gets obviously propagated into the created chroot and
    > in there, I get failures while ca-certificates gets configured:

Mmmm, so is this more a ca-certificates bug?
Or does libpam-tmpdir does not work correct in a chroot environment?
Does libpam-tmpdir need systemd to work correctly? Currently FAI does
not boot into a system with systemd running during installation.

#998239#15
Date:
2021-12-17 13:54:42 UTC
From:
To:
Hi Thomas,

nope, the problem is that TMPDIR gets diverted by libpam-tmpdir to
/tmp/user/<uidNumber>/ (instead of /tmp).

This diversion stays in place while chroot'ing into the nfsroot
sub(system) folder. However, in the nfsroot, there is not such folder
/tmp/user/<uidNumber>/.

I suppose that this issue might be very similar to the fai-cd TMPDIR
hack we looked at via bug #1000572.

Mike