Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If the main image includes multiple base images, a common file in base images causes build failure #3342

Open
utezduyar opened this issue Jan 10, 2025 · 4 comments · May be fixed by systemd/systemd#35956
Labels

Comments

@utezduyar
Copy link

mkosi commit the issue has been seen with

mkosi 25~devel

Used host distribution

Debian

Used target distribution

Debian

Linux kernel version used

6.1.0-21-amd64

CPU architectures issue was seen on

x86_64

Unexpected behaviour you saw

I have 3 base images, common, device-management and webrtc-streaming. The device-management and webrtc-streaming images are based on common. The main image is based on device-management and webrtc-streaming.
The build fails due to conflict and my guess is that because of the common part of both device-management and webrtc-streaming.

Used mkosi config

$ tree mkosi.conf mkosi.images/
mkosi.conf  [error opening dir]
mkosi.images/
|-- common
|   |-- mkosi.conf
|   `-- mkosi.extra
|       `-- usr
|           `-- lib
|               `-- systemd
|                   `-- system
|                       |-- common.target
|                       `-- default.target -> common.target
|-- device-management
|   |-- mkosi.conf
|   `-- mkosi.extra
|       `-- usr
|           `-- lib
|               `-- systemd
|                   `-- system
|                       |-- default.target -> device-management.target
|                       |-- device-management.target
`-- webrtc-streaming
    |-- mkosi.conf
    `-- mkosi.extra
        `-- usr
            `-- lib
                `-- systemd
                    `-- system
                        |-- default.target -> webrtc-streaming.target
                        `-- webrtc-streaming.target


$ cat mkosi.conf mkosi.images/common/mkosi.conf mkosi.images/device-management/mkosi.conf mkosi.images/webrtc-streaming/mkosi.conf 
[Config]
Dependencies=webrtc-streaming,device-management

[Distribution]
Distribution=debian
Release=unstable

[Output]
OutputDirectory=mkosi.output

[Content]
BaseTrees=%O/webrtc-streaming,%O/device-management

[Build]
ToolsTree=default
[Output]
Format=disk

[Content]
Autologin=true
CleanPackageMetadata=no # important for being able to have delta builds (like systemd system extensions)
Packages=
         systemd
         udev
         ca-certificates
         apt
         vim
         util-linux
         coreutils
         passwd
         login
         binutils
         iproute2
         iputils-ping
[Config]
Dependencies=common

[Output]
Format=disk

[Content]
BaseTrees=%O/common
CleanPackageMetadata=no

BuildPackages=
         golang
[Config]
Dependencies=common

[Output]
Format=disk

[Content]
CleanPackageMetadata=no
BaseTrees=%O/common

mkosi output

File '/work/var/tmp/mkosi-workspace-_p63fmi2/staging/webrtc-streaming.raw' already is of requested size or larger, not growing. (425.4M >= 425.4M)
No changes.
‣ Could not rename /var/tmp/mkosi-workspace-_p63fmi2/staging/webrtc-streaming.raw to /home/umuttl/Development/deleteme-mkosi-bugreport/mkosi.output/webrtc-streaming.raw as they are located on different devices, falling back to copying
‣  /home/umuttl/Development/deleteme-mkosi-bugreport/mkosi.output/webrtc-streaming.raw size is 425.5M, consumes 424.5M.
‣ Building default image
‣  Copying in base trees…
Failed to copy / in image '/work/home/umuttl/Development/deleteme-mkosi-bugreport/mkosi.output/device-management.raw' to '/work/var/tmp/mkosi-workspace-btkvm6x8/root': File exists
‣ "systemd-dissect --copy-from /work/home/umuttl/Development/deleteme-mkosi-bugreport/mkosi.output/device-management.raw / /work/var/tmp/mkosi-workspace-btkvm6x8/root" returned non-zero exit code 1.
@utezduyar utezduyar added the bug label Jan 10, 2025
@utezduyar
Copy link
Author

Attached file (which includes checkout out mkosi binaries too) is the compressed layout of the configuration.
sample.tar.gz

DaanDeMeyer added a commit to DaanDeMeyer/systemd that referenced this issue Jan 10, 2025
When copying a directory from or to an image, let's always merge
with existing directories instead of failing with "File Exists".

Fixes systemd/mkosi#3342.
@DaanDeMeyer DaanDeMeyer linked a pull request Jan 10, 2025 that will close this issue
@DaanDeMeyer
Copy link
Contributor

DaanDeMeyer commented Jan 10, 2025

@utezduyar The linked PR should fix your issue.

But please don't use Format=disk for base images, you Format=directory instead. Then you don't have to run everything as root.

@utezduyar
Copy link
Author

Thank you. I verified that your patch fixes it by replacing your version of systemd-dissect in mkosi.output/tools. Do you have any tips on how I can proceed while waiting for a new systemd release? I don't want to distribute tools tree with my mkosi.conf. I couldn't find any hooks in Tools*= configs.

Also, thank you for the Format=disk tip. I will change it.

@DaanDeMeyer
Copy link
Contributor

Just changing to Format=directory for your base images will fix the problem as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants