On Sun, 18 Feb 2024 12:30:01 +0300
Michael Tokarev <m...@tls.msk.ru> wrote:
> I don't maintain this code, so my email is just a random comment.

Thanks for your comment anyway!

> But I did have an issue with smbd not working right due to one
> missing/wrong parameter or another, more than once.  Also, samba
> is evolving too, so it might need more parameters or less.

During the years, my brute force approach to solve issues like this has been
to locally patch qemu source code to build custom qemu binaries with the
smb.conf parameters that I want. 

> My suggestion is still the same as 10+ years ago: to ship a shell script
> which run smbd, instead of running smbd directly.  This script will set
> up smb.conf (whole thing, exactly as it is done now in the C code), and
> exec /usr/sbin/smbd with the necessary args.

Such a script would be easier to modify than changing the C sources.

> This way, it's a) trivial to modify parameters on the qemu side (easy to
> edit just this script), b) possible to see which samba version is in use
> and adopt some parameters, c) use alternative smbd, and especially d)
> allow the end-user to override smbd or config in use.

During the years, I have also seen the need to use alternative smbd. I have
then solved it by having the old smbd that I prefered for qemu in /usr/sbin
and moved the "original" smbd provided by the Linux distribution to
/usr/local/sbin where it has been started by any real Samba servers in the
network.

> The best, I'd say, is to allow to specify the script on qemu command line
> (like samba=/etc/qemu/run-smbd.sh), and have default value for that, like
> /usr/share/qemu/run-smbd.sh, which is the default script shipped with
> qemu.  Or maybe let qemu choose to use either the one specified on the
> command line, /etc/qemu/run-smbd.sh if it exists, or
> /usr/share/qemu/run-smbd.sh.

Yes, by specifying such a script on the command line it would be possible to
have different parameters for different qemu sessions.  However, I think that
also my solution allowing settings of samba parameters fixes most of the
problems in a way which most of the times will be easier to use. 

Usually, there is no need to modify more than a handfull of parameters so
those extra arguments to the qemu command line will be less to write than a
separate script starting samba. In my experience qemu is mostly started from a
script with a rather long qemu command line anyway.

The remaining problem is when Samba comes with a new version which requires
new settings of parameters. Regardless of solution some script will need to be
modified to solve that problem.

Again, thanks for your comment! I hope that someone will consider my patch or
your suggestion. The next thing to look into would be the possibility to start
some userspace NFS daemon as an alternative to Samba as Unix-guests works
better with NFS than CIFS. However, that would be a much bigger project and I
won't dig into such a thing until I have gotten any response on this small
patch.

regards Henrik

Reply via email to