Skip to content

mkosi is over-eager to use "cp --preserve=xattr", fails in cross-filesystem cases #3732

@gdonval

Description

@gdonval

mkosi commit the issue has been seen with

main

Used host distribution

archlinux

Used target distribution

ubuntu

Linux kernel version used

6.14.6-arch1-1

CPU architectures issue was seen on

x86_64

Unexpected behaviour you saw

WorkspaceDirectory set to XFS-supported directory (here /tmp/mkosi.workspace). All other mkosi dirs on BTRFS-supported directory.

...
‣ Copying repository metadata
cp: setting attributes for '/work/tmp/mkosi-gdonval-workspace/mkosi/mkosi-metadata-lwbvcpek/cache/apt/srcpkgcache.bin': Operation not supported
...
cp: setting attributes for '/work/tmp/mkosi-gdonval-workspace/mkosi/mkosi-metadata-lwbvcpek/cache/apt': Operation not supported
‣ "cp --recursive --no-dereference --preserve=mode,links,timestamps,ownership,xattr --reflink=auto --copy-contents '/work/home/gdonval/.cache/mkosi/ubuntu~noble~x86-64/cache/apt' /work/tmp/mkosi-gdonval-workspace/mkosi/mkosi-metadata-lwbvcpek/cache/apt --no-target-directory" returned non-zero exit code 1.

The reason it happens it because original files have attrs that cannot be copied, e.g:

$ lsattr -a /home/gdonval/Documents/Work/RVMI/Services/UbuntuRVMI/mkosi.cache/ubuntu~noble~x86-64~main.metadata.cache/cache/apt/srcpkgcache.bin
--------c------------- /home/gdonval/Documents/Work/RVMI/Services/UbuntuRVMI/mkosi.cache/ubuntu~noble~x86-64~main.metadata.cache/cache/apt/srcpkgcache.bin
$ lsattr -a /tmp/mkosi-gdonval-workspace/mkosi/mkosi-metadata-lwbvcpek/cache/apt/srcpkgcache.bin
---------------------- /tmp/mkosi-gdonval-workspace/mkosi/mkosi-metadata-lwbvcpek/cache/apt/srcpkgcache.bin

That c is invalid on XFS.

Used mkosi config

[Distribution]
Distribution=ubuntu
Release=noble
Repositories=universe multiverse

[Build]
WorkspaceDirectory=/tmp/mkosi.workspace

[Output]
Format=disk

mkosi output

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions