Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#70580 - [archiso] mkarchiso fails pacstrap on unusual TMPDIR

Attached to Project: Arch Linux
Opened by stefan (stefan1) - Sunday, 25 April 2021, 10:51 GMT
Last edited by David Runge (dvzrv) - Friday, 02 July 2021, 10:42 GMT
Task Type Bug Report
Category Packages: Extra
Status Assigned   Reopened
Assigned To David Runge (dvzrv)
Giancarlo Razzolini (grazzolini)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Description
-----------

If the environment variable `TMPDIR` is set to something unusual, then
`mkarchiso` fails. I think having a non-standard setting for TMPDIR
is valid use, otherwise it would make little sense for it to be a
variable.


Version information
-------------------

I've tried this with

$ pacman -Q $(pactree -u -d1 archiso)
archiso 52-1
arch-install-scripts 23-2
bash 5.1.004-1
dosfstools 4.2-1
e2fsprogs 1.46.2-1
libisoburn 1.5.4-2
mtools 4.0.27-1
squashfs-tools 4.4-2

Output of `mkarchiso -v /usr/share/archiso/configs/baseline/
1>mkarchiso.log 2>&1` is at the end.


Steps to reproduce
------------------

1. Use a valid, but unusual `TMPDIR`, e.g.,

# export TMPDIR=/tmp/foo
# mkdir -p "${TMPDIR}"

2. Follow the steps of [1] to build an ISO from the unchanged `baseline`
or `releng` profiles:

# mkarchiso -v /usr/share/archiso/configs/baseline/
...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'archiso'
-> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
mktemp: failed to create directory via template '/tmp/foo/mkinitcpio.XXXXXX': No such file or directory
==> ERROR: Failed to create temporary working directory in /tmp/foo
error: command failed to execute correctly
...
install: cannot stat '/root/work/x86_64/airootfs/boot/initramfs-*.img': No such file or directory

Complete log is below.

3. Running the same with `TMPDIR=/tmp` works fine:

# export TMPDIR=/tmp
# mkarchiso -v /usr/share/archiso/configs/baseline/
...
[mkarchiso] INFO: Done!
343M /root/out/archlinux-baseline-2021.04.25-x86_64.iso

I assume that `mktemp` is run inside an environment that does not have
`/tmp/foo` present, but still uses the original value of `TMPDIR`.
Approaches to a solutions might be to set `TMPDIR` inside the
environment so that it matches the environment, not to rely on
`TMPDIR`, or to make sure that `TMPDIR` exists in the environment.

[1]: https://wiki.archlinux.org/index.php/Archiso



--------------------------------
Output of `mkarchiso -v /usr/share/archiso/configs/baseline/ 1>mkarchiso.log 2>&1` (the "attach a file" button did not work):

[mkarchiso] INFO: Validating options...
[mkarchiso] INFO: Validating 'bios.syslinux.mbr': 'memtest86+' is not in the package list. Memmory testing will not be available from syslinux.
[mkarchiso] INFO: Validating 'bios.syslinux.eltorito': 'memtest86+' is not in the package list. Memmory testing will not be available from syslinux.
[mkarchiso] INFO: 'edk2-shell' is not in the package list. The ISO will not contain a bootable UEFI shell.
[mkarchiso] INFO: 'edk2-shell' is not in the package list. The ISO will not contain a bootable UEFI shell.
[mkarchiso] INFO: Done!
[mkarchiso] INFO: mkarchiso configuration settings
[mkarchiso] INFO: Architecture: x86_64
[mkarchiso] INFO: Working directory: /root/work
[mkarchiso] INFO: Installation directory: arch
[mkarchiso] INFO: Build date: 2021-04-25T10:26:51+00:00
[mkarchiso] INFO: Output directory: /root/out
[mkarchiso] INFO: GPG key: None
[mkarchiso] INFO: Profile: /usr/share/archiso/configs/baseline
[mkarchiso] INFO: Pacman configuration file: /usr/share/archiso/configs/baseline/pacman.conf
[mkarchiso] INFO: Image file name: archlinux-baseline-2021.04.25-x86_64.iso
[mkarchiso] INFO: ISO volume label: ARCH_202104
[mkarchiso] INFO: ISO publisher: Arch Linux <https://archlinux.org>
[mkarchiso] INFO: ISO application: Arch Linux baseline
[mkarchiso] INFO: Boot modes: bios.syslinux.mbr bios.syslinux.eltorito uefi-x64.systemd-boot.esp uefi-x64.systemd-boot.eltorito
[mkarchiso] INFO: Packages: base cloud-init linux mkinitcpio mkinitcpio-archiso openssh syslinux
[mkarchiso] INFO: Copying custom pacman.conf to work directory...
[mkarchiso] INFO: Using pacman CacheDir: /var/cache/pacman/pkg/
[mkarchiso] INFO: Copying custom airootfs files...
[mkarchiso] INFO: Done!
[mkarchiso] INFO: Installing packages to '/root/work/x86_64/airootfs/'...
==> Creating install root at /root/work/x86_64/airootfs
==> Installing packages to /root/work/x86_64/airootfs
:: Synchronizing package databases...
downloading core.db...
downloading extra.db...
downloading community.db...
resolving dependencies...
looking for conflicting packages...

Packages (155) acl-2.3.1-1 archlinux-keyring-20210110-1 argon2-20190702-3 attr-2.5.1-1 audit-3.0.1-1 bash-5.1.004-1 bzip2-1.0.8-4 ca-certificates-20181109-4 ca-certificates-mozilla-3.64-1 ca-certificates-utils-20181109-4 coreutils-8.32-1 cryptsetup-2.3.5-4 curl-7.76.1-1 dbus-1.12.20-1 device-mapper-2.03.11-5 dhclient-4.4.2-2 diffutils-3.7-3 dnssec-anchors-20190629-3 e2fsprogs-1.46.2-1 expat-2.3.0-1 file-5.40-2 filesystem-2021.01.19-1 findutils-4.8.0-1 gawk-5.1.0-1 gcc-libs-10.2.0-6 gdbm-1.19-2 gettext-0.21-1 glib2-2.68.1-1 glibc-2.33-4 gmp-6.2.1-1 gnupg-2.2.27-1 gnutls-3.7.1-1 gpgme-1.15.1-1 grep-3.6-1 gzip-1.10-3 hwids-20201207-1 iana-etc-20210202-1 icu-69.1-1 inetutils-1.9.4-8 iproute2-5.11.0-1 iptables-1:1.8.7-1 iputils-20200821-1 json-c-0.15-1 kbd-2.4.0-2 keyutils-1.6.3-1 kmod-28-1 krb5-1.19.1-1 ldns-1.7.1-2 less-1:581-1 libarchive-3.5.1-1 libassuan-2.5.5-1 libcap-2.49-1 libcap-ng-0.8.2-1 libcroco-0.6.13-2 libedit-20210216_3.1-1 libelf-0.183-3 libffi-3.3-4 libgcrypt-1.9.3-1 libgpg-error-1.42-1 libidn2-2.3.0-1 libksba-1.4.0-2 libldap-2.4.58-1 libmnl-1.0.4-3 libnetfilter_conntrack-1.0.8-1 libnfnetlink-1.0.1-4 libnftnl-1.1.9-1 libnghttp2-1.43.0-1 libnl-3.5.0-2 libnsl-1.3.0-2 libp11-kit-0.23.22-1 libpcap-1.10.0-1 libpsl-0.21.1-1 libsasl-2.1.27-3 libseccomp-2.5.1-2 libsecret-0.20.4-1 libssh2-1.9.0-3 libtasn1-4.16.0-1 libtirpc-1.3.1-1 libunistring-0.9.10-3 libxcrypt-4.4.19-1 libxml2-2.9.10-9 libyaml-0.2.5-1 licenses-20200427-1 linux-api-headers-5.10.13-1 lz4-1:1.9.3-1 mkinitcpio-busybox-1.32.1-3 mpfr-4.1.0-1 ncurses-6.2-1 netplan-0.99-1 nettle-3.7.2-1 npth-1.6-3 openssl-1.1.1.k-1 p11-kit-0.23.22-1 pacman-5.2.2-3 pacman-mirrorlist-20210405-1 pam-1.5.1-1 pambase-20200721.1-2 pciutils-3.7.0-1 pcre-8.44-1 pcre2-10.36-1 pinentry-1.1.1-1 popt-1.18-1 procps-ng-3.3.17-1 psmisc-23.4-1 python-3.9.3-1 python-appdirs-1.4.4-3 python-attrs-20.3.0-3 python-cffi-1.14.5-1 python-chardet-4.0.0-1 python-configobj-5.0.6.r110.g3e2f4cc-1 python-cryptography-3.4.7-1 python-idna-3.1-1 python-importlib-metadata-4.0.1-1 python-jinja-2.11.3-2 python-jsonpatch-1.29-1 python-jsonpointer-2.1-1 python-jsonschema-3.2.0-4 python-markupsafe-1.1.1-7 python-netifaces-0.10.9-6 python-oauthlib-3.1.0-6 python-ordered-set-4.0.2-3 python-packaging-20.9-1 python-ply-3.11-7 python-pycparser-2.20-3 python-pyparsing-2.4.7-3 python-pyrsistent-0.17.3-3 python-requests-2.25.1-1 python-setuptools-1:56.0.0-1 python-six-1.15.0-3 python-urllib3-1.26.4-1 python-yaml-5.4.1.1-2 python-zipp-3.4.1-1 readline-8.1.0-2 run-parts-4.11.2-1 sed-4.8-1 shadow-4.8.1-4 sqlite-3.35.5-1 sudo-1.9.6.p1-1 systemd-248-5 systemd-libs-248-5 systemd-sysvcompat-248-5 tar-1.34-1 tzdata-2021a-1 util-linux-2.36.2-1 util-linux-libs-2.36.2-1 xz-5.2.5-1 zlib-1:1.2.11-4 zstd-1.4.9-1 base-2-2 cloud-init-21.1-3 linux-5.11.16.arch1-1 mkinitcpio-30-1 mkinitcpio-archiso-52-1 openssh-8.6p1-1 syslinux-6.04.pre2.r11.gbf6db5b4-3

Total Installed Size: 708.20 MiB

:: Proceed with installation? [Y/n]
checking keyring...
checking package integrity...
loading package files...
checking for file conflicts...
:: Processing package changes...
installing iana-etc...
installing filesystem...
warning: /root/work/x86_64/airootfs/etc/shadow installed as /root/work/x86_64/airootfs/etc/shadow.pacnew
installing linux-api-headers...
installing tzdata...
installing glibc...
Optional dependencies for glibc
gd: for memusagestat
installing gcc-libs...
installing ncurses...
installing readline...
installing bash...
Optional dependencies for bash
bash-completion: for tab completion
installing attr...
installing acl...
installing gmp...
installing util-linux-libs...
installing e2fsprogs...
installing openssl...
Optional dependencies for openssl
ca-certificates [pending]
perl
installing libsasl...
installing libldap...
installing keyutils...
installing krb5...
installing libtirpc...
installing pambase...
installing libcap-ng...
installing audit...
installing libxcrypt...
installing pam...
installing libcap...
installing coreutils...
installing zlib...
installing xz...
installing bzip2...
installing libseccomp...
installing file...
installing findutils...
installing mpfr...
installing gawk...
installing pcre...
installing grep...
installing libgpg-error...
installing libgcrypt...
installing libtasn1...
installing libffi...
installing libp11-kit...
installing lz4...
installing zstd...
installing systemd-libs...
installing procps-ng...
installing sed...
installing tar...
installing glib2...
Optional dependencies for glib2
python: gdbus-codegen, glib-genmarshal, glib-mkenums, gtester-report [pending]
libelf: gresource inspection tool [pending]
installing libunistring...
installing icu...
installing libxml2...
installing libcroco...
installing gettext...
Optional dependencies for gettext
git: for autopoint infrastructure updates
installing hwids...
installing kmod...
installing pciutils...
installing psmisc...
installing shadow...
installing util-linux...
Optional dependencies for util-linux
python: python bindings to libmount [pending]
words: default dictionary for look
installing pcre2...
installing less...
installing gzip...
installing licenses...
installing expat...
installing libarchive...
installing p11-kit...
installing ca-certificates-utils...
installing ca-certificates-mozilla...
installing ca-certificates...
installing libssh2...
installing libidn2...
installing libpsl...
installing libnghttp2...
installing curl...
installing npth...
installing libksba...
installing libassuan...
installing libsecret...
Optional dependencies for libsecret
org.freedesktop.secrets: secret storage backend
installing pinentry...
Optional dependencies for pinentry
gtk2: gtk2 backend
qt5-base: qt backend
gcr: gnome3 backend
installing nettle...
installing gnutls...
Optional dependencies for gnutls
guile: for use with Guile bindings
installing sqlite...
installing gnupg...
Optional dependencies for gnupg
libldap: gpg2keys_ldap [installed]
libusb-compat: scdaemon
pcsclite: scdaemon
installing gpgme...
installing pacman-mirrorlist...
installing archlinux-keyring...
installing pacman...
Optional dependencies for pacman
perl-locale-gettext: translation support in makepkg-template
installing device-mapper...
installing popt...
installing json-c...
installing argon2...
installing cryptsetup...
installing dbus...
installing libmnl...
installing libnftnl...
installing libnl...
installing libpcap...
installing libnfnetlink...
installing libnetfilter_conntrack...
installing iptables...
installing kbd...
installing libelf...
installing systemd...
Initializing machine ID from random generator.
Creating group sys with gid 3.
Creating group mem with gid 8.
Creating group ftp with gid 11.
Creating group mail with gid 12.
Creating group log with gid 19.
Creating group smmsp with gid 25.
Creating group proc with gid 26.
Creating group games with gid 50.
Creating group lock with gid 54.
Creating group network with gid 90.
Creating group floppy with gid 94.
Creating group scanner with gid 96.
Creating group power with gid 98.
Creating group adm with gid 999.
Creating group wheel with gid 998.
Creating group kmem with gid 997.
Creating group tty with gid 5.
Creating group utmp with gid 996.
Creating group audio with gid 995.
Creating group disk with gid 994.
Creating group input with gid 993.
Creating group kvm with gid 992.
Creating group lp with gid 991.
Creating group optical with gid 990.
Creating group render with gid 989.
Creating group sgx with gid 988.
Creating group storage with gid 987.
Creating group uucp with gid 986.
Creating group video with gid 985.
Creating group users with gid 984.
Creating group systemd-journal with gid 983.
Creating group rfkill with gid 982.
Creating group bin with gid 1.
Creating user bin (n/a) with uid 1 and gid 1.
Creating group daemon with gid 2.
Creating user daemon (n/a) with uid 2 and gid 2.
Creating user mail (n/a) with uid 8 and gid 12.
Creating user ftp (n/a) with uid 14 and gid 11.
Creating group http with gid 33.
Creating user http (n/a) with uid 33 and gid 33.
Creating group nobody with gid 65534.
Creating user nobody (Nobody) with uid 65534 and gid 65534.
Creating group dbus with gid 81.
Creating user dbus (System Message Bus) with uid 81 and gid 81.
Creating group systemd-journal-remote with gid 981.
Creating user systemd-journal-remote (systemd Journal Remote) with uid 981 and gid 981.
Creating group systemd-network with gid 980.
Creating user systemd-network (systemd Network Management) with uid 980 and gid 980.
Creating group systemd-oom with gid 979.
Creating user systemd-oom (systemd Userspace OOM Killer) with uid 979 and gid 979.
Creating group systemd-resolve with gid 978.
Creating user systemd-resolve (systemd Resolver) with uid 978 and gid 978.
Creating group systemd-timesync with gid 977.
Creating user systemd-timesync (systemd Time Synchronization) with uid 977 and gid 977.
Creating group systemd-coredump with gid 976.
Creating user systemd-coredump (systemd Core Dumper) with uid 976 and gid 976.
Creating group uuidd with gid 68.
Creating user uuidd (n/a) with uid 68 and gid 68.
Created symlink /etc/systemd/system/getty.target.wants/getty@tty1.service -> /usr/lib/systemd/system/getty@.service.
Created symlink /etc/systemd/system/multi-user.target.wants/remote-fs.target -> /usr/lib/systemd/system/remote-fs.target.
:: Append 'init=/usr/lib/systemd/systemd' to your kernel command line in your
bootloader to replace sysvinit with systemd, or install systemd-sysvcompat
Optional dependencies for systemd
libmicrohttpd: remote journald capabilities
quota-tools: kernel-level quota management
systemd-sysvcompat: symlink package to provide sysvinit binaries [pending]
polkit: allow administration as unprivileged user
curl: machinectl pull-tar and pull-raw [installed]
libfido2: unlocking LUKS2 volumes with FIDO2 token
tpm2-tss: unlocking LUKS2 volumes with TPM2
installing systemd-sysvcompat...
installing iputils...
installing iproute2...
Optional dependencies for iproute2
db: userspace arp daemon
libcap: tipc [installed]
linux-atm: ATM support
installing base...
Optional dependencies for base
linux: bare metal support [pending]
installing run-parts...
installing dhclient...
installing gdbm...
installing libnsl...
installing python...
Optional dependencies for python
python-setuptools [pending]
python-pip
sqlite [installed]
mpdecimal: for decimal
xz: for lzma [installed]
tk: for tkinter
installing libyaml...
installing python-yaml...
installing python-netifaces...
installing netplan...
installing python-six...
installing python-configobj...
installing inetutils...
installing python-appdirs...
installing python-pyparsing...
installing python-packaging...
installing python-ordered-set...
installing python-setuptools...
installing python-markupsafe...
installing python-jinja...
Optional dependencies for python-jinja
python-babel: for i18n support
installing python-jsonpointer...
installing python-jsonpatch...
installing python-attrs...
installing python-zipp...
installing python-importlib-metadata...
installing python-pyrsistent...
installing python-jsonschema...
installing python-ply...
installing python-pycparser...
installing python-cffi...
installing python-cryptography...
installing python-oauthlib...
installing python-urllib3...
Optional dependencies for python-urllib3
python-pysocks: SOCKS support
python-brotli: Brotli support
python-pyopenssl: security support
installing python-chardet...
installing python-idna...
installing python-requests...
Optional dependencies for python-requests
python-pysocks: SOCKS proxy support
installing sudo...
installing cloud-init...
Optional dependencies for cloud-init
cloud-guest-utils
installing mkinitcpio-busybox...
installing diffutils...
installing mkinitcpio...
warning: /root/work/x86_64/airootfs/etc/mkinitcpio.conf installed as /root/work/x86_64/airootfs/etc/mkinitcpio.conf.pacnew
Optional dependencies for mkinitcpio
gzip: Use gzip compression for the initramfs image [installed]
xz: Use lzma or xz compression for the initramfs image [installed]
bzip2: Use bzip2 compression for the initramfs image [installed]
lzop: Use lzo compression for the initramfs image
lz4: Use lz4 compression for the initramfs image [installed]
mkinitcpio-nfs-utils: Support for root filesystem on NFS
installing linux...
Optional dependencies for linux
crda: to set the correct wireless channels of your country
linux-firmware: firmware images needed for some devices
installing mkinitcpio-archiso...
installing libedit...
installing dnssec-anchors...
installing ldns...
Optional dependencies for ldns
libpcap: ldns-dpa tool [installed]
installing openssh...
warning: /root/work/x86_64/airootfs/etc/ssh/sshd_config installed as /root/work/x86_64/airootfs/etc/ssh/sshd_config.pacnew
Optional dependencies for openssh
xorg-xauth: X11 forwarding
x11-ssh-askpass: input passphrase in X
libfido2: FIDO/U2F support
installing syslinux...

