2

It's been a couple of days now that I am trying to make a fully automated unattended installation. I managed to make it work with Ubuntu/Cobbler and a preseed file, but I cannot set the correct keyboard layout which is Norwegian in this case.

I am doing the tests on a virtual machine and when I am going with a normal manual installation (no preseed) everything is working fine. When I am using the preseed file, I always end up with an "English (US)" keyboard no matter the many different options I have tried.

I can change it manually with the "dpkg-reconfigure keyboard-configuration" command, but that's not the case. It should be handled automatically using the preseed file.

I am using DEBCONF_DEBUG=5 when the grub is loading, and as I see in "/var/log/installer/syslog" file after the installation has finished, the preseeding commands are accepted.

Can anyone help on this? The preseed file I am using is following:

d-i debian-installer/country string NO
d-i debian-installer/language string en_US:en
d-i debian-installer/locale string en_US.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layout select Norwegian
d-i keyboard-configuration/variant select Norwegian
d-i keyboard-configuration/modelcode string pc105
d-i keyboard-configuration/layoutcode string no
d-i keyboard-configuration/xkb-keymap select no
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string myhostname
d-i netcfg/get_domain string simula.no
d-i hw-detect/load_firmware boolean true
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.uninett.no
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string http://10.0.1.253:3142/
d-i mirror/codename string precise
d-i mirror/suite string precise
d-i clock-setup/utc boolean true
d-i time/zone string Europe/Oslo
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string 10.0.1.254
d-i partman-auto/method string lvm
partman-auto-lvm partman-auto-lvm/new_vg_name string vg0
d-i partman-auto/purge_lvm_from_device boolean true
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-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select 30atomic
d-i partman/default_filesystem string ext4
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
d-i partman/mount_style select uuid
d-i passwd/root-login boolean false
d-i passwd/make-user boolean true
d-i passwd/user-fullname string vangelis
d-i passwd/username string vangelis
d-i passwd/user-password-crypted password $6$asdafdsdfasdfasdf
d-i passwd/user-uid string
d-i user-setup/allow-password-weak boolean false
d-i passwd/user-default-groups string adm cdrom dialout lpadmin plugdev sambashare
d-i user-setup/encrypt-home boolean false
d-i apt-setup/restricted boolean true
d-i apt-setup/universe boolean true
d-i apt-setup/backports boolean true
d-i apt-setup/services-select multiselect security
d-i apt-setup/security_host string security.ubuntu.com
d-i apt-setup/security_path string /ubuntu
tasksel tasksel/first multiselect Basic Ubuntu server, OpenSSH server
d-i pkgsel/include string build-essential htop vim nmap ntp
d-i pkgsel/upgrade select safe-upgrade
d-i pkgsel/update-policy select none
d-i pkgsel/updatedb boolean true
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i finish-install/keep-consoles boolean false
d-i finish-install/reboot_in_progress note
d-i cdrom-detect/eject boolean true
d-i debian-installer/exit/halt boolean false
d-i debian-installer/exit/poweroff boolean false

2 Answers 2

2

The installer seems to be broken. For all recent Ubuntu versions, it just seems to ignore preseeded keyboard settings and to always set US layout. A work-around is to use the "late_command" and set the Norwegian layout manually.

d-i preseed/late_command string \
 in-target /bin/sed -i "s/XKBMODEL=\"[a-z]*\"/XKBMODEL=\"pc105\"/g"        
/etc/default/keyboard ; \
 in-target /bin/sed -i "s/XKBLAYOUT=\"[a-z]*\"/XKBLAYOUT=\"no\"/g"
/etc/default/keyboard ; \
 in-target /bin/sed -i "s/XKBVARIANT=\"[a-z]*\"/XKBVARIANT=\"\"/g"
/etc/default/keyboard ; \
 in-target /bin/sed -i "s/XKBOPTIONS=\"[a-z]*\"/XKBOPTIONS=\"\"/g"
/etc/default/keyboard ; \
 in-target /usr/sbin/dpkg-reconfigure -fnoninteractive keyboard-configuration ; \
 in-target /usr/sbin/update-locale LC_TIME=en_GB.UTF-8 LC_MESSAGES=POSIX

Note, that "/usr/sbin/dpkg-reconfigure -fnoninteractive keyboard-configuration" is necessary to get the new layout configured for X11 as well. Although the documentation says that editing /etc/default/keyboard is fine, X11 will not use the new layout unless "/usr/sbin/dpkg-reconfigure keyboard-configuration" is run.

Finally, "/usr/sbin/update-locale LC_TIME=en_GB.UTF-8" is used to get a 24-hour clock with an en_IE.UTF-8 locale (metric, €, etc., but AM/PM clock). (A European English locale "en_EU.UTF-8" would be a nice feature.)

Needless to say that this work-around is really ugly, and the installer should be fixed to automatically set the proper keyboard layout.

See also https://bugs.launchpad.net/ubuntu/+source/console-setup/+bug/1553147/comments/11 .

1

I found one solution but it is not answering exactly my question (preseed every option). Still better than no solution.

Adding the following kernel options end up with a Norwegian keyboard:

keymap=no debian-installer/keymap=no

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .