The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Things look quiet here. But I've been doing a lot of blogging at dan.langille.org because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

Make the keyboard work on a headless server (read also about t-shirts!) 17 December 2001
Share
Need more help on this topic? Click here
This article has 13 comments
Show me similar articles

Last week I bought a computer from the fine folks at OEM Express. It is a AMD Duron 900MHZ with 128MB RAM, a 32X CDROM, and a Maxtor 40GB 7200RPM UDMA133 drive. No keyboard. No mouse. No monitor. This box is destined to be a server. Actually, it is destined to become a live backup of this webserver. Over the weekend, 4.4 was installed from CD, cvsup was run to get the latest sources, and then I built and installed world. It's now on 4.4-STABLE.

The box appears to be quite fast. Here are the build times:

StepElapsed
build world01:09
install world00:11
build kernel00:11
install kernel00:01

That seems pretty damn fast to me!

The keyboard issue

I have more computers than I do keyboards and monitors. So the box I built doesn't have a keyboard attached most of the time. But I found that if I did attach a keyboard to the box, I couldn't use it. That is, I couldn't use the keyboard if it was attached after the box was booted. Please note that I'm using a PS/2 keyboard not a USB keyboard.

The solution is fairly easy. Look in your kernel configuration file for this entry:

device          atkbd0  at atkbdc? irq 1 flags 0x1

Change the above to this:

device          atkbd0  at atkbdc? irq 1

The reason you want to remove the flag is found in man atkbd:

bit 0 (FAIL_IF_NO_KBD)

By default the atkbd driver will install even if a keyboard is not actually connected to the system. This option prevents the driver from being installed in this situation.

I was confused by the above description. I was thinking in terms of the kernel, not the driver. In the man page, "by default" refers to the driver, not the kernel. By default, the driver will always install, even if the keyboard is not present. The GENERIC kernel, on the other hand, uses flags 0x1, which unloads the driver if a keyboard is not found

After making the above changes and building a custom kernel, I rebooted without the keyboard attached. After the system started up, I reattached the keyboard and tried it. It worked!

Well, that's kind of stupid. Why not make that the default?

That was my thought initially. This is silly. Why not have GENERIC always load the keyboard driver? I found the answer was unexpected. It is this way because of syscons limitations. It cannot handle more than one keyboard at a time. Therefore, if atkbd doesn't find a keyboard, it goes away to allow the USB keyboard driver a chance to get the keyboard.

A similar problem exists with USB keyboards, but I don't know how to fix that one.

My thanks to Doug White for explaining this to me.

T-Shirts

I've been toying with the idea of t-shirts for The FreeBSD Diary and for FreshPorts. I think they'd go for about US$19.95 plus shipping. That is slightly more than you'd pay for most t-shirts, but you'll be supporting the Diary/FreshPorts. I don't mind writing the articles, but I'd prefer the website to pay for itself.

If you'd like to know more about the t-shirts, please read this message in the forum.

Share
Need more help on this topic? Click here
This article has 13 comments
Show me similar articles