==> For setting up Syslinux BIOS using the syslinux-install_update script follow
https://wiki.archlinux.org/index.php/Syslinux#Automatic_Install
Optional dependencies for syslinux
perl-crypt-passwdmd5: For md5pass
perl-digest-sha1: For sha1pass
mtools: For mkdiskimage and syslinux support
gptfdisk: For GPT support
util-linux: For isohybrid [installed]
efibootmgr: For EFI support
dosfstools: For EFI support
:: Running post-transaction hooks...
( 1/12) Creating system user accounts...
( 2/12) Updating journal message catalog...
( 3/12) Reloading system manager configuration...
Running in chroot, ignoring command 'daemon-reload'
( 4/12) Updating udev hardware database...
( 5/12) Applying kernel sysctl settings...
( 6/12) Creating temporary files...
( 7/12) Reloading device manager configuration...
Running in chroot, ignoring request.
( 8/12) Arming ConditionNeedsUpdate...
( 9/12) Rebuilding certificate stores...
(10/12) Updating module dependencies...
(11/12) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'archiso'
-> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
mktemp: failed to create directory via template '/tmp/foo/mkinitcpio.XXXXXX': No such file or directory
==> ERROR: Failed to create temporary working directory in /tmp/foo/
error: command failed to execute correctly
(12/12) Reloading system bus configuration...
Running in chroot, ignoring command 'try-reload-or-restart'
[mkarchiso] INFO: Done! Packages installed successfully.
[mkarchiso] INFO: Creating files with iso version...
[mkarchiso] INFO: Done!
[mkarchiso] INFO: Creating a list of installed packages on live-enviroment...
[mkarchiso] INFO: Done!
[mkarchiso] INFO: Setting up SYSLINUX for BIOS booting from a disk...
[mkarchiso] INFO: Preparing kernel and initramfs for the ISO 9660 file system...
install: cannot stat '/root/work/x86_64/airootfs/boot/initramfs-*.img': No such file or directory


