Updated to Oct 2020 OSMC on Pi3 B+ - Samba now broken

Hello,

Pi 3 B+ Osmc
Samba version 4.9.5-Debian

I got an on-screen message to update my OSMC so I let it update. After it came back all is ok except now Samba isn’t running and I can’t access my shares.

I have another Pi on my LAN network and I can see it’s Samba shares.

I tried a few things:

$ smbclient -L localhost
do_connect: Connection to localhost failed (Error NT_STATUS_CONNECTION_REFUSED)

And this…

root@osmc:/home/osmc/.hts/tvheadend# systemctl status smbd.service

  • smbd.service - Samba SMB Daemon
    Loaded: loaded (/lib/systemd/system/smbd.service; disabled; vendor preset: enabled)
    Drop-In: /lib/systemd/system/smbd.service.d
    `-smb-app-osmc.conf
    Active: failed (Result: exit-code) since Sun 2020-10-25 23:27:53 GMT; 1h 3min ago
    Docs: man:smbd(8)
    man:samba(7)
    man:smb.conf(5)
    Process: 2235 ExecStartPre=/usr/share/samba/update-apparmor-samba-profile (code=exited, status=0/SUCCESS)
    Process: 2236 ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS (code=exited, status=1/FAILURE)
    Main PID: 2236 (code=exited, status=1/FAILURE)
    Status: “daemon failed to start: reinit_after_fork() failed”
    Error: 2 (No such file or directory)

Oct 25 23:27:52 osmc systemd[1]: Starting Samba SMB Daemon…
Oct 25 23:27:53 osmc smbd[2236]: [2020/10/25 23:27:53.243865, 0] …/source3/lib/util.c:493(reinit_after_fork)
Oct 25 23:27:53 osmc smbd[2236]: messaging_reinit() failed: NT_STATUS_OBJECT_NAME_NOT_FOUND
Oct 25 23:27:53 osmc smbd[2236]: [2020/10/25 23:27:53.244236, 0] …/lib/util/become_daemon.c:124(exit_daemon)
Oct 25 23:27:53 osmc smbd[2236]: exit_daemon: STATUS=daemon failed to start: reinit_after_fork() failed, error code 2
Oct 25 23:27:53 osmc systemd[1]: smbd.service: Main process exited, code=exited, status=1/FAILURE
Oct 25 23:27:53 osmc systemd[1]: smbd.service: Failed with result ‘exit-code’.
Oct 25 23:27:53 osmc systemd[1]: Failed to start Samba SMB Daemon.
root@osmc:/home/osmc/.hts/tvheadend#

And this…

> root@osmc:/home/osmc# systemctl restart smbd
> Job for smbd.service failed because the control process exited with error code.
> See "systemctl status smbd.service" and "journalctl -xe" for details.
> root@osmc:/home/osmc# journalctl -xe
> -- Support: https://www.debian.org/support
> --
> -- A start job for unit smbd.service has finished with a failure.
> --
> -- The job identifier is 690 and the job result is failed.
> Oct 26 00:36:48 osmc systemd[1]: Starting Samba SMB Daemon...
> -- Subject: A start job for unit smbd.service has begun execution
> -- Defined-By: systemd
> -- Support: https://www.debian.org/support
> --
> -- A start job for unit smbd.service has begun execution.
> --
> -- The job identifier is 736.
> Oct 26 00:36:48 osmc smbd[3569]: [2020/10/26 00:36:48.463908,  0] ../source3/lib/util.c:493(reinit_after_fork)
> Oct 26 00:36:48 osmc smbd[3569]:   messaging_reinit() failed: NT_STATUS_OBJECT_NAME_NOT_FOUND
> Oct 26 00:36:48 osmc smbd[3569]: [2020/10/26 00:36:48.464359,  0] ../lib/util/become_daemon.c:124(exit_daemon)
> Oct 26 00:36:48 osmc smbd[3569]:   exit_daemon: STATUS=daemon failed to start: reinit_after_fork() failed, error code 2
> Oct 26 00:36:48 osmc systemd[1]: smbd.service: Main process exited, code=exited, status=1/FAILURE
> -- Subject: Unit process exited
> -- Defined-By: systemd
> -- Support: https://www.debian.org/support
> --
> -- An ExecStart= process belonging to unit smbd.service has exited.
> --
> -- The process' exit code is 'exited' and its exit status is 1.
> Oct 26 00:36:48 osmc systemd[1]: smbd.service: Failed with result 'exit-code'.
> -- Subject: Unit failed
> -- Defined-By: systemd
> -- Support: https://www.debian.org/support
> --
> -- The unit smbd.service has entered the 'failed' state with result 'exit-code'.
> Oct 26 00:36:48 osmc systemd[1]: Failed to start Samba SMB Daemon.
> -- Subject: A start job for unit smbd.service has failed
> -- Defined-By: systemd
> -- Support: https://www.debian.org/support
> --
> -- A start job for unit smbd.service has finished with a failure.
> --
> -- The job identifier is 736 and the job result is failed.

I took these steps to create a log file:

  • enable debug logging at settings->system->logging
  • enable component-specific logging for all components
  • enable event logging and notification event logging
  • reboot the OSMC device twice(!)
  • reproduce the issue…

For this I ssh’s in to OSMC and ran these commands… I have a share on the Pi 3B+ running OSMC called “osmc”…

Here is the log file.

When I type

\\ip-of-pi3b+

into Windows Explorer window it says: “Windows Cannot Access [ip addr]”

This is my /etc/smb.conf file:

> [global]
> 
> # If you require a fully custom smb.conf create smb-local.conf instead of editing smb.conf so your
> # configuration will not be overwritten by samba upgrades. You can use smb.conf as a template by
> # copying it to smb-local.conf then removing the config file line below in the new file. If you only
> # need to add some additional shares see smb-shares.conf below for a simpler way to do this.
> 
>     config file = /etc/samba/smb-local.conf
> 
>     workgroup = WORKGROUP
>     security=user
>     follow symlinks = yes
>     wide links = no
>     unix extensions = no
>     lock directory = /var/cache/samba
>     load printers = no
>     printing = bsd
>     printcap name = /dev/null
>     disable spoolss = yes
>     log level = 1
>     map to guest = bad user
> #   usershare template share = automount template
> 
> # Automount template disabled to work around a samba bug causing crashes accessing external drives.
> 
>     read raw = Yes
>     write raw = Yes
>     lock directory = /var/cache/samba
>     load printers = no
>     printing = bsd
>     printcap name = /dev/null
>     disable spoolss = yes
>     log level = 1
>     map to guest = bad user
> #   usershare template share = automount template
> 
> # Automount template disabled to work around a samba bug causing crashes accessing external drives.
> 
>     read raw = Yes
>     write raw = Yes
>     strict locking = no
>     min receivefile size = 16384
>     use sendfile = true
>     aio read size = 2048
>     aio write size = 2048
>     socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072
> 
> [osmc]
>     browsable = yes
>     read only = no
>     valid users = osmc
>     path = /home/osmc
>     comment = OSMC Home Directory
> 
> [automount template]
>     browseable = yes
>     -valid = no
>     valid users = osmc
>     path = %P
>     hide files = /$RECYCLE.BIN/System Volume Information/desktop.ini/thumbs.db/
> 
> # Add custom shares in smb-shares.conf instead of editing smb.conf so they will not be
> # overwritten by samba updates. You can only add new shares to smb-shares.conf, not change
> # the default shares or global options. If you need full control see smb-local.conf above.
> 
> include = /etc/samba/smb-shares.conf

I also have this smb-local.conf file in case smb.conf gets over-written during a Samba update.

[global]

# If you require a fully custom smb.conf create smb-local.conf instead of editing smb.conf so your
# configuration will not be overwritten by samba upgrades. You can use smb.conf as a template by
# copying it to smb-local.conf then removing the config file line below in the new file. If you only
# need to add some additional shares see smb-shares.conf below for a simpler way to do this.

#    config file = /etc/samba/smb-local.conf

        #min protocol = SMB2_02
    workgroup = WORKGROUP
    security=user
        follow symlinks = yes
    wide links = no
    unix extensions = no
    # Commenting out this line makes smbstatus work.. See: https://discourse.osmc.tv/t/running-smbstatus-in-osmc-gives-$
        #lock directory = /var/cache/samba
    load printers = no
    printing = bsd
    printcap name = /dev/null
    disable spoolss = yes
    log level = 1
    map to guest = bad user
#   usershare template share = automount template

# Automount template disabled to work around a samba bug causing crashes accessing external drives.

    read raw = Yes
    write raw = Yes
    strict locking = no
    min receivefile size = 16384
    use sendfile = true
    aio write size = 2048
    #socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072

[root]
    comment = OSMC Root Directory
    path = /
    browseable = yes
    read only = no
    writable = yes
        # Adding force user = root allows you to create new files and modify files in any folder
        # in OSMC from the Samba share in Windows Explorer. Without this I wasn't able to.
    force user = root
    valid users = root,osmc
    create mask = 0777
    directory mask = 0777

[osmc]
    browsable = yes
    read only = no
    valid users = osmc
    path = /home/osmc
    comment = OSMC Home Directory

[automount template]
    browseable = yes
    -valid = no
    valid users = osmc
    path = %P
    hide files = /$RECYCLE.BIN/System Volume Information/desktop.ini/thumbs.db/

# Add custom shares in smb-shares.conf instead of editing smb.conf so they will not be
# overwritten by samba updates. You can only add new shares to smb-shares.conf, not change
# the default shares or global options. If you need full control see smb-local.conf above.

include = /etc/samba/smb-shares.conf

I don’t have a /etc/samba/smb-shares.conf file.

I saw in another thread someone had the same issue and they just re-installed OSMC again from scratch. Is that my best option? I’d prefer not to have to set everything up again.

Any help very much appreciated.

Cheers,

Flex

I followed steps recommended by JimKnopf in this post to re-install Samba and now it’s working again.

The issue was that I had commented out the line:

lock directory = /var/cache/samba

In smb-local.conf

I did that a few months ago because unless it was commented out smbstatus wasn’t giving me any information about my shares. But now with it un-commented again Samba is running and smbstatus IS giving me information about active shares… so I’m still a bit confused but things are working.

Cheers,

Flex

2 Likes