1

During installation I just want to run a set of commands and not do all the settings with raspi-config.

How can I set the keyboard layout just with the command line without any further interaction / UIs?

3
  • Does this answer your question? Simple Keyboard Configuration
    – Dougie
    Commented Dec 4, 2021 at 10:11
  • If you use ctrl-shift-x in raspberry pi imager, the keyboard setting can be set there - best way to do it "during installation"
    – Bravo
    Commented Dec 5, 2021 at 9:56
  • @Dougie I also saw that post but wanted something without any interaction / clicking / typing
    – Kai Walter
    Commented Dec 5, 2021 at 15:58

2 Answers 2

2

I figured out this sed command line to set e.g. german keyboard layout:

sudo sed -i -e 's/XKBLAYOUT="[a-z][a-z]"/XKBLAYOUT="de"/' /etc/default/keyboard
1

It's possible to do this via raspi-config nonint do_configure_keyboard. E.g. raspi-config nonint do_configure_keyboard us sets the US keyboard layout.

Reference: Where can I learn about the raspi-config noint parameters?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.