Created attachment 10402 [details] smb.conf for reproduction with socat It appears that the inetd mode of smbd (for non-root users) has been broken since Samba 4 (?). This affects folder sharing in QEMU (-net user,smb=/some/path). Steps to reproduce: 1. Start server in inetd mode as non-root user (use attached config): socat TCP-LISTEN:1337,reuseaddr EXEC:"smbd -s smb.conf",nofork 2. Run client: smbclient -NL -p1337 127.0.0.1 Expected results: smbclient should return immediately, printing the "qemu" disk share. Actual results: smbd hangs which results in a timeout. Earliest affected version: samba-4.0.0alpha17 Current git which is also affected: samba-4.2.0rc1-419-g6faef4d Related links: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=747636 https://bugzilla.novell.com/show_bug.cgi?id=853379 http://lists.nongnu.org/archive/html/qemu-devel/2014-10/msg03040.html http://lists.nongnu.org/archive/html/qemu-devel/2014-11/msg00283.html
Created attachment 10403 [details] log.smbd (qemu, as root) This log is created with QEMU 2.1.2 and Samba 4.1.12. Surely there is a way to create this issue without QEMU, but this is my use case. The QEMU disk image was specially prepared just for testing this Samba issue and prints the result of smbclient to serial. QEMU was invoked with: qemu-system-x86_64 -enable-kvm -m 4G -drive if=virtio,file=/tmp/arch.qcow2,id=vd0,snapshot=on -net user -net nic,model=virtio -serial none -vnc :0 The nested QEMU actually starts smbd: qemu-system-x86_64 -m 1G -drive if=virtio,file=/dev/vda,id=vd0,snapshot=on -serial stdio -net nic,model=virtio -net user,smb=/usr -vnc :0
Created attachment 10404 [details] log.smbd (bad, running as non-root, peter(1000)) By the way, both times, the smb.conf file was modified to add a single 'log level=10' line to the global config. This is the config which was generated by QEMU 2.1.2: [global] log level=10 private dir=/tmp/qemu-smb.20473-0 socket address=127.0.0.1 pid directory=/tmp/qemu-smb.20473-0 lock directory=/tmp/qemu-smb.20473-0 state directory=/tmp/qemu-smb.20473-0 ncalrpc dir=/tmp/qemu-smb.20473-0/ncalrpc log file=/tmp/qemu-smb.20473-0/log.smbd smb passwd file=/tmp/qemu-smb.20473-0/smbpasswd security = user map to guest = Bad User [qemu] path=/usr read only=no guest ok=yes force user=peter
Looking in the pcap capture, I see an error about an unwritable log file. This is fixed by invoking smbd with the -l option: smbd -s smb.conf -l /tmp/smbs/ If log messages were written to stderr rather than stderr, then this problem would not have occurred.