简体   繁体   中英

Packer: Creating a vmware box with with non-US keyboard layout

I went throught the packer / atlas tutorial and got everything working, that is, I managed to build a vmware box via packer build template.json .

I am fine with having everything in English (eg menus, help files, ...) but I need to use a keyboard with a non-US layout (German).

I tried to set the keyboard layout in the preseed.cfg , the file wich is part of the tutorial's git repo and tried the di commands I found in the ubuntu preseed documentation . The settings were ignored though. The keyboard layout was still US. The relevant lines of the original preseed.cfg from the tutorial's git repo are:

d-i debian-installer/locale string en_US.utf8
d-i console-setup/ask_detect boolean false
d-i console-setup/layout string USA

Fiddling with the boot commands in the template.json wasn't successful either (either still US-layout or installation did not went through any more). The relevant extract from the original template.json file is

"type": "vmware-iso",
"boot_command": [
"<esc><esc><enter><wait>",
"/install/vmlinuz noapic preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{ .Name }} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"initrd=/install/initrd.gz -- <enter>"
]

Could someone tell me how to configure packer, eg starting from the simple example from the packer / atlas tutorial , so that the built vagrant box has a keyboard layout set to German?

I eventually got it working with this boot_command:

"boot_command": [
                "<esc><esc><enter><wait>",
                "/install/vmlinuz noapic preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/my_preseed.cfg ",
                "debian-installer/locale=en_US keyboard-configuration/layoutcode=de ",
                "hostname={{ .Name }} ",
                "fb=false debconf/frontend=noninteractive ",
                "console-setup/ask_detect=false ",
                "initrd=/install/initrd.gz -- keyboard-configuration/layout=de <enter>"
            ],

and these lines in the pressed.cfg

# File starts here
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string de

#d-i netcfg/get_hostname string dummy
...

Yet, I don't know why this works and the other config did not. Does anybody know?

I also asked a question at "Unix & Linux" regarding (the difference between) configuration/layoutcode and keyboard-configuration/layout .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM