Score:1

Debian automated install preseed auto partitioning seemingly ignored

tr flag

I'm playing with Debian preseed files trying to auto-partitioning a single disk. The final disk state I'm trying to reach is the following :

boot              Primary Partition 1   ext3    [256MB]   primary   /boot (/dev/sda1)
rootfs            Primary Partition 2   f2fs    [16GB]    primary   / (/dev/sda2)
swap              swap                  swap    [4GB]     swap      (/dev/sda3)
extended          Extended partition    ext4    [42GB]    primary   (/dev/sda4)
 |- application                         ext4    [4GB]     logical   /application (/dev/sda5)
 |- database                            btrfs   [4GB]     logical   /database (/dev/sda6)
 |- medias                              btrfs   [32GB]    logical   /medias (/dev/sda7)

For that purpose, I created the following section in the preseed file :

d-i partman-auto/expert_recipe string                     \
  boot-root ::                                            \
          256 256 256 ext3                                \
                  $primary{ } $bootable{ }                \
                  method{ format } format{ }              \
                  use_filesystem{ } filesystem{ ext3 }    \
                  label{ boot }                           \
                  mountpoint{ /boot }                     \
          .                                               \
          4096 4096 200% linux-swap                       \
                  method{ swap } format{ }                \
                  label{ swap_part }                      \
                  mountpoint{ /swap }                     \
          .                                               \
          16384 16384 16384 f2fs                          \
                  $primary{ }                             \
                  method{ format } format{ }              \
                  use_filesystem{ } filesystem{ f2fs }    \
                  label{ rootfs }                         \
                  mountpoint{ / }                         \
          .                                               \
          42000 42000 -1 ext4                             \
                  $primary{ }                             \
                  method{ format } format{ }              \
                  use_filesystem{ } filesystem{ ext4 }    \
                  mountpoint{ / }                         \
          .                                               \
          4096 4096 4096 ext4                             \
                  method{ format } format{ }              \
                  use_filesystem{ } filesystem{ ext4 }    \
                  label{ application }                    \
                  mountpoint{ /application }              \
          .                                               \
          4096 4096 4096 btrfs                            \
                  method{ format } format{ }              \
                  use_filesystem{ } filesystem{ btrfs }   \
                  label{ database }                       \
                  mountpoint{ /database }                 \
          .                                               \
          32768 32768 32768 btrfs                         \
                  method{ format } format{ }              \
                  use_filesystem{ } filesystem{ btrfs }   \
                  label{ medias }                         \
                  mountpoint{ /medias }                   \

It doesn't work as expected and create the following :

user@debian:~$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   80G  0 disk
|--sda1  8:1    0   79G  0 part /
|--sda2  8:2    0    1K  0 part
|--sda5  8:5    0  975M  0 part [SWAP]
sr0     11:0    1 1024M  0 rom

It's pretty confusing since it has nothing expected based on the preseed instructions. The preseed is being downloaded on the fly and the full content can be found here :

preseed.cfg

Thanks for your insights.

Gerard H. Pille avatar
in flag
$primary missing on rootfs?
Bil5 avatar
tr flag
@GerardH.Pille Great catch, I added $primary and changed f2fs to ext4 to get more chance to have it working but there's actually no difference, it seems it's not even considered, which is weird since if I remove the rootfs it complains telling there must be a root file system.
Gerard H. Pille avatar
in flag
mountpoint{ / } duplicate?
Bil5 avatar
tr flag
I read somewhere that it was the way to go to have an extended partition since there is no other option to specify it, but for testing purposes, I completely removed this partition and it's unfortunately still the same. The current version of my preseed file is here : https://pastebin.com/xhV643Jd the relevant partitioning part is here : https://pastebin.com/3sf1fpXK
Gerard H. Pille avatar
in flag
"Due to limitation of the algorithms in partman-auto, there must be at least one partition with high maximal size ", you don't have a 1000000000 partition.
Bil5 avatar
tr flag
Isn't the `-1` part equivalent to "max" ? I just tried with `32000 32768 1000000000 btrfs` for the last partition but it resulted in the same, I guess there must be another subtility somewhere, the documentation is quite poor unfortunately
Gerard H. Pille avatar
in flag
-1 is max indeed, but read 5. Limitations. Doesn't partman (or whatever is running this) leave a log behind?
Gerard H. Pille avatar
in flag
There's no choose_recipe boot-root (beet-root?)
Bil5 avatar
tr flag
The only recipes I encountered so far are `boot-root` and `root`, it may exist other ones but it's not documented. Concerning the logs, it's a very good idea, I pasted it here https://pastebin.com/1FDm0u9d I can see that the instructions are somehow clearly ignored https://pastebin.com/1FDm0u9d
Bil5 avatar
tr flag
I finally managed to have it working, 2 things : First of all, f2fs is clearly rejected and will not work (at least for the root fs), I reindented all the instructions and I noticed an extra `/` at the end of a line. There was no complaint about it but it seems to have made the difference. Secondly, the `-1` works as expected. Last thing to mention, after a successful installation, I checked again the logs, they correspond to what was expected by the preseed file. Thanks a ton @GerardH.Pille to have helped debugging this!
Score:0
th flag
DDJ

Not realy relevant at this pont anymore I guess, but here is my two cents. you need to add this line on your preseed.cfg

d-i partman-auto/choose_recipe select boot-root

Otherwise the preseed will never know that you want to use this particular recipe.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.