Permanent mount of Samba share fails

  • following the guide here for Samba mountiong in Libreelec:

    Mount Network Share - LibreELEC.wiki

    I created the file at /storage/.config/system.d/storage-recordings.mount as directed

    I have tried different Samba version numbers as described in the Samba docs too

    When I run "systemctl status storage-recordings.mount" , I see the error

    Code
    ● storage-recordings.mount - cifs mount script
    Loaded: bad-setting (Reason: Unit storage-recordings.mount has a bad unit file setting.)
    Active: inactive (dead)
    Where: /storage/.kodi/userdata/addon_data/script.module.zap2epg
    What: //10.0.0.250/xmltv

    I can mount that IP and share from Windows changing out the slashes for backslashes and the directory is also valid.

    Is it possible that the system is trying to mount the SMB share before /storage is mounted?

    Otherwise as the share is from a raspberry Pi I guess I might as well try NFS.


    _-----------------update-------------------------

    Just tried NFS and same error.

    Edited once, last by tekno (May 5, 2022 at 11:12 PM).

  • I have a hunch that the {special} filename is incorrect as normally the filename should match the full path to the mount. However I have no clue how to represent a path with folders that start with or contain periods and underscores. Create a more simple path like /storage/xmltv to mount to, and name the file storage-xmltv.mount. If that works you proved the theory and can hit Google for documentation.

  • However I have no clue how to represent a path with folders that start with or contain periods and underscores

    systemd-escape -p --suffix=mount "/your/path-some/where/"

    your-path\x2dsome-where.mount

  • Hi all,


    I have a similar issue here.


    Created a file named storage-win.mount in /storage/.config/system.d

    Also created a folder named storage-win in the /storage

    Here is the file itself

    [Unit]
    Description=cifs mount script
    Requires=network-online.service
    After=network-online.service
    Before=kodi.service

    [Mount]
    What=//192.168.1.152/LibreELEC
    Where=/storage/storage-win
    Options=username=my_user,password=my_password,rw,vers=2.1
    Type=cifs

    [Install]
    WantedBy=multi-user.target

    Result?

    LibreELEC:~ # systemctl start storage-win.mount
    Failed to start storage-win.mount: Unit storage-win.mount has a bad unit file setting.


    On the other hand, If I do a :


    mount -t cifs -o username=my_user//192.168.1.152/LibreELEC /storage
    /storage-win

    it works like a charm. It simply asks for the password and the folder is mounted.


    Where am I wrong?

  • Code
    # systemd-analyze verify storage-win.mount
    storage-win.mount: Where= setting doesn't match unit name. Refusing.
    Unit storage-win.mount has a bad unit file setting.

    Create the correct name:

    Code
    # systemd-escape -p --suffix=mount /storage/storage-win
    storage-storage\x2dwin.mount
  • /storage/storage-win requires a storage-storage-win.mount file.

    /storage/win would match the storage-win.mount file that you created.

    You mean the file itself would have to be named storage-storage-win.mount? I did this one also. Don't work either....

  • Use the included tool systemd-escape yourself to create the correct file name, see post #5.

    This can even be reversed (name to path of the wrong unit name):

    Code
    # systemd-escape --unescape -p storage-storage-win
    /storage/storage/win