febrero 14, 2017

CUPS

CUPS (Common UNIX Printing System) es un sistema de impresión para GNU/Linux y otros sistemas operativos basados sobre el estándar POSIX, distribuido bajo los términos de la licencia GNU/GPLv2. Podemos encontrar mucha información sobre CUPS en su sitio oficial.
Pero lo que nos trae no son las bondades de CUPS, sino los problemas que recientemente está generando después de las últimas actualizaciones, que afectan a casi todas las distribuciones de Linux, el cual verificamos en los logs, con el siguiente mensaje (cada 5 o 6 min y el servicio cae):
Feb  8 11:38:19 ubuntuserver systemd[1]: Started CUPS Scheduler.
Feb  8 11:42:20 ubuntuserver systemd[1]: Started CUPS Scheduler.
Feb  8 11:47:08 ubuntuserver systemd[1]: Started CUPS Scheduler.
Feb  8 11:50:59 ubuntuserver systemd[1]: Started CUPS Scheduler.
Feb  8 11:55:24 ubuntuserver systemd[1]: Started CUPS Scheduler.
Feb  8 11:59:22 ubuntuserver systemd[1]: Started CUPS Scheduler.
Feb  8 12:03:08 ubuntuserver systemd[1]: Started CUPS Scheduler.
Feb  8 12:07:20 ubuntuserver systemd[1]: Started CUPS Scheduler.
Feb  8 12:11:52 ubuntuserver systemd[1]: Started CUPS Scheduler.
Feb  8 12:16:10 ubuntuserver systemd[1]: Started CUPS Scheduler.
Feb  8 12:20:04 ubuntuserver systemd[1]: Started CUPS Scheduler.
Y el /var/log/cups/access_log:
localhost - - [14/Feb/2017:06:25:49 -0500] "POST / HTTP/1.1" 200 349 Create-Printer-Subscriptions successful-ok
localhost - - [14/Feb/2017:06:25:49 -0500] "POST / HTTP/1.1" 200 176 Create-Printer-Subscriptions successful-ok
localhost - - [14/Feb/2017:15:30:36 -0500] "POST / HTTP/1.1" 401 123 Cancel-Subscription successful-ok
localhost - root [14/Feb/2017:15:30:36 -0500] "POST / HTTP/1.1" 200 123 Cancel-Subscription successful-ok
localhost - - [14/Feb/2017:15:30:36 -0500] "POST / HTTP/1.1" 200 152 Cancel-Subscription successful-ok
localhost - - [14/Feb/2017:15:30:36 -0500] "POST / HTTP/1.1" 200 349 Create-Printer-Subscriptions successful-ok
localhost - - [14/Feb/2017:15:30:36 -0500] "POST / HTTP/1.1" 200 176 Create-Printer-Subscriptions successful-ok
localhost - - [14/Feb/2017:15:35:31 -0500] "POST / HTTP/1.1" 401 123 Cancel-Subscription successful-ok
localhost - root [14/Feb/2017:15:35:31 -0500] "POST / HTTP/1.1" 200 123 Cancel-Subscription successful-ok
localhost - - [14/Feb/2017:15:35:31 -0500] "POST / HTTP/1.1" 200 152 Cancel-Subscription successful-ok
localhost - - [14/Feb/2017:15:35:31 -0500] "POST / HTTP/1.1" 200 349 Create-Printer-Subscriptions successful-ok
localhost - - [14/Feb/2017:15:35:31 -0500] "POST / HTTP/1.1" 200 176 Create-Printer-Subscriptions successful-ok
localhost - - [14/Feb/2017:15:51:39 -0500] "POST / HTTP/1.1" 401 123 Cancel-Subscription successful-ok
localhost - root [14/Feb/2017:15:51:39 -0500] "POST / HTTP/1.1" 200 123 Cancel-Subscription successful-ok
localhost - - [14/Feb/2017:15:51:39 -0500] "POST / HTTP/1.1" 200 152 Cancel-Subscription successful-ok
localhost - - [14/Feb/2017:15:51:39 -0500] "POST / HTTP/1.1" 200 349 Create-Printer-Subscriptions successful-ok
localhost - - [14/Feb/2017:15:51:39 -0500] "POST / HTTP/1.1" 200 176 Create-Printer-Subscriptions successful-ok
localhost - - [14/Feb/2017:16:05:18 -0500] "POST / HTTP/1.1" 401 123 Cancel-Subscription successful-ok
localhost - root [14/Feb/2017:16:05:18 -0500] "POST / HTTP/1.1" 200 123 Cancel-Subscription successful-ok
localhost - - [14/Feb/2017:16:05:18 -0500] "POST / HTTP/1.1" 200 152 Cancel-Subscription successful-ok
localhost - - [14/Feb/2017:16:05:18 -0500] "POST / HTTP/1.1" 200 349 Create-Printer-Subscriptions successful-ok
localhost - - [14/Feb/2017:16:05:18 -0500] "POST / HTTP/1.1" 200 176 Create-Printer-Subscriptions successful-ok
Sin extendernos mucho, ya que es un BUG confirmado y hay abundante información sobre el problema, pasaremos directo a una solución provisional, que, al menos, evitará que su servidor se vuelva loco.
sudo cp -f /etc/cups/cupsd.conf{,.bak}
sudo service cups stop
sudo apt-get install -f
sudo cp /usr/share/cups/cupsd.conf.default /etc/cups/cupsd.conf
sudo service cups start
Y poner algún vigilante en /etc/init.d con el siguiente contenido:
# CUPS service
date=`date +%d/%m/%Y" "%H:%M:%S`
if [[ `ps -A | grep cupsd` != "" ]];then
echo -e "\nONLINE"
else
echo -e "\n"
service cups start
# constancia en el log (opcional)
echo "CUPS fue iniciado $date" >> /var/log/syslog.log
fi
#
date=`date +%d/%m/%Y" "%H:%M:%S`
if [[ `ps -A | grep cups-browsed` != "" ]];then
echo -e "\nONLINE"
else
echo -e "\n"
service cups start
# constancia en el log (opcional)
echo "CUPS-browsed fue iniciado $date" >> /var/log/syslog.log
fi
Y programar el script en el cron cada 2 min. Ej:
*/02 * * * * /etc/init.d/fixcups.sh
Otra solución que proponen en launchpad es editar cups.service y reemplazar "l" por "f":
/lib/systemd/system/cups.service
ExecStart=/usr/sbin/cupsd -f
Pero si no lo usa, lo más recomendado en estos momentos es que lo desinstale, hasta que se corrija el Bug de forma definitiva.
sudo apt-get purge --auto-remove cups-daemon
Maravento, Actualizado en: 16:25
Escrito por: Maravento Studio
 
© 2017 Maravento. All Rights Reserved | Powered by Maravento
Design by Novatoz and Maravento | Bloggerized By LawnyDesignz
# https://github.com/google/code-prettify