Bug 2263500 - samba do not show CUPS printer list
Summary: samba do not show CUPS printer list
Keywords:
Status: POST
Alias: None
Product: Fedora
Classification: Fedora
Component: samba
Version: 39
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Guenther Deschner
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-02-09 12:05 UTC by Dario Lesca
Modified: 2024-04-23 11:55 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gitlab samba-team samba merge_requests 3546 0 None opened packaging: Provide a systemd service file for samba-bgqd 2024-03-12 13:10:52 UTC

Description Dario Lesca 2024-02-09 12:05:03 UTC
I have configure CUPS as printer server and samba to share CUPS printers to all user.

After the setup, cups list all printer but samba show only the folders share, all CUPS printers are missing in browser list.

to ensure that the printers are displayed you need to add a fake printer to smb.conf and print on it, every time I add a printer in cups


Reproducible: Always

Steps to Reproduce:
1. install fedora 39 workstation
2. install cups + cups-pdf + samba
3. try list all shared resource, printers and folders

Actual Results:  
Only folders are listed

Expected Results:  
listed folders and printers shared

# Install a fresh Fedora 39 server

# Install cups
dnf install cups -y
systemctl restart cups

# Add a fake printer
lpadmin -p laser1 -oraw -v socket://laser1:9100/ -E

# Install another virtual printer (cups-PDF)
dnf install cups-pdf -y

# Check CUPS printers list
lpstat -t
# CUPS printers are listed

# Install and start samba
dnf install samba samba-client -y
systemctl restart smb nmb

# List printers
smbclient -N -L fedora
# CUPS printers list is NOT show

# add a dumb printer
cat << EOF >> /etc/samba/smb.conf
[lp1]
        comment = LP1 Printer
        path = /var/tmp
        printable = Yes
        browseable = Yes
	printer name = Cups-PDF
	public = yes
EOF

# disable auth (or add a user to samba)
sed -i '/security = user/a\\tmap to guest = bad user' /etc/samba/smb.conf

# Check ..
testparm -s /etc/samba/smb.conf

# Restart samba
systemctl restart smb nmb

# List printers
smbclient -N -L fedora
# CUPS printers are NOT show
# are only displayed the manually added printer         

# Once Again ...
smbclient -N -L fedora
# CUPS printers are NOT show
# are only displayed the manually added printer         

# ....

# Print a simple job to dumb lp1 printer
smbclient -N //fedora/lp1 -c 'print /etc/issue'

# List printers
smbclient -N -L fedora
# from now and forever the list of CUPS printers will be shown

Comment 1 Dario Lesca 2024-02-09 12:06:43 UTC
Also you add a new printer in CUPS you cannot see it into samba printers shared list

You must print a jobs on some existent printers and then also the new printer is show.

Comment 2 Dario Lesca 2024-02-09 16:26:28 UTC
I have try same procedure on a fresh installed debian 11 and the CUPS printers are list immediately

root@debian:~# apt install cups samba samba-client -y
root@debian:~# systemctl status cups
root@debian:~# apt install cups-pdf -y
root@debian:~# lpstat -t
root@debian:~# lpadmin -p laser1 -oraw -v socket://laser1:9100/ -E
root@debian:~# lpstat -t
root@debian:~# smbclient -N -L debian
root@debian:~# systemctl restart cups smbd.service nmbd.service 

root@debian:~# smbclient -N -L debian

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.13.13-Debian)
        laser1          Printer   laser1
        PDF             Printer   PDF
SMB1 disabled -- no workgroup available

# add another printer
root@debian:~# lpadmin -p laser2 -oraw -v socket://laser2:9100/ -E
root@debian:~# smbclient -N -L debian

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.13.13-Debian)
        laser1          Printer   laser1
        PDF             Printer   PDF
SMB1 disabled -- no workgroup available

# It's not show, but if I restart ...
root@debian:~# systemctl restart cups smbd.service nmbd.service 

# the new printer is visible
root@debian:~# smbclient -N -L debian

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.13.13-Debian)
        laser1          Printer   laser1
        PDF             Printer   PDF
        laser2          Printer   laser2
SMB1 disabled -- no workgroup available

Comment 3 Alexander Bokovoy 2024-02-09 16:51:21 UTC
Hi Dario,

