site  contact  subhomenews

Norwegian keyboard layout fix

November 30, 2026 — BarryK

We have had this problem with the Norwegian keyboard for a long time, for example reported by forum tallboy:

https://forum.puppylinux.com/viewtopic.php?p=158593#p158593

Quoting tallboy:

I still have the same problem with my keyboard needing ASCII code to work on some keys, while others don't work at all.

We have worked on it, but no fix. Today, I thought, why not throw the problem at Claude AI. So far, I have been pretty much gobsmacked how clever Claude is, so decided give it a go. I uploaded a skeleton EasyOS rootfs and asked Claude:

This is a skeleton root filesystem for the EasyOS Linux distribution. A user with Norwegian layout keyboard has used the Xorg gui layout tool at usr/local/apps/XkbConfigurationManager/XkbConfigMngr but some keys on his keyboard do not work and he has to type ascii codes for them. Can you fix this?

Claude came up with a fix very quickly:

I'll extract the archive and look at the tool.

Checking the options scripts next, since AltGr (third level) keys are the usual casualty for Norwegian.

Status: the symbols and Lv3 script look stock, so I'm now checking the model chooser and the rules mapping.

Xvfb and setxkbmap are available, so I can test what each setting actually produces for Norwegian.

Running the actual scripts in a sandbox with a stubbed dialog to see what config they write for Norwegian.

The `==` is a dash-only failure in my sandbox (EasyOS uses busybox ash), so I'll use bash for the test.

The tool writes valid config, so the fault must be in what that config resolves to. Comparing what the keymap does with the keycodes a real evdev keyboard sends (AltGr = 108):

Verifying the fixed ApplyNow end-to-end on a legacy "xorg" config, then checking AltGr resolves correctly.

Fix works: AltGr is now keycode 108 (what the keyboard actually sends) and AltGr+7 gives `{`. Repacking the skeleton.

I've fixed it and repacked the skeleton, but I only tested the fix against the keymap compiler, not on a real Norwegian keyboard. The tool itself writes valid config. The problem was the keycode set that the `xorg` rules select.

**Cause:** the config tool and `10-evdev-puppy.conf` set `XkbRules` to `xorg`, which in this skeleton points to `base`. That uses the old `xfree86` keycodes, where AltGr is 113. A real keyboard through Xorg's evdev driver sends 108. I compiled the Norwegian keymap both ways to confirm.

So AltGr did nothing. Norwegian needs it for `@ $ { [ ] } \ ~ |`, which is why the user had to type ASCII codes. The arrow keys and KP_Enter are also remapped wrongly under those rules. The US layout needs none of these keys, so the problem only shows once someone picks Norwegian.

**Changes** (all in the tarball `rootfs-skeleton-easyos-fixed.tar.gz`):
- `XkbApplyNow` now runs `setxkbmap -rules evdev`, and rewrites an old `"XkbRules" "xorg"` line to `"evdev"` first.
- `XkbConfigMngr` does the same rewrite when it starts, so the fix also holds if the user skips "Yes" and waits for a reboot. This also repairs the user's existing config.
- `etc/X11/xorg.conf.d/10-evdev-puppy.conf` and the `.confMIX` copy now ship with `"XkbRules" "evdev"`.
- `usr/sbin/keymap-set` and `usr/sbin/quicksetup` also called `setxkbmap -rules xorg`, so I changed them to `evdev`. Otherwise they would have broken AltGr again after the tool fixed it. This is outside the Xkb tool, so revert it if you'd rather keep this change narrow.

**Check on the keymap:** with the evdev rules, AltGr is `ISO_Level3_Shift` on keycode 108 and AltGr+7 gives `{`. I also ran `XkbApplyNow` on a config containing `"xorg"` in a sandbox, and it came out as `"evdev"`. The test used bash because my sandbox shell is dash, which rejects the `==` in these scripts; EasyOS's busybox ash accepts it.

**Not changed:** `XkbVariantConfig` finds the chosen variant with a plain substring match. With several layouts, picking `1: nodeadkeys` could also match `11: …`. It doesn't affect a single Norwegian layout.

Yes, six files have been changed:

/etc/X11/xorg.conf.d/10-evdev-puppy.conf
/etc/X11/xorg.conf.d/10-evdev-puppy.confMIX
/usr/local/apps/XkbConfigurationManager/XkbApplyNow
/usr/local/apps/XkbConfigurationManager/XkbConfigMngr
/usr/sbin/keymap-set
/usr/sbin/quicksetup

I haven't looked at this fix in depth, and haven't tested it. Well, I don't have a Norwegian keyboard, but haven't tested if the fix breaks anything else. I have been so darn impressed with Claude, just taking this fix as good and have applied it. It will be in the next release of EasyOS.

One thought; EasyOS is staying with evdev, while many other Linux distributions have retired it, in favour of libinput, and if we go that path it might affect the above fixes. I need to do some more research about the difference between the two. Hey, why not ask Claude:

EasyOS is using evdev, but if in the future will change to using libinput, will the above fixes need to be reconsidered?

Claude reply:

No, the fixes should survive a move to libinput.

- **Keycodes:** the `evdev` in `-rules evdev` names the XKB keycode set, which is the kernel's event codes plus 8. It is not tied to the evdev driver. The libinput driver in Xorg produces the same codes. The legacy `xfree86` codes were only for the old `kbd` driver, so `evdev` rules are correct for either input driver.
- **XKB settings:** `XkbRules`, `XkbModel`, `XkbLayout` and `XkbOptions` are handled by the X server's XKB layer, not by the input driver. The tool's config entries and `setxkbmap` work the same under libinput. You would only change the `Driver "evdev"` line and the `MatchIsKeyboard` section header in `10-evdev-puppy.conf`.
- **Other changes in `10-evdev-puppy.confMIX`:** that file already moves the pointer, tablet and touchscreen sections to libinput but keeps the keyboard on evdev. The tool still finds `XkbLayout` there, so nothing else needs to change.

Three things are worth checking if you do switch:
1. **File names:** the scripts look for `10-evdev-puppy.conf` and read `/etc/X11/xkb/rules/evdev.lst`. If you rename the conf file or a future xkeyboard-config drops the `evdev` rules files, update those paths. Newer releases may merge `base` and `evdev`, so I'd confirm the files are still there after any upgrade.
2. **Wayland:** this tool only edits Xorg config, so it would not control the keyboard layout in a Wayland session.
3. **Rules name:** the `base` rules still use `xfree86` keycodes. Nothing in this fix needs them, but don't point anything back at `xorg` or `base`.

Then I asked:

EasyOS will be staying with Xorg, will not use Wayland

Claude reply:

Then the Wayland caveat doesn't apply, and the fix is complete as delivered. On Xorg with either evdev or libinput, `-rules evdev` and `XkbRules "evdev"` are the correct settings, and nothing else in the tool needs to change.

The only upkeep is the one from before. If a future xkeyboard-config update drops or renames the `evdev` rules files, the `evdev.lst` path in the scripts and the `evdev` rules name would need updating. I'd check after any xkeyboard-config upgrade.

...so, we have some guidance if switch to libinput.

If you are thinking it's a worry how clever Claude AI is, join the club.        

Tags: easy