More CrunchBang 11

[If you don’t know who or what these (*) are, check the Glossary page.]

At The Robotic Frog, we’re still very much in love with CrunchBang 11 (Waldorf). It has a couple of small warts, but from our point of view, it’s performing brilliantly.

CrunchBang isn’t a Linux distribution that we would recommend to a complete Linux newbie. If you’re brand new to Linux, RoboFrog* recommends Xubuntu 12.04 or Linux Mint. (TheFrog prefers Xubuntu.) If you’re at all comfortable with using command line and a text editor, with a little persistence, you should be able to get CrunchBang to look and feel the way you want. It’s worth the effort.

CrunchBang 11: Apple Extended Keyboard

Wired Apple Keyboard

Wired Apple Keyboard (Photo credit: Jalada and Sefran)

I love the Apple Extended (aluminum) Keyboard. The touch is just right, the keys are large, and they’re well-spaced for my hands. I like the short keystroke too.

Fair warning: RoboFrog’s aunt has the same Apple Extended Keyboard and she hates it…because of the size of the keys and short keystroke. Go figure.

There are a couple of problems with it, though. First, it doesn’t have an Insert key. I use Freemind (mind-mapping software)…a lot. The keyboard command to insert a new node is…you guessed it…Insert. Some have recommended the Enter key on the number pad for this function, but Enter doesn’t do the same thing as Insert. Enter adds a new node to the root node…no matter which node is highlighted. Insert adds a new node to the highlighted node. With Numlock turned off, the Zero-key on the number pad will produce the Insert command. It’s a minor irritation, though, to remember to turn the number pad on and off each time I use Freemind. I prefer to have the number pad always turned on.

The Apple keyboard has several unused keys (in the Linux world): F13-F19. Those function keys are just sitting there taking up space…unless we give them a job. F13 looks like a good candidate for Insert…if we can figure out how to assign the Insert command to it.

Google It!

We talked last time about the power of Google (search engines) and man pages. Here’s how we used those tools to solve our Insert-key problem.

A Google search is almost always the best place to start solving a problem. We’re not the most sophisticated searchers; we keep it simple. First, think about what kind of information you want. In this case, we have an Apple Extended Keyboard; we want to assign the Insert command to an unused key; and, we think F13 (the F13 function key) is a terrific candidate since it’s near the location that we expect the Insert key on a PC keyboard. So here’s our Google search:

[apple extended keyboard insert f13]

As you can see, it’s simply a bunch of keywords identifying the three things we want to know something about: apple extended keyboard, insert, f13. F13 is a wild guess, but it makes the search more specific…and it does make a difference. The solution we finally choose does not come up if we search without the f13 keyword.

The Google search gives a list of links. The best of all worlds is if we get a link that say, “RoboFrog, here’s how to set the F13 key to Insert on your Apple Extended Keyboard with CrunchBang 11 running on BigDog.” That rarely happens. We’d like a specific solution to our problem, but more importantly, we’re looking for clues. One of the links says, “Apple Keyboard – ArchWiki.” This is from the Arch Linux documentation. Your first impression may be that this isn’t very useful because it’s about Arch Linux. We’re trying to configure CrunchBang Linux. That’s a mistake. We used Arch Linux for a long time and know what’s in their wiki documents. Arch-folk are expected to fix their own problems. To help with that, the Arch Linux community put together terrific documentation that they keep on the ArchWiki. I can’t count the number of problems that RoboFrog has solved with information HE* found on the ArchWiki. So, when an ArchWiki link pops up, we pay attention.

What did we find at the ArchWiki? We’re not going to repeat the wiki here. Click the link to see the wiki page. We’ll point out the sections in which we found useful information.

“Function keys do not work” — (ArchWiki)

It’s not that the function keys don’t work. It’s that you have to use the fn shift key to get to them because the keyboard defaults to the media keys. Here’s an example of a problem we didn’t even know that we had. We really like the media keys and we use them a lot. If you want an interesting exercise, try pressing the fn shift key to activate the function keys while, at the same time, holding down both the Control and Alt keys, then pressing F3 (Ctl+Alt+F3). (Experienced Linux-ers know that this is how you switch to a console window.) You have to be a contortionist to do this. Then, you have to press Ctl+Alt+F7 to return to your graphical environment and that’s even more difficult. It would be much better to shift the media keys rather than the function keys. So in this ArchWiki section, is a fix for this problem for Arch Linux…and, it works just fine with CrunchBang.

