After upgrading my Compaq laptop from Fedora Core 2 to Fedora Core 3, CUPS printing stopped working due to some problems caused by udev. After the upgrade, the /dev/usb directory, which usually held devices files for printers and scanners, has turned itself into a device file.
Now, udev is unable to create /dev/usb/lp0, since /dev/usb is not a directory anymore, and since it’s missing, CUPS is unable to print to my HP DeskJet 970Cx printer configured at /dev/usb/lp0.
I haven’t been able to find why /dev/usb has suddendly become a device file:
ls -l /dev/usb
crw------- 1 root root 180, 0 ene 30 12:28 /dev/usb
I have been searching in Google and have found an interesting page that describe how udev rules work . Basically, a udev rule tells udev how to extract information about devices from the sysfs filesystem and how to dynamically create device files for those devices.
Although I have been unable to fix my problems with /dev/usb being a device file, I have been able to create an specific udev rule for my printer that creates /dev/lp? and /dev/printers/hp970 device nodes for me. The rule is as follows:
BUS="usb", SYSFS{serial}="ES9981103BJQ", NAME="%k", SYMLINK="printers/hp970"
and must be placed inside the file /etc/udev/rules.d/10-local.rules.
BUS states the bus which the device is attached to. SYSFS{serial} references the device serial number (in this case, the USB printer serial number). NAME is the device file name that will get created, where “%k” means the standard device name assigned by the kernel (lp0, lp1, and so on). SYMLINK allows creating aliases, or different names, for this device, which in turn are just symlinks to the device NAME (in this case, a synlink named /dev/printers/hp970 will be created pointing to /dev/lp0).
By default, udev rules are stored inside /etc/udev/rules.d as individual files, and are processed in alphabetical order. For every device attached, rule files are checked alphabetically, and once a rule file is found to contain a matching rule for the device being processed, no further rule files for the same device are read. Thus, my custom rule must be inside a rule file that gets read and processed before rule files for the default rules. udev places default rules in a file called 50-udev.rules so in order for the previous custom role to take precedence over the default ones, it must be placed inside a file starting with a numer lower than 50.
After running udevstart or rebooting, the /dev/lp? and /dev/printers/hp970 device nodes should be available and accesible. The last step is reconfiguring the HP DeskJet 970Cxi printer in CUPS to point to /dev/printers/hp970. This can be done by editing /etc/cups/printers.conf, then restarting or reloading CUPS.
Wow, this is awesome post on Problems with udev and my USB printer.
Way to stare somebody down. Fuck.
One roller coaster that I love is the Mystery Mine at Dollywood in Pigeon Forge, Tennesse. It features a 100 foot drop, a corkscrew, two ninety degree angles going up, and a flip. It’s awesome. The Boss is painful. The Screamin Eagle is awesome, too. It’s at the same place as Boss.