I am trying to automate a Ubuntu Server installation. I want to change some configurations after the installation, for example keyboard layout and time zone. Tried both 16.04 and 18.04, same problem.

After installation, changing configurations using the dpkg-reconfigure console menu works perfectly. I can change both the timezone and keyboard layout in the menu, and the configuration persists through the reboots.

However this approach is not possible during an automated install, therefore I would like to do this using the noninteractive frontend. My approach is like this, according to other answers I read:

I feed debconf selections with the desired configuration:

debconf-set-selections <<< "keyboard-configuration keyboard-configuration/layoutcode select de"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/layout select German"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/variant select German"

I check using debconf-show if the selections are properly set:

debconf-show keyboard-configuration

Afterwards I run dpkg-reconfigure with noninteractive backend:

sudo dpkg-reconfigure keyboard-configuration -f noninteractive

This unfortunately does not change the layout, furthermore listing the selections using debconf-show shows that the selections are reverted to the old values.

Setting DEBIAN_FRONTEND=noninteractive does not help. This is also the case for setting time zone data using tzdata.

What is the proper way to use the noninteractive frontend of dpkg-reconfigure? Any help would be appreciated.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.