“Media Keys” — (ArchWiki)

We keep a utility called Tomboy running on all of our machines. It’s a notes application. A notes application is like having a pad of sticky-notes always available. It’s a terrific tool to have when problem solving. We copy and paste the information from the ArchWiki to a ‘sticky-note’ and continue looking for clues. That way we don’t have to keep going back and forth between web sites.

Reading down the ArchWiki page, we find a few more clues. Under the Media Keys section are the following:

  • ~/.Xmodmap
  • keycode 49 = less greater less greater bar brokenbar
  • “Then run xmodmap ~/.Xmodmap. This command can also go into ~/.bashrc.”
  • xev

That’s quite a lot of information and it took only a few minutes to get it. If your new to Linux, this is probably pretty scary stuff. If, however, you know a bit about configuration files, command line utilities, and shell scripting there are a bunch of clues here.

.Xmodmap is a configuration file and it’s located in the home directory (~/). I checked my home directory and there’s no .Xmodmap. That’s okay; it means that I need to create one.

[keycode 49 = …] When you press a key, it produces a number that the computer reads: a keycode. This tells us that we can take a known keycode (49 in this case) and assign stuff to it. We don’t want to play around with keycode 49, but if we can find the keycode for our F13 key, then this is how to assign a function to it. The information for the assignment is stored in our .Xmodmap configuration file. Apparently, that’s not enough, though.

[xmodmap] appears to be a utility program and we have to feed it the information in our .Xmodmap file. There’s another clue that I missed: “This command can also go into ~/.bashrc." Frankly, I’m a little embarrassed that I missed this one. It’s important, as you’ll see later.

[xev] This is the holy grail. It’s a utility program that displays the keycode for a key when we press it. Now we have a way to determine the keycode for our F13 function key.

We learned a lot. Even though this information isn’t specific to CrunchBang Linux (or whatever your favorite distribution) it’s very useful and applicable. The point is that we should scan links from our search even if they don’t appear applicable to our particular distribution. This is Linux and there are more things, from distribution to distribution, that are the same than are different.

Lazy Robot: Apple Aluminum Keyboard on Linux

You know what? Just as we like Robotic Frogs, we also like Lazy Robots (LR)! Going back to our search list, the third entry is for Lazy Robot. We consider that a good omen. Not only did we get a chuckle from the name, but we also got an exact solution to our problem…almost.

If we follow the link to Lazy Robot, we’re greeted immediately with a picture of the Apple Extended Keyboard. We’re in the right place. Lazy Robot does a terrific job of distilling things down to the essentials.

Scanning the page we see that the keycode for F13 is 191 and LR shows us how to assign Insert to the keycode. It doesn’t get much better than that.

That’s it. It will be enabled when you log in. If you want to enable it immediately, type this:

    $ xmodmap .Xmodmap

Magic. You now have an insert key.

Caveat emptor: I can’t tell you how grateful we are to folks like Lazy Robot for sharing information like this. It’s one of the reasons that we do what we do. But…there’s always a ‘but’, isn’t there? But this is only mostly right for our system. That’s not unusual, so be careful.

Here’s how we configure CrunchBang:

  • create a configuration text file in our home directory (/home/robofrog/.Xmodmap)
  • Add a line to the file: keycode 191 = Insert
  • From the command line execute: xmodmap ~/.Xmodmap

RoboFrog and I are doing high-fives. It works perfectly. Finally, I have an Insert key. No more shifting the number pad on and off. That is until I rebooted. Once I rebooted, no more Insert.

“Insert is gone,” says I.

“Did you add xmodmap to the start up script?”

HE* has that look on HIS* face. You know the one. The one that says, “Did you plug it in?” I just want to smack HIM. Actually, RoboFrog is the most patient of Frogs. Maybe the look is my imagination. Not!

“Try running xmodmap again,” says TheFrog.

I do…Magic!…I have Insert again. What does that tell me? That xmodmap must be run every time my system boots (Of course, TheFrog knows that.). No problem. I do that by putting the command in one of my startup scripts. CrunchBang gives me a simple way to do that.

Settings->Openbox->Edit autostart

Add this line to the Openbox autostart configuration file:

xmodmap ~/.Xmodmap &

Now Insert is assigned to F13 every time my system boots. More problem solving and the Apple keyboard next time.

We’re back … I think!

* If you don’t know who or what these are check the Glossary page.

Shoot-out At the OK Corral

RoboFrog is an irresistible force when HE* gets in one of HIS* moods, and trust me, for three weeks HE has been…grouchy. It all started innocently enough. Remember that Defiant’s* hard drive died. HE ordered a new one from allhdd.com and chose not to expedite the shipping. It took about seven days to get the drive.

NOTE: Our experience with allhdd.com was very good. They had the product that we wanted at a reasonable price. Their communication was excellent and the drive arrived at the promised time. We will definitely purchase from them in the future.

It’s fun to watch HIM* when when HE gets something like a new hard drive. I don’t think I’ve ever seen a kid in a toy store any happier or more excited. Replacing Defiant’s (IBM ThinkPad T43) hard drive isn’t a big deal. There’s an external cover to the drive bay on the right side of the machine, held on with one screw. To replace the drive remove the bay cover, slide the old drive out, remove the metal cage from the old drive and install it on the new drive, push the new drive into the bay, and replace the cover. That’s it. Install an operating system and you’re done. At least that’s what HE had hoped.

Note: There are two caveats when replacing a hard drive on a T43. First, they’re really picky about hard drives. You need to get one that specifically works with this machine. Check here for drive information. Second, don’t get the drive upside down. Make sure to maintain the same orientation for the new drive as the old.

That’s when things went bad and RoboFrog transformed from kid-in-the-toy-store to The Terminator. Changing the drive was no problem at all. Loading the operating system, though, turned into a three week nightmare.

I don’t want to get into a long discussion of Linux distributions and the trials and tribulations HE had trying to find a distribution that would work on all of our machines. Frankly, we’re both completely worn out with trying to find an acceptable Linux distribution.

First, we retired Untouchable* (at least temporarily). We decided that life had gotten too complicated. We’re going through a dramatic change, removing clutter, getting things organized, and looking for ways to simplify everything in our lives. We will undoubtedly write about this in the future, but for now, we decided that a desktop and a laptop were all we needed. Second, Untouchable got the boot because it’s the only 64-bit machine that we have. Now we install both machines from the same medium; that’s one small variable eliminated. Whitestar is our only desktop machine (I’m not counting Chatterbox, our file server) and Defiant our only laptop.

All of our equipment is older, on the order of eight years. We suspect that’s one of the reasons we’re experiencing so many Linux problems. We’re starting to consider new machines. To simplify things further, we may buy a very capable laptop with a docking station. That would bring us down to one machine plus the file server. Our biggest worry is that if our one machine dies, we’re completely out of business.

Back to finding a Linux distribution. RoboFrog started with Ubuntu Studio 11.10, and as I said, this is where the problems began. It worked…okay…not great. And, that’s when HIS mood went sour. HE shut down everything we were doing and informed me that we weren’t doing anything else until we had an acceptable operating system running on Defiant and Whitestar. Notice that I said “acceptable operating system.” For the first time in five years, HE put Windows™ back on the list of possibilities. I was stunned. I never thought I would hear that from HIM.

Over the past three weeks HE repeatedly installed

  • Ubuntu Studio 11.10
  • Xubuntu 11.10
  • PCLinuxOS 2012
  • Fedora 16 Xfce
  • Fedora 16 KDE
  • Arch Linux
  • Kubuntu

HE would run one of them for a couple of days thinking HE’d finally found us a home. Then a problem would pop up. After HE told MsRoboFrog, for the third time, that the problems were resolved SHE started giving HIM the evil-eye. I noticed that HE took Defiant to the basement and stopped mentioning computers to MsRoboFrog.

RoboFrog always had great confidence in the Linux world because no matter how many distributions HE tried or how much trouble HE had with them…HE always had Arch Linux to come back to. That confidence has been shaken.

Arch has been our favorite distribution for a long time. Sadly, we’re retiring Arch Linux. We get all of our news and media entertainment from the Internet. We read the morning news on Yahoo! and Google, stream music from Pandora, movies from Amazon, and TV from Hulu. All but the morning news depend on Adobe Flash Player® to deliver content. Something changed recently with Arch Linux and Flash. We tried Arch Linux a couple of times on both Defiant and Whitestar with the same results. Flash video looks more like a slideshow (and not a particularly fast one) than video. That’s a deal-breaker. We searched the Internet and Arch Forums, but found no way to correct the problem. We’ve lost an old friend.

