Skip to content

[2.4.9 regression] cupsd don't start when only Listen /path/to/domain/socket is set in conf #985

Closed

Description

@Maryse47

Describe the bug
Setting cupsd to listen only on socket path prevents cups daemon from starting. It worked in 2.4.8 and before and stopped working in 2.4.9.

If the only Listen directive in cupsd.conf is set to socket path like:
Listen /run/cups/cups.sock
then cupsd daemon fails to start when running from systemd:
cups.service: Failed with result 'protocol'.

The cups error log shows:
No valid Listen or Port lines were found in the configuration file.

To Reproduce
Steps to reproduce the behavior (on ArchLinux):

  1. Go to /etc/cups/cupsd.conf and remove any other Listen directive than Listen /run/cups/cups.sock
  2. Run systemct start cups.socket
  3. Run systemctl start cups
  4. See cups.service: Failed with result 'protocol'. and No valid Listen or Port lines were found in the configuration file. error messages

Expected behavior
I expect cupsd service to start like before

System Information:
OS: ArchLinux
Cups 2.4.9

Additional context
By reading changelog I presume it's somewhat related to a436956 but the listening on socket functionality is still present in cups and I don't know what users are supposed to do to make it work.

Activity

  1. michaelrsweet commented on Jun 13, 2024

    @michaelrsweet
    Member

    Sounds like a configuration problem - systemd is supposed to supply the domain socket to cupsd when running on-demand.

  2. Maryse47 commented on Jun 13, 2024

    @Maryse47
    Author

    I use the default cups.service and cups.socket provided from this repo.

  3. Maryse47 commented on Jun 13, 2024

    @Maryse47
    Author

    If I remove Listen /run/cups/cups.sock from config then it fails with the same error message: No valid Listen or Port lines were found in the configuration file. so something isn't working as it should. Does anyone has it working with only Listen on socket file?

  4. Maryse47 commented on Jun 13, 2024

    @Maryse47
    Author

    The @CUPS_LISTEN_DOMAINSOCKET@ is also provided by default in cupsd.conf so the only thing I did is to remove Listen localhost:@DEFAULT_IPP_PORT@ line above because I don't want it to listen on local network. I don't see what I did wrong @zdohnal do you have any idea how it should work after your changes?

  5. zdohnal commented on Jun 14, 2024

    @zdohnal
    Member

    Ok, we did not count the possibility the Listen for socket is the only Listen directive in the cupsd.conf. In that case, the Listen line for .sock is ignored, thus the service is not started.

    @michaelrsweet probably we have to move continue into the if block, so we don't omit the socket if it matches the expected domain socket name. WDYT?

  6. zdohnal commented on Jun 14, 2024

    @zdohnal
    Member

    Or do not let the loading fail - I'll look into the code.

  7. Maryse47 commented on Jun 14, 2024

    @Maryse47
    Author

    Ok, we did not count the possibility the Listen for socket is the only Listen directive in the cupsd.conf. In that case, the Listen line for .sock is ignored, thus the service is not started.

    Even if there are two Listen directives and the service start does cups listen on both or is socket no-op?

  8. michaelrsweet commented on Jun 14, 2024

    @michaelrsweet
    Member

    @zdohnal @Maryse47 OK, I think I have a fix:

    [master 7adb508] Don't abort early if there are no listen sockets after loading cupsd.conf (Issue #985)

    [2.4.x 6131f6a] Don't abort early if there are no listen sockets after loading cupsd.conf (Issue #985)

  9. added this to the v2.4.x milestone on Jun 14, 2024
  10. Maryse47 commented on Jun 14, 2024

    @Maryse47
    Author

    @michaelrsweet A added 6131f6a on top of 2.4.9 but unfortunately it still fails with the same error: No valid Listen or Port lines were found in the configuration file.

  11. 6 remaining items

  12. added 2 commits that reference this issue on Jun 17, 2024
    b3dc902
    dbe3dda
  13. Maryse47 commented on Jun 17, 2024

    @Maryse47
    Author

    Here's excerpt from log using 2.4.x git branch:

    systemd[1]: Starting CUPS Scheduler...
    cupsd[39853]: Remote access is disabled.
    cupsd[39853]: Loaded configuration file "/etc/cups/cupsd.conf"
    cupsd[39853]: Using keychain "/etc/cups/ssl" for server name "localhost".
    cupsd[39853]: Using default TempDir of /var/spool/cups/tmp...
    cupsd[39853]: cupsdSetEnv: CUPS_CACHEDIR=/var/cache/cups
    cupsd[39853]: cupsdSetEnv: CUPS_DATADIR=/usr/share/cups
    cupsd[39853]: cupsdSetEnv: CUPS_DOCROOT=/usr/share/cups/doc
    cupsd[39853]: cupsdSetEnv: CUPS_REQUESTROOT=/var/spool/cups
    cupsd[39853]: cupsdSetEnv: CUPS_SERVERBIN=/usr/lib/cups
    cupsd[39853]: cupsdSetEnv: CUPS_SERVERROOT=/etc/cups
    cupsd[39853]: cupsdSetEnv: CUPS_STATEDIR=/run/cups
    cupsd[39853]: cupsdSetEnv: HOME=/var/spool/cups/tmp
    cupsd[39853]: cupsdSetEnv: PATH=/usr/lib/cups/filter:/usr/bin:/usr/bin:/bin:/usr/bin
    cupsd[39853]: cupsdSetEnv: SOFTWARE=CUPS/2.4.10
    cupsd[39853]: cupsdSetEnv: TMPDIR=/var/spool/cups/tmp
    cupsd[39853]: cupsdSetEnv: USER=root
    cupsd[39853]: cupsdSetEnv: CUPS_MAX_MESSAGE=2047
    cupsd[39853]: Configured for up to 100 clients.
    cupsd[39853]: Allowing up to 100 client connections per host.
    cupsd[39853]: Using policy "default" as the default.
    cupsd[39853]: Full reload complete.
    cupsd[39853]: cupsdCleanFiles(path="/var/spool/cups/tmp", pattern="(null)")
    cupsd[39853]: Cleaning out old files in "/var/spool/cups/tmp".
    cupsd[39853]: cupsdCleanFiles(path="/var/cache/cups", pattern="*.ipp")
    cupsd[39853]: Cleaning out old files in "/var/cache/cups".
    cupsd[39853]: service_checkin: pid=39853
    cupsd[39853]: service_checkin: 1 listeners.
    cupsd[39853]: service_add_listener: Listener #1 at fd 3, "/run/cups/cups.sock".
    cupsd[39853]: service_add_listener: Adding new listener #1 for /run/cups/cups.sock.
    cupsd[39853]: service_checkin: No listener sockets present.
    cupsd[39853]: cupsdEndProcess(pid=39853, force=0)
    systemd[1]: cups.service: Failed with result 'protocol'.
    systemd[1]: Failed to start CUPS Scheduler.
    
    
  14. added 3 commits that reference this issue on Jun 18, 2024
    0884199
    145b946
    cd13b3e
  15. added a commit that references this issue on Jun 18, 2024
    74f437b
  16. added a commit that references this issue on Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions