1

Recently I inherited a lab but unfortunately the person who had setup has left the organization. I am finding trouble in understanding the pxe installation flow at the point where the debconf variables are initialized in the preseed configuration.

part of preseed configuration:

### Account setup
d-i passwd/user-fullname string TEST User
d-i passwd/username string test
d-i passwd/user-password-crypted password xxxxxxxxxxxxxxxxxxxxxxxxxxx
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false

### Boot loader installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true

### Finishing up the installation
d-i finish-install/reboot_in_progress note

### Custom stuff, update pre-late.sh if creating new variables
base-config      test/http/server       string 
base-config      test/ubuntu/release    string 16.04 
base-config      test/nfs/server        string 10.44.55.5
base-config      test/nfs/config        string /export/vol01/ubuntu/config
base-config      test/nis/domain        string ccd
base-config      test/nis/server        string 10.44.55.100 10.44.55.101

#### Advanced options
d-i preseed/late_command   string wget http://10.44.55.5/ubuntu/config/pre-late.sh -O /tmp/pre-late.sh; sh -x /tmp/pre-late.sh
d-i     preseed/run     string classes.sh

The above mentioned debconf variables test/ubuntu/release, test/nfs/server, test/nfs/config, test/nfs/domain and test/nis/server are being extracted and set the environment variables as shown below in the pre_late-sh script that is executed with preseed/late_command in the above preseed configuration.

#!/bin/sh

#Source debconf library
. /usr/share/debconf/confmodule

db_get test/ubuntu/release
export RELEASE="$RET"
db_get test/nfs/server
export NFS_SERVER="$RET"
db_get test/nfs/config
export NFS_CONFIG="$RET"
db_get test/nis/domain
export NIS_DOMAIN="$RET"
db_get test/nis/server
export NIS_SERVER="$RET"

I tried to google a lot about the way of initializing the debconf variables but not able to understand the way they are getting initialized here using base-config. Can someone help me to understand how is this being done?

1

Preseeding stores the defined variables in the appropriate debconf database; the installer’s for d-i-owned variables, the system’s (in /var/cache/debconf) for others. So all the base-config variables end up stored in the system debconf database.

db_get, which is provided by /usr/share/debconf/confmodule, retrieves the value of the named variable from the debconf database, and stores it in the RET variable. So

db_get test/ubuntu/release
export RELEASE="$RET"

retrieves the value of test/ubuntu/release, and stores it in the environment variable RELEASE.

See the preseeding page on the Debian wiki for details of preseeding, and the debconf page on the Debian wiki for details of debconf.

3
  • @ Stephen - Thanks for your explanation. So, is there no specific format to the base-config variable defined? Is the name "test/nfs/server" just a simple text? Will it work even if I change "test/nfs/server" to "nfs/server" by removing the word test? – Karthik Aug 27 '20 at 9:59
  • 1
    base-config is a historical remnant. You can remove test/; but you should have a unique prefix on your variables, to avoid conflicts in future. Since this is specific to your organisation, your organisation’s name would make a suitable prefix IMO. – Stephen Kitt Aug 27 '20 at 10:01
  • @ Stephen - Thank you very much for your answer. Now it is clear. – Karthik Aug 27 '20 at 10:22

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.