We recently changed domain and host name on a RHEL8 server from old.domain.name to more.better.name.

I happened to notice a reference in /etc/printcap to old.domain.name.

[user@box ~]# cat /etc/printcap 
# This file was automatically generated by cupsd(8) from the
# /etc/cups/printers.conf file.  All changes to this file
# will be lost.
[user@box ~]# 

Correct hostname shows

[user@box ~]# hostname
[user@box ~]# 

The server has been restarted a few times since changing the hostname.

I found zero other references to old.domain.name with

[user@box ~]# grep -r "old.domain.name" /etc/
[user@box ~]# 

old.domain.name is not found in /etc/cups/printer.conf

[user@box]# cat /etc/cups/printers.conf
# Printer configuration file for CUPS v2.2.6
# Written by cupsd on 2021-08-24 10:01
<Printer office_printer_123>
UUID urn:uuid:e74ed8e4-e5e6-30b9-64b9-2283cc9c93e7
AuthInfoRequired none
Info office_printer_123
MakeModel HP LaserJet 600 M601 M602 M603 Postscript (recommended)
DeviceURI ipp://
State Idle
StateTime 1629813648
ConfigTime 1618257051
Type 8425668
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer

How do I change what's in the printcap file? And where could it be pulling old.domain.name?

  • man 8 lpadmin ?
    – Jiri B
    Aug 29 at 13:05
  • Did you actually read the man page? Zero references to either printcap or rm or remote machine
    – a coder
    Aug 30 at 20:24
  • Use the cups web interface to make a trivial modification to office_printer_123. Or name a big change and then revert it. The act of changing the configuration should automatically update printcap. If this works (as documented) I'll write it as an answer with a couple of references
    – roaima
    Aug 30 at 22:47

Check the modification timestamp of the /etc/printcap file. If it is older than the current uptime of the server, then it may have been written by an older version of CUPS, and the current version may simply not have updated it on start-up for some reason.

You could also try moving the printcap file away and restarting CUPS. At least on Debian 11, the current CUPS seems to create the file if it does not exist but does not update it if it exists but is stale.

Apparently because of this, /etc/printcap is now a symlink to /run/cups/printcap in Debian 11, and since /run is a tmpfs filesystem, it obviously won't survive a reboot.

systemctl stop cups
mv /etc/printcap /etc/printcap.old
systemctl start cups
diff -u /etc/printcap.old /etc/printcap

/etc/printcap is auto-genereated by cupsd - and it is there for BSD printing compatibility, so you do not edit the file directly when using CUPS.

# mv /etc/printcap{,.bk}
# systemctl restart cups
# ls -l /etc/printcap{,.bk}
-rw-r--r-- 1 root root 261 Aug 31 09:51 /etc/printcap
-rw-r--r-- 1 root root 261 Jul 18 08:02 /etc/printcap.bk
  • The OP obviously did know that. The question is: How can CUPS remember the old domain name?
    – Philippos
    Aug 31 at 12:20
  • Was this file older than /etc/cups/printers.conf? Was the file with odd content present after the server was restarted a few times since changing the hostname? No info provided. We can only guess and CUPS is not free of bugs, so...
    – Jiri B
    Aug 31 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.