cups-browsed service not working after boot

You have a problem with Salix? Post here and we'll do what we can to help.
Post Reply
Tristar
Posts: 6
Joined: 26. Feb 2011, 13:32

cups-browsed service not working after boot

Post by Tristar »

Hi.
I have a problem with my fresh installation of Salix 14.2. Everything works fine except the connection to a printer which is shared by a raspberry pi.
I know that I have to use the cups-browsed service for this, which I started with the command

Code: Select all

sudo service start cups-browsed
It worked after this command. I could see the printer in cups and print a test page.
But after a reboot the printer wasn't showing anymore.

Code: Select all

sudo service list
is showing that the cups-browsed service is running.

Code: Select all

acpid (Der acpid Systemdienst) : [on]
alsa (The Advanced Linux Sound Architecture) : [on]
alsa-oss (Der alsa-oss Systemdienst) : [on]
autofs (Der autofs Systemdienst) : [off]
bluetooth (Der bluetooth Systemdienst) : [on]
cgmanager (Der cgmanager Systemdienst) : [off]
cgproxy (Der cgproxy Systemdienst) : [off]
cgred (Der cgred Systemdienst) : [off]
consolekit (Der consolekit Systemdienst) : [on]
cpufreq (Der cpufreq Systemdienst) : [on]
cups (The CUPS print spooler/server) : [on]
cups-browsed (Der cups-browsed Systemdienst) : [on]
fuse (Der fuse Systemdienst) : [on]
inetd (The BSD Inetd daemon) : [off]
ip_forward (Activate IP packet forwarding) : [off]
loop (Der loop Systemdienst) : [on]
messagebus (The DBUS system) : [on]
mysqld (The MySQL database server) : [off]
networkmanager (Der networkmanager Systemdienst) : [on]
nfsd (The Network File System daemon) : [off]
ntpd (The Network Time Protocol service) : [on]
pcmcia (Der pcmcia Systemdienst) : [off]
pulseaudio (Der pulseaudio Systemdienst) : [off]
samba (The Samba SMB file server) : [off]
saslauthd (The SASL authentication server) : [off]
snmpd (The Simple Network Management Protocol service) : [off]
sshd (The SSHD (secure shell) daemon) : [off]
syslog (The Linux system logging server) : [on]
sysstat (Der sysstat Systemdienst) : [off]
udev (The UDEV dynamic device manager system) : [on]
wireless (Standard single network Wifi startup script) : [on]
xrdp (Der xrdp Systemdienst) : [on]
When I manually restart the cups-browsed service with

Code: Select all

sudo service restart cups-browsed
the printer reappears in cups.

I hope somebody can help.
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: cups-browsed service not working after boot

Post by mimosa »

This is just a guess, but taking a look at the rc.cups-browsed initialisation script, it seems to look if the cups demon is running. But possibly, if called on boot, it hasn't had time to get going yet. If so, a possible fix would be to insert a delay, say

Code: Select all

sleep 20
(experiment with different values if necessary)

early on in the script, for example, just above where it says "OS-dependent configuration" towards the beginning:

Code: Select all

sudo leafpad /etc/rc.d/rc.cups-browsed
Tristar
Posts: 6
Joined: 26. Feb 2011, 13:32

Re: cups-browsed service not working after boot

Post by Tristar »

Thanks for the reply. I tried your suggestion with the sleep command in the rc.cups-browsed script but it didn't solve the problem.

After further investigation I was able to find out that the rc.cups-browsed script isn't even called during boot up.
In addition to the sleep command I have also inserted some logging into a file early in the script.

Code: Select all

rclog=/var/log/cups/rclog
zeitstempel=$(date)
echo "$zeitstempel - Warte 20 Sekunden bevor cups-browsed gestartet wird..." >> $rclog
sleep 20
echo "$zeitstempel - Starte cups-browsed!" >> $rclog
But after boot up there is no text entry in the rclog file.

A similar entry in the rc.cups script did add the text into the rclog file.

Any idea where I can check if the rc.cups-browsed script is being called during boot up?
westms
Posts: 298
Joined: 17. Mar 2013, 18:51

Re: cups-browsed service not working after boot

Post by westms »

Tristar wrote:I have a problem with my fresh installation of Salix 14.2. Everything works fine except the connection to a printer which is shared by a raspberry pi.
I do not quite understand. Is the PI used as a printer server on the LAN or has the printer installed or connected a different server? Is not important, however, if the PI is not the server.
Tristar wrote:I know that I have to use the cups-browsed service for this, which I started with the command
Salix 14.1 still had CUPS 1.5.4 in use, Salix 14.2 uses CUPS 2.1.4. This is really a huge version jump and it has also changed a lot. Since CUPS 1.6.x in my opinion "CUPS broadcasting/browsing" is no longer used. But also in version 2.1.4, my installation runs a LAN printer without this unfortunate Bonjour broadcasting.

I have specially configured my previously untouched CUPS installation using a web browser over http://localhost:631/ for my LAN printer. JavaScript must be enabled. The printer on the LAN was found immediately and configured automatically and correctly. The "cups-browsed" service was and is not involved. Probably the problem lies elsewhere and you play in the wrong place.

Edit: LAN printer was remote printer before.
Last edited by westms on 20. Feb 2017, 21:30, edited 1 time in total.
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: cups-browsed service not working after boot

Post by mimosa »

Well, it obviously does work, because the problem was only after rebooting. It does seem strange that rc.cups-browsed is apparently not even called under those circumstances, and that fact seems likely to be the explanation for its not working.

I am at a loss to think how that might (not) be happening, but perhaps someone else can?
westms
Posts: 298
Joined: 17. Mar 2013, 18:51

Re: cups-browsed service not working after boot

Post by westms »

Tristar wrote:Any idea where I can check if the rc.cups-browsed script is being called during boot up?
The script is not called anywhere. But if you indispensable want, set the file execute mode bits. Then reboot.
Or check the box at Salix-Menu > System > Systemdienste > Cups-browsed.
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: cups-browsed service not working after boot

Post by mimosa »

The service command should set rc.cups-browsed executable, meaning it will indeed be called during startup. Is it in fact executable, and did you activate it?

Code: Select all

ls -l /etc/rc.d/rc.cups-browsed
-rw-r--r-- 1 root root 3085 Jun 13  2016 /etc/rc.d/rc.cups-browsed
sudo service start cups-browsed
ls -l /etc/rc.d/rc.cups-browsed
-rwxr-xr-x 1 root root 3085 Jun 13  2016 /etc/rc.d/rc.cups-browsed
EDIT I can confirm it isn't being called for me either. Looking at the top of the file, there seems to be some functionality to not execute the script in certain circumstances, see line 3 "Required-start". I don't understand how this works, but it looks as though there may be an unmet package or as it were, service dependency.

I thought Slackware init didn't have this kind of gimmickry in it though - so perhaps I'm barking up the wrong tree. But it is very strange that it is not being called, rather than just not working. Here is the bit of rc.M that calls everything left in /etc/rc.d, excluding certain named files:

Code: Select all

# Start all other rc files not listed in here
if [ -x /etc/rc.d/rc.services ]; then
        python /etc/rc.d/rc.services
fi
But rc.services apparently just checks the non-blacklisted items are executable, before calling them.

I'm afraid at this point I'm stumped, but perhaps someone more knowledgeable can help.
Tristar
Posts: 6
Joined: 26. Feb 2011, 13:32

Re: cups-browsed service not working after boot

Post by Tristar »

westms wrote:The script is not called anywhere. But if you indispensable want, set the file execute mode bits. Then reboot.
Or check the box at Salix-Menu > System > Systemdienste > Cups-browsed.
mimosa wrote:The service command should set rc.cups-browsed executable, meaning it will indeed be called during startup. Is it in fact executable, and did you activate it?
I have checked the corresponding box in Salix-Menu > System > Systemdienste and the script has the executable flags set.

Code: Select all

ls -l rc.cups-browsed 
-rwxr-xr-x 1 root root 3280 Feb 19 18:33 rc.cups-browsed
mimosa wrote:EDIT I can confirm it isn't being called for me either.
I'm somewhat glad that I am not the only one with this problem. Thanks mimosa for your effort to try it yourself.
westms
Posts: 298
Joined: 17. Mar 2013, 18:51