do you see any SELinux AVCs? What happens if you'd put the system in permissive mode?

Comment 4 Dario Lesca 2024-02-09 18:07:30 UTC
No, no warnings o avc are recorded in the audit.log

I have put a tail on audit log file and try to add a printer. None are show in log

See this steps

root@fedora:~# tail -f /var/log/audit/audit.log |grep -i avc &
[1] 1842
root@fedora:~# smbclient -N -L fedora

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        lp1             Printer   LP1 Printer
        IPC$            IPC       IPC Service (Samba 4.19.4)
        Cups-PDF        Printer   Cups-PDF
        laser1          Printer   laser1
SMB1 disabled -- no workgroup available
root@fedora:~# lpstat -t
lo scheduler è in funzione
nessuna destinazione predefinita di sistema
dispositivo per Cups-PDF: cups-pdf:/
dispositivo per laser1: socket://laser1:9100/
Cups-PDF sta accettando richieste da gio 8 feb 2024, 18:50:39
laser1 sta accettando richieste da ven 9 feb 2024, 08:59:54
la stampante Cups-PDF è inattiva.  è stata abilitata da gio 8 feb 2024, 18:50:39
la stampante laser1 è inattiva.  è stata abilitata da ven 9 feb 2024, 08:59:54
root@fedora:~# lpadmin -p laser2 -oraw -v socket://laser2:9100/ -E
root@fedora:~# lpstat -t
lo scheduler è in funzione
nessuna destinazione predefinita di sistema
dispositivo per Cups-PDF: cups-pdf:/
dispositivo per laser1: socket://laser1:9100/
dispositivo per laser2: socket://laser2:9100/
Cups-PDF sta accettando richieste da gio 8 feb 2024, 18:50:39
laser1 sta accettando richieste da ven 9 feb 2024, 08:59:54
laser2 sta accettando richieste da ven 9 feb 2024, 19:01:39
la stampante Cups-PDF è inattiva.  è stata abilitata da gio 8 feb 2024, 18:50:39
la stampante laser1 è inattiva.  è stata abilitata da ven 9 feb 2024, 08:59:54
la stampante laser2 è inattiva.  è stata abilitata da ven 9 feb 2024, 19:01:39
root@fedora:~# smbclient -N -L fedora

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        lp1             Printer   LP1 Printer
        IPC$            IPC       IPC Service (Samba 4.19.4)
        Cups-PDF        Printer   Cups-PDF
        laser1          Printer   laser1
SMB1 disabled -- no workgroup available
root@fedora:~# systemctl restart cups smb nmb
root@fedora:~# smbclient -N -L fedora

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        lp1             Printer   LP1 Printer
        IPC$            IPC       IPC Service (Samba 4.19.4)
        Cups-PDF        Printer   Cups-PDF
        laser1          Printer   laser1
SMB1 disabled -- no workgroup available

# here's the trick

root@fedora:~# smbclient -N //fedora/lp1 -c 'print /etc/issue'
putting file /etc/issue as issue-1889 (0,2 kb/s) (average 0,2 kb/s)
root@fedora:~# smbclient -N -L fedora

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        lp1             Printer   LP1 Printer
        IPC$            IPC       IPC Service (Samba 4.19.4)
        Cups-PDF        Printer   Cups-PDF
        laser1          Printer   laser1
        laser2          Printer   laser2
SMB1 disabled -- no workgroup available

Comment 5 Dario Lesca 2024-02-09 18:12:10 UTC
If I put the system in permissive mode same problem:

root@fedora:~# getenforce
Enforcing
root@fedora:~# setenforce 0
root@fedora:~# getenforce
Permissive
root@fedora:~# 
root@fedora:~# 
root@fedora:~# lpadmin -p laser3 -oraw -v socket://laser3:9100/ -E
type=USER_MAC_STATUS msg=audit(1707502202.800:226): pid=829 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  op=setenforce lsm=selinux en
forcing=0 res=1 exe="/usr/bin/dbus-broker" sauid=81 hostname=? addr=? terminal=?'UID="dbus" AUID="unset" SAUID="dbus"
root@fedora:~# lpstat -t
lo scheduler è in funzione
nessuna destinazione predefinita di sistema
dispositivo per Cups-PDF: cups-pdf:/
dispositivo per laser1: socket://laser1:9100/
dispositivo per laser2: socket://laser2:9100/
dispositivo per laser3: socket://laser3:9100/
Cups-PDF sta accettando richieste da ven 9 feb 2024, 19:02:10
laser1 sta accettando richieste da ven 9 feb 2024, 08:59:54
laser2 sta accettando richieste da ven 9 feb 2024, 19:01:39
laser3 sta accettando richieste da ven 9 feb 2024, 19:10:02
la stampante Cups-PDF è inattiva.  è stata abilitata da ven 9 feb 2024, 19:02:10
la stampante laser1 è inattiva.  è stata abilitata da ven 9 feb 2024, 08:59:54
la stampante laser2 è inattiva.  è stata abilitata da ven 9 feb 2024, 19:01:39
la stampante laser3 è inattiva.  è stata abilitata da ven 9 feb 2024, 19:10:02
root@fedora:~# smbclient -N -L fedora

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        lp1             Printer   LP1 Printer
        IPC$            IPC       IPC Service (Samba 4.19.4)
        Cups-PDF        Printer   Cups-PDF
        laser1          Printer   laser1
        laser2          Printer   laser2
SMB1 disabled -- no workgroup available
root@fedora:~# systemctl restart cups smb nmb
root@fedora:~# smbclient -N -L fedora

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        lp1             Printer   LP1 Printer
        IPC$            IPC       IPC Service (Samba 4.19.4)
        Cups-PDF        Printer   Cups-PDF
        laser1          Printer   laser1
        laser2          Printer   laser2
SMB1 disabled -- no workgroup available
root@fedora:~# smbclient -N //fedora/lp1 -c 'print /etc/issue'
putting file /etc/issue as issue-1989 (0,3 kb/s) (average 0,3 kb/s)
root@fedora:~# smbclient -N -L fedora

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        lp1             Printer   LP1 Printer
        IPC$            IPC       IPC Service (Samba 4.19.4)
        Cups-PDF        Printer   Cups-PDF
        laser1          Printer   laser1
        laser2          Printer   laser2
        laser3          Printer   laser3
SMB1 disabled -- no workgroup available

Comment 6 wasundwarum 2024-02-21 20:29:21 UTC
Hello,
same Problem here on arch with samba samba-4.19.5-1.

I have in smb.conf a browseable = yes

but in testparm -s /etc/samba/smb.conf I get always browseable = No

Only after printing to a fake printer all printers will listing in Windows network environment.

Comment 7 Andreas Schneider 2024-02-22 10:45:58 UTC
There is some kind of chicken and egg problem. If you start with a new smbd, then the printer_list database is empty. Once you do a request to enumerate the printers, the samba-dcerpcd will be started and enumerates the printers, but the result will be emtpy. The samba-dcerpcd also starts a background process to task cups about its printers. cups is slow so it takes ~1sec for each printer. So if you have 5 printers you have to wait 5 sec till the printer_list database has been populated.

If you enumerate the printers again, they will be listed now.

If you add or remove printers, you have to enumerate them twice. One to trigger the update and the another to get the current result.

Why are we doing it that way? If we always would talk to cups you would have a blocking call. 5 printers would block the call for 5 seconds. However I know about print servers with 200 printers, and we would block for 200sec.

So we need a background job to update the list to not block. Adding an removing printers isn't something which happens all the time under normal circumstances. So once you have a printer_list database set up. The enumeration of printers should happen right away. You just might to enumerate twice from time to time if you added a new printer.

Comment 8 Dario Lesca 2024-02-22 11:42:39 UTC
I noticed this behavior on Debian, only after a few seconds the list of printers appeared. But it appeared.

On RH and ARCH Linux the CUPS printers list does not appear until you print a jobs on a printer manually added on smb.conf

