1

I'm trying to create a LUKS LVM disk partition autmatically using preseed on Debian 10 (Buster). I have only a single disk /dev/sda with the size of 80GB and it has system memory of 4GB

Here is my full preseed configuration:

#### Preseed preconfiguration file (for Debian buster)
### Partman early command
### Kernal parameter
d-i debian-installer/add-kernel-opts string net.ifnames=0 biosdevname=0 console=ttyS0,19200n8
### Localization
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/language string en
d-i debian-installer/country string MY

### Keyboard selection
d-i keyboard-configuration/xkb-keymap select us

###  Network configuration
d-i netcfg/choose_interface select eth0
d-i netcfg/use_dhcp string false
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Configure network manually
# IPv4 Static network configuration
d-i netcfg/get_ipaddress string 172.14.5.185
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 172.14.5.1
d-i netcfg/get_nameservers string 139.12.11.5
d-i netcfg/confirm_static boolean true

# Set a hostname
d-i netcfg/get_hostname string sun
d-i netcfg/get_domain string domain.com
# Force a hostname
d-i netcfg/hostname string sun.domain.com
# Disable that annoying WEP key dialog
d-i netcfg/wireless_wep string

### Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string deb.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string

### Account setup
# Skip creation of a normal user account
d-i passwd/make-user boolean false
# Set root password
# or encrypted using a crypt(3)  hash.
d-i passwd/root-password-crypted password $6$R3C6TyiPkyqUwaw7$4rgc4Uluov6wm5ZXmEdssw3pZs5E5dsnOuVPa/VAHAJTsQCsxSeKjIj7hp3xJzZ9t5wQpx6UuYcXZxYpjbkn/

### Clock and time zone setup
# Set hardware clock to UTC
d-i clock-setup/utc boolean true
# Set timezone
d-i time/zone string Asia/Kuala_Lumpur
# Use NTP clock during installation
d-i clock-setup/ntp boolean true

### Partitioning
# LVM LUKS method
d-i partman-auto/method string crypto
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-auto-lvm/guided_size string max
d-i partman-auto-lvm/new_vg_name string box1
d-i partman-auto/disk string /dev/sda
d-i partman-auto/choose_recipe select boot-crypto
d-i partman-auto/expert_recipe string \
boot-crypto :: \
  1024 1024 1024 ext4 \
          $primary{ } $bootable{ } \
          method{ format } format{ } \
          use_filesystem{ } filesystem{ ext4 } \
          mountpoint{ /boot } \
  . \
  15360 15360 15360  ext4 \
          $lvmok{ } lv_name{ root } \
          in_vg { box1 } \
          method{ format } format{ } \
          use_filesystem{ } filesystem{ ext4 } \
          mountpoint{ / } \
  . \
  2048 2048 2048 ext4 \
          $lvmok{ } lv_name{ tmp } \
          in_vg { box1 } \
          method{ format } format{ } \
          use_filesystem{ } filesystem{ ext4 } \
          mountpoint{ /tmp } \
          options/nosuid{ nosuid } \
          options/noexec{ noexec } \
  . \
  4096 4096 4096 linux-swap \
          $lvmok{ } lv_name{ swap } \
          in_vg { box1 } \
          method{ swap } format{ } \
  . \
  80896 80896 1000000 ext4 \
          $lvmok{ } lv_name{ home } \
          in_vg { box1 } \
          method{ format } format{ } \
          use_filesystem{ } filesystem{ ext4 } \
          mountpoint{ /home } \
          options/nosuid{ nosuid } \
d-i partman-basicfilesystems/no_mount_point boolean false
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

### Apt setup
d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/cdrom/set-next boolean false
d-i apt-setup/cdrom/set-failed boolean false
d-i apt-setup/services-select multiselect security, updates
d-i apt-setup/security_host string security.debian.org
### Package selection
tasksel tasksel/first multiselect standard
# Individual additional packages to install
d-i pkgsel/include string openssh-server
popularity-contest popularity-contest/participate boolean false

The other preseed config ran successfully. The disk is created with LUKS LVM but the problem is that there is a missing partition like /home (which is not created from the beginning) but I did defined it in the preseed file above. In addition, the swap disk space should be 4GB but it filled up the rest of the space. Here is the screenshot how this preseed config created the disk structure:

NAME            MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda               8:0    0   79G  0 disk
|-sda1            8:1    0  976M  0 part  /boot
|-sda2            8:2    0    1K  0 part
`-sda5            8:5    0   78G  0 part
  `-sda5_crypt  254:0    0   78G  0 crypt
    |-box1-root 254:1    0 14.3G  0 lvm   /
    |-box1-tmp  254:2    0  1.9G  0 lvm   /tmp
    `-box1-swap 254:3    0 61.8G  0 lvm   [SWAP]

What could be the reason for this? Any mistakes in my preseed file for partitioning?

My partition scheme is this:

TOTAL SPACE is 80 GB

partition: /boot 1GB | FILE SYSTEM: ext4 | bootable flag: on | no need to encrypt


# This is LVM container encryption called box1:

partition: /root (/) 15 GB | FILE SYSTEM: ext4

partition: /tmp 2GB | FILE SYSTEM: ext4 | mount with: nosuid, noexec

partition: swap 4GB

partition: /home 60GB (or the rest space left) | FILE SYSTEM: ext4| mount with: nosuid
8
  • 1
    try something like 40960 61440 -1 for the /home partition (minimum 40GB, "priority" 60GB, maximum unlimited). With a total size of 80GB, your 80896 80896 1000000 is asking for a minimum size of 80GB for /home, after all the other partitions have been defined....at a guess, this may be what is confusing di-partman.
    – cas
    Apr 10 at 9:14
  • Ok, you are right about the space, I made a little mistake here but using what you are suggesting here: 40960 61440 -1 I still don't get the home partition created and it's the similar result that I posted in the question. Something is wrong here. I'm not sure where, I've been looking for this for many hours now. Do you know how to debug this error after Debian installation?
    – ToiletGuy
    Apr 10 at 15:15
  • I think I found something ... the end of the statement ... shouldn't have `\`. Testing now ...
    – ToiletGuy
    Apr 10 at 15:22
  • yes, that'll do it - the partition def is merged with the next line, so isn't valid. i should have noticed that myself. I'm surprised d-i didn't complain - was there anything in the log?
    – cas
    Apr 10 at 15:25
  • 1
    It's working! So, the main problem is the syntax error but debconf-set-selections didn't complain about it.
    – ToiletGuy
    Apr 10 at 16:01
3

It's working! First as mentioned by @cas, I made a mistake when declaring the size of the home directory where I accidentally used the size of the overall disk. But the main problem here is the syntax error that prevented home directory from created. Surprisingly, the debconf-set-selections that has syntax checker using an option -c did not complain about this error in preseed file. What I did was, put this missing dot (without \ symbol)

.

after this line:

      $lvmok{ } lv_name{ home } \
      in_vg { box1 } \
      method{ format } format{ } \
      use_filesystem{ } filesystem{ ext4 } \
      mountpoint{ /home } \
      options/nosuid{ nosuid } \

So it will look like this:

      $lvmok{ } lv_name{ home } \
      in_vg { box1 } \
      method{ format } format{ } \
      use_filesystem{ } filesystem{ ext4 } \
      mountpoint{ /home } \
      options/nosuid{ nosuid } \
      .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.