Re: cups-browsed service not working after boot

Post by westms »

Tristar wrote:I'm somewhat glad that I am not the only one with this problem.
I think that only you have the problem, because the problem looks like self-made.

You have not explained at all why it should be necessary to launch rc.cups-browsed. I had expressed my doubts and I am still of the opinion that it is superfluous. With "Salix-Menu > System > Systemdienste > Cups-browsed" or alternatively manual setting of the X bits, I have not made a recommendation, but only answered your question about how to do.

In fact, I think it is wrong to launch the script via rc.services, because rc.services starts everything in background. See file rc.services, line 84:

Code: Select all

os.system('/usr/bin/ionice -c2 -n2 sh /etc/rc.d/'+i+' start &')
rc.cups-browsed launch then in turn /usr/sbin/cups-browsed in background. Two times in background? Such a thing is nonsensical. See file rc.cups-browsed, line 119:

Code: Select all

/usr/sbin/cups-browsed &
In my view of these things, rc.cups-browsed must be launched in the foreground. This can be done by explicit call or source it in rc.M or rc.local. The running script rc.cups-browsed sends the program /usr/sbin/cups-browsed into the background as already shown above.
Similarly, /usr/sbin/cupsd is launched in rc.cups, only /usr/sbin/cupsd itself goes into background. See file rc.cups, line 161:

Code: Select all

/usr/sbin/cupsd
rc.cups is launched in rc.M by an explicit call. See file rc.M, lines 181-189, special line 184:

Code: Select all

if [ -x /etc/rc.d/rc.cups ]; then
  # Start CUPS:
  echo -e "${BOLDWHITE}Starting the print spooling system:${COLOR_RESET}"
  /etc/rc.d/rc.cups start
elif [ -x /etc/rc.d/rc.lprng ]; then
  # Start LPRng (lpd):
  echo -e "${BOLDWHITE}Starting the print spooling system:${COLOR_RESET}"
  . /etc/rc.d/rc.lprng start
fi
From another article:
Tristar wrote:

Code: Select all

echo "$zeitstempel - Starte cups-browsed!" >> $rclog
Many of the scripts in /etc/rc.d run in background. This means that these scripts and programs that have been started do not have any input channel or output channels anymore. In other words, standard input, standard output and standard error output are suspended and no longer exist for these script and programs. Standard output redirection as shown by you can not work then.


If you want to go further, you should reset everything to the beginning. Especially cups-browsed turn off again. Then reboot. Then check to see if cupsd is running. If everything runs on Salix, switch on the printer and if an external printer server is connected, turn it on too. When everything is ready, run a web-browser with JavaScript enabled on http://localhost:631/. Select the dialog for adding a printer and wait for a printer to be found. This can take a couple of minutes (1-2). If this does not work, select the "Search-for-a-printer" dialog. As soon as the printer is ready for operation (switched on), it must be kept awake, no standby, no sleep..., until the end of the configuration.

If nothing happens, you can establish a direct connection to the print server via its IP address and see which protocols are available and if necessary, set a preference.


If it is at all reasonable to start rc.cups-browsed, then you can do this as follows in rc.M or more correctly in rc.local:

Code: Select all

if [ -x /etc/rc.d/rc.cups-browsed ]; then
  # Start CUPS-BROWSED:
  # A daemon for browsing the Bonjour broadcasts of shared, remote CUPS printers.
  echo -e "${BOLDWHITE}Starting something called cups-browsed:${COLOR_RESET}"
  /etc/rc.d/rc.cups-browsed start
fi
The file-execute bits of rc.cups-browsed must be reset.
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: cups-browsed service not working after boot

Post by mimosa »

I think that only you have the problem, because the problem looks like self-made.
No. I have already confirmed this here.

rc.cups-browsed appears to work fine except when called at boot. I used the same logging test as Tristar, and that also works except after reboot.

Maybe a workaround can be found, but I can see no reason for this behaviour. This is a standard-issue Slackware script, and it ought to work, whether at boot or not.
Post Reply