Discussion:
Bug#896826: partman-auto: Wrong minimal disk size calculation when using expert_recipe and lvm partitions
(too old to reply)
Garinot Pierre
2018-04-24 16:30:02 UTC
Permalink
Package: partman-auto
Version: partman-auto
Severity: important
Tags: d-i

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)



-- System Information:
Debian Release: 9.4
APT prefers stable-updates
APT policy: (700, 'stable-updates'), (700, 'stable'), (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-6-amd64 (SMP w/4 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Garinot Pierre
2018-04-25 14:40:02 UTC
Permalink
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.
Garinot Pierre
2018-04-28 17:00:01 UTC
Permalink
Just found this bug while looking for something else, sorry i missed it
before.
I reported the same to partman-auto: #896826
My idea for the patch is almost the same, except it doesn't modify
min_size() and only ignore lvm in choose_recipe.

Not sure which is better...
Garinot Pierre
2018-04-28 16:40:02 UTC
Permalink
I updated the patch (joined) so that we also run filter_lvm on recipes
from /lib/partman/recipes*.
Garinot Pierre
2018-04-28 17:10:01 UTC
Permalink
I also encountered this bug.

The attached patches fixes it for me.
They also should allow using multiple PV for the same VG (not tested).

WARNING:
_ partman-auto.diff applies on top of the one i provided in #896826
_ I have no idea how to get the device in reuse_partitions(), so my
patch set it to 'reuse', that's wrong, but i don't use $reuse{ and
don't even know what it is used for, so i can't test.

What they do:
_ when calling setup_partition() we also give it the device
(/dev/...) associated to it, setup_partition() writes it in
$id/device
_ auto_lvm_create_vg_map() use the previous information to find
the PVs associated to a VG (by checking $id/vg_name)
Marco Fleckinger
2022-02-02 02:50:04 UTC
Permalink
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

On Tue, 24 Apr 2018 18:07:31 +0200 Garinot Pierre
Post by Garinot Pierre
Package: partman-auto
Version: partman-auto
Severity: important
Tags: d-i
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)?
----
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 \
Holger Wansing
2024-09-17 20:40:01 UTC
Permalink
Hi Pierre,
Post by Garinot Pierre
* What was the outcome of this action?
"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).
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
--
Holger Wansing <***@mailbox.org>
PGP-Fingerprint: 496A C6E8 1442 4B34 8508 3529 59F1 87CA 156E B076
Pascal Hambourg
2024-09-17 22:30:01 UTC
Permalink
Post by Holger Wansing
We have just overworked the partitioning recipes and some related things, so
maybe your issue is also fixed now.
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.
Holger Wansing
2024-09-18 04:20:01 UTC
Permalink
[bug submitter is no longer reachable; mail address does not exist ]
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.
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
--
Sent from /e/ OS on Fairphone3
Loading...