systemd / mkosi

💽 Build Bespoke OS Images
https://mkosi.systemd.io/
1.19k stars 321 forks source link

failure with kernel-install script #3048

Closed cvlc12 closed 1 month ago

cvlc12 commented 1 month ago

mkosi commit the issue has been seen with

24.3

Used host distribution

Arch

Used target distribution

initrd

Linux kernel version used

6.6.52-1-lts

CPU architectures issue was seen on

x86_64

Unexpected behaviour you saw

Crash when running mkosi kernel-install plugin. Maybe linked to pacman update ?

Used mkosi config

none

mkosi output

# kernel-install add 6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz --verbose
layout=uki set via config
INITRD_GENERATOR (mkosi-initrd) set via config.
Loaded config.
Loading /etc/machine-info…
MACHINE_ID=9821320080000801887cbe1 set via /etc/machine-id.
Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy
Found container virtualization none.
Directory "/boot" is not the root of the file system.
Couldn't find an XBOOTLDR partition.
Using EFI System Partition at /efi as $BOOT_ROOT.
Using entry token: 9821320080000801887cbe1
File '/etc/kernel/install.d/91-sbctl.install' is a mask.
File '/usr/lib/kernel/install.d/91-sbctl.install' is masked by previous entry.
kernel version (6.6.52-1-lts) set via command line.
kernel image file (/lib/modules/6.6.52-1-lts/vmlinuz) set via command line.
Using ENTRY_DIR=/efi/9821320080000801887cbe1/6.6.52-1-lts
Using plugins: 
  /usr/lib/kernel/install.d/50-depmod.install
  /usr/lib/kernel/install.d/50-mkinitcpio.install
  /usr/lib/kernel/install.d/50-mkosi.install
  /etc/kernel/install.d/55-lsinitcpio.install
  /usr/lib/kernel/install.d/60-ukify.install
  /usr/lib/kernel/install.d/90-loaderentry.install
  /usr/lib/kernel/install.d/90-uki-copy.install
Plugin environment: 
  LC_COLLATE=C.UTF-8
  KERNEL_INSTALL_VERBOSE=1
  KERNEL_INSTALL_IMAGE_TYPE=pe
  KERNEL_INSTALL_MACHINE_ID=9821320080000801887cbe1
  KERNEL_INSTALL_ENTRY_TOKEN=9821320080000801887cbe1
  KERNEL_INSTALL_BOOT_ROOT=/efi
  KERNEL_INSTALL_LAYOUT=uki
  KERNEL_INSTALL_INITRD_GENERATOR=mkosi-initrd
  KERNEL_INSTALL_UKI_GENERATOR=
  KERNEL_INSTALL_STAGING_AREA=/tmp/kernel-install.staging.uPZxMw
Plugin arguments: add 6.6.52-1-lts /efi/9821320080000801887cbe1/6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz
Successfully forked off '(sd-exec-strv)' as PID 9154.
About to execute /usr/lib/kernel/install.d/50-depmod.install add 6.6.52-1-lts /efi/9821320080000801887cbe1/6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz
Successfully forked off '(direxec)' as PID 9155.
+depmod -a 6.6.52-1-lts
/usr/lib/kernel/install.d/50-depmod.install succeeded.
About to execute /usr/lib/kernel/install.d/50-mkinitcpio.install add 6.6.52-1-lts /efi/9821320080000801887cbe1/6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz
Successfully forked off '(direxec)' as PID 9158.
/usr/lib/kernel/install.d/50-mkinitcpio.install succeeded.
About to execute /usr/lib/kernel/install.d/50-mkosi.install add 6.6.52-1-lts /efi/9821320080000801887cbe1/6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz
Successfully forked off '(direxec)' as PID 9159.
‣ Building initrd
‣ + timedatectl show -p Timezone --value
‣ + timedatectl show -p Timezone --value
‣ + findmnt --target / --output FSTYPE --noheadings
‣ + stat --file-system --format %T /var/tmp/mkosi-workspace-hzxtwzx8
‣ + btrfs subvolume create /var/tmp/mkosi-workspace-hzxtwzx8/root
Create subvolume '/var/tmp/mkosi-workspace-hzxtwzx8/root'
‣ Copying in package manager file trees…
‣ + cp --version
‣ + cp --recursive --no-dereference --preserve=mode,links --reflink=auto --copy-contents /tmp/tmp5w2obs6t /var/tmp/mkosi-workspace-hzxtwzx8/pkgmngr --keep-directory-symlink --no-target-directory
‣ + rm -rf -- /var/tmp/mkosi-workspace-hzxtwzx8
‣ + mount --make-rslave /
‣ + mount --rbind /etc /etc --options ro,nosuid,nodev,noexec
‣ + mount --rbind /opt /opt --options ro
‣ + mount --rbind /boot /boot --options ro,nosuid,nodev,noexec
‣ + mount --rbind /efi /efi --options ro,nosuid,nodev,noexec
‣ + mount --rbind /media /media --options ro,nosuid,nodev,noexec
‣ + mount --rbind /usr /usr --options ro
‣ Building default image
‣ + stat --file-system --format %T /var/tmp/mkosi-workspace-0p_x2n12
‣ + btrfs subvolume create /var/tmp/mkosi-workspace-0p_x2n12/root
Create subvolume '/var/tmp/mkosi-workspace-0p_x2n12/root'
‣  Copying in package manager file trees…
‣ + cp --version
‣ + cp --recursive --no-dereference --preserve=mode,links --reflink=auto --copy-contents /tmp/tmp5w2obs6t /var/tmp/mkosi-workspace-0p_x2n12/pkgmngr --keep-directory-symlink --no-target-directory
‣ Acquiring lock on /var/cache/pacman
‣ Acquired lock on /var/cache/pacman
‣ Acquiring lock on /var/lib/pacman
‣ Acquired lock on /var/lib/pacman
‣ + cp --version
‣ + cp --recursive --no-dereference --preserve=mode,links --reflink=auto --copy-contents /var/cache/pacman /var/tmp/mkosi-workspace-0p_x2n12/root/var/cache/pacman --keep-directory-symlink --no-target-directory
‣ + cp --version
‣ + cp --recursive --no-dereference --preserve=mode,links --reflink=auto --copy-contents /var/lib/pacman /var/tmp/mkosi-workspace-0p_x2n12/root/var/lib/pacman --keep-directory-symlink --no-target-directory
‣  Installing Arch
‣ + pacman --root=/buildroot --logfile=/dev/null --dbpath=/var/lib/pacman --cachedir=/var/cache/pacman/mkosi --cachedir=/var/cache/pacman/pkg --hookdir=/buildroot/etc/pacman.d/hooks --arch x86_64 --color auto --noconfirm --sync --needed --assume-installed initramfs filesystem
resolving dependencies...
looking for conflicting packages...

Package (2)      New Version   Net Change

core/iana-etc    20240814-1      3.98 MiB
core/filesystem  2024.04.07-1    0.02 MiB

Total Installed Size:  4.01 MiB

:: Proceed with installation? [Y/n] 
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
‣ "bwrap --die-with-parent --proc /proc --setenv SYSTEMD_OFFLINE 1 --unsetenv TMPDIR --dir /tmp --dir /var/tmp --unshare-ipc --dev /dev --symlink usr/bin /bin --symlink usr/bin /sbin --symlink usr/lib /lib --symlink usr/lib /lib64 --setenv PATH /scripts:/usr/local/sbin:/usr/local/bin:/usr/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl --uid 0 --gid 0 --cap-add ALL --bind /var/tmp/mkosi-workspace-0p_x2n12/root /buildroot --bind /var/tmp/mkosi-workspace-0p_x2n12/pkgmngr/etc /etc --ro-bind /etc/ca-certificates /etc/ca-certificates --ro-bind /etc/pacman.d/gnupg /etc/pacman.d/gnupg --ro-bind /etc/pki /etc/pki --bind /etc/resolv.conf /etc/resolv.conf --ro-bind /etc/ssl /etc/ssl --ro-bind /etc/ca-certificates/extracted/tls-ca-bundle.pem /proxy.cacert --bind /var/tmp/mkosi-workspace-0p_x2n12/repository /repository --ro-bind /usr /usr --bind /var/tmp/mkosi-workspace-0p_x2n12/root/var/cache/pacman /var/cache/pacman --ro-bind /var/tmp/mkosi-workspace-0p_x2n12/repository /var/cache/pacman/mkosi --bind /var/cache/pacman/pkg /var/cache/pacman/pkg --bind /var/tmp/mkosi-workspace-0p_x2n12/root/var/lib/pacman /var/lib/pacman --bind /var/tmp/mkosi-workspace-0p_x2n12/pkgmngr/var/log /var/log --bind /var/tmp/mkosi-workspace-0p_x2n12/tmp/mkosi-var-tmp-4970ebc78f7a451c /var/tmp sh -c 'chmod 1777 /tmp && chmod 1777 /dev/shm && chmod 1777 /var/tmp && chmod 755 /etc && exec $0 "$@"' setpgid --foreground -- pacman --root=/buildroot --logfile=/dev/null --dbpath=/var/lib/pacman --cachedir=/var/cache/pacman/mkosi --cachedir=/var/cache/pacman/pkg --hookdir=/buildroot/etc/pacman.d/hooks --arch x86_64 --color auto --noconfirm --sync --needed --assume-installed initramfs filesystem" returned non-zero exit code 1.
‣ + rm -rf -- /var/tmp/mkosi-workspace-0p_x2n12
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/mkosi/run.py", line 60, in uncaught_exception_handler
    yield
  File "/usr/lib/python3.12/site-packages/mkosi/run.py", line 101, in fork_and_wait
    target(*args, **kwargs)
  File "/usr/lib/python3.12/site-packages/mkosi/__init__.py", line 4761, in run_build
    build_image(Context(args, config, workspace=workspace, resources=resources, package_dir=package_dir))
  File "/usr/lib/python3.12/site-packages/mkosi/__init__.py", line 3915, in build_image
    install_distribution(context)
  File "/usr/lib/python3.12/site-packages/mkosi/__init__.py", line 152, in install_distribution
    context.config.distribution.install(context)
  File "/usr/lib/python3.12/site-packages/mkosi/distributions/__init__.py", line 114, in install
    return self.installer().install(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mkosi/distributions/arch.py", line 41, in install
    cls.install_packages(context, ["filesystem"], apivfs=False)
  File "/usr/lib/python3.12/site-packages/mkosi/distributions/arch.py", line 45, in install_packages
    Pacman.invoke(
  File "/usr/lib/python3.12/site-packages/mkosi/installer/pacman.py", line 167, in invoke
    return run(
           ^^^^
  File "/usr/lib/python3.12/site-packages/mkosi/run.py", line 150, in run
    with spawn(
  File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
    next(self.gen)
  File "/usr/lib/python3.12/site-packages/mkosi/run.py", line 352, in spawn
    raise subprocess.CalledProcessError(returncode, cmdline)
subprocess.CalledProcessError: Command '['pacman', '--root=/buildroot', '--logfile=/dev/null', '--dbpath=/var/lib/pacman', '--cachedir=/var/cache/pacman/mkosi', '--cachedir=/var/cache/pacman/pkg', '--hookdir=/buildroot/etc/pacman.d/hooks', '--arch', 'x86_64', '--color', 'auto', '--noconfirm', '--sync', '--needed', '--assume-installed', 'initramfs', 'filesystem']' returned non-zero exit status 1.
‣ + tput cnorm
‣ + tput smam
‣ "mkosi --force --directory '' --format cpio --output initrd --output-dir /tmp/kernel-install.staging.uPZxMw --cache-only=metadata --extra-tree /usr/lib/modules/6.6.52-1-lts:/usr/lib/modules/6.6.52-1-lts --extra-tree=/usr/lib/firmware:/usr/lib/firmware '--remove-files=/usr/lib/firmware/*-ucode' '--kernel-modules-exclude=.*' --kernel-modules-include=host --include=mkosi-initrd --debug --workspace-dir=/var/tmp --package-cache-dir=/var --include /etc/mkosi-initrd --package-manager-tree /tmp/tmp5w2obs6t" returned non-zero exit code 1.
‣ "mkosi-initrd --kernel-version 6.6.52-1-lts --format cpio --output initrd --output-dir /tmp/kernel-install.staging.uPZxMw --debug" returned non-zero exit code 1.
/usr/lib/kernel/install.d/50-mkosi.install failed with exit status 1.
/usr/lib/kernel/install.d/50-mkosi.install failed with exit status 1.
(sd-exec-strv) failed with exit status 1.
DaanDeMeyer commented 1 month ago

@cvlc12 Please reproduce with the latest git main commit mkosi has changed significantly since the last release

cvlc12 commented 1 month ago

hmm, different failure, but still failing with mkosi-git from AUR (not finding mtab) I'm trying to git clone/build as well but I'm running into errors ("no module named mkosi" when run from kernel-install)

# kernel-install --verbose add 6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz 
layout=uki set via config
INITRD_GENERATOR (mkosi-initrd) set via config.
Loaded config.
Loading /etc/machine-info…
MACHINE_ID=9821320080000801887cbe1 set via /etc/machine-id.
Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy
Found container virtualization none.
Directory "/boot" is not the root of the file system.
Couldn't find an XBOOTLDR partition.
Using EFI System Partition at /efi as $BOOT_ROOT.
Using entry token: 9821320080000801887cbe1
File '/etc/kernel/install.d/91-sbctl.install' is a mask.
File '/usr/lib/kernel/install.d/91-sbctl.install' is masked by previous entry.
kernel version (6.6.52-1-lts) set via command line.
kernel image file (/lib/modules/6.6.52-1-lts/vmlinuz) set via command line.
Using ENTRY_DIR=/efi/9821320080000801887cbe1/6.6.52-1-lts
Using plugins: 
  /usr/lib/kernel/install.d/50-depmod.install
  /usr/lib/kernel/install.d/50-mkinitcpio.install
  /etc/kernel/install.d/50-mkosi.install
  /etc/kernel/install.d/55-lsinitcpio.install
  /usr/lib/kernel/install.d/60-ukify.install
  /usr/lib/kernel/install.d/90-loaderentry.install
  /usr/lib/kernel/install.d/90-uki-copy.install
Plugin environment: 
  LC_COLLATE=C.UTF-8
  KERNEL_INSTALL_VERBOSE=1
  KERNEL_INSTALL_IMAGE_TYPE=pe
  KERNEL_INSTALL_MACHINE_ID=9821320080000801887cbe1
  KERNEL_INSTALL_ENTRY_TOKEN=9821320080000801887cbe1
  KERNEL_INSTALL_BOOT_ROOT=/efi
  KERNEL_INSTALL_LAYOUT=uki
  KERNEL_INSTALL_INITRD_GENERATOR=mkosi-initrd
  KERNEL_INSTALL_UKI_GENERATOR=
  KERNEL_INSTALL_STAGING_AREA=/tmp/kernel-install.staging.yWKKge
Plugin arguments: add 6.6.52-1-lts /efi/9821320080000801887cbe1/6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz
Successfully forked off '(sd-exec-strv)' as PID 21527.
About to execute /usr/lib/kernel/install.d/50-depmod.install add 6.6.52-1-lts /efi/9821320080000801887cbe1/6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz
Successfully forked off '(direxec)' as PID 21528.
+depmod -a 6.6.52-1-lts
/usr/lib/kernel/install.d/50-depmod.install succeeded.
About to execute /usr/lib/kernel/install.d/50-mkinitcpio.install add 6.6.52-1-lts /efi/9821320080000801887cbe1/6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz
Successfully forked off '(direxec)' as PID 21530.
/usr/lib/kernel/install.d/50-mkinitcpio.install succeeded.
About to execute /etc/kernel/install.d/50-mkosi.install add 6.6.52-1-lts /efi/9821320080000801887cbe1/6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz
Successfully forked off '(direxec)' as PID 21531.
‣ Building initrd
‣ Loading configuration file /tmp/tmpluj981ai/resources/mkosi-initrd/mkosi.conf
‣ Loading configuration file /tmp/tmpluj981ai/resources/mkosi-initrd/mkosi.conf.d/10-arch.conf
‣ + timedatectl show -p Timezone --value
‣ Loading configuration file /tmp/tmpluj981ai/resources/mkosi-initrd/mkosi.conf
‣ Loading configuration file /tmp/tmpluj981ai/resources/mkosi-initrd/mkosi.conf.d/10-arch.conf
‣ + timedatectl show -p Timezone --value
‣ + timedatectl show -p Timezone --value
‣ Copying repository metadata
‣ + cp --recursive --no-dereference --preserve=mode,links,timestamps,ownership,xattr --reflink=auto --copy-contents /work/var/cache/pacman /work/var/tmp/mkosi-metadata-si14i0xu/cache/pacman --no-target-directory
‣ + cp --recursive --no-dereference --preserve=mode,links,timestamps,ownership,xattr --reflink=auto --copy-contents /work/var/lib/pacman /work/var/tmp/mkosi-metadata-si14i0xu/lib/pacman --no-target-directory
‣ Building default image
‣  Copying in sandbox trees…
‣ + cp --version
‣ + cp --recursive --no-dereference --preserve=mode,links --reflink=auto --copy-contents /work/tmp/tmpj0xun6c0 /work/var/tmp/mkosi-workspace-ryz5knet/sandbox --keep-directory-symlink --no-target-directory
‣ + btrfs subvolume create /work/var/tmp/mkosi-workspace-ryz5knet/root
Create subvolume '/work/var/tmp/mkosi-workspace-ryz5knet/root'
‣  Installing Arch
‣ + pacman --root=/buildroot --logfile=/dev/null --dbpath=/var/lib/pacman --cachedir=/var/cache/pacman/mkosi --cachedir=/var/cache/pacman/pkg --hookdir=/buildroot/etc/pacman.d/hooks --arch x86_64 --color auto --noconfirm --sync --needed --assume-installed initramfs filesystem
resolving dependencies...
looking for conflicting packages...

Package (2)      New Version   Net Change

core/iana-etc    20240814-1      3.98 MiB
core/filesystem  2024.04.07-1    0.02 MiB

Total Installed Size:  4.01 MiB

:: Proceed with installation? [Y/n] 
(2/2) checking keys in keyring                                  [##################################] 100%
(2/2) checking package integrity                                [##################################] 100%
(2/2) loading package files                                     [##################################] 100%
(2/2) checking for file conflicts                               [##################################] 100%
error: could not open file: /etc/mtab: No such file or directory
error: could not determine filesystem mount points
error: not enough free disk space
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
‣ "/usr/bin/python -SI /usr/lib/python3.12/site-packages/mkosi/sandbox.py --proc /proc --unsetenv TMPDIR --setenv SYSTEMD_OFFLINE 1 --ro-bind /usr/lib/python3.12/site-packages/mkosi/sandbox.py /sandbox.py --ro-bind /usr /usr --symlink usr/bin /bin --symlink usr/bin /sbin --symlink usr/lib /lib --symlink usr/lib /lib64 --ro-bind /etc/ld.so.cache /etc/ld.so.cache --dir /var/tmp --dir /var/log --unshare-ipc --dev /dev --ro-bind /etc/resolv.conf /etc/resolv.conf --setenv PATH /scripts:/usr/local/sbin:/usr/local/bin:/usr/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl --overlay-lowerdir /var/tmp/mkosi-workspace-ryz5knet/sandbox/etc --overlay-upperdir /var/tmp/mkosi-workspace-ryz5knet/tmp/mkosi-var-tmp-df8351a5f4e94f9c --overlay-workdir /var/tmp/mkosi-workspace-ryz5knet/tmp/mkosi-var-tmp-8712cdbec7ba44bc --overlay /etc --bind /var/tmp/mkosi-workspace-ryz5knet/tmp/mkosi-var-tmp-288860d4519b48b7 /opt --bind /var/tmp/mkosi-workspace-ryz5knet/tmp/mkosi-var-tmp-2576633ba0014cc4 /srv --bind /var/tmp/mkosi-workspace-ryz5knet/tmp/mkosi-var-tmp-50c2c9092a2a4f66 /media --bind /var/tmp/mkosi-workspace-ryz5knet/tmp/mkosi-var-tmp-551607ae64ef4e5f /mnt --bind /var/tmp/mkosi-workspace-ryz5knet/tmp/mkosi-var-tmp-fe10ed83823f46cf /var --tmpfs /run --tmpfs /tmp --bind /var/tmp/mkosi-workspace-ryz5knet/tmp/mkosi-var-tmp-824fdb396ac44bbe /var/tmp --bind /var/tmp/mkosi-workspace-ryz5knet/root /buildroot --ro-bind /etc/ca-certificates /etc/ca-certificates --ro-bind /etc/pacman.d/gnupg /etc/pacman.d/gnupg --ro-bind /etc/pki /etc/pki --ro-bind /etc/ssl /etc/ssl --bind /var/tmp/mkosi-workspace-ryz5knet/repository /repository --bind /var/tmp/mkosi-metadata-si14i0xu/cache/pacman /var/cache/pacman --bind /var/cache/pacman/pkg /var/cache/pacman/pkg --bind /var/tmp/mkosi-metadata-si14i0xu/lib/pacman /var/lib/pacman --ro-bind /var/tmp/mkosi-workspace-ryz5knet/repository /var/cache/pacman/mkosi --bind /var/tmp/mkosi-workspace-ryz5knet/root/var/lib/pacman/local /var/lib/pacman/local --become-root --suppress-chown --ro-bind-try /var/tmp/mkosi-workspace-ryz5knet/root/etc/machine-id /buildroot/etc/machine-id --ro-bind-try /var/tmp/mkosi-workspace-ryz5knet/root/etc/passwd /etc/passwd --ro-bind-try /var/tmp/mkosi-workspace-ryz5knet/root/etc/group /etc/group --ro-bind-try /var/tmp/mkosi-workspace-ryz5knet/root/etc/shadow /etc/shadow --ro-bind-try /var/tmp/mkosi-workspace-ryz5knet/root/etc/gshadow /etc/gshadow --ro-bind /etc/ca-certificates/extracted/tls-ca-bundle.pem /proxy.cacert -- pacman --root=/buildroot --logfile=/dev/null --dbpath=/var/lib/pacman --cachedir=/var/cache/pacman/mkosi --cachedir=/var/cache/pacman/pkg --hookdir=/buildroot/etc/pacman.d/hooks --arch x86_64 --color auto --noconfirm --sync --needed --assume-installed initramfs filesystem" returned non-zero exit code 1.
‣ + rm -rf -- /work/var/tmp/mkosi-workspace-ryz5knet
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/mkosi/run.py", line 64, in uncaught_exception_handler
    yield
  File "/usr/lib/python3.12/site-packages/mkosi/run.py", line 105, in fork_and_wait
    target(*args, **kwargs)
  File "/usr/lib/python3.12/site-packages/mkosi/__init__.py", line 3964, in run_build
    build_image(
  File "/usr/lib/python3.12/site-packages/mkosi/__init__.py", line 3194, in build_image
    install_distribution(context)
  File "/usr/lib/python3.12/site-packages/mkosi/__init__.py", line 195, in install_distribution
    context.config.distribution.install(context)
  File "/usr/lib/python3.12/site-packages/mkosi/distributions/__init__.py", line 129, in install
    return self.installer().install(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mkosi/distributions/arch.py", line 41, in install
    cls.install_packages(context, ["filesystem"], apivfs=False)
  File "/usr/lib/python3.12/site-packages/mkosi/distributions/arch.py", line 45, in install_packages
    Pacman.invoke(
  File "/usr/lib/python3.12/site-packages/mkosi/installer/pacman.py", line 166, in invoke
    return run(
           ^^^^
  File "/usr/lib/python3.12/site-packages/mkosi/run.py", line 152, in run
    with spawn(
         ^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
    next(self.gen)
  File "/usr/lib/python3.12/site-packages/mkosi/run.py", line 296, in spawn
    raise subprocess.CalledProcessError(returncode, cmdline)
subprocess.CalledProcessError: Command '['pacman', '--root=/buildroot', '--logfile=/dev/null', '--dbpath=/var/lib/pacman', '--cachedir=/var/cache/pacman/mkosi', '--cachedir=/var/cache/pacman/pkg', '--hookdir=/buildroot/etc/pacman.d/hooks', '--arch', 'x86_64', '--color', 'auto', '--noconfirm', '--sync', '--needed', '--assume-installed', 'initramfs', 'filesystem']' returned non-zero exit status 1.
‣ + tput cnorm
‣ + tput smam
‣ "mkosi --force --directory '' --format cpio --output initrd --output-dir /tmp/kernel-install.staging.yWKKge --extra-tree /usr/lib/modules/6.6.52-1-lts:/usr/lib/modules/6.6.52-1-lts --extra-tree=/usr/lib/firmware:/usr/lib/firmware '--remove-files=/usr/lib/firmware/*-ucode' '--kernel-modules-exclude=.*' --kernel-modules-include=host --build-sources '' --include=mkosi-initrd --debug --workspace-dir=/var/tmp --package-cache-dir=/var --cache-only=metadata --sandbox-tree /tmp/tmpj0xun6c0" returned non-zero exit code 1.
‣ "mkosi-initrd --kernel-version 6.6.52-1-lts --format cpio --output initrd --output-dir /tmp/kernel-install.staging.yWKKge --debug" returned non-zero exit code 1.
/etc/kernel/install.d/50-mkosi.install failed with exit status 1.
/etc/kernel/install.d/50-mkosi.install failed with exit status 1.
(sd-exec-strv) failed with exit status 1.
DaanDeMeyer commented 1 month ago

@cvlc12 Please give https://github.com/systemd/mkosi/pull/3055 a try

cvlc12 commented 1 month ago

Updated main as the fix above got merge, goes a little further but still failing:

# kernel-install --verbose add 6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz 
layout=uki set via config
INITRD_GENERATOR (mkosi-initrd) set via config.
Loaded config.
Loading /etc/machine-info…
MACHINE_ID=982132008de649089768b8fa1887cbe1 set via /etc/machine-id.
Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy
Found container virtualization none.
Directory "/boot" is not the root of the file system.
Couldn't find an XBOOTLDR partition.
Using EFI System Partition at /efi as $BOOT_ROOT.
Using entry token: 982132008de649089768b8fa1887cbe1
File '/etc/kernel/install.d/91-sbctl.install' is a mask.
File '/usr/lib/kernel/install.d/91-sbctl.install' is masked by previous entry.
kernel version (6.6.52-1-lts) set via command line.
kernel image file (/lib/modules/6.6.52-1-lts/vmlinuz) set via command line.
Using ENTRY_DIR=/efi/982132008de649089768b8fa1887cbe1/6.6.52-1-lts
Using plugins: 
  /usr/lib/kernel/install.d/50-depmod.install
  /usr/lib/kernel/install.d/50-mkinitcpio.install
  /etc/kernel/install.d/50-mkosi.install
  /etc/kernel/install.d/55-lsinitcpio.install
  /usr/lib/kernel/install.d/60-ukify.install
  /usr/lib/kernel/install.d/90-loaderentry.install
  /usr/lib/kernel/install.d/90-uki-copy.install
Plugin environment: 
  LC_COLLATE=C.UTF-8
  KERNEL_INSTALL_VERBOSE=1
  KERNEL_INSTALL_IMAGE_TYPE=pe
  KERNEL_INSTALL_MACHINE_ID=982132008de649089768b8fa1887cbe1
  KERNEL_INSTALL_ENTRY_TOKEN=982132008de649089768b8fa1887cbe1
  KERNEL_INSTALL_BOOT_ROOT=/efi
  KERNEL_INSTALL_LAYOUT=uki
  KERNEL_INSTALL_INITRD_GENERATOR=mkosi-initrd
  KERNEL_INSTALL_UKI_GENERATOR=
  KERNEL_INSTALL_STAGING_AREA=/tmp/kernel-install.staging.EuIxGA
Plugin arguments: add 6.6.52-1-lts /efi/982132008de649089768b8fa1887cbe1/6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz
Successfully forked off '(sd-exec-strv)' as PID 9008.
About to execute /usr/lib/kernel/install.d/50-depmod.install add 6.6.52-1-lts /efi/982132008de649089768b8fa1887cbe1/6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz
Successfully forked off '(direxec)' as PID 9009.
+depmod -a 6.6.52-1-lts
/usr/lib/kernel/install.d/50-depmod.install succeeded.
About to execute /usr/lib/kernel/install.d/50-mkinitcpio.install add 6.6.52-1-lts /efi/982132008de649089768b8fa1887cbe1/6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz
Successfully forked off '(direxec)' as PID 9012.
/usr/lib/kernel/install.d/50-mkinitcpio.install succeeded.
About to execute /etc/kernel/install.d/50-mkosi.install add 6.6.52-1-lts /efi/982132008de649089768b8fa1887cbe1/6.6.52-1-lts /lib/modules/6.6.52-1-lts/vmlinuz
Successfully forked off '(direxec)' as PID 9013.
‣ Building initrd
‣ Loading configuration file /tmp/tmpzboys311/resources/mkosi-initrd/mkosi.conf
‣ Loading configuration file /tmp/tmpzboys311/resources/mkosi-initrd/mkosi.conf.d/10-arch.conf
‣ + timedatectl show -p Timezone --value
‣ Loading configuration file /tmp/tmpzboys311/resources/mkosi-initrd/mkosi.conf
‣ Loading configuration file /tmp/tmpzboys311/resources/mkosi-initrd/mkosi.conf.d/10-arch.conf
‣ + timedatectl show -p Timezone --value
‣ + timedatectl show -p Timezone --value
‣ Copying repository metadata
‣ + cp --recursive --no-dereference --preserve=mode,links,timestamps,ownership,xattr --reflink=auto --copy-contents /work/var/cache/pacman /work/var/tmp/mkosi-metadata-fp38d4rw/cache/pacman --no-target-directory
‣ + cp --recursive --no-dereference --preserve=mode,links,timestamps,ownership,xattr --reflink=auto --copy-contents /work/var/lib/pacman /work/var/tmp/mkosi-metadata-fp38d4rw/lib/pacman --no-target-directory
‣ Building default image
‣  Copying in sandbox trees…
‣ + cp --version
‣ + cp --recursive --no-dereference --preserve=mode,links --reflink=auto --copy-contents /work/tmp/tmps57m9jem /work/var/tmp/mkosi-workspace-vd_a6elt/sandbox --keep-directory-symlink --no-target-directory
‣ + btrfs subvolume create /work/var/tmp/mkosi-workspace-vd_a6elt/root
Create subvolume '/work/var/tmp/mkosi-workspace-vd_a6elt/root'
‣  Installing Arch
‣ + pacman --root=/buildroot --logfile=/dev/null --dbpath=/var/lib/pacman --cachedir=/var/cache/pacman/mkosi --cachedir=/var/cache/pacman/pkg --hookdir=/buildroot/etc/pacman.d/hooks --arch x86_64 --color auto --noconfirm --sync --needed --assume-installed initramfs filesystem
resolving dependencies...
looking for conflicting packages...

Package (2)      New Version   Net Change

core/iana-etc    20240814-1      3.98 MiB
core/filesystem  2024.04.07-1    0.02 MiB

Total Installed Size:  4.01 MiB

:: Proceed with installation? [Y/n] 
(2/2) checking keys in keyring                                                                                                  [#############################################################################] 100%
(2/2) checking package integrity                                                                                                [#############################################################################] 100%
(2/2) loading package files                                                                                                     [#############################################################################] 100%
(2/2) checking for file conflicts                                                                                               [#############################################################################] 100%
(2/2) checking available disk space                                                                                             [#############################################################################] 100%
:: Processing package changes...
(1/2) installing iana-etc                                                                                                       [#############################################################################] 100%
(2/2) installing filesystem                                                                                                     [#############################################################################] 100%
‣ + pacman --root=/buildroot --logfile=/dev/null --dbpath=/var/lib/pacman --cachedir=/var/cache/pacman/mkosi --cachedir=/var/cache/pacman/pkg --hookdir=/buildroot/etc/pacman.d/hooks --arch x86_64 --color auto --noconfirm --sync --needed --assume-installed initramfs bash e2fsprogs gzip less libfido2 lvm2 p11-kit systemd tpm2-tss udev util-linux xfsprogs
resolving dependencies...
looking for conflicting packages...
warning: dependency cycle detected:
warning: systemd-libs will be installed before its libcap dependency

Package (90)                  New Version                  Net Change  Download Size

core/acl                      2.3.2-1                        0.32 MiB               
core/argon2                   20190702-6                     0.10 MiB               
core/attr                     2.5.2-1                        0.21 MiB               
core/audit                    4.0.2-2                        1.03 MiB               
core/brotli                   1.1.0-2                        0.97 MiB               
core/bzip2                    1.0.8-6                        0.14 MiB               
core/ca-certificates          20240618-1                     0.00 MiB               
core/ca-certificates-mozilla  3.104-1                        1.04 MiB               
core/ca-certificates-utils    20240618-1                     0.01 MiB               
core/coreutils                9.5-2                         15.87 MiB               
core/cryptsetup               2.7.5-1                        2.93 MiB               
core/curl                     8.10.1-1                       1.89 MiB               
core/dbus                     1.14.10-2                      0.89 MiB               
core/dbus-broker              36-4                           0.35 MiB               
core/dbus-broker-units        36-4                           0.00 MiB               
core/dbus-units               36-4                           0.00 MiB       0.00 MiB
core/device-mapper            2.03.26-1                      0.74 MiB               
core/expat                    2.6.3-2                        0.42 MiB               
core/file                     5.45-1                         8.33 MiB               
core/findutils                4.10.0-2                       1.71 MiB               
core/gcc-libs                 14.2.1+r134+gab884fffe3fc-1  143.35 MiB               
core/gdbm                     1.24-1                         0.70 MiB               
core/glibc                    2.40+r16+gaa533d58ff-2        47.64 MiB               
core/gmp                      6.3.0-2                        1.01 MiB               
core/grep                     3.11-1                         0.87 MiB               
extra/hidapi                  0.14.0-3                       0.13 MiB               
core/hwdata                   0.387-1                        9.23 MiB               
core/json-c                   0.18-1                         0.18 MiB               
core/kbd                      2.6.4-3                        3.01 MiB               
core/keyutils                 1.6.3-3                        0.20 MiB               
core/kmod                     33-3                           0.29 MiB               
core/krb5                     1.21.3-1                       4.53 MiB               
core/libaio                   0.3.113-3                      0.04 MiB               
core/libcap                   2.70-1                         1.72 MiB               
core/libcap-ng                0.8.5-2                        0.12 MiB               
extra/libcbor                 0.11.0-1                       0.16 MiB               
core/libedit                  20240517_3.1-1                 0.27 MiB               
core/libelf                   0.191-4                        2.93 MiB               
core/libevent                 2.1.12-4                       1.12 MiB               
core/libffi                   3.4.6-1                        0.09 MiB               
core/libgcrypt                1.11.0-2                       1.83 MiB               
core/libgpg-error             1.50-1                         1.07 MiB               
core/libidn2                  2.3.7-1                        0.46 MiB               
core/libinih                  58-1                           0.05 MiB               
core/libldap                  2.6.8-2                        0.65 MiB               
core/libnghttp2               1.63.0-1                       0.40 MiB               
core/libnghttp3               1.5.0-1                        0.23 MiB               
core/libnsl                   2.0.1-1                        0.07 MiB               
core/libp11-kit               0.25.5-1                       2.80 MiB               
core/libpsl                   0.21.5-2                       0.22 MiB               
core/libsasl                  2.1.28-5                       0.50 MiB               
core/libseccomp               2.5.5-3                        0.24 MiB               
core/libssh2                  1.11.0-1                       0.45 MiB               
core/libtasn1                 4.19.0-2                       0.45 MiB               
core/libtirpc                 1.3.5-1                        0.42 MiB               
core/libunistring             1.2-1                          2.49 MiB               
extra/liburcu                 0.14.1-1                       0.80 MiB       0.13 MiB
core/libverto                 0.3.2-5                        0.07 MiB               
core/libxcrypt                4.4.36-2                       0.18 MiB               
core/linux-api-headers        6.10-1                         5.57 MiB               
extra/lmdb                    0.9.33-1                       0.40 MiB               
core/lz4                      1:1.10.0-2                     0.44 MiB               
core/ncurses                  6.5-3                          3.99 MiB               
core/openssl                  3.3.2-1                       10.98 MiB               
core/pam                      1.6.1-3                        3.21 MiB               
core/pambase                  20230918-2                     0.00 MiB               
core/pcre2                    10.44-1                        6.39 MiB               
core/popt                     1.19-2                         0.23 MiB               
core/readline                 8.2.013-1                      0.73 MiB               
core/sed                      4.9-3                          0.70 MiB               
core/shadow                   4.16.0-1                       3.86 MiB               
core/sqlite                   3.46.1-1                       8.25 MiB               
core/systemd-libs             256.6-1                        2.82 MiB               
core/thin-provisioning-tools  1.1.0-1                        2.99 MiB       1.01 MiB
core/tzdata                   2024b-2                        1.93 MiB               
core/util-linux-libs          2.40.2-1                       1.26 MiB               
core/xz                       5.6.2-1                        2.69 MiB               
core/zlib                     1:1.3.1-2                      0.33 MiB               
core/zstd                     1.5.6-1                        1.49 MiB               
core/bash                     5.2.032-2                      9.20 MiB               
core/e2fsprogs                1.47.1-4                       5.20 MiB               
core/gzip                     1.13-4                         0.15 MiB               
core/less                     1:661-1                        0.28 MiB               
extra/libfido2                1.15.0-1                       0.45 MiB               
core/lvm2                     2.03.26-1                      5.54 MiB       1.78 MiB
core/p11-kit                  0.25.5-1                       0.93 MiB               
core/systemd                  256.6-1                       32.45 MiB               
core/tpm2-tss                 4.0.1-1                        3.61 MiB               
core/util-linux               2.40.2-1                      14.48 MiB               
core/xfsprogs                 6.10.1-1                       3.94 MiB       1.22 MiB

Total Download Size:     4.13 MiB
Total Installed Size:  402.43 MiB

:: Proceed with installation? [Y/n] 
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
‣ "/usr/bin/python -SI /usr/lib/python3.12/site-packages/mkosi/sandbox.py --proc /proc --unsetenv TMPDIR --setenv SYSTEMD_OFFLINE 1 --ro-bind /usr/lib/python3.12/site-packages/mkosi/sandbox.py /sandbox.py --ro-bind /usr /usr --symlink usr/bin /bin --symlink usr/bin /sbin --symlink usr/lib /lib --symlink usr/lib /lib64 --ro-bind /etc/ld.so.cache /etc/ld.so.cache --dir /var/tmp --dir /var/log --unshare-ipc --symlink ../proc/self/mounts /etc/mtab --dev /dev --ro-bind /etc/resolv.conf /etc/resolv.conf --setenv PATH /scripts:/usr/local/sbin:/usr/local/bin:/usr/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl --overlay-lowerdir /var/tmp/mkosi-workspace-vd_a6elt/sandbox/etc --overlay-upperdir /var/tmp/mkosi-workspace-vd_a6elt/tmp/mkosi-var-tmp-fdd3aed4db86437d --overlay-workdir /var/tmp/mkosi-workspace-vd_a6elt/tmp/mkosi-var-tmp-c01fe1fa68064d3e --overlay /etc --bind /var/tmp/mkosi-workspace-vd_a6elt/tmp/mkosi-var-tmp-03732b4a5f874ebf /opt --bind /var/tmp/mkosi-workspace-vd_a6elt/tmp/mkosi-var-tmp-d102ebfd66d646f6 /srv --bind /var/tmp/mkosi-workspace-vd_a6elt/tmp/mkosi-var-tmp-6f7fe6d9fa704838 /media --bind /var/tmp/mkosi-workspace-vd_a6elt/tmp/mkosi-var-tmp-e740fe2c55454927 /mnt --bind /var/tmp/mkosi-workspace-vd_a6elt/tmp/mkosi-var-tmp-f345a2bfde0849e8 /var --dir /run --dir /tmp --bind /var/tmp/mkosi-workspace-vd_a6elt/tmp/mkosi-var-tmp-2a51b99d820043f4 /var/tmp --bind /var/tmp/mkosi-workspace-vd_a6elt/root /buildroot --ro-bind /etc/ca-certificates /etc/ca-certificates --ro-bind /etc/pacman.d/gnupg /etc/pacman.d/gnupg --ro-bind /etc/pki /etc/pki --ro-bind /etc/ssl /etc/ssl --bind /var/tmp/mkosi-workspace-vd_a6elt/repository /repository --bind /var/tmp/mkosi-metadata-fp38d4rw/cache/pacman /var/cache/pacman --bind /var/cache/pacman/pkg /var/cache/pacman/pkg --bind /var/tmp/mkosi-metadata-fp38d4rw/lib/pacman /var/lib/pacman --ro-bind /var/tmp/mkosi-workspace-vd_a6elt/repository /var/cache/pacman/mkosi --bind /var/tmp/mkosi-workspace-vd_a6elt/root/var/lib/pacman/local /var/lib/pacman/local --tmpfs /buildroot/run --tmpfs /buildroot/tmp --proc /buildroot/proc --dev /buildroot/dev --dir /buildroot/run/user/0 --write mkosi /buildroot/run/host/container-manager --become-root --suppress-chown --ro-bind-try /var/tmp/mkosi-workspace-vd_a6elt/root/etc/machine-id /buildroot/etc/machine-id --ro-bind-try /var/tmp/mkosi-workspace-vd_a6elt/root/etc/passwd /etc/passwd --ro-bind-try /var/tmp/mkosi-workspace-vd_a6elt/root/etc/group /etc/group --ro-bind-try /var/tmp/mkosi-workspace-vd_a6elt/root/etc/shadow /etc/shadow --ro-bind-try /var/tmp/mkosi-workspace-vd_a6elt/root/etc/gshadow /etc/gshadow --ro-bind /etc/ca-certificates/extracted/tls-ca-bundle.pem /proxy.cacert -- pacman --root=/buildroot --logfile=/dev/null --dbpath=/var/lib/pacman --cachedir=/var/cache/pacman/mkosi --cachedir=/var/cache/pacman/pkg --hookdir=/buildroot/etc/pacman.d/hooks --arch x86_64 --color auto --noconfirm --sync --needed --assume-installed initramfs bash e2fsprogs gzip less libfido2 lvm2 p11-kit systemd tpm2-tss udev util-linux xfsprogs" returned non-zero exit code 1.
‣ + rm -rf -- /work/var/tmp/mkosi-workspace-vd_a6elt
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/mkosi/run.py", line 64, in uncaught_exception_handler
    yield
  File "/usr/lib/python3.12/site-packages/mkosi/run.py", line 105, in fork_and_wait
    target(*args, **kwargs)
  File "/usr/lib/python3.12/site-packages/mkosi/__init__.py", line 3960, in run_build
    build_image(
  File "/usr/lib/python3.12/site-packages/mkosi/__init__.py", line 3190, in build_image
    install_distribution(context)
  File "/usr/lib/python3.12/site-packages/mkosi/__init__.py", line 223, in install_distribution
    context.config.distribution.install_packages(context, context.config.packages)
  File "/usr/lib/python3.12/site-packages/mkosi/distributions/__init__.py", line 132, in install_packages
    return self.installer().install_packages(context, packages)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mkosi/distributions/arch.py", line 45, in install_packages
    Pacman.invoke(
  File "/usr/lib/python3.12/site-packages/mkosi/installer/pacman.py", line 166, in invoke
    return run(
           ^^^^
  File "/usr/lib/python3.12/site-packages/mkosi/run.py", line 152, in run
    with spawn(
         ^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
    next(self.gen)
  File "/usr/lib/python3.12/site-packages/mkosi/run.py", line 296, in spawn
    raise subprocess.CalledProcessError(returncode, cmdline)
subprocess.CalledProcessError: Command '['pacman', '--root=/buildroot', '--logfile=/dev/null', '--dbpath=/var/lib/pacman', '--cachedir=/var/cache/pacman/mkosi', '--cachedir=/var/cache/pacman/pkg', '--hookdir=/buildroot/etc/pacman.d/hooks', '--arch', 'x86_64', '--color', 'auto', '--noconfirm', '--sync', '--needed', '--assume-installed', 'initramfs', 'bash', 'e2fsprogs', 'gzip', 'less', 'libfido2', 'lvm2', 'p11-kit', 'systemd', 'tpm2-tss', 'udev', 'util-linux', 'xfsprogs']' returned non-zero exit status 1.
‣ + tput cnorm
‣ + tput smam
‣ "mkosi --force --directory '' --format cpio --output initrd --output-dir /tmp/kernel-install.staging.EuIxGA --extra-tree /usr/lib/modules/6.6.52-1-lts:/usr/lib/modules/6.6.52-1-lts --extra-tree=/usr/lib/firmware:/usr/lib/firmware '--remove-files=/usr/lib/firmware/*-ucode' '--kernel-modules-exclude=.*' --kernel-modules-include=host --build-sources '' --include=mkosi-initrd --debug --workspace-dir=/var/tmp --package-cache-dir=/var --cache-only=metadata --sandbox-tree /tmp/tmps57m9jem" returned non-zero exit code 1.
‣ "mkosi-initrd --kernel-version 6.6.52-1-lts --format cpio --output initrd --output-dir /tmp/kernel-install.staging.EuIxGA --debug" returned non-zero exit code 1.
/etc/kernel/install.d/50-mkosi.install failed with exit status 1.
/etc/kernel/install.d/50-mkosi.install failed with exit status 1.
(sd-exec-strv) failed with exit status 1.
DaanDeMeyer commented 1 month ago

@cvlc12 Any chance you can patch mkosi to call pacman with strace? It's not telling us anything useful in its error message

gdiscry commented 1 month ago

Here is what I've found.

  1. mkosi-initrd creates an empty etc/pacman.conf in the sandbox.
  2. If /etc/pacman.conf exists on the host, mkosi-initrd copies its content in the sandbox.
  3. When Pacman.setup() is called, etc/pacman.conf already exists in the sandbox and is kept as is.
  4. Since Pacman 7, a sandbox is used with the user alpm to download the files (as configured by default in pacman.conf).
  5. pacman cannot find the user alpm in mkosi's own sandbox and fails.

I tried adding "--disable-sandbox" when calling pacman, without success.

If I remove the line DownloadUser = alpm in /etc/pacman.conf, mkosi-initrd works (24.3 and git main).