This task depends upon

Comment by David Runge (dvzrv) - Tuesday, 01 June 2021, 12:41 GMT
@stefan1: Thanks for the report.

I was able to reproduce this with archiso 55. The problem is with mkinitcpio's `-t` option [1] in this case, as it honors TMPDIR and it seems we pass TMPDIR into the chroot.

For good measure I will also assign Giancarlo to this ticket.

[1] https://man.archlinux.org/man/mkinitcpio.8#OPTIONS
Comment by nl6720 (nl6720) - Friday, 02 July 2021, 10:42 GMT
  • Field changed: Percent Complete (100% → 0%)
This is actually a bug in arch-install-scripts:

# mkdir /tmp/foo
# export TMPDIR=/tmp/foo
# mkdir /tmp/test
# pacstrap /tmp/test base linux


==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
-> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
mktemp: failed to create directory via template '/tmp/foo/mkinitcpio.XXXXXX': No such file or directory
==> ERROR: Failed to create temporary working directory in /tmp/foo
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
-> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
mktemp: failed to create directory via template '/tmp/foo/mkinitcpio.XXXXXX': No such file or directory
==> ERROR: Failed to create temporary working directory in /tmp/foo
error: command failed to execute correctly
Comment by David Runge (dvzrv) - Friday, 02 July 2021, 10:43 GMT
@nl6720: Thanks! Can you open a ticket with arch-install-scripts [1] for this?

[1] https://github.com/archlinux/arch-install-scripts/issues

Loading...