Bug 21164 - Problem with SMB backend for CUPS, caused by /usr/lib/cups/backend/smb danging link
Summary: Problem with SMB backend for CUPS, caused by /usr/lib/cups/backend/smb dangin...
Status: ASSIGNED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Base system maintainers
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 25518
  Show dependency treegraph
 
Reported: 2017-06-30 09:42 CEST by Nicolas Salguero
Modified: 2020-08-23 17:50 CEST (History)
7 users (show)

See Also:
Source RPM: samba-4.12.6-1.mga8.src.rpm
CVE:
Status comment:


Attachments
Results for commands proposed @ comment #6 (6.54 KB, text/plain)
2019-09-12 15:49 CEST, Luciano Roberto Rampazzo
Details

Description Nicolas Salguero 2017-06-30 09:42:34 CEST
Hi,

After upgrading from Mageia 5 to 6, I discovered that "/usr/lib/cups/backend/smb" was a dangling link, so printing failed for a printer accessed via SMB protocol.

The link referenced "/etc/alternatives/smb", which referenced "/usr/lib/cups/backend/smb3" from samba-client-3.6.25-2.7.mga5.

In Mageia 6, samba-client-4.6.5-1.mga6 contains "/usr/libexec/samba/cups_backend_smb".

When I did "ln -svf /usr/libexec/samba/cups_backend_smb /usr/lib/cups/backend/smb", printing worked again.

Moreover, I found several other dangling links related to samba3 in "/etc/alternatives/" but those links where not referenced elsewhere.

Best regards,

Nico.
Comment 1 Marja Van Waes 2017-07-01 06:27:03 CEST
Assigning to the registered samba maintainer

Summary: Problem with SMB backend for CUPS => Problem with SMB backend for CUPS, caused by /usr/lib/cups/backend/smb danging link
CC: (none) => marja11
Assignee: bugsquad => bgmilne
Source RPM: (none) => samba-4.6.5-1.mga6

Comment 2 papoteur 2017-08-31 14:07:28 CEST
Bug confirmed here :
https://www.mageialinux-online.org/forum/topic-24043-1+probleme-mageia6-pour-configurer-une-imprimante-avec-le-protocol-smb.php#m231071

and workaround also confirmed. Thanks Nicolas.

We need now a packager to correct the problem.

CC: (none) => yves.brungard_mageia

Florian Hubold 2018-07-11 22:36:45 CEST

CC: (none) => doktor5000

Comment 3 Luciano Roberto Rampazzo 2019-07-29 20:43:36 CEST
Please, add this information in Mageia 7 Errata.

Still valid.

CC: (none) => lrampazzo

