systemd / mkosi

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

systemd-repart fails to copy data from squashfs: no space left on device #2380

Closed CosmicToast closed 8 months ago

CosmicToast commented 8 months ago

I'm generating a rootfs, and am interested exclusively in the squashfs build of it. Since plain_squashfs was removed as an option, I'm following the available instructions to use Format=disk and customize the repart.d settings. My setup looks like so:

# mkosi.conf
[Config]
# missing Dependency=kernel
# I build a custom kernel manually as Format=none for multiple architectures at once
# if I included the dependency here, I would have n^2 builds for no reason

[Output]
Format=disk
SplitArtifacts=yes
Output=rootfs-%a

[Content]
Autologin=yes
Bootable=no
RootPassword=hashed:

Packages=
Packages=
    ... various packages

BuildPackages=

RemovePackages=
RemovePackages=
    ... a few packages

# this is for kernel modules, %O/kernel-%a/lib/modules/... is the only thing that exists there
ExtraTrees=%O/kernel-%a:/usr
# mkosi.repart/root.conf
[Partition]
Type=root
Format=squashfs

CopyFiles=/
Minimize=best

I'm interested exclusively in the root squashfs, not so much in the overall gpt image.

What ends up happening is that the squashfs will get created, and is about 850M. The automatically determined minimal disk image size is just above that. I then get this sequence:

Applying changes.
Wiped block device.
Discarded entire block device.
Successfully wiped file system signatures from future partition 0.
Copying in '...' (850.6M) on block level into future partition 0.
Failed to copy in data from '...': No space left on device

I've tried giving hints and setting padding sizes, but to no avail so far.

Is there a workaround for this? I'm only really interested in the rootfs anyway, which is getting generated (at least so far).

CosmicToast commented 8 months ago

As an additional comment, this used to work! What changed:

  1. I added the ExtraTrees after redoing how I handled the kernel. Everything was still fine after this.
  2. I added a few more packages in the config (I started installing *-firmware).
  3. At this point I presume the image got less compressible or just too big, and I started getting the above failure.

DaanDeMeyer commented 8 months ago

I can't reproduce this with latest systemd. Can you either build systemd from source, use it via ExtraSearchPaths= and see if you can still reproduce or give me a link to a git repo with a config that reproduces the issue?

CosmicToast commented 8 months ago

It's currently a WIP, and I tend not to keep things in VCS while I do active prototyping (a lot of the components are on their 4th rewrite). Is it alright if I send a tarball that I can reproduce with? The biggest component is just the linux sources.

Regardless, I'll most likely get around to it tomorrow.

DaanDeMeyer commented 8 months ago

tarball is fine, I just need a proper reproducer

CosmicToast commented 8 months ago

Ah, my bad, sorry.

As it turns out, the "no space left on device" was referring to my filesystem, because I had too many gigabytes of builds. (I found this out because I tried to build the reproducer in tmpfs after cleaning out a bunch of artifacts in the original directory).

Really sorry for the waste of time.