#896826 partman-auto: Wrong minimal disk size calculation when using expert_recipe and lvm partitions #896826
- Package:
- partman-auto
- Source:
- partman-auto
- Submitter:
- Garinot Pierre
- Date:
- 2024-09-18 04:15:01 UTC
- Severity:
- important
- Tags:
Dear Maintainer,
* What led up to the situation?
Trying to pressed the debian installer for automatic partitionning.
* What exactly did you do (or not do) that was effective (or
ineffective)?
Used these preseed rules:
----
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-auto/expert_recipe string \
arcadia :: \
30 50 100 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
64 1024 300% linux-swap \
method{ swap } format{ } \
. \
1980 3000 -1 ext4 \
$defaultignore{ } \
$primary{ } \
method{ lvm } \
device{ /dev/sda } \
vg_name{ system } \
. \
60 100 150 ext4 \
$lvmok{ } in_vg{ system } lv_name{ root } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
. \
750 1000 15000 ext4 \
$lvmok{ } in_vg{ system } lv_name{ usr } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /usr } \
. \
10 20 30 ext4 \
$lvmok{ } in_vg{ system } lv_name{ home } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /home } \
. \
10 20 30 ext4 \
$lvmok{ } in_vg{ system } lv_name{ roothome } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /root } \
. \
20 30 50 ext4 \
$lvmok{ } in_vg{ system } lv_name{ tmp } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /tmp } \
. \
800 1000 10000 ext4 \
$lvmok{ } in_vg{ system } lv_name{ var } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /var } \
. \
250 500 1000 ext4 \
$lvmok{ } in_vg{ system } lv_name{ log } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /var/log } \
. \
10 20 10000 ext4 \
$lvmok{ } in_vg{ system } lv_name{ local } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /usr/local } \
. \
10 20 30 ext4 \
$lvmok{ } in_vg{ system } lv_name{ srv } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /srv } \
.
----
* What was the outcome of this action?
Partitionning fails with the following message in syslog:
"partman-auto: Available disk space (2147) too small for expert recipe(3994);
skipping"
* What outcome did you expect instead?
Partitionning successfull, with LVM setup correctly.
The computed size should be /boot + swap + VG(system) = 2074, which would fit
on
the disk (2147).
I believe the problem to be in lib/recipes.sh, function min_size, which adds
the
min_size of _all_ partitions, including those that are LV setup to be part of a
VG.
As a result, the computed min_size is larger than what it would actually be.
I'm sorry i can't work on a patch, since it is more complicated that just
ignoring partitions using $lvmok{ }, and i don't have time right now.
The function should also check that all the LVs can fit in their designated VG,
which may not be defined in the recipe (default one, or created by another mean
before partman-auto)
Actually i took a closer look at this and wrote a patch that fixes it
for me.
It is attached with this mail.
It filters partitions using 'in_vg{' when computing min_size in
choose_recipe() and using method 'lvm'.
I saw that min_size() is used in some other places in partman, that's
the reason i put the filter in choose_recipe():
The recipe is still the same, we only modify the $scheme used by
min_size() for this particular check.
For all i know and understand about d-i, this shouldn't affect anything
other than this bug.
I'm not used to making patches for debian packages, much less for the
installer, so that may not be the _right_ way to do it, just tell me
and i'll find the time to modify my patch. Anyway, it works for me.
I updated the patch (joined) so that we also run filter_lvm on recipes from /lib/partman/recipes*.
Dear Maintainer,
I can confirm this behavior on Debian 11. In a VM with about 8 GB disk
size, the following recipe leads to a very similar error (just numbers
change): Available disk space (8589) too small for expert recipe (13500);
My recipe is:
partman-auto partman-auto/expert_recipe string with_lvm :: \
500 50 500 ext4 \
$primary{ } \
$bootable{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /boot } \
. \
8000 50 8000 lvm \
$primary{ } \
method{ lvm } \
vg_name{ vg0 } \
. \
5000 50 5000 ext4 \
$lvmok{ } \
in_vg{ vg0 } \
lv_name{ root } \
method{ format } \
format{} \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ / } \
.
Regards, Marco
Hi Pierre, Garinot Pierre <garinot.pierre@errlock.org> wrote: Sorry for the late reply! We have just overworked the partitioning recipes and some related things, so maybe your issue is also fixed now. Maybe you want to give it a try. Holger
Unfortunately I doubt the recent changes fix this issue. Most changes take place in built-in recipes so do not affect expert recipes. Even the patches in MR17 won't help, they aim to fix the opposite bug (calculated minimal disk size is lower than it should). Fixing this bug properly is not simple and the proposed patch does not cover all cases.
[bug submitter is no longer reachable; mail address does not exist ] Am 18. September 2024 00:16:03 MESZ schrieb Pascal Hambourg <pascal@plouf.fr.eu.org>: Anyway, this is also a bug, where the installer is acting on the limits (very small disk). So we should not value this too high... Holger