You may wonder why, given the wireless problems we had with the *buntu’s, that we’re testing them again. Remember that we installed the Diamond Wireless Range Extender? Well, the problem with losing the wireless lock is gone. We’re very happy with the Diamond Wireless Range Extender.

So…who won? We’re holding our collective breaths, but HE has Kubuntu running on all three machines: Whitestar, Defiant, and Chatterbox*. (There’s an interesting story about Chatterbox and Kubuntu, but I’ll save that for another time.) Kubuntu is not just running okay; it’s running extremely well. We’ve been running Kubuntu for four days. Don’t laugh; that’s twice as long as any of the others.

We’re going to continue testing Kubuntu (and try to steer clear of MsRoboFrog for a while) and hope that we truly have resolved our Linux issues. For the moment, I don’t have to worry about HIM taking us back to Windows™. It wouldn’t be the end of the world, but it would certainly be a significant failure in what we’re trying to do here on the LilyPad.

More Kubuntu next time…and, I hope we’re back!

Making backup painless

* If you don’t know who or what this is, check the Glossary page.

*** WARNING: This is post pretty geeky. ***

Last time, we talked about how important backup is at The Robotic Frog. Let me show you how we made it painless.

First, let me describe the new computer setup here at RFCC*. We added a machine…Chatterbox*…that is our new file server. We’ll say more about Chatterbox next time, but for now, understand that it’s the machine that we have our backup hard drives connected to. Untouchable*, Whitestar*, and Defiant* talk to Chatterbox to back up their files. Untouchable and Whitestar are desk machines that sit side-by-side in RoboFrog’s office. They are situated so that HE* can turn ninty degrees without moving HIS* desk chair and use either one. Defiant is a laptop that sees service everywhere on the LilyPad. Check out the Glossary page if you’re interested in more detail about the machines.

Yesterday, we showed you our backup script. The script is named rbak. It is stored in the directory /home/bvines/Myfiles and must be executable. It’s also backed up in /home/bvines/Myfiles/Restore. Untouchable, Whitestar, and Defiant get shut down at the end of each day. Before they go down, we want everything that was created that day to be backed up. These machines run Arch Linux. Arch has a file /etc/rc.local.shutdown. If we place the command /home/bvines/Myfiles/rbak in this file then rbak runs each time the machine is shut down.

{

If you’re running Ubuntu: 1) copy rbak to /etc/init.d 2) make a symbolic link to rbak in /etc/rc6.d. The name of the symbolic link is important.

sudo cp /home/bvines/Myfiles/rbak /etc/init.d
cd /etc/rc6.d
sudo ln -s /etc/init.d/rbak A01rbak

}

This assures that these machines are backed up every time we shut them down. It’s automatic. We don’t have to hope that HE will remember to run rbak.

Chatterbox is different. It stays on 24/7. On Linux systems there’s a utility called cron. It runs programs or scripts periodically: hourly, daily, weekly, monthly. We run rbak daily on Chatterbox. To make this happen, copy rbak to /etc/cron.daily. Any program or script saved in this directory gets run once each day by cron. Again, it’s automatic.

This is a simple scheme for keeping up with our backups. It automates the entire process. We had occasion to test this system today. That story next time, but here’s how we restore a system.

*** rsto ***

#!/bin/bash
echo “”
echo “…restore thunderbird from backup…”
rsync -azr –stats /media/Media/Now/Myfiles_chatterbox/Restore/thunderbird/ /home/bvines/.thunderbird
echo “”
echo “…restore Myfiles from backup…”
echo “”
rsync -arz –stats /media/Media/Now/Myfiles_chatterbox/ /home/bvines/Myfiles
echo “”
echo “…restore complete…”
echo “”

##########

This is the restore script for Chatterbox. As I said, we needed to use it this morning and it worked perfectly. We keep a directory in every Myfile folder called Restore. It has information that we use to restore a machine. We keep a copy of rsto there. To restore a machine all we have to do is copy rsto from our backup drive to our main user, directory, /home/bvines in our case, then execute rsto (./rsto). Obviously, rsto must be executable. That’s all there is to it. Painless.

Next time…HE’s loose again!