1

Currently I am trying to build a more or less dynamic preseed. This means I am creating custom templates/question and depending on the answers I want to set specific "d-i" options. My environment is ubuntu/debian using the debian-installer.

These are executed using the following command: d-i preseed/early_command string wget -qO preseed_early_command.sh http://myurl/preseed/server/bionic/preseed_early_command.sh && sh preseed_early_command.sh

Depending on the language selection I am trying to set specific options using debconf-set and it looks like they are recognized but I am still getting language dialog after early_command finishes (tho all set values are set correctly following the questions asked)

if [ "$(debconf-get language-select/select)" = "German" ]; then
    debconf-set debian-installer/language "de"
    debconf-set debian-installer/country "DE"
    debconf-set debian-installer/locale "de_DE.UTF-8"
    debconf-set console-setup/ask_detect false
    debconf-set keyboard-configuration/layoutcode "de"
    debconf-set keyboard-configuration/variantcode "nodeadkeys"
fi

How can I prevent the installer asking me the questions again despite being set? Is it even possible to manipulate the preseed in such a way I am trying to?

Depending on the machine type selection (i.e. Desktop / Headless) I would want to set the tasksel/pkgsel options. But these always fail with an error whether I am trying to run them directly or using debconf-set

if [ "$(debconf-get machine-type/select)" = "Ubuntu Desktop" ]; then
    debconf-set tasksel/first multiselect ubuntu-desktop
    debconf-set pkgsel/include openssh-server build-essential nano vim hardinfo htop remmina bash-completion dkms dialog
elif [ "$(debconf-get machine-type/select)" = "Ubuntu Headless" ]; then
    debconf-set tasksel/first multiselect standard
    debconf-set pkgsel/include "openssh-server nano vim htop bash-completion ntp"
fi

How are the "pkgsel/tasksel" options being executed/evaluated? Tasksel doesn't seem to be availabe at this stage as busybox throws not found.

  • While both topics are loosely related, there are two separate questions asked here. Could the second question please be moved into a separate post? As stated in in the FAQ, asking multiple questions at once is problematic. – sampi Feb 1 at 22:53
0

This answer only attempts to cover the first of the two questions asked.

Within the debian-installer debconf-set is a short shellscript, which merely source confmodule(3) and calls db_set $1 $2. The more useful command is debconf-set-selections which, as can by understood from debconf-set-selections(1), takes a file in the same format as a preseed file as its argument. Supposedly it should also accept data on stdin, but I was unsuccessful getting that to work in the debian-installer environment.

e.g.:

VALUES=`mktemp`
cat > "${VALUES}" << END_OF_DEBCONF
d-i time/zone string Antarctica/Troll
END_OF_DEBCONF
debconf-get-selections "${VALUES}"

Also. It might be simpler merely using preseed/run with a script, than reconstructing the same functionality by using preseed/early_command.

| improve this answer | |

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.