pop-os / distinst

Installer Backend
GNU Lesser General Public License v3.0
221 stars 43 forks source link

chroot_conf: Write keyboard layout directly, avoiding localectl #325

Closed davidmhewitt closed 10 months ago

davidmhewitt commented 1 year ago

With Ubuntu Noble (24.04) based images, we get the following and the install fails:

log: INFO: configuring keyboard layout
log: INFO: running DEBIAN_FRONTEND="noninteractive" HOME="/root" LC_ALL="en_US.UTF-8" PATH="/usr/sbin:/usr/bin:/sbin:/bin" "chroot" "/tmp/distinst.KccLvDD3OjnV" "localectl" "set-x11-keymap" "us" "" ""
log: WARN: Setting X11 and console keymaps is not supported in Debian.
log: ERROR: configuring chroot error: error setting keyboard layout: command failed with exit status: exit status: 1

See https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2030788

Essentially localectl no longer supports setting keyboard config in Debian and Ubuntu.

So, we change to writing the keyboard config to /etc/default/keyboard instead.

I've tested this with elementary OS images based on Ubuntu 22.04 and the upcoming 24.04. I've confirmed that it fixes the 24.04 bug and continues to work correctly on 22.04.

My testing has involved setting non-US keyboard layouts (gb, gb/colemak), and checking they are used on the disk decryption screen, which they are.

Unsure how this behaves once in a graphical session, as we set the keyboard layout again in the initial setup in elementary OS. But I believe that this is all localectl was doing anyway before the functionality was removed.

Will need some further testing, but this should be a possible fix for installation failures on newer Ubuntu bases.