What is messing with my samba config?

Hi,

I have this in my /etc/config/fstab:

config global
        option anon_swap '0'
        option anon_mount '0'
        option auto_swap '1'
        option auto_mount '0'
        option delay_root '5'
        option check_fs '0'

config mount
        option target '/home/mh/S2'
        option uuid 'ec670b9b-86f2-482c-8f0d-300bf2a2aefe'
        option enabled '1'

And this in my /etc/config/samba:

config samba
        option workgroup 'WORKGROUP'
        option homes '1'
        option name 'GL-AR300M'
        option description 'GL-AR300M-e16'

config sambashare
        option name 'stuff'
        option path '/home/mh/stuff'
        option read_only 'no'
        option guest_ok 'yes'

config sambashare
        option name 'S2'
        option path '/home/mh/S2'
        option read_only 'no'
        option guest_ok 'yes'

Yet when I reboot the samba-entry mutates to:

config samba
        option workgroup 'WORKGROUP'
        option homes '1'
        option name 'GL-AR300M'
        option description 'GL-AR300M-e16'

config sambashare
        option name 'stuff'
        option path '/home/mh/stuff'
        option read_only 'no'
        option guest_ok 'yes'

config sambashare
        option name 'S2'
        option path '/home/mh/S2'
        option read_only 'no'
        option guest_ok 'yes'

config sambashare
        option path '/mnt/S2'
        option name 'S2'
        option read_only 'yes'
        option guest_ok 'yes'

The last stanza then makes my samba unusuable.
How can I find out what process is messing with my config?

Many thanks!

What's the output of the mount command?

mount shows:

/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/ubi0_1 on /overlay type ubifs (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
/dev/sda1 on /home/mh/S2 type ext4 (rw,relatime,data=ordered)

That's a curious one. It looks like the first (or only) partition on the disk is mounted to /home/mh/S2, and the samba process ought to be sharing it as \S2 for any clients which browse to it. It's not immediately clear why the /mnt/S2 entry is appearing.

Most configuration information is usually held in /etc. Just out of curiosity, what does grep -lr S2 /etc return?

1 Like

This is my /etc/config/fstab:

config global
        option anon_swap '0'
        option anon_mount '0'
        option auto_swap '1'
        option auto_mount '1'
        option delay_root '5'
        option check_fs '0'

config mount
        option target '/home/mh/S2'
        option uuid 'ec670b9b-86f2-482c-8f0d-300bf2a2aefe'
        option enabled '1'

The disk mounted to /home/mh/S2 is an USB-stick. Automounting it works, however every time I remove it and plug it in again it gets mounted again, however even this messes up the samba-config.

This is really my fundamental problem - removing and plugging in the USB-stick destroys my samba-config - and it is not clear to me why this action triggers a rewrite of the samba-config in the first place...

Here is the output of your grep:

mh@an:~$ sudo grep -lr S2 /etc
/etc/board.d/01_leds
/etc/config/samba
/etc/config/fstab
/etc/config/.samba.uci-AobnHi
/etc/config/.samba.uci-pFOmEh
grep: /etc/localtime: No such file or directory
/etc/mtab
grep: /etc/ppp/resolv.conf: No such file or directory
/etc/samba/lowcase.dat
/etc/samba/upcase.dat
/etc/samba/smb.conf
/etc/ssl/certs/1e08bfd1.0
/etc/ssl/certs/2b349938.0
/etc/ssl/certs/2c543cd1.0
/etc/ssl/certs/349f2832.0
/etc/ssl/certs/3bde41ac.0
/etc/ssl/certs/3e44d2f7.0
/etc/ssl/certs/40193066.0
/etc/ssl/certs/4f316efb.0
/etc/ssl/certs/54657681.0
/etc/ssl/certs/5d3033c5.0
/etc/ssl/certs/6410666e.0
/etc/ssl/certs/76cb8f92.0
/etc/ssl/certs/8160b96c.0
/etc/ssl/certs/87229d21.0
/etc/ssl/certs/9168f543.0
/etc/ssl/certs/988a38cb.0
/etc/ssl/certs/9f0f5fd6.0
/etc/ssl/certs/AffirmTrust_Commercial.crt
/etc/ssl/certs/AffirmTrust_Premium.crt
/etc/ssl/certs/Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.crt
/etc/ssl/certs/Buypass_Class_2_Root_CA.crt
/etc/ssl/certs/Buypass_Class_3_Root_CA.crt
/etc/ssl/certs/Certinomis_-_Root_CA.crt
/etc/ssl/certs/Certplus_Root_CA_G1.crt
/etc/ssl/certs/Certum_Trusted_Network_CA_2.crt
/etc/ssl/certs/Cybertrust_Global_Root.crt
/etc/ssl/certs/EC-ACC.crt
/etc/ssl/certs/GeoTrust_Global_CA.crt
/etc/ssl/certs/GeoTrust_Primary_Certification_Authority_-_G3.crt
/etc/ssl/certs/Go_Daddy_Root_Certificate_Authority_-_G2.crt
/etc/ssl/certs/IdenTrust_Public_Sector_Root_CA_1.crt
/etc/ssl/certs/Microsec_e-Szigno_Root_CA_2009.crt
/etc/ssl/certs/NetLock_Arany_=Class_Gold=_Főtanúsítvány.crt
/etc/ssl/certs/OISTE_WISeKey_Global_Root_GA_CA.crt
/etc/ssl/certs/OISTE_WISeKey_Global_Root_GB_CA.crt
/etc/ssl/certs/OpenTrust_Root_CA_G1.crt
/etc/ssl/certs/QuoVadis_Root_CA_2.crt
/etc/ssl/certs/Security_Communication_RootCA2.crt
/etc/ssl/certs/SwissSign_Gold_CA_-_G2.crt
/etc/ssl/certs/TUBITAK_Kamu_SM_SSL_Kok_Sertifikasi_-_Surum_1.crt
/etc/ssl/certs/Taiwan_GRCA.crt
/etc/ssl/certs/TrustCor_RootCert_CA-1.crt
/etc/ssl/certs/TrustCor_RootCert_CA-2.crt
/etc/ssl/certs/VeriSign_Universal_Root_Certification_Authority.crt
/etc/ssl/certs/b1b8a7f3.0
/etc/ssl/certs/b727005e.0
/etc/ssl/certs/ba89ed3b.0
/etc/ssl/certs/c01cdfa2.0
/etc/ssl/certs/ca-certificates.crt
/etc/ssl/certs/ca6e4ad9.0
/etc/ssl/certs/cbf06781.0
/etc/ssl/certs/cd58d51e.0
/etc/ssl/certs/d7e8dc79.0
/etc/ssl/certs/e2799e36.0
/etc/ssl/certs/e73d606e.0
/etc/ssl/certs/e8de2f56.0
/etc/ssl/certs/ePKI_Root_Certification_Authority.crt
/etc/ssl/certs/ff34af3f.0
/etc/ssl/certs/thawte_Primary_Root_CA_-_G3.crt
/etc/tertf/mac_vendor.db
grep: /etc/systemd/system/multi-user.target.wants/sundtek.service: No such file or directory
/etc/tvheadend/bouquet/c99525a2d2480333891b24986e8c67da
/etc/tvheadend/bouquet/56a9773574a693b3464dc5c012f0b62b
/etc/tvheadend/bouquet/7a6a15ed39014bd451178b42950d950d
/etc/tvheadend/bouquet/5bce296dfc017c771cc437926d4d3ad0
/etc/tvheadend/bouquet/5fdc7f68ee4db8c3ee0c55c05bc2ede8
/etc/tvheadend/bouquet/4ba717974c20f53390794f8d7d80c489
grep: /etc/tvheadend/epgdb.v2: No such file or directory
/etc/mpd.conf

No.

This only disables automounting. Then when I remove the Stick and plug it in again it does not get mounted again.

What I want is my stick to get automatically mounted but to leave my samba-config alone.

1 Like

I reckon you can probably ignore everything in /etc/ssl but, in your shoes, I would certainly be wondering what's in the other configuration files. Maybe one of them might shed some light on what's causing /mnt/S2 to appear.

I could also probably work around it by simply using the /mnt/S2 mount-point that is generated (rather than /home/mh/S2 that I want), but I am curious...

Even if I find another config-file - how does the whole process work?

I understand that when I restart samba /etc/config/samba is used to re-generate the samba-config in /etc/samba/smb.conf but how can re-inserting a usb-stick also trigger this?

Is it the event that a new usb-device shows up on the bus, is it a mount-event - what is the trigger and how does it propagate?

How are mounts and generating a samba-config connected?

Now that I don't know, but there's a chance that there might be a pointer to the answer to that question in another configuration file.

The only config files that matter here are /etc/config/fstab (see above), /etc/config/samba (see above) and /etc/samba/smb.conf (generated).

The files below /etc/certs are certificates, the ones below /etc/tvheadend belong to a software for a tv-stick.

/etc/mpd.conf is a config-file for mpd that simply configures that references that stick as the directory where to find media and /etc/mtab is a symlink to /proc/mounts.

Nothing left.

It might be a bug in the block automount implementation.
The simplest workaround is symlinking the default mount point with the desired location.

Yes of course I can easily work-around the problem, but I would like to understand how the pieces fit together.

How does the automounter initiate the rewrite of the samba-config? There must be some script that does that...

https://git.openwrt.org/?p=project/fstools.git;a=blob;f=block.c;hb=HEAD

1 Like

What an interesting way to say that you cannot answer my question as you don't understand the process yourself.

Very helpful, many thanks!

I'm not motivated enough to study and troubleshoot the source, but you are free to try. :wink:

3 Likes

@tmomas it's not the first time some users are being unpleasant in their reaction to people trying to help, is it possible for me to permanently ignore such users so I don't ever try to help those?

1 Like

Preferences > Notifications > Users

3 Likes

Thanks, one added! In retrospect, should have googled that. :frowning:

2 Likes