Ubuntu Preseed 设置了挪威语键盘?

Ubuntu Preseed 设置了挪威语键盘?

几天前,我一直在尝试进行全自动无人值守安装。我设法让它与 Ubuntu/Cobbler 和预置文件一起工作,但我无法设置正确的键盘布局,在本例中是挪威语。

我在虚拟机上进行测试,当我进行常规手动安装(无预置)时,一切都运行正常。当我使用预置文件时,无论我尝试了多少不同的选项,我总是得到“英语(美国)”键盘。

我可以使用“dpkg-reconfigure keyboard-configuration”命令手动更改它,但事实并非如此。它应该使用预置文件自动处理。

我在 grub 加载时使用 DEBCONF_DEBUG=5,并且正如我在安装完成后在“/var/log/installer/syslog”文件中看到的那样,预置命令被接受。

有人能帮忙吗?我使用的预置文件如下:

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

答案1

安装程序似乎已损坏。对于所有最新的 Ubuntu 版本,它似乎只是忽略了预置的键盘设置并始终设置美国布局。一种解决方法是使用“late_command”并手动设置挪威布局。

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

请注意,要为 X11 配置新的布局,还需要“/usr/sbin/dpkg-reconfigure -fnoninteractive keyboard-configuration”。尽管文档说编辑 /etc/default/keyboard 就可以了,但除非运行“/usr/sbin/dpkg-reconfigure keyboard-configuration”,否则 X11 将不会使用新的布局。

最后,“/usr/sbin/update-locale LC_TIME=en_GB.UTF-8”用于获取具有 en_IE.UTF-8 区域设置的 24 小时制时钟(公制、€ 等,但 AM/PM 时钟)。(欧洲英语区域设置“en_EU.UTF-8”将是一个不错的功能。)

不用说,这种解决方法确实很糟糕,并且安装程序应该被修复以自动设置正确的键盘布局。

也可以看看https://bugs.launchpad.net/ubuntu/+source/console-setup/+bug/1553147/comments/11

答案2

我找到了一个解决方案,但它并没有完全回答我的问题(预先设定每个选项)。但总比没有解决方案要好。

添加以下内核选项最终会得到挪威语键盘:

keymap=no debian-installer/keymap=no

相关内容