ubuntu-12.04 – 设置键盘配置的debconf选择失败…布局最终为阿富汗尼

前端之家收集整理的这篇文章主要介绍了ubuntu-12.04 – 设置键盘配置的debconf选择失败…布局最终为阿富汗尼前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一台我安装的机器,带有德语键盘设置,但它忽略了我的设置,并且安装了美国键盘.我确定我设置了它,因为如果我没有设置它,它会交互式地询问,但我想要一个无人值守的安装.

这是Ubuntu 12.04.3

所以现在之后,我想编写一个修复程序,使其成为德语键盘.

所以首先我在一台机器上交互式设置设置,然后读取设置以查看它们的值,然后在另一台机器上,我设置选择:

debconf-set-selections <<< "keyboard-configuration keyboard-configuration/altgr select The default for the keyboard layout"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/compose select No compose key"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/ctrl_alt_bksp boolean false"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/layoutcode string de"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/layout select German"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/modelcode string pc105"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/model select Generic 105-key (Intl) PC"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/optionscode string "
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/store_defaults_in_debconf_db boolean true"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/switch select No temporary switch"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/toggle select No toggling"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/unsupported_config_layout boolean true"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/unsupported_config_options boolean true"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/unsupported_layout boolean true"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/unsupported_options boolean true"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/variantcode string "
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/variant select German"
debconf-set-selections <<< "keyboard-configuration keyboard-configuration/xkb-keymap select "

然后我用以下方式显示选择:

debconf-show keyboard-configuration

这是输出

* keyboard-configuration/modelcode: pc105
* keyboard-configuration/unsupported_config_options: true
* keyboard-configuration/unsupported_config_layout: true
* keyboard-configuration/toggle: No toggling
* keyboard-configuration/compose: No compose key
* keyboard-configuration/layout: German
* keyboard-configuration/xkb-keymap:
* keyboard-configuration/variant: German
  debian-installer/console-setup-udeb/title:
* keyboard-configuration/switch: No temporary switch
* keyboard-configuration/unsupported_options: true
  console-setup/detect:
  console-setup/detected:
* keyboard-configuration/altgr: The default for the keyboard layout
* keyboard-configuration/ctrl_alt_bksp: false
* keyboard-configuration/unsupported_layout: true
* keyboard-configuration/variantcode:
* keyboard-configuration/model: Generic 105-key (Intl) PC
* console-setup/ask_detect: false
* keyboard-configuration/layoutcode: de
  keyboard-configuration/other:
* keyboard-configuration/store_defaults_in_debconf_db: true
* keyboard-configuration/optionscode:

然后重新配置包以使系统实际使用设置,我运行:

DEBIAN_FRONTEND=noninteractive dpkg-reconfigure keyboard-configuration

这是输出

update-initramfs: deferring update (trigger activated)

然后检查发生了什么,我再次检查设置:

debconf-show keyboard-configuration

这是输出

* keyboard-configuration/modelcode: a4techKB21
  keyboard-configuration/unsupported_config_options: true
  keyboard-configuration/unsupported_config_layout: true
* keyboard-configuration/toggle: Caps Lock
* keyboard-configuration/compose: No compose key
* keyboard-configuration/layout: Afghani
* keyboard-configuration/xkb-keymap: af
* keyboard-configuration/variant: Afghani
  debian-installer/console-setup-udeb/title:
* keyboard-configuration/switch: No temporary switch
  keyboard-configuration/unsupported_options: true
  console-setup/detect:
  console-setup/detected:
* keyboard-configuration/altgr: The default for the keyboard layout
* keyboard-configuration/ctrl_alt_bksp: false
  keyboard-configuration/unsupported_layout: true
* keyboard-configuration/variantcode:,* keyboard-configuration/model: A4Tech KB-21
* console-setup/ask_detect: false
* keyboard-configuration/layoutcode: us,af
  keyboard-configuration/other:
* keyboard-configuration/store_defaults_in_debconf_db: true
* keyboard-configuration/optionscode: grp:caps_toggle,grp_led:scroll

为什么哦为什么把它变成阿富汗布局(在每个问题的字母表中首先选择)?为什么它不能只使用我的设置,或者至少忽略它们,而不是用伪造的值设置它们!

在过去,我使用了更像这样的东西,但与其他东西(如后缀等):

apt-get install --reinstall keyboard-configuration

但在这种情况下使用键盘配置,它的作用与之相同

DEBIAN_FRONTEND=noninteractive dpkg-reconfigure.

在重新配置之前,我还将交互式设置机器与上面编写的机器进行了比较,除了具有id的“grub-pc grub-pc / install_devices …”之外,整个机器的debconf是相同的,显然不是相关.如果我在交互式安装的机器上运行脚本方法,它不会重置为阿富汗尼,因此尽管debconf相同,系统的行为也不同.

这个问题有方法解决吗?

我已经看到了:

What does “dpkg-reconfigure keyboard-configuration” actually do?
http://ubuntuforums.org/showthread.php?t=1793250
automate dpkg-reconfigure tzdata

我理解你对这个的沮丧.以下是我在类似情况下处理此问题的方法(流浪者条款),所以希望这一天到来.

关键是使用debconf-utils来描述配置.第一:

sudo apt-get install debconf-utils

您可以使用以下命令查看当前配置:

debconf-get-selections | grep keyboard-configuration

处理所有这些配置选项可能有点繁琐,因此您可能希望在一台计算机上执行交互式dpkg-reconfigure键盘配置,如在建议的解决方案中那样.然后,使用上面的命令将新设置导出到新文件,例如file.conf.

文件传输到需要配置的计算机,并:

debconf-set-selections < file.conf
dpkg-reconfigure keyboard-configuration -f noninteractive

真的是这样的.

奖励:Ansible任务

如果你使用Ansible,这是我的剧本的一部分:

- name: Configuring keyboard [creating file]
  template: src=templates/deb-keyboard.conf.j2 dest=/home/vagrant/.deb-keybard.conf
  register: debconf_template

- name: Configuring keyboard [setting selections]
  shell: debconf-set-selections < /home/vagrant/.deb-keybard.conf
  become: true
  when: debconf_template.changed
  # or use handlers

- name: Configuring keyboard [reconfiguring dpkg]
  command: dpkg-reconfigure keyboard-configuration -f noninteractive
  become: true
  when: debconf_template.changed

猜你在找的Ubuntu相关文章