You are not logged in.

#1 2023-11-28 17:15:51

grimor
Member
From: Spain
Registered: 2023-10-27
Posts: 21

[SOLVED] Keyboard layout wrong on Arch Linux emergency mode

If on Arch Linux emergency mode:

systemd.unit=emergency.target

I change US keyboard layout to Spanish:

# loadkeys es

special characters fail.

For example: if I type "ñ" shell shows "". If I type "¿" shell shows "A¿". If I type "ç" shell shows "A∮".

Last edited by grimor (2023-11-30 17:12:35)

Offline

#2 2023-11-28 21:38:17

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,054

Re: [SOLVED] Keyboard layout wrong on Arch Linux emergency mode

That's not the keyboard layout but the locale.

Online

#3 2023-11-29 10:43:25

grimor
Member
From: Spain
Registered: 2023-10-27
Posts: 21

Re: [SOLVED] Keyboard layout wrong on Arch Linux emergency mode

seth wrote:

That's not the keyboard layout but the locale.

OK. But works fine on Recovery (init=/bin/sh) and Rescue (systemd.unit=rescue.target) Modes. Not in Emergency sad.

Offline

#4 2023-11-29 12:32:56

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,054

Re: [SOLVED] Keyboard layout wrong on Arch Linux emergency mode

So fix the locale?

Is this btw. some sort of https://en.wikipedia.org/wiki/XY_problem
Why do you want to enter anything spanish/utf-8 in the emergency shell. It's for emergency to fix the system.

Online

#5 2023-11-29 15:45:20

grimor
Member
From: Spain
Registered: 2023-10-27
Posts: 21

Re: [SOLVED] Keyboard layout wrong on Arch Linux emergency mode

seth wrote:

So fix the locale?

Is this btw. some sort of https://en.wikipedia.org/wiki/XY_problem
Why do you want to enter anything spanish/utf-8 in the emergency shell. It's for emergency to fix the system.

I run

locales=es_ES.UTF-8

on Emergency shell but doesn't work. Also, I add

locales=es_ES.UTF-8 systemd.unit=emergency.target

like kernel parameter on GRUB screen but doesn't work.

Last edited by grimor (2023-11-29 15:47:25)

Offline

#6 2023-11-29 19:44:26

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,054

Re: [SOLVED] Keyboard layout wrong on Arch Linux emergency mode

Where did you pick up that nonsense?
https://wiki.archlinux.org/title/Locale

Also you didn't explain why you think you want to enter UTF-8 text in an emergency shell.
What kind of problem are you actually trying to fix here?

Online

#7 2023-11-29 20:58:37

grimor
Member
From: Spain
Registered: 2023-10-27
Posts: 21

Re: [SOLVED] Keyboard layout wrong on Arch Linux emergency mode

seth wrote:

Where did you pick up that nonsense?
https://wiki.archlinux.org/title/Locale

On Debian-based systems it works like this. I thought it was the same in Arch Linux. My apologies.

seth wrote:

Also you didn't explain why you think you want to enter UTF-8 text in an emergency shell.
What kind of problem are you actually trying to fix here?

I don't have any problems currently. It's only for test purposes. It's to add it on my own user manual for Arch. Sorry again.

If the moderators want to close this thread, that's no problem for me.

Offline

#8 2023-11-29 21:03:48

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,054

Re: [SOLVED] Keyboard layout wrong on Arch Linux emergency mode

You'd need to interpret the parameter w/ some userspace process, in doubt the shellrc. Otherwise it won't do anything.

There's no reason to close this, but if you managed to fix your locale and understand and "solved" your original problem, please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Also please be aware that you'll unlikely be in the position where you want to enter some non-ascii text from the emergency shell specifically.

Online

#9 2023-11-29 21:55:07

grimor
Member
From: Spain
Registered: 2023-10-27
Posts: 21

Re: [SOLVED] Keyboard layout wrong on Arch Linux emergency mode

seth wrote:

please be aware that you'll unlikely be in the position where you want to enter some non-ascii text from the emergency shell specifically.

Well. I usually use cryptsetup and eCryptfs. My passwords use special characters. I am used to using the keyboard with Spanish configuration. I don't know the key layout of the English keyboard well. If one day I have to rescue my encrypted volumes, a keyboard layout in "Spaniard" will come in handy.

Offline

#10 2023-11-30 07:17:18

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,054

Re: [SOLVED] Keyboard layout wrong on Arch Linux emergency mode

The question would however not about the layout (you set that) but the locale.
https://wiki.archlinux.org/title/Dm-cry … mkinitcpio

Online

#11 2023-11-30 17:12:09

grimor
Member
From: Spain
Registered: 2023-10-27
Posts: 21

Re: [SOLVED] Keyboard layout wrong on Arch Linux emergency mode

Bingo!

In Emergency Mode or Normal Mode:

- Edit '/etc/locale.gen' and uncomment "#es_ES.UTF-8 UTF-8":

# nano /etc/locale.gen

* Before:

#es_ES.UTF-8 UTF-8

* After:

es_ES.UTF-8 UTF-8

- Generate the locales:

# locale-gen

- Add LANG variable:

# echo LANG=es_ES.UTF-8 > /etc/locale.conf

- Define keyboard layout:

# echo KEYMAP=es > /etc/vconsole.conf

- Edit '/etc/mkinitcpio.conf' file and move keyboard word before autodetect word in HOOK parameters:

# nano /etc/mkinitcpio.conf

*Before:

HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block encrypt lvm2 filesystems fsck)

*After:

HOOKS=(base udev keyboard autodetect modconf kms keymap consolefont block encrypt lvm2 filesystems fsck)

- Regenerate initramfs image:

# mkinitcpio -p linux

- Reboot system and return to Emergency Mode

Now Emergency, Recovery and Rescue Modes have Spanish keyboard by default correctly without errors in special characters.

Thanks once again, seth.

Offline

Board footer

Powered by FluxBB