HP LaserJet 1018 was working but stoped working

I have NixOS installed on a desktop computer.

An HP LaserJet 1018 is connected to the desktop computer with a USB cable. After installing NixOS on the computer I had several months of problem free printing with this printer.

This month I changed the graphical X environment from i3 to XFCE in my configuration file and updated the system with nixos-rebuild switch --upgrade.

I noticed that after the updating and switching to XFCE the laser printer stoped working.

My user is a member of the lp gproup. groups outputs users wheel disk floppy lp networkmanager scanner.

The printer shows up in the output of lsusb as Bus 002 Device 003: ID 03f0:4117 HP, Inc LaserJet 1018

systemctl status cups outputs:
“”"
● cups.service - CUPS Scheduler
Loaded: loaded (/etc/systemd/system/cups.service; linked; preset: enabled)
Drop-In: /nix/store/4fd053x4cckjjfx555f41gpnbfalpvcm-system-units/cups.service.d
└─overrides.conf
Active: active (running) since Mon 2024-05-20 12:01:18 EDT; 5h 21min ago
TriggeredBy: ● cups.socket
Docs: man:cupsd(8)
Process: 1044 ExecStartPre=/nix/store/08klwiwrfyvfcjcgfq43zz2chnbily5x-unit-script-cups-pre-start/bin/cups-pre-star>
Main PID: 1087 (cupsd)
Status: “Scheduler is running…”
IP: 296B in, 72B out
IO: 88.0M read, 8.1M written
Tasks: 5 (limit: 9354)
Memory: 54.1M
CPU: 3.506s
CGroup: /system.slice/cups.service
├─1087 /nix/store/fhi4f3p9kj2cil28pa6fwp2r0hp8mpg9-cups-2.4.7/sbin/cupsd -l
├─1093 /nix/store/ph4y49g1ymq1s6mlam0amfp0602xv2zy-cups-progs/lib/cups/notifier/dbus dbus://
├─1094 /nix/store/ph4y49g1ymq1s6mlam0amfp0602xv2zy-cups-progs/lib/cups/notifier/dbus dbus://
├─1095 /nix/store/ph4y49g1ymq1s6mlam0amfp0602xv2zy-cups-progs/lib/cups/notifier/dbus dbus://
└─6583 /nix/store/ph4y49g1ymq1s6mlam0amfp0602xv2zy-cups-progs/lib/cups/notifier/dbus dbus://
“”"

I have not been successful at getting the printer to work again. Here are some of the things that I have tried to get the printer to work:

  • turning it off and on again
  • rebooting the computer
  • trying a know good USB cable
  • switching back to i3
  • switching to MATE

The relavant parts of my /etc/nixos/configuration.nix:
“””
environment.systemPackages = with pkgs; [ hplipWithPlugin ];

#printer setup
services.printing.enable = true;
services.printing.drivers = [ pkgs.hplipWithPlugin ];
services.avahi.enable = true;
“””
System packages truncated to just the printer driver for brevity of this post.

The HP Device Manager program showed that whenever I tried printing, under the Printer Control tab the printers status would change to stoped from Started/Idle. If I then started it by clicking Start Printer button the I would get a message about a connection error.

In the HP Device Manager program I tried to remove the printer and readd it using the USB connection type. But then the HP Device Manager program does not find the printer.

I would appreciate suggestions on things I can try to get this printer to work again.

I can provide further information to further diagnose the issue.

I suggest removing the printer’s configuration in CUPS and recreating it.

I’ve had issues in the past, and even recently, with printers working for a while and then suddenly they stop working.

The only “solution” I’ve found is to remove the config in CUPS and create it again.

emmanuelrosa thanks for that suggestion. When I go to http://localhost:631/ and select the administration tab and click on the Add Printer button it gives me radio button options to select from. There are options for local printers and network printers. As I can only connect to this printer using USB I do not think the network printer option are relevant. Under the local printer it does not give me an option for this printer I am trying to add. There is just the radio buttons and a continue button. Clicking on the continue button without a radio button slected just reloads the same page.

I have some more information I can share after reading information about CUPS.

The printer does not show up in the output of lpinfo -l -v.

lpinfo -m | grep 1018 outputs:
“””
HP/hp-laserjet_1018.ppd.gz HP LaserJet 1018, hpcups 3.23.3, requires proprietary plugin

drv:///hp/hpcups.drv/hp-laserjet_1018.ppd HP LaserJet 1018, hpcups 3.23.3, requires proprietary plugin
“””
When I restart the printer dmesg -W outputs:
“””
[82548.172276] usb 2-1.2: USB disconnect, device number 3
[82550.391798] usb 2-1.2: new high-speed USB device number 9 using ehci-pci
[82550.490924] usb 2-1.2: New USB device found, idVendor=03f0, idProduct=4117, bcdDevice= 1.00
[82550.490934] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[82550.490938] usb 2-1.2: Product: HP LaserJet 1018
[82550.490940] usb 2-1.2: Manufacturer: Hewlett-Packard
[82550.490942] usb 2-1.2: SerialNumber: KP27JA1
“””

ls -l /dev/bus/usb/002/009 outputs crw-rw-r--+ 1 root lp 189, 136 May 21 10:56 /dev/bus/usb/002/009

Maybe using a previous version of the driver would help fix this.

From the output of ls /nix/store/*hplip* it looks like it is 3.23.3

shows me that there are some previous version I could try 3.22.6, 3.21.12, …

I looked at NixOS Manual but I am not sure how to specify the use of a previous version of a package.

How can I specify a specific previous version of the driver in configuration.nix?

Currently my configuration.nix has this for printing:
“””
environment.systemPackages = with pkgs; [ hplipWithPlugin ];

#printer setup
services.printing.enable = true;
services.printing.drivers = [ pkgs.hplipWithPlugin ];
services.avahi.enable = true;
“””

The NixOS wiki mentions that the hplip proprietary bits don’t work with the CUPS UI. See Printing - NixOS Wiki

As for installing older versions of packages, look into “pinning Nixpkgs”. See FAQ/Pinning Nixpkgs - NixOS Wiki

@emmanuelrosa thanks for pointing out the the CUPS UI does not work with hplipWithPlugin.

I was able to add the printer using the lpadmin.

This is the command that worked for me:

lpadmin -p laserjet1018 -D "HP LaserJet 1018" -E -m drv:///hp/hpcups.drv/hp-laserjet_1018.ppd -v hp:/usb/HP_LaserJet_1018?serial=XXXXXXXXXX

Were XXXXXXXXXX is the serial number off of the back of the printer.

I got the value for -m from the command lpinfo -m | grep 1018. Grepping for the model number of the printer.

I got the value for -v from a web search result and changed the serial number.

Interestingly when I added the printer with lpadmin it output this message “lpadmin: Printer drivers are deprecated and will stop working in a future version of CUPS.”

I want to continue using this reliable laser printer. So this is a good motivator for me to figure out how to pin the version of a software package in a NixOS configuration file.

I will split pinning a package in configuration.nix out to it’s own thread.

Now the printer is showing up in the CUPS web interface as well as the HP Device Manager program.

There is a new issue. When the printer is started in the HP Device Manager or resumed in the CUPS web interface and I go to print the following happens:

  • in the CUPS web interface it changes to paused
  • in the HP Device Manager program under the printer control tab it changes the printer to stoped
  • there is an HP Device Manager popup dialog window

The Dialog says:
“””
Driver Plug-In installation is required

HP Device requires proprietary plug-in which is missing. Click “Next” to continue plug-in installation
“””

It has a Next and Cancel button.

When I use the cancel button the popup comes back whenever I try to print.

When I click next it gives me two options download and install from HP server or select and install a local copy of the plug-in file.

I already have the plug-in installed with hplipWithPlugin.

ls /nix/store/*hplip* outputs:
“””
/nix/store/02s47bxza3v2wrqs7899yw0r9s71fvcm-hplip-3.23.3-plugin.run.drv

/nix/store/0pla4cnps8l23ywjlpfl29sg9mzpm3yr-hplip-3.23.3.drv

/nix/store/0w4c8hdl01i2ms6alsb3g3k9g96fr9xx-hplip-3.23.3.drv

/nix/store/0x0nga4ssc4hcr80kgdj9ig471hgnnss-hplip-3.23.3.drv

/nix/store/1pabv1cxx52ywvkiicy1j8qwx5ch6f97-hplip.state

/nix/store/38sxjc5psws4c81mnjcb4iilr7gxd33l-hplip-3.23.3.drv

/nix/store/6qbrcn1v6vikisxhd4sx2irdsn6yf44l-hplip-3.23.3-plugin.run.drv

/nix/store/6xjcnhfikbfvn0xxhmxjlgrvc7l9ii5z-hplip-3.23.3.tar.gz

/nix/store/8bfy5qbmi9c3nvwzajd1dm7vx0zklcl5-hplip-3.23.3-plugin.run.drv

/nix/store/948k2yz5z3zksjjrcip004rf5m9klah7-hplip.state

/nix/store/97y9vdxlp0cv7nw8i4m4j8cfylz74b8d-hplip-3.23.3.tar.gz.drv

/nix/store/a7idip02kccs6wj5jj51vci9adnx7vx5-hplip-3.23.3.drv

/nix/store/ab8lvj67m70hhbhzwpbglv3pw8qca313-hplip-3.23.3.tar.gz.drv

/nix/store/b4gx7195ls044arhi85i6vp89666clbw-hplip-3.23.3.drv

/nix/store/c9jg8wl7hvx3abl4q9m332d6y01g1wrg-hplip-3.23.3.tar.gz.drv

/nix/store/cqbd8yq61nhh91riqih3lbjh3b0sac1s-hplip.state.drv

/nix/store/d3c0dygp3yry0jz1r9j40vkgcmykkpi9-hplip.state.drv

/nix/store/f6azmawqbnmmz6lsmnqbiwwg33vizvpp-hplip-3.23.3-plugin.run.drv

/nix/store/g5dz0w0512yv99xcw3h88003lpmha6ks-hplip.state.drv

/nix/store/gb10w1jm8i71yi3740zbvdm5kxpgkqdb-hplip-3.23.3.tar.gz.drv

/nix/store/h12npbl61b8r2s7fksk9z1825q8cy7bn-hplip-3.23.3.tar.gz.drv

/nix/store/h2ybja493iwl5a1li8p13mv9dsyigc0x-hplip-3.20.11-nixos-cups-ppd-search-path.patch

/nix/store/h48dv6ys81dm7sjd9js67vz5ksaq0rpf-hplip-3.23.3-plugin.run

/nix/store/i90pn8smsn9l4blw8lm79k6rbpbbpa9v-hplip.state.drv

/nix/store/iny28f8390nbcg3vp3xydbqjb5bivpm2-hplip-3.23.3-plugin.run.drv

/nix/store/jbb7mjn1pb76fzsjzza4xkyrc1d92470-hplip-3.23.3.tar.gz.drv

/nix/store/kmm1isbmgs4gpxpqrz5pyjg1l7yn6p2m-hplip.state

/nix/store/kq24j6s910x2d0g7c5mcrhpgh6l10qqk-hplip.state

/nix/store/lp2zbfz4dgkxv0lf7gzzxvx1mda97yjg-hplip.state.drv

/nix/store/pzahmlc4bnmldj29nd30qmzmjakymcrl-hplip-3.23.3.drv

/nix/store/s2z86mz17n3mf1wm2mn4kn7jz1rx00h1-hplip.state

/nix/store/scp8k21rd03ra3wnig9qz2427kwnlfv5-hplip-3.23.3.drv

/nix/store/v1flbzcy0iqxx215m3k2k5ik4r50234f-hplip.state

/nix/store/xlawxs46a817w6kaza2v6frf63axrf4l-hplip-3.23.3-plugin.run.drv

/nix/store/1c5pz51sm5ipnviqi1bqhiwk822blyz4-hplip-3.23.3:

bin etc lib nix-support share xdg

/nix/store/2f23dinfmk7w1xmjs1wr473i5c38mldv-hplip-3.23.3:

bin etc lib nix-support share var xdg

/nix/store/4xbgwl2r2s31p8mjx46vxm9dsx3k59zd-hplip-3.23.3:

bin etc lib nix-support share var xdg

/nix/store/a7kggkgvdvvbd4zjykl791jz6hc1z2n9-hplip-3.23.3:

bin etc lib nix-support share xdg

/nix/store/gng5wi89spsf1m9a3azka4ddqsf4dn4i-hplip-3.23.3:

bin etc lib nix-support share var xdg

/nix/store/r34wfd2iwi6i9zl4z5drr4zrqsi36gsw-hplip-3.23.3:

bin etc lib nix-support share var xdg

/nix/store/r4sbcbks6lm8x5jclg6k4ir8xz6m6zpw-hplip-3.23.3:

bin etc lib nix-support share var xdg

/nix/store/y92kzdj84zvl8m5faap8y6m4zv52hsdn-hplip-3.23.3:

bin etc lib nix-support share var xdg
“””

Which file path should I give it for the driver plug-in file?

That’s referencing the fact that CUPS 3 will remove support for PPD-based printer drivers in favor of print applications. See Request to rename `cups` to `cups2` · Issue #306568 · NixOS/nixpkgs · GitHub; I imagine this will prevent a lot of users from upgrading to CUPS 3. CUPS 2 will still support PPD-based drivers though.

@Pandapip1 I like your proposal " that the cups package be renamed to cups2." to help deal with the breaking changes of CUPS 3.0.

You shouldn’t have to provide a Nix store path to the plugin; Such a path would change every time you update Nixpkgs.

The hplip Nix package should be placing the plugin file at a fixed path. Take a look at /var/lib/cups/path

The plugin is probably somewhere under the share directory. I suspect the plugin is in /var/lib/cups/path/share/hplip/prnt/plugins/

@emmanuelrosa thanks for pointing out to look under /var/lib/cups/path instead of the store.

When I use the HP Device Manager – Plug-In Installer dialog and choose to the option “Select and install an existing local copy of the plug-in file” it brings up a file selector.

The file selector allows me to navigate through directories and for file type it has a drop down with the only option being Plugin Files.

The problem is that when I use the plug-in picker to navigate the sub directories under /var/lib/cups/ it only shows directories and no files (plug-ins) show up in any of the subdirectories to select.

Tagging the hplip maintainers @ttuegel and @arthsmn.

How have you installed the printer? Have you used the command to install it? Can you comment the driver line, remove all the printers, uncomment, rebuild and then try installing again, this should make a “clean” install.

@arthsmn thanks for your questions and suggestions.

“How have you installed the printer?”

The printer is plugged into power outlet and connected to a desktop computer using a USB cable.

The relevant lines of my configuration.nix for printing are:
‘’’
environment.systemPackages = with pkgs; [ hplipWithPlugin ];
#printer setup
services.printing.enable = true;
services.printing.drivers = [ pkgs.hplipWithPlugin ];
services.avahi.enable = true;
‘’’

I also have some lines for scanning in my configuration.nix:
‘’’
#scanner setup
hardware.sane = {
enable = true;
extraBackends = [ pkgs.hplipWithPlugin ];
};
‘’’

“Have you used the command to install it?”

I removed the printer using the HP Device Manager Program. I was unable to add it using the HP Device Manager or the CUPS web interface.

I was able to add the printer using this command:
lpadmin -p laserjet1018 -D "HP LaserJet 1018" -E -m drv:///hp/hpcups.drv/hp-laserjet_1018.ppd -v hp:/usb/HP_LaserJet_1018?serial=XXXXXXXXXX
Were XXXXXXXXXX is the serial number off of the back of the printer.

“Can you comment the driver line, remove all the printers, uncomment, rebuild and then try installing again, this should make a “clean” install.”

I have done the following in this order:

  • powered off the printer and scanner
  • unplugged the power and USB cables for the printer and scanner
  • commented out the printer and scanner lines in configuration.nix
  • removed all devices
    ** no devices listed in HP Device Manager or the CUPS web interface
  • ran nixos-rebuild switch –upgrade
  • rebooted the computer
  • uncommented the printer and scanner lines in configuration.nix
  • reconnected the power and USB cables for the printer and scanner
  • ran nixos-rebuild switch –upgrade
  • rebooted the computer
  • ran lpadmin to readd the printer
  • rebooted the computer

When I send a print job to the printer, in the CUPS web interface it switches to paused.

In the HP Device Manager the printer status switches to stoped. If I click the start button for the printer it switches itself back to stopped.

In the CUPS web interface the printer says paused. If I resume the printer, it switches back to paused.

I am no longer being presented with a dialog to install the hplip plug-in.

Have you used the command in the wiki to install the printer? NIXPKGS_ALLOW_UNFREE=1 nix-shell -p hplipWithPlugin --run 'sudo -E hp-setup'

@arthsmn when I run the command NIXPKGS_ALLOW_UNFREE=1 nix-shell -p hplipWithPlugin --run 'sudo -E hp-setup' it start the HP Device Manager - Setup program. The printer can only be connected by USB. When I select the USB radio button and click the Next button the printer does not show up as a discovered device.

That’s sad to hear. I also had problems with my printer (now just not using it). I was thinking about refactoring the hplip derivation so I could debug it, but I currently have no time to do so. Sorry.