Comment 4 Buchan Milne 2019-09-04 21:07:41 CEST
The problem was introduced by the switch from samba-3.x to samba-4.x (where a different distribution's samba package was imported without considering all the possible impact, in http://svnweb.mageia.org/packages/cauldron/samba/current/SPECS/samba.spec?r1=852307&r2=854335 )

Previously, the samba (samba-client) package managed the /usr/lib/cups/backend/smb symlink as a slave of the smbclient alternative ( http://svnweb.mageia.org/packages/cauldron/samba/current/SPECS/samba.spec?revision=852307&view=markup&pathrev=852307#l1728 ), and systems that had the previous version still have the alternative installed:

[root@media ~]# update-alternatives --display smbclient
smbclient - status is auto.
 link currently points to /usr/bin/smbclient3
/usr/bin/smbclient3 - priority 10
 slave cups_smb: /usr/lib/cups/backend/smb3
 slave findsmb.1: /usr/share/man/man1/findsmb3.1.xz
 slave findsmb: /usr/bin/findsmb3
 slave smbspool.8: /usr/share/man/man8/smbspool3.8.xz
 slave smbget.1: /usr/share/man/man1/smbget3.1.xz
 slave smbtar.1: /usr/share/man/man1/smbtar3.1.xz
 slave nmblookup: /usr/bin/nmblookup3
 slave smbgetrc.5: /usr/share/man/man5/smbgetrc3.5.xz
 slave smbget: /usr/bin/smbget3
 slave smbtar: /usr/bin/smbtar3
 slave nmblookup.1: /usr/share/man/man1/nmblookup3.1.xz
 slave eventlogadm: /usr/bin/eventlogadm3
 slave smbclient.1: /usr/share/man/man1/smbclient3.1.xz
 slave smbprint: /usr/bin/smbprint3
 slave smbspool: /usr/bin/smbspool3
Current `best' version is /usr/bin/smbclient3.
[root@media ~]#


There are now ( http://svnweb.mageia.org/packages/cauldron/samba/current/SPECS/samba.spec?revision=1436819&view=markup#l892 ) update-alternatives configurations that maintain the symlink /usr/libexec/samba/cups_backend_smb:

[root@buchan-desktop ~]# update-alternatives --display cups_backend_smb
cups_backend_smb - status is auto.
 link currently points to /usr/bin/smbspool
/usr/bin/smbspool - priority 10
Current `best' version is /usr/bin/smbspool.
[root@buchan-desktop ~]# cat /var/lib/alternatives/cups_backend_smb 
auto
/usr/libexec/samba/cups_backend_smb

/usr/bin/smbspool
10
[root@buchan-desktop ~]#


Another alternative is provided in the samba-krb5-printing sub-package, for a kerberos-wrapped backend.

So, the real question is, which package should own the /usr/lib/cups/backend/smb symlink?

If the samba package should own it, I would maybe rather change this update-alternatives config to add a "slave", but e.g. in Fedora, the cups package owns the /usr/lib/cups/backend symlink:

https://src.fedoraproject.org/rpms/cups/blob/master/f/cups.spec#_591

I propose:
* samba package to add removal of the old smbclient alternatives
* cups package adds the symlink via trigger following Fedora's convention pointing to the existing symlink /usr/libexec/samba/cups_backend_smb which is already present in the samba-client package.

(I wouldn't mind resolving this soon so I could potentially include this for the pending samba update for Mageia 7).


(trying to re-assign to cups maintainer tv@)

Source RPM: samba-4.6.5-1.mga6 => cups-2.2.11-2.mga7.src.rpm
CC: (none) => bgmilne
Assignee: bgmilne => bugsquad

Buchan Milne 2019-09-04 21:09:32 CEST

Assignee: bugsquad => thierry.vignaud

Comment 5 Buchan Milne 2019-09-05 22:52:09 CEST
To clean up what is in scope for the samba package, it looks like calling:

update-alternatives --remove smbclient /usr/bin/smbclient3 || :


should be enough:

[root@media ~]# ls -l /usr/lib/cups/backend/smb 
lrwxrwxrwx 1 root root 26 Jun 23  2013 /usr/lib/cups/backend/smb -> /etc/alternatives/cups_smb
[root@media ~]# ls -l /etc/alternatives/cups_smb
lrwxrwxrwx 1 root root 26 Jul 22  2017 /etc/alternatives/cups_smb -> /usr/lib/cups/backend/smb3
[root@media ~]# update-alternatives --remove smbclient /usr/bin/smbclient3
[root@media ~]# ls -l /etc/alternatives/cups_smb
ls: cannot access '/etc/alternatives/cups_smb': No such file or directory
[root@media ~]# ls -l /usr/lib/cups/backend/smb 
ls: cannot access '/usr/lib/cups/backend/smb': No such file or directory
[root@media ~]# update-alternatives --remove smbclient /usr/bin/smbclient3
[root@media ~]# echo $?
2
[root@media ~]#

But, I need to test some more.

Putting the correct symlink in /usr/lib/cups/backend will need to be done by cups.
Comment 6 Buchan Milne 2019-09-10 19:37:47 CEST
Since there wasn't any traction, and it makes just as much sense to add the symlink to samba-client, I have committed a fix in http://svnweb.mageia.org/packages?view=revision&revision=1439385 (cauldron) and http://svnweb.mageia.org/packages?view=revision&revision=1439417 for 7, and I have submitted this to core/updates_testing (samba-4.10.8-2.mga7)

Affected users could help by testing this package on affected machines currently running Mageia 7.

Testing procedure:
1)Before upgrading, run the following commands:
ls -l $(readlink -f /usr/lib/cups/backend/smb )
ls -l $(readlink -f /etc/alternatives/smb*)
/usr/sbin/update-alternatives --list|grep smb
/usr/sbin/update-alternatives --display smbclient
cat /var/lib/alternatives/smbclient

The first command should return:
ls: cannot access '/etc/alternatives/cups_smb': No such file or directory

The 2 command should show a lot of broken symlinks

The other 3 commands provide more information in case the update doesn't do the right thing.


2)Upgrade at least samba-client from updates_testing by running the following commands as root:
urpmi.update "Core Updates Testing"
urpmi --media "Core Updates Testing" samba-client

3)Run the commands from (1) again

This time, the first command should return the listing for /usr/bin/smbspool, e.g.:
-rwxr-xr-x 1 root root 27664 Sep 10 16:10 /usr/bin/smbspool*

The 2nd command should return:
ls: cannot access '/etc/alternatives/smb*': No such file or directory

Ideally, the last 3 commands should return nothing, but it looks like the /var/lib/alternatives/smbclient gets left behind. Since this is mainly cosmetic, I will update cauldron to clean this up, and on upgrading to Mageia 8 (or, if we need to do another update for 7, on applying that update) this remnant should also be removed.

It would be useful to have the all of the output from the 3 sets of commands from anyone who tests this.

Source RPM: cups-2.2.11-2.mga7.src.rpm => samba-4.6.5-1.mga6
Status: NEW => ASSIGNED
Assignee: thierry.vignaud => bugsquad

Comment 7 Luciano Roberto Rampazzo 2019-09-12 15:49:12 CEST
Created attachment 11274 [details]
Results for commands proposed @ comment #6
Thierry Vignaud 2019-10-03 13:47:26 CEST

Blocks: (none) => 25518

Comment 8 Thierry Vignaud 2019-10-03 13:53:53 CEST
This generates an error while updating cups (see bug#25518).

/usr/lib/cups/backend/smb -> /usr/libexec/samba/cups_backend_smb

(In reply to Buchan Milne from comment #4)
> The problem was introduced by the switch from samba-3.x to samba-4.x (where
> a different distribution's samba package was imported without considering
> all the possible impact, in
(...)
> Previously, the samba (samba-client) package managed the
> /usr/lib/cups/backend/smb symlink as a slave of the smbclient alternative (
(...)
> If the samba package should own it, I would maybe rather change this
> update-alternatives config to add a "slave", but e.g. in Fedora, the cups
> package owns the /usr/lib/cups/backend symlink:

(In reply to Buchan Milne from comment #5)
> Putting the correct symlink in /usr/lib/cups/backend will need to be done by
> cups.

it's debatable since /usr/lib/cups/backend/smb is a symlink to /usr/libexec/samba/cups_backend_smb, owned by samba, but I'm OK to add the triggersin into cups

CC: (none) => thierry.vignaud

Comment 9 Aurelien Oudelet 2020-08-23 17:50:07 CEST
Currently
Samba is samba-4.12.6-1.mga8 > samba-4.6.5-1.mga6

Cups is cups-2.3.3-6.mga8.

Does this still apply in Cauldron Mageia 8 Beta 1?
Assigning meanwhile to Base System Team.

CC: (none) => ouaurelien
Assignee: bugsquad => basesystem

Aurelien Oudelet 2020-08-23 17:50:45 CEST

Source RPM: samba-4.6.5-1.mga6 => samba-4.12.6-1.mga8.src.rpm


Note You need to log in before you can comment on or make changes to this bug.