FS#38684 - [cups] fails to start correctly when enabled via .socket
Attached to Project:
Arch Linux
Opened by Jeff Bigler (saturn_knight) - Monday, 27 January 2014, 10:13 GMT
Last edited by Andreas Radke (AndyRTR) - Friday, 07 March 2014, 20:18 GMT
Opened by Jeff Bigler (saturn_knight) - Monday, 27 January 2014, 10:13 GMT
Last edited by Andreas Radke (AndyRTR) - Friday, 07 March 2014, 20:18 GMT
|
Details
Description:
As of version 1.7.1-3 Cups fails to start correctly if a drive in fstab is not mounted. Downgrading to the previous version (1.7.1-1) works fine. If my eSata drive (which is listed in my fstab) is not turned on when booting the system, I am unable to print. The culprit seems to be the cups.socket service. Using the lpstat command results in an "lpstat: Forbidden" error. The cups error log reports: E [27/Jan/2014:16:44:00 +0700] Unable to bind socket for address [v1.::1]:631 - Address already in use. E [27/Jan/2014:16:44:00 +0700] Unable to bind socket for address 127.0.0.1:631 - Address already in use. Steps to reproduce: Drive in fstab is unavailable during boot. |
This task depends upon
But can you please try to find out why that error happens? Check your systemd journal in what order services come up. I guess some required service isn't up at that time and we need to add some Requires or After directive to the socket service file.
ListenStream=631
If I remove that line and reboot, everything works. If the line is added I am unable to access my printers. However, despite not being able to access my printers there are no errors in the journal and the service shows as active. If I stop all the cups related services and restart them everything works.
It does appear to be related to another service which isn't available when it starts. I'll keep plugging away at it, just wanted to remove the red herring about the fstab.
- https://bbs.archlinux.org/viewtopic.php?id=176201
- https://bbs.archlinux.org/viewtopic.php?id=157482
- https://bbs.archlinux.org/viewtopic.php?id=176930
I wish I'd found this sooner, as I sleuthed around for quite a long time to track down the same issue, the ListenStream=631 line in cups.socket. On one computer, I can verify that uncommenting my ipv6 address in /etc/hosts resolved the issue, however I was perplexed that I still had web interface access on localhost:631 with another Arch system even with that line commented out. I checked systemctl list-units and cups.path and cups.socket were not running on that system.
Stopping cups.service and starting cups.socket, cups.path, and cups.service (in that order) replicated the same "Bad Request" issue when trying to visit localhost:631 from both Chromium and Firefox.
I just set up my home printer and used Maintenance -> Print test page successfully with the two scenarios I've found that allow web interface access:
- cups.socket, cups.path, and cups.service (with modified #ListenStream=631 line)
- cups.socket and cups.path stopped and only cups.service running
Technically, I guess there are three scenarios; the third is with cups.path and cups.service, but I didn't try that.
I confirm that the ListenStream=631 line was added with 1.7.1. I grabbed the 01/01/2014 package (v1.7.0) from ARM, untarred it, and the systemd service doesn't have the line.
- https://bugs.archlinux.org/task/32923
It appears it's purpose is such that cups.socket and cups.path can be started and *not* cups.service upon system boot. When one accesses localhost:631, cups.socket triggers cups.service to start, in order to keep it from constantly running. I'm still not *exactly* sure why that line causes issues with everyone, but I believe I've made more progress.
The systemd documentation mentions a line BindIPv6Only=option, which determines which protocol the ListenStream=port option will function with. The default is to use the system settings, found in /proc/sys/net/ipv6/bindv6only. It says the default for that is 'both', however mine ouputs '0' with cat, so I'm not sure what that means.
In any case, if I add 'BindIPv6Only=both' to cups.socket, I can access localhost:631 even with my ipv6 address commented in /etc/hosts.
In addition, I can confirm that starting only cups.socket and cups.path, followed by visiting localhost:631 starts cups.service, so this option appears to let everyone have what they want.
You may want to keep an eye on the Debian systemd patch that currently sees some changes.
Can we close this one as fixed and
FS#32923+FS#38803?Noone required ipv6? Are you guys using msdos?
I've been posting a lot in the forums and following these, and could take a shot at the Wiki. The Arch Cups setup will work in two scenarios (from my experience):
- ipv6 enabled, and an ipv6 address in /etc/hosts
- Using ipv6.disable=1 *and* having the ipv6 address commented out in /etc/hosts
In either of those scenarios, having cups.socket and cups.path started and visiting localhost:631 will start cups.service successfully. My confusion was *not* having disabled ipv6 via the kernel line and yet having my ipv6 address commented out.
This forum post is the only instance I've seen where someone appears to have an ipv6 address in /etc/hosts and yet still get the "Bad Request" error:
- https://bbs.archlinux.org/viewtopic.php?pid=1387476#p1387476
I just posted requesting an attempt to ensure that the hostname is featured in /etc/hosts, as in the first post it was missing.
EDIT: In other words, yes, I think the bugs are resolved. Re. the ipv6 comment that came in while I was typing this... I haven't run into a need for ipv6 in ~4 years of using Arch.
You a lucky for this but not the only one ArchLinux user. I have an ipv6 assignments for the working purposes so I have to request do not disable ipv6 due to cups bugs
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-print/cups/files/cups-1.5.0-systemd-socket-2.patch?revision=1.2&view=markup
but Debian seems to drop this:
cups (1.7.1-6) unstable; urgency=low
.
* Add systemd socket activation support (Closes: #732435):
- Add Gentoo patch to enable runtime-detected systemd socket activation
cups (1.7.1-7) unstable; urgency=low
.
* systemd socket activation:
- Drop ListenDatagram from cups.socket as that's now in use by
cups-browsed
- Drop the Debian-specific patch to make sure that the localhost web
access works; Listen on 0.0.0.0 and [::] in the main patch instead
removing
ListenStream=631
helps and everything became work very well
the kernel ipv6.disable=1 parameter is not a good solution for me, since it's requred
and BindIPv6Only seems will break access from ipv6 address
I'm not really sure where the real bug is, but probably cups people should be more carefully looks to support systemd properly
http://pkgs.fedoraproject.org/cgit/cups.git/commit/cups-systemd-socket.patch?id=6ef39188975c03f6132a98c8cad20ce80b3d95d9
firefox with network.dns.disableIPv6=true results in "Bad Request" on http://localhost:631/
with ipv6 enabled
http://127.0.0.1:631/ results in Forbidden
http://localhost:631/ works fine
This is required in my IPv4 only setup to get a proper link shown in cups web interface when you want to modify a printer
and require to switch to the https admin interface address. Before there was a mix shown of IPv6+IPv4 and now the desired IPv4 only address will be shown.
This is now the same socket file that is used in Gentoo. Please some IPv4 + IPv6 user test it.
http://localhost6:631 does not working
However for now BindIPv6Only it's a good solution for me if the ListenStream is really requred