1

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.

Bil5
  • 153
  • 5
  • $primary missing on rootfs? – Gerard H. Pille Jul 12 '21 at 00:28
  • @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. – Bil5 Jul 12 '21 at 02:01
  • mountpoint{ / } duplicate? – Gerard H. Pille Jul 12 '21 at 02:32
  • 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 – Bil5 Jul 12 '21 at 02:45
  • "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. – Gerard H. Pille Jul 12 '21 at 03:02
  • 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 – Bil5 Jul 12 '21 at 03:29
  • -1 is max indeed, but read 5. Limitations. Doesn't partman (or whatever is running this) leave a log behind? – Gerard H. Pille Jul 12 '21 at 04:34
  • There's no choose_recipe boot-root (beet-root?) – Gerard H. Pille Jul 12 '21 at 04:53
  • 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 Jul 12 '21 at 06:46
  • 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! – Bil5 Jul 12 '21 at 07:43

1 Answers1

0

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.

DDJ
  • 11
  • 1