What's new

Entware samba4-server would be killed by stop_samba(int force)

  • 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!

Jiang

Occasional Visitor
Router: RT-AC88U
Firmware: 386.5_2

It seems that this problem has occurred since 386.5_X.

I installed samba by
Code:
opkg install samba4-server
And it has worked fine for the last few months (or even years). But recently I found that the samba server stays dead after system reboot and have to run
Code:
/opt/sbin/smbd -D
/opt/sbin/nmbd -D
manually to start samba server.

So I added lines to `/jffs/scripts/post-mount` to print the `pid` of `smbd` and found such phenomenon in the system log:
Code:
Jun  4 08:20:06 post-mount: smbd pid: 5571 5569 5568 5566 # these are the pid printed, indicating that the samba server installed by opkg starts normally at system boot.
Jun  4 08:20:06 rc_service: hotplug 4384:notify_rc restart_nasapps
Jun  4 17:20:06 custom_script: Running /jffs/scripts/service-event (args: restart nasapps)
Jun  4 17:20:06 avahi-daemon[514]: Files changed, reloading.
Jun  4 17:20:06 avahi-daemon[514]: Loading service file /tmp/avahi/services/mt-daap.service.
Jun  4 17:20:06 iTunes: daemon is stopped
Jun  4 17:20:06 FTP_Server: daemon is stopped
Jun  4 08:20:06 spdMerlin: /tmp/mnt/cao contains Entware, starting spdMerlin
Jun  4 17:20:06 Samba_Server: smb daemon is stopped # smbd and nmbd are killed here.
Please pay attention to the first and last lines of the log.

So I searched by "smb daemon is stopped" in the GitHub source code and found that:
the `smbd` and `nmbd` process would be killed by function `stop_samba` and print a message to the log in this line.

May I ask the motivation of this operation? And is it a bug ? If not, how can I solve this?
 
Last edited:
You could try starting Entware samba again in /jffs/scripts/service-event-end after any event involving nasapps or samba, etc.
 
You could try starting Entware samba again in /jffs/scripts/service-event-end after any event involving nasapps or samba, etc.
Thanks for your reply dave! I followed your instructions and solved this problem.
Still, I think this behavior should be somehow "optimized" to improve the usability of merlin.
 
Thanks for your reply dave! I followed your instructions and solved this problem.
Still, I think this behavior should be somehow "optimized" to improve the usability of merlin.
I would consider it a “known risk” trying to replace a built-in firmware utility with an Entware package that uses the same binary names.
 
Forgive my curiosity, but what does the Entware Samba give you that the Asus version does not? I know Firmware Samba is Version 3 and Entware Version 4. This thread is useful as I too have considered the Entware version. However, the Entware version is not complied with options I want.

Second thought here, could you not rename the binary of the Entware Version? Or are there other samba utils/tools that send signals to smbd?

Either way, glad you have it working.

Regards
 
Forgive my curiosity, but what does the Entware Samba give you that the Asus version does not? I know Firmware Samba is Version 3 and Entware Version 4. This thread is useful as I too have considered the Entware version. However, the Entware version is not complied with options I want.

Second thought here, could you not rename the binary of the Entware Version? Or are there other samba utils/tools that send signals to smbd?

Either way, glad you have it working.

Regards
Hello Young,

Thanks for your reply. I prefer Entware Samba mainly because
1. I want to use samba 3 other than 2 (protocol version, not smbd binary version).
2. I want to share only one disk entirely as one share point (appears as one folder), but the asus version shows all folders from all attached usb drivers.
3. Entware samba could be fully controlled by a customized `/opt/etc/samba/smb.conf`. Although I have not tried to modify the `smb.conf` of asus's samba server, there is a possibility that the asus's samba server's `smb.conf` will be rewritten after reboot since it is under system `/etc`. Correct me if I am wrong.

If 3 is wrong, then 2 can never be a problem for me. The only concern left would be the protocol version. The asus router is not the only samba provider in my home network, so I want to keep all samba server using the same version of protocol (item 1).

As for your second thought, it sounds possible. But it is not `elegant` to do so. I believe that since merlin provides support for Entware, the compatibility between system built-in services and Entware packages should be considered for better experience.

Best wishes
 
Last edited:
Thanks. Yes, I agree, it would be nice if Asus would let you choose what you want shared. +1 on this notion. Thanks
 
Hello Young,

Thanks for your reply. I prefer Entware Samba mainly because
1. I want to use samba 3 other than 2 (protocol version, not smbd binary version).
2. I want to share only one disk entirely as one share point (appears as one folder), but the asus version shows all folders from all attached usb drivers.
3. Entware samba could be fully controlled by a customized `/opt/etc/samba/smb.conf`. Although I have not tried to modify the `smb.conf` of asus's samba server, there is a possibility that the asus's samba server's `smb.conf` will be rewritten after reboot since it is under system `/etc`. Correct me if I am wrong.

If 3 is wrong, then 2 can never be a problem for me. The only concern left would be the protocol version. The asus router is not the only samba provider in my home network, so I want to keep all samba server using the same version of protocol (item 1).

As for your second thought, it sounds possible. But it is not `elegant` to do so. I believe that since merlin provides support for Entware, the compatibility between system built-in services and Entware packages should be considered for better experience.

Best wishes
Points 2) and 3) can be solved by using a custom config file.
 
Can you share your smb.conf for your samba4-server.

I'm unable to get worked.
It seems that I cannot either paste complete content of smb.conf or upload the file to the forum. See the following.
Code:
[global]
       # omit global settings above
        #max protocol = SMB3
        min protocol = SMB2
        smb ports = 445 139
[nas]
        comment=My NAS
        path = /mnt/nas
        writeable = yes
 
It seems that I cannot either paste complete content of smb.conf or upload the file to the forum. See the following.
Code:
[global]
       # omit global settings above
        #max protocol = SMB3
        min protocol = SMB2
        smb ports = 445 139
[nas]
        comment=My NAS
        path = /mnt/nas
        writeable = yes
Thanks but not work.

Another question, how you solve your initial post?
 
What does not work specifically? what do the logs say? Are you trying to get Entware Samba working or you trying to get the built in Samba working via a postconf script?
 
I'm trying to get work Entware Samba but i have two main issue.

- I'm able to run samba in windows network i see my samba but when i click i'm unable to enter because an error can't find the path with or without path name
- I'm unable to run samba when reboot because exactly error for you initial post.
 
When you try to access the router SMB from the Windows computer, are you using the domain name of the router or IP address (\\name vs \\IP_address).

from the router, can you confirm that smba is actually running (ps -w | grep smbd | grep -v grep)?

You likely can't post your smb.conf file because this web sites editor blocks certain key words or phrases for security reasons, such as "/e t c/smb.conf" - note that where I put spaces to circumvent the editor blocking the text. Perhaps look through your smb config file and modify as appropriate so that it will post. Either that, or use pastebin and post a link to your pastebin file.

EDIT: Followup questions

1. Any particular reason why you want Entware's Samba compared to the built in version? Perhaps a postconf script would be easier.

2. Have you looked at post #2 above from @dave14305?
 
Last edited:
When you try to access the router SMB from the Windows computer, are you using the domain name of the router or IP address (\\name vs \\IP_address).
As i say before, i try to enter in both case and give me same error.

from the router, can you confirm that smba is actually running (ps -w | grep smbd | grep -v grep)?
Samba is running that is not the issue, if not running then i wouldn't be seeming in Windows

Have you looked at post #2 above from @dave14305?
Because i not have that file and i don't know what is the content of the file and that is why i asking.
 
Thanks but not work.

Another question, how you solve your initial post?
I followed the suggestions from @dave14305 to start `smbd` and `nmbd` mannually in `/jffs/scripts/service-event-end`.
Code:
# cat /jffs/scripts/service-event-end
if [ -z $(pidof smbd) ]
then
    logger -t "service-event-end" "smbd is dead. Trying to restart."
    /opt/etc/init.d/S91smb stop
    sleep 1s
    /opt/sbin/smbd -D
    /opt/sbin/nmbd -D
    logger -t "service-event-end" "smbd pid: $(pidof smbd)"
else
    logger -t "service-event-end" "smbd is already alive with pid: $(pidof smbd). No need to restart."
fi

I suggest you opening a new thread to give us a complete description of your problem, together with supplement information (screenshots, logs, etc.).
 

Latest threads

Sign Up For SNBForums Daily Digest

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