What's new

Entware Starting SMB Entware at boot...

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

unsynaps

Senior Member
This is driving me bonkers.

I am trying to replace the build in samba with the one in entware and have it start at boot.

I have tried putting the start commands in:
services-start: Does not work. Script runs before the USB drive containing the entware install is mounted.
post-mount: Does not work. For some reason, even though it is SHUT OFF, the internal samba server IS RUNNING when this script runs so the entware version does not start properly.

Why does the built-in samba start at all when I have it turned off?

I am at a complete loss as to where to put the command to start the entware samba service.
 
This has come up before. Search for those posts as my memory might be wrong.

There should be an automatic startup script in /opt/etc/init.d/S91smb, you don't need any additional startup scripts. IIRC the problem is that script doesn't specify the full path to the executables, so it starts up the built-in version of Samba rather than the Entware version.
 
Last edited:
1) I did search.
2) /opt/etc/init.d/S91smb launches the entware samba not the built in one.
- It launches smbd. The only smbd that exists on the router is /usr/sbin/smbd.
3) /opt/etc/init.d/S91smb does not run on boot by itself.
- removing /opt/etc/init.d/S91smb from all scripts results in nothing starting when the router is rebooted.
 
Last edited:
2) /opt/etc/init.d/S91smb launches the entware samba not the built in one.
If you're running it from the command line that's probably the case. That's not necessarily true for the automatic startup.
- It launches smbd. The only smbd that exists on the router is /usr/sbin/smbd.
But you just said it launched the Entware version which should be in /opt/sbin

3) /opt/etc/init.d/S91smb does not run on boot by itself.
- removing /opt/etc/init.d/S91smb from all scripts results in nothing starting when the router is rebooted.
But you just said that the internal Samba server was starting even though you disabled it. Try editing S91smb and putting /opt/sbin/ in front of smbd and nmbd.
 
If you're running it from the command line that's probably the case. That's not necessarily true for the automatic startup.

But you just said it launched the Entware version which should be in /opt/sbin


But you just said that the internal Samba server was starting even though you disabled it. Try editing S91smb and putting /opt/sbin/ in front of smbd and nmbd.
wouldn't he want to add arguements in the S91 script that kills the routers smbd as well?
 
OK I looked into this a bit more and there are multiple issues.

The first problem is that after Entware's Samba is started via post-mount the router runs restart_nasapps. This kills smbd and nmbd regardless of whether Samba is enabled or not in the GUI. This problem and a possible workaround is discussed here.

The second problem I found was that smbd would fail to start with a permissions problem. This is fixed with the following command:
Code:
chmod 755 /opt/var/run/samba/ncalrpc
EDIT: This was fixed in a subsequent update.

A third problem is more a user error than anything, is that Samba needs to have a working configuration. So /opt/etc/samba/smb.conf needs to contain something sensible.

Another user error (that I just got caught out by) is trying to start Samba from SSH when the PATH isn't set correctly. This can happen if you SSH into the router before the USB drive has been mounted. In this situation trying to run /opt/etc/init.d/S91smb directly will try to start the built-in version of Samba. To prevent this you can edit S91smb to add /opt/sbin/ in front of smbd and nmbd.
 
Last edited:
The first problem is that after Entware's Samba is started via post-mount the router runs restart_nasapps. This kills smbd and nmbd regardless of whether Samba is enabled or not in the GUI. This problem and a possible workaround is discussed here.

I remember this thread. Could another solution be to use
mount --bind /opt/sbin/smbd /usr/sbin/smbd to link the new smbd executable to the old? I have not tested it. Then for the config file, use a postconf script and use a custom conf smb.conf file.
 
I remember this thread. Could another solution be to use
mount --bind /opt/sbin/smbd /usr/sbin/smbd to link the new smbd executable to the old? I have not tested it. Then for the config file, use a postconf script and use a custom conf smb.conf file.
In theory, You should be able to use the entware launch script to first kill smbd (make sure it is killed I mean). then mount the /opt verson on top of the local version. Then you should be able to service start the smbd using the entware version that is now mounted on top of the local version. This would in effect force the router to use the entware smbd as long as it is mounted on top. (fun stuff.)
 
I am trying to replace the build in samba with the one in entware and have it start at boot.

Just out of curiosity, what is the reason you want to use the Entware version of samba?
 
I remember this thread. Could another solution be to use
mount --bind /opt/sbin/smbd /usr/sbin/smbd to link the new smbd executable to the old? I have not tested it. Then for the config file, use a postconf script and use a custom conf smb.conf file.
I quite like this idea. But the more I think about it the more problems I can see.

Something I considered but initially dismissed as requiring too many changes was to the make copies of Entware's smbd and nmbd called smbd4 and nmbd4. Then modify S91smb with these new names. Generally speaking I'm not keen on modifying system scripts in case they get reset by a subsequent software update. But in the end it might be the easiest way to avoid the firmware erroneously stopping and starting Samba.

EDIT: I've just tried this and it seems to work well enough.
 
Last edited:

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top