Comment 9 Andreas Schneider 2024-02-22 12:29:51 UTC
krikkit:~ # rpm -q samba
samba-4.19.5-1.fc39.x86_64
krikkit:~ # rpm -V samba-common                                                           
krikkit:~ # smbpasswd -a asn                                                              
New SMB password:                                                                         
Retype new SMB password:                                                                  
Added user asn.
krikkit:~ # systemctl start smb
krikkit:~ # rpcclient ncacn_np:localhost -Uasn -c enumprinters
Password for [SAMBA\asn]:
No printers returned.
krikkit:~ # rpcclient ncacn_np:localhost -Uasn -c enumprinters
Password for [SAMBA\asn]:
        flags:[0x800000]
        name:[\\LOCALHOST\Cups-PDF]
        description:[\\LOCALHOST\Cups-PDF,,Cups-PDF]
        comment:[Cups-PDF]


This works.


krikkit:~ # systemctl stop smb
krikkit:~ # rm -f /var/lib/samba/lock/printer_list.tdb
krikkit:~ # systemctl start smb
krikkit:~ # smbclient -Uasn -L //localhost
Password for [SAMBA\asn]:

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.19.5)
        asn             Disk      Home Directories
SMB1 disabled -- no workgroup available
krikkit:~ # smbclient -Uasn -L //localhost
Password for [SAMBA\asn]:

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.19.5)
        asn             Disk      Home Directories
SMB1 disabled -- no workgroup available


It looks like listing shares with smbclient doesn't trigger an rpc call. I guess it only looks into the printer_list.tdb.

krikkit:~ # rpcclient ncacn_np:localhost -Uasn -c enumprinters
Password for [SAMBA\asn]:
No printers returned.
krikkit:~ # smbclient -Uasn -L //localhost
Password for [SAMBA\asn]:

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.19.5)
        Cups-PDF        Printer   Cups-PDF
        asn             Disk      Home Directories
SMB1 disabled -- no workgroup available

Comment 10 Dario Lesca 2024-02-23 09:18:18 UTC
Thanks Andreas

then on these systems run "rpcclient ncacn_np:localhost -c enumprinters -Usomeuser" can be used as a trick, rather than adding a fake printer

since the same version of samba works on debian, I imagine that the anomaly depends on how samba was built on these systems? or specific policy of other component?

I'm not a programmer, but if you need any test or check let me know

Comment 11 Andreas Schneider 2024-02-26 08:31:41 UTC
I can't really believe that this just works on Debian. They would need to rewrite some parts for samba-dcerpcd to work and I doubt that.

smbd starts samba-dcerpcd on demand, depending on the rpc service it starts a another backend daemon. We need rpcd_spoolss to be running as that starts samba-bgqd. samba-bgqd is responsible for talking to CUPS and filling the printer_list.tdb.

Comment 12 Dario Lesca 2024-02-26 09:37:52 UTC
yes it's incredible(In reply to Andreas Schneider from comment #11)
> I can't really believe that this just works on Debian. They would need to
> rewrite some parts for samba-dcerpcd to work and I doubt that.

root@debian:~# date
lun 26 feb 2024, 10:01:32, CET
root@debian:~# find / |grep printer_list
/run/samba/printer_list.tdb
root@debian:~# apt -qq list samba
samba/oldstable,oldstable-security,now 2:4.13.13+dfsg-1~deb11u5 amd64 [installato]
root@debian:~# systemctl stop smbd.service nmbd.service 
root@debian:~# rm -f /run/samba/printer_list.tdb
root@debian:~# date
lun 26 feb 2024, 10:02:17, CET
root@debian:~# systemctl start smbd.service nmbd.service 
root@debian:~# date
lun 26 feb 2024, 10:02:31, CET
root@debian:~# smbclient -N -L debian

	Sharename       Type      Comment
	---------       ----      -------
	print$          Disk      Printer Drivers
	IPC$            IPC       IPC Service (Samba 4.13.13-Debian)
	laser1          Printer   laser1
	PDF             Printer   PDF
	laser2          Printer   laser2
SMB1 disabled -- no workgroup available

The printers are here

