]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: Correctly handle btrfs compression (#39597)
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 9 Nov 2025 16:52:19 +0000 (01:52 +0900)
committerGitHub <noreply@github.com>
Sun, 9 Nov 2025 16:52:19 +0000 (01:52 +0900)
systemd-repart is incorrectly choosing the loop-mount
code path to copy files after formatting, instead of using the --rootdir
path, which is required by mkfs.btrfs to apply compression (since it's
on files, not the fs).

So two fixes (and an integ test):

1. If Btrfs compression is requested without a root directory (e.g.,
Compression= without CopyFiles=), we now log a warning and skip the
--compress flag. This prevents the mkfs.btrfs failure, and it's
meaningless anyway without any files.
2. The logic in repart now uses the --rootdir code path whenever the
partition is btrfs and compression is requested. Otherwise it still
won't work even in the legitimate case because use the loop mounting
code, which is too late to use --compress.

Fixes: https://github.com/systemd/systemd/issues/39584

Trivial merge