Jump to content

Samba won't broadcast shares.

Go to solution Solved by Tech N Gamer,

I have found a workaround, and I think I know what the issue is. So, at startup, there is no internet connection therefor Samba is unable to bind to an ip/port. The workaround is to disable smbd.service and create smbd.timer. In the timer file located at /usr/lib/systemd/system/ I'd put in:


[Unit]
Description=Runs smbd 1 minutes after restart.

[Timer]
OnBootSec=1min

[Install]
WantedBy=timers.target

 

And now it works fine aside from having to wait a minute till it starts it.

First off, I have no idea where to put this, I'm putting it here since it's a Linux issue. Secondly, no matter which OS I'm using, rather it is Arch or Windows, I cannot access my SMB shares. I have to SSH into the device (or walk over to it and log in) and type:

 


sudo systemctl restart smbd

 

It's annoying since I have a script that will run pacman and update the system and once updated, it will restart it. Problem is, Samba won't load/broadcast any shares listed in the config. Please help.

Brah, do you even Java?

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, geo3 said:

What dist is your server? Can you post your smb.conf?

The distro is Arch, hence the tag Arch.

smb.conf

Brah, do you even Java?

Link to comment
Share on other sites

Link to post
Share on other sites

12 minutes ago, Tech N Gamer said:

The distro is Arch, hence the tag Arch.

smb.conf

Ah, the way it was worded it made it look like Arch was one of your clients.

 

Anyway, try adding one or both of these lines to your shares

browsable = yes
guest ok = yes
 
If 'guest ok = yes' works and you don't want to enable guest access your going to have to look into configuring smb users and authentication schemes.
Link to comment
Share on other sites

Link to post
Share on other sites

16 minutes ago, geo3 said:

Ah, the way it was worded it made it look like Arch was one of your clients.

 

Anyway, try adding one or both of these lines to your shares

browsable = yes
guest ok = yes
 
If 'guest ok = yes' works and you don't want to enable guest access your going to have to look into configuring smb users and authentication schemes.

That didn't work, still, have to SSH or go to it and type sudo systemctl restart smbd.

Brah, do you even Java?

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, geo3 said:

And is it accessible after you do that? When does it become inaccessible?

Is the service enabled :


sudo systemctl enable smbd.service

 

Yes, it is accessible after I do that. It becomes inaccessible when Arch restarts or starts up after shutdown. The service is enabled. I have a script that makes sure the system is up to date and restarts once it is to force anything running to use the newer version.

Brah, do you even Java?

Link to comment
Share on other sites

Link to post
Share on other sites

This is the output of that.

● smbd.service - Samba SMB/CIFS server
   Loaded: loaded (/usr/lib/systemd/system/smbd.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2018-04-22 13:58:22 CDT; 47s ago
  Process: 388 ExecStart=/usr/bin/smbd -D (code=exited, status=0/SUCCESS)
 Main PID: 414 (smbd)
    Tasks: 4 (limit: 4915)
   Memory: 30.0M
   CGroup: /system.slice/smbd.service
           ├─414 /usr/bin/smbd -D
           ├─416 /usr/bin/smbd -D
           ├─417 /usr/bin/smbd -D
           └─418 /usr/bin/smbd -D

Apr 22 13:58:22 Data_Laptop smbd[388]: [2018/04/22 13:58:22.660768,  0] ../lib/util/debug.c:1053(reopen_logs_internal)
Apr 22 13:58:22 Data_Laptop smbd[388]:   Unable to open new log file '/usr/local/samba/var/log.smbd': No such file or directory
Apr 22 13:58:23 Data_Laptop smbd[414]: [2018/04/22 13:58:23.269761,  0] ../lib/util/debug.c:1053(reopen_logs_internal)
Apr 22 13:58:23 Data_Laptop smbd[414]:   Unable to open new log file '/usr/local/samba/var/log.smbd': No such file or directory
Apr 22 13:58:23 Data_Laptop smbd[414]: [2018/04/22 13:58:23.269993,  0] ../lib/util/debug.c:1053(reopen_logs_internal)
Apr 22 13:58:23 Data_Laptop smbd[414]:   Unable to open new log file '/usr/local/samba/var/log.smbd': No such file or directory
Apr 22 13:58:23 Data_Laptop smbd[414]: [2018/04/22 13:58:23.269713,  0] ../lib/util/become_daemon.c:124(daemon_ready)
Apr 22 13:58:23 Data_Laptop smbd[414]:   STATUS=daemon 'smbd' finished starting up and ready to serve connections
Apr 22 13:58:23 Data_Laptop smbd[418]: [2018/04/22 13:58:23.312547,  0] ../lib/util/debug.c:1053(reopen_logs_internal)
Apr 22 13:58:23 Data_Laptop smbd[418]:   Unable to open new log file '/usr/local/samba/var/log.smbd': No such file or directory

By the way, this SMB Server is just an old laptop that I repurposed into an SMB server.

Brah, do you even Java?

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, geo3 said:

It looks like it's running. Is it? Just make sure the path to the log file exists.

I created the path to the log file, restarted the system to test if it worked, and it didn't change the outcome. SMB Share's is inaccessible until I restart the service.

Brah, do you even Java?

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, geo3 said:

Hmm. Reboot systen then do a status, then restart the service manually and do another status. Compare the two status messages.

In the first message, after the reboot, this message appears:

 

Apr 22 14:56:26 Data_Laptop smbd[431]: [2018/04/22 14:56:26.377492,  0] ../source3/lib/util_sock.c:396(open_socket_in)
Apr 22 14:56:26 Data_Laptop smbd[431]:   bind failed on port 445 socket_addr = 2602:306:bd16:2d20:a2c:b33b:67f9:652c.
Apr 22 14:56:26 Data_Laptop smbd[431]:   Error = Cannot assign requested address
Apr 22 14:56:26 Data_Laptop smbd[431]: [2018/04/22 14:56:26.377722,  0] ../source3/smbd/server.c:1093(smbd_open_one_soc>
Apr 22 14:56:26 Data_Laptop smbd[431]:   smbd_open_one_socket: open_socket_in: Cannot assign requested address
Apr 22 14:56:26 Data_Laptop smbd[431]: [2018/04/22 14:56:26.377761,  0] ../source3/lib/util_sock.c:396(open_socket_in)
Apr 22 14:56:26 Data_Laptop smbd[431]:   bind failed on port 139 socket_addr = 2602:306:bd16:2d20:a2c:b33b:67f9:652c.
Apr 22 14:56:26 Data_Laptop smbd[431]:   Error = Cannot assign requested address
Apr 22 14:56:26 Data_Laptop smbd[431]: [2018/04/22 14:56:26.377808,  0] ../source3/smbd/server.c:1093(smbd_open_one_soc>
Apr 22 14:56:26 Data_Laptop smbd[431]:   smbd_open_one_socket: open_socket_in: Cannot assign requested address

 

After I restart the service, it's gone.

Brah, do you even Java?

Link to comment
Share on other sites

Link to post
Share on other sites

I have found a workaround, and I think I know what the issue is. So, at startup, there is no internet connection therefor Samba is unable to bind to an ip/port. The workaround is to disable smbd.service and create smbd.timer. In the timer file located at /usr/lib/systemd/system/ I'd put in:


[Unit]
Description=Runs smbd 1 minutes after restart.

[Timer]
OnBootSec=1min

[Install]
WantedBy=timers.target

 

And now it works fine aside from having to wait a minute till it starts it.

Brah, do you even Java?

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, geo3 said:

In your smb.conf you have: interfaces = lo wlp1s0

That looks like a wireless connection. Which could be why it's not available immediately on boot.  Can you try it on a wired connection?

No. The router is too far away and off of its jacks are taken up.

Brah, do you even Java?

Link to comment
Share on other sites

Link to post
Share on other sites

47 minutes ago, Tech N Gamer said:

I have found a workaround, and I think I know what the issue is. So, at startup, there is no internet connection therefor Samba is unable to bind to an ip/port. The workaround is to disable smbd.service and create smbd.timer. In the timer file located at /usr/lib/systemd/system/ I'd put in:

 


[Unit]
Description=Runs smbd 1 minutes after restart.

[Timer]
OnBootSec=1min

[Install]
WantedBy=timers.target

 

 

And now it works fine aside from having to wait a minute till it starts it.

Another option is to configure the smbd.service to auto restart on failure. In your smbd service descriptor file you can put Restart=always and RestartSec=5  under the [Service] block. This link has more details. https://unix.stackexchange.com/questions/289629/systemd-restart-always-is-not-honored

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×