5

I am developing a replacement for the /sbin/init process that will run 1 time and then remove itself from the system. During development I need to be able to do some debugging. I have no SSH (or network, or even systemd for that matter). I cannot change the locale and reboot. I find it hard to believe that the only option is for me to buy a GB keyboard. Currently, this keyboard is connected to the RPi.

Requirements

  1. Type a | character
  2. No changes to the filesystem
  3. Work with a standard US keyboard
  4. Work with the latest Raspbian Lite (unmodified, as distributed)
    • This appears to be an issue with the GB locale

Update

https://github.com/RichardBronosky/pi-init2 now works and is totally awesome!

Raspberry Pi Pre Init

A program which lets you set up a Raspberry Pi solely by writing to the /boot partition (i.e. the one you can write from most computers!).

This allows you to distribute a small .zip file to set up a Raspberry Pi to do anything. You tell the user to unzip it over the top of the Pi's boot partition - the system can set itself up perfectly on the first boot. You no longer have to host entire distrobution images (like RetroPie).

Thanks for the help, everybody!

Bruno Bronosky
  • 1,540
  • 17
  • 20

5 Answers5

7

| = AltGr + Shift + `~

\ = AltGr + -_

One solution that I've found is to hold the AltGr key and press the `~ key. But I'm not sure if this would work for a normal "right alt" on a US keyboard. According to wikipedia, the answer is: it depends how the US keyboard was made. I happen to be using a CanaKit CK-KB-101 which is identical to this one and it has a key labeled AltGr. I had never heard of the "Alt Graph" key until this post.

Additional Info

The wikipedia article has a LOT of info. But the most important thing to know is that because the RPi is a British invention, the Raspbian OS ships configured for the GB keyboard that looks like this:

GB keyboard

And the US keyboard looks like this:

US keyboard

The immediate reaction of many is that you just have to locate the key with the proper markings. That is NOT the case. Many of the keys send different scancodes. And creating the proper scan codes is the issue.

Bonus

Although I couldn't use it in this case (because I'm bypassing the init/systemd all together), I'm going to link to another Q/A that might help people that get here via Google. How could one automate the raspbian raspi-config setup? In that answer I explain how you can set your locale and keyboard layout non-interactively (though not "without raspi-config").

Bruno Bronosky
  • 1,540
  • 17
  • 20
2

Press alt + ~` key next to the number 1 key it types a pipe

Gaberpont
  • 21
  • 1
1

The problem is the Raspberry pi foundation Raspbian image ships configured for a UK keyboard, while you have a US keyboard.

Keyboards do not send characters to the computer, they send "scan codes". This allows the same keyboard to be sold in many different countries with just the printing on the keys being changed.

However there are two different physical layouts, the 104 key US layout and the 105 key layout used for most non-US layouts. So when you go look at a British keyboard layout, find the key normally used to type the backslash and pipe then go looking for the key in the same location on your American keyboard it just doesn't exist.

Fortunately Linux provides* an alternative way to type these characters. In the UK keyboard layout the right hand alt key becomes "Alt Gr" and can be used as a modifier to type additional characters. The pipe can be typed by using altgr in combination with the key that is labeled as ",~" on a US keyboard while the backslash can be typed using altgr in combiantion with the key that is labeled "_-"

* Note: Linux seems to differ from windows in this regard. Windows types a "broken pipe" instead of a regular pipe.

Peter Green
  • 6,595
  • 1
  • 21
  • 26
-1

Try holding Alt, press 1, 2, 4 on the Numpad and release Alt again.

eltomato
  • 17
  • 3
-1

From the looks of your keyboard, you've got the pipe character right on it, above the Enter key. Pressing Shift+\ should get you what you're looking for. I know the symbol shown on the key is the "broken bar" (¦) but I'm pretty sure it will actually enter the plain old pipe character when you type it if it's a US keyboard and your input method is set to US/QWERTY.

Doktor J
  • 117
  • 4