USB Guard locked my keyboard and mouse when I changed battery

Asked by VanillaMozilla on 2021-04-30

USB Guard locked my keyboard and mouse when I changed battery. Normal booting leaves the keyboard and mouse inoperational. The only way I can use the computer is to boot with Upstart. Booting in recovery mode does not work either. The instant I press a key to make a selection and complete the startup process, I get a message that usbguard has locked the keyboard.

The fact that Ubuntu grub provided the option to boot with Upstart seems like a very fortunate accident. Without that option my computer would be bricked. I can't assume that option will be available indefinitely. I'll be happy to provide any diagnostic information, for a limited time.

I assume and hope that uninstalling USBGuard will solve the problem. Unless the problem can be permanently repaired beyond any question, that's exactly what I'm going to do. Any thoughts?

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:

This is Ubuntu 16.04 LTS with usbguard 0.7.2-0pmjdebruijn1-xenial.

Manfred Hampl (m-hampl) said : #2

The usbguard package that you have installed comes from a foreign source, probably
If you have a problem with it, then you have to ask there.

Are you aware that support for Ubuntu xenial has ended a week ago, five years after publication?
(It is only in ESM status - a paid extended support period for servers).

Manfred Hampl (m-hampl) said : #3

I do not understand why usbguard should block your keyboard or mouse after changing the battery. This should neither change the USB ID, nor have an influence on the port number.

Manfred Hampl (m-hampl) said : #4

What kind of keyboard and mouse are these?
How are they connected?

Ordinary Dell USB devices, connected directly to the back of the computer. There's nothing special about them. Will supply more info if needed.

I don't know why USBGuard blocks them after a battery change, but it definitely does. Here's the relevant part of rules.conf if that helps (with serials and hash removed).
allow id .... serial "" name "Optical USB Mouse" hash "...." parent-hash "...." via-port "6-1" with-interface 03:01:02
allow id .... serial "" name "Dell USB Keyboard" hash "...." parent-hash "...." via-port "6-2" with-interface 03:01:01
allow with-interface equals { 08:*:* }
reject with-interface all-of { 08:*:* 03:00:* }
reject with-interface all-of { 08:*:* 03:01:* }
reject with-interface all-of { 08:*:* e0:*:* }
reject with-interface all-of { 08:*:* 02:*:* }

Yes, this is Pascal de Bruijn's PPA. Will ask him, although I assume this problem may affect other versions.

Thanks, I mistook end of life date for end of normal service. Will look into updating if I can do so without breaking too much.

Manfred Hampl (m-hampl) said : #6

Which battery did you change?

A USB keyboard and a USB mouse, connected directly to the back of the computer, do not need a battery.
My USB keyboard doesn't have one. My wireless mouse does have a battery, but is not directly connected to the computer.

It's a desktop unit, and I changed the BIOS/system/clock/whatever #1024 button battery. Nothing that should have anything to do with the USB ports. Neither mouse nor keyboard uses a battery. And no change in the BIOS settings that I'm aware of.

I changed the system battery and usbguard immediately blocked the keyboard and mouse.

Upgrading to Bionic could be extremely hazardous with usbguard installed. Also, uninstalling it and reinstalling it on Bionic sounds rather hazardous, unless I solve this first. If I recall correctly, usbguard for Bionic and later comes with warnings that don't even apply to the PPA that I am using.

Manfred Hampl (m-hampl) said : #8

If it is the BIOS battery, then this can have an influence on the BIOS and consequently can affect everything that runs on your system. The same applies to a BIOS upgrade.


- Did you change something in BIOS before changing the battery? Then you may have to re-apply these changes again.
Eventually resetting BIOS to sane defaults also can help.

- Disable or uninstall usbguard and check ‚Äčthe device and port numbers that your keyboard and mouse now get and compare that with the your config settings.

No changes in BIOS, but I made two changes and one of them solved the problem. Or at least it went well for one boot.
1. Apparently the battery was not making good connection, because it still told me the battery was low. I reseated the battery and all is well.
2. Removed the nonexistent diskette drive from BIOS and all is well. (It appeared to be disabled but wasn't.)

I should mention FYI that the keyboard worked for BIOS setup and for grub, and was not blocked until usbguard started. So as odd as this may seem, usbguard apparently has some BIOS dependency that I don't understand.

Some things shall remain mysterious. Thanks very much for your help. Frustrating trying to troubleshoot someone else's computer from a distance, I know.