SMB share refresh question in debian

More
15 Jul 2024 17:29 #305251 by chienMouille
Hello, 

I'm running LinuxCNC debian image. I have set a SMB shared directory to upload gcode files directly from my PC (windows). I used to have the CNC computer hosting the samba server, but that would cause problems (huges lags looking for the server) in my PC when the machine was turned off. I now host the SMB share on a local (ubuntu) server. I can mount and access the folder from debian on the CNC without problems. However, the folder doesn't update when files are uploaded to the server. I can see them after manual reload (F5) in the file explorer, but I can't refresh even manually within the CNC GUI (Probe basic), which is pretty annoying. When the share was hosted on the machine it was refreshing automatically on changes both in the file explorer and in Probe basic. 

I have tried playing with all kinds of mounting and SMB settings both on the server and on the machine. I can't seem to find a solution. Could it be because of some settings disabled in the BIOS maybe? Or would you have an idea of to fix this small, yet disabling problem?

thanks a lot,

Please Log in or Create an account to join the conversation.

More
15 Jul 2024 22:25 #305285 by cornholio
For Linux to Linux file sharing forget about SMB, setup NFS.
Use SMB for Windows to Linux.
NFS is easier to setup on both the client & server side.
This site has awesome tutorials
www.digitalocean.com/community/tutorials...ount-on-ubuntu-22-04

Windows NFS client is also an option, tho being an exclusive Linux user I have no recent experience with windows .

Please Log in or Create an account to join the conversation.

More
16 Jul 2024 03:52 #305312 by rodw
Using SAMBA shares on a linux box from Windows requires a change in policy on the client PC.  Don't ask me what it is. I gave up with Windows too
Its possible your issue is related to this with later versisn of Linux

Please Log in or Create an account to join the conversation.

More
16 Jul 2024 04:43 - 16 Jul 2024 04:51 #305314 by cornholio
The issue seems to be related to the file explorer within Linuxcnc.

Have you tried going up a directory, then going back into the directory you want ?

Having I guess, the file list for your wanted directory may sit in a cache and is not updated until you leave then re enter the directory ie: until the directory is reread.

I've also seem some strange behaviour from file managers within a program when directory is accessed via a UNC path or via gvfs rather than mounted into the file system ie: via fstab or a mount command.

I think windows shares may have setting that tells the system to mount them at login or not eg: automount or manual mount.
Last edit: 16 Jul 2024 04:51 by cornholio.

Please Log in or Create an account to join the conversation.

More
16 Jul 2024 11:58 - 16 Jul 2024 12:00 #305344 by chienMouille
Thanks for the messages. 
It seems to be a Linux file explorer problem indeed. 
I have been able replicate the same issue on another device (a PI5), also doesn't refresh automatically. It is the same issue with a NFS share as well.

Going up and down a folder works in certain conditions, but the up folder GUI button freezes (both on the file explorer and in Probebasic) once inside the shared folder (as if it doesn't know if UP is up on the server or locally.

I have tried adding all the options I found for no-caching, both on the server SMB config and on the client (when mounting), but nothing does.

The only thing which allows the folder to be updated on linux seems to be when the machine is hosting the folder itself (as changes are actually written on the machine itself). But that would require the machine to stay on at all times, which I don't want.

Any other ideas or ressources?
Though, I'm now pretty it is Linux specific and not Linuxcnc...
Last edit: 16 Jul 2024 12:00 by chienMouille. Reason: spelling

Please Log in or Create an account to join the conversation.

More
16 Jul 2024 13:24 #305349 by cornholio
So this is what I've discovered. And exactly what I expected to happen.

Using NFS
mount the nfs share via the mount command.
Tried this with both axis & qtdragon, using the file browser of each. Red is what I did on the linuxcnc machine, blue is what I did another remote machine. Server runs ubuntu, RPI5 is debian & Linuxcnc machine is running Mint.
Open a file in a sub dir of nfs share. create a file either locally on the server or via another pc (RPi5) that has the share mounted, go up one level, then back into the dir and I have no issues seeing the newly created files.
 

Please Log in or Create an account to join the conversation.

More
16 Jul 2024 14:43 #305361 by Mecanix
Never had a problem, works everytime. Here's some set-up notes. 
$ sudo apt install samba
$ sudo -s
$ mkdir /home/share
$ chmod 777 /home/share
$ exit

$ sudo nano /etc/samba/smb.conf
    ###### (Under [global])    
    unix charset = UTF-8
    ###### (Replace with network/machine addresses)
    interfaces = 127.0.0.0/8 enp3s0 192.168.10.0/24 wlp1s0 192.168.10.0/24
    ###### 
    bind interfaces only = yes
    map to guest = Bad User
    ###### (Add this at the end of the conf file)
    [Share]
    path = /home/share
    writable = yes
    guest ok = yes
    guest only = yes
    create mode = 0777
    directory mode = 0777

$ sudo systemctl restart smbd.service

ON WINDOWS, MAP DRIVE or CREATE SHORTCUT
e.g. \\192.168.10.100\share

Please Log in or Create an account to join the conversation.

More
16 Jul 2024 17:53 #305381 by chienMouille
Thank you all for the suggestions!

@cornholio: I did try with both smb and nfs shares, and the problem of refreshing is the same. Changes made on the machine are relfected on the server and other computers on the network instantly, but the reverse isn't. Even the folder up buttons don't work in the GUI, both on the debian file explorer and the Probebasic file explorer. (i think it tries to go up a directory on the server, which it isn't allowed to do). Pressing F5 works in the debian file explorer. 

@mecanix: I have tried many modification to smb.conf, including the ones you suggest. Except, I never tried to have it set as a public folder like you do. I have rwe permissions on everyone except guests who don't have access. I was mounting the share using credentials. Again, I could see and upload files to it so i think permissions are working, It just wouldn't update automatically, just making the day to day workflow pretty tidious. Either a debian bug or lack of feature, or an issue with cache settings, or CIFS notification protocol.

The refreshing issue is identical on the second test device RPi5, running rpios. So I don't think it has anything to do with the linuxcnc real time kernel.

Eventually, I ended up doing an overkill set up, which is now avoiding the problem: I let the folder as an SMB share on the server (so i can access it from the multiple devices I use (the PC being the main one) and installed SYNCTHING in a docker container on the server as well as on the CNC computer. It does watch both folders for changes and updates them accordingly. It is making local copies on both devices, which not only allows the folders to be updated instantly and automatically in both the debian and Probe basic file explorers, but let's me load the gcode from the machine's storage and not through the network, which is a plus. Also, if one of the devices is offline, the changes are just queued and nothing hangs like windows was if the smb folder was mounted but the device disconnected (which sometimes it was doing, freezing the file explorer for several minutes before giving up on the share and marking it "disconnected", aaaah windows).

Anyways, thanks a lot, I wish i had an actual fix to document here for future users, but I only have this overkill workaround.

Please Log in or Create an account to join the conversation.

More
16 Jul 2024 23:04 #305432 by cornholio
I just can't replicate the issues you are having.
Even when using a sftp connection from the system file manager I can't replicate these issues.
When you say changes, do you mean changes to the file system, ie adding a new file, or editing a file ie changes to the contents of a file, as that can be a whole different kettle of fish.
When mounting a share on the Linuxcnx box, are you manually mounting it via using mount on the command line or do you have an entry in fstab ? Is that entry auto or noauto?
Another thing to tryis to open the file browser of probe basic, in a second window copy a file to the directory you have open in probe basic and see if you can get that file to show .

Please Log in or Create an account to join the conversation.

More
18 Jul 2024 05:34 #305554 by chienMouille
By changes I mean adding a new file or deleting one. Actually didn't try modifying the content of an existing one.

I tried both mounting using mount and using fstab.

Any changes made directly on disk will be reflected instantly in the file browser both in debian and in probebasic. So when the folder is hosted on the machine, even as an smb or nfs share, it does work. It doesn't only when it is a remote share. Like, it works, but I have to manually refresh it to see the changes. Either by F5 command or by exiting and re-entering the folder. (which doesn't work well in probe basic).

This also why the syncthing workaround functions. Because a full copy of the folder is hosted on the machine.

I believe the problem is with the remote share notification protocol.

Please Log in or Create an account to join the conversation.

Time to create page: 0.105 seconds
Powered by Kunena Forum