Package: cloud.debian.org
Severity: important
Tags: l10n
X-Debbugs-Cc: neit...@archlinux.org

Dear Maintainer,

Trying to use the `keyboard: layout:` directive[0] in cloud-init config doesn't 
result in the virtual
console using it and the following error appears in the logs:

```
$ cloud-init status --long
status: error
boot_status_code: enabled-by-generator
last_update: Tue, 17 Jun 2025 12:13:30 +0000
detail:
('keyboard', ProcessExecutionError("Unexpected error while running 
command.\nCommand: ['systemctl', 'restart', 'console-setup']\nExit code: 
5\nReason: -\nStdout: \nStderr: Failed to restart console-setup.service: Unit 
console-setup.service not found."))

$ cat /var/log/cloud-init.log | grep keyboard
2025-06-17 12:59:56,968 - modules.py[DEBUG]: Running module keyboard (<module 
'cloudinit.config.cc_keyboard' from 
'/usr/lib/python3/dist-packages/cloudinit/config/cc_keyboard.py'>) with 
frequency once-per-instance
2025-06-17 12:59:56,968 - handlers.py[DEBUG]: start: 
modules-config/config-keyboard: running config-keyboard with frequency 
once-per-instance
2025-06-17 12:59:56,968 - util.py[DEBUG]: Writing to 
/var/lib/cloud/instances/iid-local01/sem/config_keyboard - wb: [644] 24 bytes
2025-06-17 12:59:56,968 - helpers.py[DEBUG]: Running config-keyboard using lock 
(<FileLock using file 
'/var/lib/cloud/instances/iid-local01/sem/config_keyboard'>)
2025-06-17 12:59:56,968 - cc_keyboard.py[DEBUG]: Setting keyboard layout to 'fr'
2025-06-17 12:59:57,021 - handlers.py[DEBUG]: finish: 
modules-config/config-keyboard: FAIL: running config-keyboard with frequency 
once-per-instance
2025-06-17 12:59:57,021 - util.py[WARNING]: Running module keyboard (<module 
'cloudinit.config.cc_keyboard' from 
'/usr/lib/python3/dist-packages/cloudinit/config/cc_keyboard.py'>) failed
2025-06-17 12:59:57,021 - util.py[DEBUG]: Running module keyboard (<module 
'cloudinit.config.cc_keyboard' from 
'/usr/lib/python3/dist-packages/cloudinit/config/cc_keyboard.py'>) failed
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_keyboard.py", line 
77, in handl
```

This is because `console-setup`[1] is missing in Debian cloud images.

Once added to the packages to be installed in cloud-init config, a minute or so 
after booting the virtual
console keymap and font change to the desired/correct values.

Working `user-data.yaml`:

```yaml
keyboard:
  layout: fr
locale: fr_FR.UTF-8

packages:
  - console-setup

bootcmd:
  - cloud-init-per once setlocales sed -i '/fr_FR.UTF/s/^# //' /etc/locale.gen
```

With this the console keymap and font switch from qwerty to azerty after about 
a minute.

Please include console-setup in the default set of packages on cloud images to 
resolve this issue!

This is related/adjacent to Bug#1107636[2].

Cheers

[0]: https://packages.debian.org/bookworm/console-setup
[1]: https://cloudinit.readthedocs.io/en/22.4.2/topics/modules.html#keyboard
[2]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1107636

Reply via email to