systemd / mkosi

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

`mkosi build` fails when /etc/pacman.conf on {SkeletonTrees,PackageManagerTrees} #2281

Closed mati1210 closed 10 months ago

mati1210 commented 10 months ago
$ cat mkosi.conf
[Distribution]
Distribution=arch

$ cp /etc/pacman.conf mkosi.skeleton/etc/pacman.conf

$ mkosi build
‣ Removing output files…
‣ Building default image                                                                                                        
‣  Copying in package manager file trees…
‣  Copying in skeleton file trees…
‣  Installing Arch                    
error: config file /etc/pacman.d/mirrorlist could not be read: No such file or directory 
‣ "pacman --root /home/mat/.cache/mkosi-workspacepw5p87lr/root --logfile=/dev/null --cachedir /home/mat/.cache/mkosi-workspacepw5p87lr/cache/cache/pacman/pkg --hookdir /home/mat
/.cache/mkosi-workspacepw5p87lr/root/etc/pacman.d/hooks --arch x86_64 --color auto --noconfirm --sync --refresh --needed --assume-installed initramfs filesystem" returned non-ze
ro exit code 1.

If mirrorlist is also copied into mkosi.skeleton it fails with another missing file

error: could not open file: /etc/mtab: No such file or directory
error: could not determine filesystem mount points
error: failed to commit transaction (unexpected error)

this also happens on PackageManagerTrees, --debug output https://gist.github.com/mati1210/f1c851987bd2b9889dff71630365e825

i'm not sure if this is the right way to do this, but it worked before updating to v20

DaanDeMeyer commented 10 months ago

Please post the contents of your pacman.conf

mati1210 commented 10 months ago

here! it's just the standard pacman.conf with a few NoExtracts to remove some files i don't need

the error also happens with the standard pacman.conf, though

$ bsdtar Oxf /var/cache/pacman/pkg/pacman-6.0.2-8-x86_64.pkg.tar.zst etc/pacman.conf >mkosi.skeleton/etc/pacman.conf

$ mkosi build
‣ Removing output files…
‣ Building default image
Create subvolume '/home/mat/.cache/mkosi-workspacej8uvm7k2/root'
‣  Copying in package manager file trees…
‣  Copying in skeleton file trees…
‣  Installing Arch
error: config file /etc/pacman.d/mirrorlist could not be read: No such file or directory
‣ "pacman --root /home/mat/.cache/mkosi-workspacej8uvm7k2/root --logfile=/dev/null --cachedir /home/mat/.cache/mkosi-workspacej8uvm7k2/cache/cache/pacman/pkg --hookdir /home/mat/.cache/mkosi-workspacej8uvm7k2/root/etc/pacman.d/hooks --arch x86_64 --color auto --noconfirm --sync --refresh --needed --assume-installed initramfs filesystem" returned non-zero exit code 1.
DaanDeMeyer commented 10 months ago

@mati1210 We do proper sandboxing of the build since v20, so it's expected that /etc/pacman.d/mirrorlist isn't accessible anymore by default. You'll need to add it to your package manager tree so it can be found. I'll look into the other error.

DaanDeMeyer commented 10 months ago

@mati1210 The other error was caused by CheckSpace. I just merged a fix for that. You'll still need to put /etc/pacman.d/mirrorlist in either a package manager or skeleton tree.