The Raspberry Pi Superuser

Fixing some pesky keyboard problems.

Introduction:

In the last segment, we installed elinks, a simple command line based browser. In this segment, we'll be fixing a problem that plagues keyboards with a US layout. Right now, open leafpad and try to type the @ and " characters. Huh? Is your keyboard suddenly dyslexic? Try typing a ~ character (hint: it's to the left of 1.) Wrong again, keyboard! What's the deal? Well, remember, the Raspberry Pi is British, so the default Raspbian distro is set to a British keyboard layout. How can this be changed? We're going to tell you how. Don't worry, it's a real simple fix.

Let's get started.



Checking that nano is installed

Nano is a classic command line text editor, created by GNU and present since the early days of Linux. It's easier for the beginner to use than Vim, and powerful enough for the superuser. To verify that you have it installed correctly, open an LXTerminal window and type the following lines.

sudo -s
apt-get install nano

If you have nano installed, you'll receive a message saying that it's up to date. If it's not installed, then allow it to install.

Fixing the keyboard

Now, it's time to get your keyboard in proper working condition. Open LXTerminal and type the following lines.

sudo -s
nano /etc/default/keyboard

And there it is, your keyboard layout file in all its glory. Now, to edit it.

Change
XKBLAYOUT="gb"
to
XKBLAYOUT="us"

Press Ctrl-X, say yes to save buffer, and hit enter. Your keyboard layout file may be changed, but it's not ready to use just yet. Type this into your terminal:

reboot

Give the system a few seconds. The screen will then go black, with a blinking white cursor. Don't press anything! Let the system cycle through and reboot, and then when the desktop appears, your new keyboard layout should be ready to use.

A little bit of fun

You may as well get used to it, you're going to get a little bit of fun at the end of every Raspberry Pi Superuser lesson. If you've been completing the lessons from the beginning, we may as well start calling you an uberuser.

Anyways, click here to download a small Python program. Make sure you save the file in /home/pi, and then open an LXTerminal window. Type the following lines.

sudo -s
apt-get install zip
cd /home/pi
unzip spirograph.zip
python3 spirograph.py

Enter the little bit of data needed, and watch the program go to work. It's a little slow on the Pi, but still pretty cool.

Copyright © Computer Sciences Club 2013