LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cups-lpd running via xinetd (https://www.linuxquestions.org/questions/linux-newbie-8/cups-lpd-running-via-xinetd-4175711983/)

awaismalik 05-12-2022 08:43 AM

cups-lpd running via xinetd
 
i have installed cups-lpd using dnf install cups-lpd and managing it by xinetd. The files look as follows:

Code:

#cat /etc/xinetd.conf
# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/

defaults
{

# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info


}

includedir /etc/xinetd.d

Code:

#cat /etc/xinetd.d/cups-lpd

service printer
    {
        socket_type = stream
        protocol = tcp
        wait = no
        flags = IPv4
        user = lp
        server = /usr/lib/cups/daemon/cups-lpd
        server_args = -o document-format=application/octet-stream -o job-sheets=none
    }

and service is running on port 515.
Cups-lpd is being using by an external software. I have to test if cups-lpd is working or not.
I have tried:

Code:

#lp -d PrinterName testpage.txt
The printed page does not contain the expected content but as follows(this information):

Code:

Error Name:    /undefined
Offending Command: cups-lpd
Operand Stack:

Code:

#cups-lpd -h PrinterName testpage.txt
-bash: cups-lpd: Command not found

furthermore i have also stopped xinetd and started and enabled cups-lpd.socket because systemd manages it.
But the result was same

Before printing from the Application how can i test cups-lpd to make sure it is working?
am i doing anything wrongly ?
Following are the mix logs of xinetd and systemd.


Code:

/var/log/messages:348950:May 12 11:12:18 server xinetd[974]: xinetd Version 2.3.15 started with loadavg labeled-networking options compiled in.
/var/log/messages:348951:May 12 11:12:18 server xinetd[974]: Started working: 2 available services
/var/log/messages:356372:May 12 12:22:12 server xinetd[974]: unexpected signal: 18 (Continued) in signal pipe
/var/log/messages:356373:May 12 12:22:12 server xinetd[974]: Exiting...
/var/log/messages:356374:May 12 12:22:12 server systemd[1]: xinetd.service: Succeeded.
/var/log/messages:356378:May 12 12:22:12 server xinetd[20626]: xinetd Version 2.3.15 started with loadavg labeled-networking options compiled in.
/var/log/messages:356379:May 12 12:22:12 server xinetd[20626]: Started working: 2 available services
/var/log/messages:362713:May 12 13:22:21 server xinetd[20626]: unexpected signal: 18 (Continued) in signal pipe
/var/log/messages:362714:May 12 13:22:21 server xinetd[20626]: Exiting...
/var/log/messages:362715:May 12 13:22:21 server systemd[1]: xinetd.service: Succeeded.
/var/log/messages:364380:May 12 13:37:49 server xinetd[40878]: xinetd Version 2.3.15 started with loadavg labeled-networking options compiled in.
/var/log/messages:364381:May 12 13:37:49 server xinetd[40878]: Started working: 2 available services
/var/log/messages:364636:May 12 13:40:02 server xinetd[40878]: unexpected signal: 18 (Continued) in signal pipe
/var/log/messages:364637:May 12 13:40:02 server xinetd[40878]: Exiting...
/var/log/messages:364638:May 12 13:40:02 server systemd[1]: xinetd.service: Succeeded.





Code:

System information:
NAME="AlmaLinux"
VERSION="8.5 (Arctic Sphynx)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.5"
PLATFORM_ID="platform:el8"
PRETTY_NAME="AlmaLinux 8.5 (Arctic Sphynx)"


TB0ne 05-12-2022 08:48 AM

Quote:

Originally Posted by awaismalik (Post 6352533)
i have installed cups-lpd using dnf install cups-lpd and managing it by xinetd. The files look as follows:
Code:

#cat /etc/xinetd.conf
# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/
defaults
{

# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info

}

includedir /etc/xinetd.d

#cat /etc/xinetd.d/cups-lpd

service printer
    {
        socket_type = stream
        protocol = tcp
        wait = no
        flags = IPv4
        user = lp
        server = /usr/lib/cups/daemon/cups-lpd
        server_args = -o document-format=application/octet-stream -o job-sheets=none
    }

and service is running on port 515. Cups-lpd is being using by an external software. I have to test if cups-lpd is working or not. I have tried:
Code:

#lp -d PrinterName testpage.txt
The printed page does not contain the expected content but as follows(this information):
Code:

Error Name:    /undefined
Offending Command: cups-lpd
Operand Stack:

#cups-lpd -h PrinterName testpage.txt
-bash: cups-lpd: Command not found

furthermore i have also stopped xinetd and started and enabled cups-lpd.socket because systemd manages it. But the result was same Before printing from the Application how can i test cups-lpd to make sure it is working? am i doing anything wrongly ? Following are the mix logs of xinetd and systemd.
Code:

/var/log/messages:348950:May 12 11:12:18 server xinetd[974]: xinetd Version 2.3.15 started with loadavg labeled-networking options compiled in.
/var/log/messages:348951:May 12 11:12:18 server xinetd[974]: Started working: 2 available services
/var/log/messages:356372:May 12 12:22:12 server xinetd[974]: unexpected signal: 18 (Continued) in signal pipe
/var/log/messages:356373:May 12 12:22:12 server xinetd[974]: Exiting...
/var/log/messages:356374:May 12 12:22:12 server systemd[1]: xinetd.service: Succeeded.
/var/log/messages:356378:May 12 12:22:12 server xinetd[20626]: xinetd Version 2.3.15 started with loadavg labeled-networking options compiled in.
/var/log/messages:356379:May 12 12:22:12 server xinetd[20626]: Started working: 2 available services
/var/log/messages:362713:May 12 13:22:21 server xinetd[20626]: unexpected signal: 18 (Continued) in signal pipe
/var/log/messages:362714:May 12 13:22:21 server xinetd[20626]: Exiting...
/var/log/messages:362715:May 12 13:22:21 server systemd[1]: xinetd.service: Succeeded.
/var/log/messages:364380:May 12 13:37:49 server xinetd[40878]: xinetd Version 2.3.15 started with loadavg labeled-networking options compiled in.
/var/log/messages:364381:May 12 13:37:49 server xinetd[40878]: Started working: 2 available services
/var/log/messages:364636:May 12 13:40:02 server xinetd[40878]: unexpected signal: 18 (Continued) in signal pipe
/var/log/messages:364637:May 12 13:40:02 server xinetd[40878]: Exiting...
/var/log/messages:364638:May 12 13:40:02 server systemd[1]: xinetd.service: Succeeded.

System information:
NAME="AlmaLinux"
VERSION="8.5 (Arctic Sphynx)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.5"
PLATFORM_ID="platform:el8"
PRETTY_NAME="AlmaLinux 8.5 (Arctic Sphynx)"


Again, you need to use CODE tags when posting all of this; it is nearly impossible to read/parse. And is this a continuation of your other CUPS threads, where you ignored most of the advice given to you??
https://www.linuxquestions.org/quest...er-4175711204/
https://www.linuxquestions.org/quest...ps-4175704136/

Since you marked the last thread about your CUPS server as 'Solved', it's odd that you open a new one since you are saying you got it working previously. Start by reading the CUPS documentation about testing things:
http://www.cups.org/doc/options.html

awaismalik 05-12-2022 08:59 AM

Thanks for identation, i will keep in mind to use CODE tags next time. Yes i read the documentation http://www.cups.org/doc/options.html and https://www.cups.org/doc/man-cups-lpd.html which has been mentioned that what i have tried. these command not only gave the expected print out but also i can not see in /var/log that if someone tried to connect to cups-lpd.

TB0ne 05-12-2022 09:09 AM

Quote:

Originally Posted by awaismalik (Post 6352538)
Thanks for identation, i will keep in mind to use CODE tags next time.

You need to go back in THIS POST and edit it to enclose things in CODE tags.
Quote:

Yes i read the documentation http://www.cups.org/doc/options.html and https://www.cups.org/doc/man-cups-lpd.html which has been mentioned that what i have tried. these command not only gave the expected print out but also i can not see in /var/log that if someone tried to connect to cups-lpd.
You did not mention that you looked at those directions, only the things you tried. And now you're saying that things DID work, but you just can't see things in /var/log? Did you actually set up an accounting file to show what's been/being printed??
http://www.cups.org/doc/accounting.html
https://www.cups.org/doc/man-cupsd-logs.html

/var/log is a directory...what actual FILE are you looking in? And seeing network connections is far different than printer accounting.

michaelk 05-13-2022 12:45 PM

Either run cups-lpd from xinetd or systemd but not both. I would suggest using systemd.

The easiest way to test the server is to create a raw printer queue that points to a real printer via the cups web page as
lpd://localhost/existing_printer_queue

You can then print something using the regular lpr or lp commands and specify the new print queue. You can test to see if your actually connecting to cups-lpd by stopping it and see what happens.

awaismalik 05-17-2022 08:30 AM

Thanks michaelk. I followed your suggestion and it worked on command line now i will test with the application.But before that i am looking for a log as cups-lpd is being managed by xinetd. This is how the /etc/xinetd looks
Code:

# Define general logging characteristics.
        #log_type        = SYSLOG daemon info
        log_type        = FILE /var/log/xinetdlog
        log_on_failure        = HOST
        log_on_success        = PID HOST DURATION EXIT

cups-lpd service file look like

Code:

service printer
    {
        socket_type = stream
        protocol = tcp
        wait = no
        flags = IPv4
        log_type = FILE /var/log/xinetdlog
        log_on_success = DURATION EXIT HOST PID USERID
        log_on_failure = ATTEMPT HOST USERID
        user = lp
        server = /usr/lib/cups/daemon/cups-lpd
        server_args = -o document-format=application/octet-stream -o job-sheets=none
    }

But the cat /var/log/xinetdlog is empty. Even after running lp -d PrinterName file.txt three times and have also started xinetd service multiple times.

Have also tried
Code:

grep -rn "cups-lpd" /var/log/
grep -rn "xinetd" /var/log/

But could not find any log info about cups-lpd service.
Do you have an idea where i should look at ?

michaelk 05-17-2022 09:05 AM

I would not expect anything in the logs as "cups-lpd" since the service name is printer.

awaismalik 05-17-2022 11:28 AM

i have look around using
Code:

grep -rn "printer" /var/log/
but the result was empty

Here is how the network looks like
Code:

Proto Recv-Q Send-Q Local Address          Foreign Address        State      PID/Program name    Timer
tcp        0      0 0.0.0.0:22              0.0.0.0:*              LISTEN      16406/sshd            (0.00/0/0)
tcp        0      0 0.0.0.0:631            0.0.0.0:*              LISTEN      19412/cupsd          (0.00/0/0)
tcp        0      0 0.0.0.0:515            0.0.0.0:*              LISTEN      20263/xinetd          (0.00/0/0)
tcp6      0      0 :::22                  :::*                    LISTEN      16406/sshd            (0.00/0/0)
tcp6      0      0 :::631                  :::*                    LISTEN      19412/cupsd          (0.00/0/0)

still i could not find log file

michaelk 05-17-2022 11:41 AM

Check your /etc/xinetd.conf maybe it isn't configured to log anything.

awaismalik 05-17-2022 11:47 AM

this is file

Code:

# cat /etc/xinetd.conf

#
# This is the master xinetd configuration file. Settings in the
# default section will be inherited by all service configurations
# unless explicitly overridden in the service configuration. See
# xinetd.conf in the man pages for a more detailed explanation of
# these attributes.

defaults
{
# The next two items are intended to be a quick access place to
# temporarily enable or disable services.
#
#        enabled                =
#        disabled        =

# Define general logging characteristics.
        #log_type        = SYSLOG daemon info
        log_type        = FILE /var/log/xinetdlog
        log_on_failure        = HOST
        log_on_success        = PID HOST DURATION EXIT

# Define access restriction defaults
#
#        no_access        =
#        only_from        =
#        max_load        = 0
        cps                = 50 10
        instances        = 50
        per_source        = 10

# Address and networking defaults
#
#        bind                =
#        mdns                = yes
        v6only                = no

# setup environmental attributes
#
#        passenv                =
        groups                = yes
        umask                = 002

# Generally, banners are not used. This sets up their global defaults
#
#        banner                =
#        banner_fail        =
#        banner_success        =
}

includedir /etc/xinetd.d


TB0ne 05-17-2022 12:00 PM

Quote:

Originally Posted by awaismalik (Post 6354191)
this is file

Code:

# cat /etc/xinetd.conf

#
# This is the master xinetd configuration file. Settings in the
# default section will be inherited by all service configurations
# unless explicitly overridden in the service configuration. See
# xinetd.conf in the man pages for a more detailed explanation of
# these attributes.

defaults
{
# The next two items are intended to be a quick access place to
# temporarily enable or disable services.
#
#        enabled                =
#        disabled        =

# Define general logging characteristics.
        #log_type        = SYSLOG daemon info
        log_type        = FILE /var/log/xinetdlog
        log_on_failure        = HOST
        log_on_success        = PID HOST DURATION EXIT

# Define access restriction defaults
#
#        no_access        =
#        only_from        =
#        max_load        = 0
        cps                = 50 10
        instances        = 50
        per_source        = 10

# Address and networking defaults
#
#        bind                =
#        mdns                = yes
        v6only                = no

# setup environmental attributes
#
#        passenv                =
        groups                = yes
        umask                = 002

# Generally, banners are not used. This sets up their global defaults
#
#        banner                =
#        banner_fail        =
#        banner_success        =
}

includedir /etc/xinetd.d


Great; **AGAIN** did you read the documentation on CUPS??? If you haven't defined the file(s) to use, you aren't going to get anything in them.
http://www.cups.org/doc/man-cups-files.conf.html

michaelk 05-17-2022 12:45 PM

cups uses the IPP protocol and it makes sense that cups-lpd is an intermediate process that basically talks lpd to the client and then sends the job on to cups itself.

Searching has not found much and I have not personally tested anything yet but to throw out another guess try changing the log file name is the same in both your service and xinetd.conf. Try changing the service file to something else and restart xinetd.

TB0ne 05-17-2022 12:47 PM

Quote:

Originally Posted by michaelk (Post 6354210)
cups uses the IPP protocol and it makes sense that cups-lpd is an intermediate process that basically talks lpd to the client and then sends the job on to cups itself.

Searching has not found much and I have not personally tested anything yet but to throw out another guess try changing the log file name is the same in both your service and xinetd.conf. Try changing the service file to something else and restart xinetd.

Unless the log files are specified, things aren't going to get logged. Unless you define AccessLog, ErrorLog, PageLog, etc., and define what goes in them, they won't exist. I believe (unknown), that by default it's logged to syslog, so either journalctl or /var/log/messages may have things, but I'm not sure.

http://www.cups.org/doc/man-cups-files.conf.html

michaelk 05-17-2022 12:57 PM

xinetd is separate from cups and the cups-lpd is separate from the actual cups daemon. xinetd log files are separate from cups log files and unrelated. I would not expect the OP to need to change any cups configuration.

TB0ne 05-17-2022 01:16 PM

Quote:

Originally Posted by michaelk (Post 6354216)
xinetd is separate from cups and the cups-lpd is separate from the actual cups daemon. xinetd log files are separate from cups log files and unrelated. I would not expect the OP to need to change any cups configuration.

Interesting; would have thought the service itself would have logged the data. In that case, what they're looking for is probably in the system journal.


All times are GMT -5. The time now is 06:19 PM.