Comment 13 Dario Lesca 2024-02-26 09:45:40 UTC
root@fedora:~# rpm -V samba-common
root@fedora:~# lpstat -v
dispositivo per Cups-PDF: cups-pdf:/
root@fedora:~# systemctl start smb
root@fedora:~# smbclient -N -L  fedora
Anonymous login successful

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.19.5)
SMB1 disabled -- no workgroup available
root@fedora:~# date
lun 26 feb 2024, 10:42:41, CET
root@fedora:~# smbclient -N -L  fedora
Anonymous login successful

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.19.5)
SMB1 disabled -- no workgroup available
root@fedora:~# date
lun 26 feb 2024, 10:42:56, CET
root@fedora:~# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
root@fedora:~# rpcclient ncacn_np:fedora -Uroot -c enumprinters
Password for [SAMBA\root]:
No printers returned.
root@fedora:~# date
lun 26 feb 2024, 10:44:16, CET
root@fedora:~# smbclient -N -L  fedora
Anonymous login successful

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.19.5)
        Cups-PDF        Printer   Cups-PDF
SMB1 disabled -- no workgroup available

Comment 14 Dario Lesca 2024-02-26 11:02:36 UTC
I have install a fresh debian 12 and this is what happens

root@debian:~# lpstat -v
dispositivo per PDF: cups-pdf:/
root@debian:~# apt -qq list samba
samba/stable,stable-security,now 2:4.17.12+dfsg-0+deb12u1 amd64 [installato]
root@debian:~# find / |grep printer_list
root@debian:~# systemctl start smbd.service nmbd.service
root@debian:~# smbclient -N -L debian

	Sharename       Type      Comment
	---------       ----      -------
	print$          Disk      Printer Drivers
	IPC$            IPC       IPC Service (Samba 4.17.12-Debian)
	nobody          Disk      Home Directories
SMB1 disabled -- no workgroup available
root@debian:~# find / |grep printer_list
/run/samba/printer_list.tdb
root@debian:~# smbclient -N -L debian

	Sharename       Type      Comment
	---------       ----      -------
	print$          Disk      Printer Drivers
	IPC$            IPC       IPC Service (Samba 4.17.12-Debian)
	nobody          Disk      Home Directories
SMB1 disabled -- no workgroup available

Printer PDF is missing on list

root@debian:~# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
root@debian:~# rpcclient ncacn_np:debian -Uroot -c enumprinters
Password for [WORKGROUP\root]:
No printers returned.
root@debian:~# smbclient -N -L debian
Anonymous login successful

	Sharename       Type      Comment
	---------       ----      -------
	print$          Disk      Printer Drivers
	IPC$            IPC       IPC Service (Samba 4.17.12-Debian)
	PDF             Printer   PDF
	nobody          Disk      Home Directories
SMB1 disabled -- no workgroup available
root@debian:~# rpcclient ncacn_np:debian -Uroot -c enumprinters
Password for [WORKGROUP\root]:
	flags:[0x800000]
	name:[\\DEBIAN\PDF]
	description:[\\DEBIAN\PDF,,PDF]
	comment:[PDF]


In this case the behavior is the same as fedora.

Seem It seems to depend on the newer version of samba

On debian 11 samba 4.13.13
On debian 12 samba 4.17.12

Comment 15 Dario Lesca 2024-02-26 11:35:57 UTC
On debian 12 I have update samba using this repo: https://samba.tranquil.it/doc/en/samba_config_server/debian/server_install_samba_debian.html#server-install-samba-debian

root@debian:~# apt -qq list samba
samba/sconosciuto,now 2:4.19.5+dfsg-3-1bookworm1 amd64 [installato]
root@debian:~# systemctl stop smbd.service nmbd.service
root@debian:~# find / |grep printer_list
/run/samba/printer_list.tdb
root@debian:~# rm -f /run/samba/printer_list.tdb
root@debian:~# systemctl start smbd.service nmbd.service
root@debian:~# smbclient -N -L debian
Anonymous login successful

	Sharename       Type      Comment
	---------       ----      -------
	print$          Disk      Printer Drivers
	IPC$            IPC       IPC Service (Samba 4.19.5-Debian)
	nobody          Disk      Home Directories
SMB1 disabled -- no workgroup available

root@debian:~# rpcclient ncacn_np:debian -Uroot -c enumprinters
Password for [WORKGROUP\root]:
No printers returned.
root@debian:~# smbclient -N -L debian
Anonymous login successful

	Sharename       Type      Comment
	---------       ----      -------
	print$          Disk      Printer Drivers
	IPC$            IPC       IPC Service (Samba 4.19.5-Debian)
	PDF             Printer   PDF
	nobody          Disk      Home Directories
SMB1 disabled -- no workgroup available

Same problem.

Comment 16 Andreas Schneider 2024-02-26 16:14:36 UTC
I'm currently not sure how to address this. I need to discuss it with other developers.

Comment 17 Andreas Schneider 2024-02-27 13:11:16 UTC
One solution is to start `/usr/libexec/samba/samba-bgqd`, without any options it will just run in the backgroup. That will update the printer_list.tdb depending on `printcap cache time` smb.conf option. A temporary solution could be if we ship a systemd service file for /usr/libexec/samba/samba-bgqd.

Comment 18 Dario Lesca 2024-02-27 19:47:34 UTC
(In reply to Andreas Schneider from comment #17)
> One solution is to start `/usr/libexec/samba/samba-bgqd`, without any
> options it will just run in the backgroup. That will update the
> printer_list.tdb depending on `printcap cache time` smb.conf option. A
> temporary solution could be if we ship a systemd service file for
> /usr/libexec/samba/samba-bgqd.

Yes, it work.
I have try manually start samba-bgqd and the printers are listed:

root@fedora:~# systemctl stop smb nmb
root@fedora:~# ps -fea |grep sam
root        3995    1800  0 20:03 pts/2    00:00:00 grep --color=auto sam
root@fedora:~# rm /var/lib/samba/lock/printer_list.tdb
rm: rimuovere file regolare '/var/lib/samba/lock/printer_list.tdb'? y
root@fedora:~# systemctl start smb nmb
root@fedora:~# smbclient -N -L  fedora
Anonymous login successful

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.19.5)
SMB1 disabled -- no workgroup available
root@fedora:~# smbclient -N -L  fedora
Anonymous login successful

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.19.5)
SMB1 disabled -- no workgroup available
root@fedora:~# systemctl stop smb nmb
root@fedora:~# /usr/libexec/samba/samba-bgqd
root@fedora:~# systemctl start smb nmb
root@fedora:~# smbclient -N -L  fedora
Anonymous login successful

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.19.5)
        Cups-PDF        Printer   Cups-PDF
SMB1 disabled -- no workgroup available

Printers are listed.

But if I add a printer I must restart the samba-bgqd process to see newer printers

root@fedora:~# lpadmin -p laser1 -oraw -v socket://laser1:9100/ -E
root@fedora:~# lpstat -v
dispositivo per Cups-PDF: cups-pdf:/
dispositivo per laser1: socket://laser1:9100/
root@fedora:~# smbclient -N -L  fedora
Anonymous login successful

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.19.5)
        Cups-PDF        Printer   Cups-PDF
SMB1 disabled -- no workgroup available
root@fedora:~# pkill samba
root@fedora:~# /usr/libexec/samba/samba-bgqd 
root@fedora:~# smbclient -N -L  fedora
Anonymous login successful

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.19.5)
        Cups-PDF        Printer   Cups-PDF
        laser1          Printer   laser1
SMB1 disabled -- no workgroup available

Comment 19 Andreas Schneider 2024-02-28 09:41:18 UTC
> But if I add a printer I must restart the samba-bgqd process to see newer printers

If you want to see it instantly, yes you have to restart it. But as already explained earlier, it will show up after `printcap cache time` is reached. That's 12 min and 30 sec by default. So after 13 min it will show up. You can also set it to a lower value ...

Comment 20 Dario Lesca 2024-02-28 14:53:53 UTC
(In reply to Andreas Schneider from comment #19)
> So after 13 min it will show up.

Ok, thanks, this time (or restart the process, or run rpcclient) is sufficient, without change the default timeout
Now we have a work around and know how to make the list of printers appear, even without changing anything

A curiosity, Why is it not possible to restore the previous method used up to version 14.14, the latest samba version which immediately displays the list of CUPS printers?

Comment 21 Andreas Schneider 2024-02-28 16:54:27 UTC
The display was also not immediately on earlier versions. I was if you might have had only one printer but not with more :-)

The dcerpc architecture was rewritten and that also introduced new issues.

Comment 22 Andreas Schneider 2024-04-09 11:59:53 UTC
This should be fixed with Samba 4.20.1 in Fedora 40 providing a samba-bgqd.service systemd file.


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