Skip navigation

So you’re running Gentoo, you rebooted, and now your keyboard and mouse (which had worked just fine before) don’t work. Did you do a software update recently? If your copy of Xorg underwent a version bump, you’ll need to recompile your Xorg drivers to update how they talk to your X server.

First step: Get to a terminal, since X11 won’t work right for you until you fix it. If you’re running an SSH server on the machine, that’s easy; just SSH in. If you’re not, then perhaps you have a serial console enabled. (Admittedly unlikely…) You might try SysRq[1] If it comes down to it, you can simply reboot the computer (either tap the power button and let acpid reboot things for you, or give it a hard power off and face the consequences…) and edit your grub boot menu to add “gentoo=nox” to your kernel command line.[2] That’ll at least prevent X from starting on a given bootup.

Second step: Re-emerge all of your x11 drivers. The simplest command I’ve seen for this (to date)[3] is:

emerge -1a $(qlist -I -C x11-drivers/)

There are two commands here. The first that gets run is qlist, and the second is emerge.

emerge, of course, is your usual installation tool. The “-1” parameter tells it to “just build, don’t add this to our world file.” That’s useful if package A is installed as a dependency of package B, and you want to allow package A be automatically removed after package B is removed. The -a parameter tells emerge to ask for confirmation before doing anything.

qlist querie’s Portage’s database and returns lists. It’s found in app-portage/portage-utils, which you probably already have installed. The -I parameter asks it to list installed packages, and the -C parameter asks it to not use color codings. (That’s important, because color codes in the output would confuse emerge.) Finally, the “x11-drivers/” parameter asks it to limit its listing to those packages found under…x11-drivers/. So, it’ll only list installed X11 drivers. Handy.

The $() surrounding the qlist command takes the output of the command it’s run and applies it as part of the argument set to the command currently being processed–in this case, the emerge command.

Once you’ve run the command, you should be able to restart slim, gdm, kdm, nodm, or whatever you were using, or even simply restart your computer. X11 should work properly again after that.

[1] “Hold down Alt, hold down SysRq, press each of the keys in turn. The usual full sequence is R-E-I-S-U-B Reboot Even If System Utterly Broken” Thanks to Dale. Or Neil. Not sure.

[2] Thanks to CJoeB for noting this one.

[3] Thanks to Michael Hampicke for posting this one on the gentoo-user mailing list.

%d bloggers like this: