SMB Mount Error

  • Hi, I have a problem with SMB configuration with libreelec.

    I attach the two configurations that I used and neither worked. I would like to point out that the server has an IP of 192.168.1.200 and shares files and libraries with 2 other devices with Kodi

    1-

    /storage/.config/system.d/var-media-sambashare.mount
    [Unit]
    Description=cifs mount script
    Requires=network-online.service
    After=network-online.service
    Before=kodi.service
    [Mount]
    What=//127.0.0.1/hdd
    Where=/var/media/sambashare
    Options=credentials=/storage/.config/.smbcredentials,rw
    Type=cifs
    [Install]
    WantedBy=multi-user.target


    2-

    /storage/.config/system.d/var-media-sambashare.mount
    [Unit]
    Description=cifs mount script
    Requires=network-online.service
    After=network-online.service
    Before=kodi.service
    [Mount]
    What=//192.168.1.200/hdd
    Where=/var/media/sambashare
    Options=credentials=/storage/.config/.smbcredentials,rw
    Type=cifs
    [Install]
    WantedBy=multi-user.target

    Both give back:

    var-media-sambashare.mount - cifs mount script
    Loaded: loaded (/storage/.config/system.d/var-media-s Active: failed (Result: exit-code) since Sat 2025-03- Where: /var/media/sambashare
    What: //127.0.0.1/hdd
    CPU: 12ms
    Mar 01 12:30:10 KODI-TV systemd[1]: Mounting var-media-samMar 01 12:30:10 KODI-TV mount[1028]: mount error(111): couMar 01 12:30:10 KODI-TV systemd[1]: var-media-sambashare.mMar 01 12:30:10 KODI-TV systemd[1]: var-media-sambashare.mMar 01 12:30:10 KODI-TV systemd[1]: Failed to mount var-me


    If I use the command

    mount -t cifs //127.0.0.1/hdd /var/media/sambashare -o credentials=/storage/.config/.smbcredentials

    everything works perfectly , but it doesn't connect automatically at boot

  • Problem solved. I share my solution, in case it helps someone! I added " After=smbd.service " So that smbd has time to start.


    /storage/.config/system.d/var-media-sambashare.mount

    # This is a sample service script to mount CIFS/SAMBA shares.

    # Please read carefully the comments in this file. For production usage

    # you can remove all comments (lines beginning with "#") from this file.

    [Unit]

    # The description should be used to explain what this servicefile is for

    Description=SMB script

    # if we do network mounts like here we *require* 'network-online.service'

    # which checks if the network is online

    Requires=network-online.service

    # our scripts must start *after* 'network-online.service', on timeout and if

    # 'network-online.service' fails we can not mount and this scripts fails too

    After=network-online.service

    After=smbd.service

    # usually we mount networks shares because we want they avaible *before* XBMC starts.

    # so XBMC has access to this mounts from beginning. Note: this slows down the boot!

    Before=kodi.service

    [Mount]

    # The share we want mount

    What=//192.168.1.200/hdd

    # Where we want mount this share

    Where=/var/media/sambashare

    # Any options you usually use with the "-o" parameter in the mount command

    Options=username=libreelec,password=libreelec

    # filesystem type

    Type=cifs

    [Install]

    # The target is used by 'systemctl enable <name_of_this_file.mount>' to link

    # this service to a runlevel for starting on boot. usually 'multi-user.target'

    # is ok here.

    WantedBy=multi-user.target

    # Important:

    # this file must be renamed to <mountpoint>.mount where <mountpoint>, is the FULL path

    # where the share will be mounted but slashes "/" MUST BE REPLACED with dashes "-" with .mount

    # as extension.

    # This means, if we want mount to "/storage/music2" (see above "Where=/storage/music2")

    # then this file must be renamed to 'storage-music2.mount' and can be enabled via ssh with the

    # command 'systemctl enable storage-music2.mount'