Bug in busybox implementation of CIFS mount

  • I know this issue has been beaten to death, but I have done a couple hours of debugging and I know what's going on.

    Working on Libreelec rPi2 8.2.2 and LibreELEC (community): devel-20171004193021-r26173-gd404dbb (TinkerBoard.arm) trying to execute this:

    Code
    mount -t cifs -oguest //192.168.1.1/ROMS /storage/emulators/roms

    I keep getting Invalid arguments

    I ran strace on Libreelec and my desktop (Fedora 27) machine, comparing the syscalls:

    Libreelec:

    Code
    mount("//192.168.1.1/ROMS", "/storage/emulators/roms/", "cifs", MS_SILENT, "guest,unc=\\\\192.168.1.1\\ROMS,ip=192.168.1.1") = -1 EINVAL (Invalid argument)

    Fedora:

    Code
    mount("//192.168.1.1/ROMS", ".", "cifs", 0, "ip=192.168.1.1,unc=\\\\192.168.1.1\\ROMS,user=,pass=") = 0

    Those 2 syscalls are the result of exactly the same command (with mount directory changed).

    The difference is that the Fedora command is invoked by mount.cifs, in the cifs-tools package, whereas the Libreelec is busybox.

    To make busybox mount using guest mounts correctly, you must use the following syntax:

    Code
    mount -t cifs -ouser=,pass= //192.168.1.1/ROMS /storage/emulators/roms

    Consequently, in the systemd.mount file, you MUST use this syntax for guest mounts:

    Code
    Options=user=,pass=

    The systemd.mount method above is a workaround, the proper behavior should be to issue user= and pass= when using guest. If you pull in the cifs-tools package, it will solve this problem for you.

    --Perry Harrington

  • Thanks for your post. However at the moment we have no plans to switch away from busybox for mount (but if we do, we would most likely switch to using mount from the util-linux package).

    Guest access is becoming increasingly more difficult to achieve, with Microsoft now actively disabling such access to shares, so you might want to consider adding authentication (and avoid using SMB1 which is the default CIFS protocol used by kernels earlier than 4.13.y):

    guest-access-smb2-disabled-by-default-in-windows-10-server-2016

    Note that starting with kernel 4.14.y the protocol negotiated by CIFS will be at least SMB2_10 and never SMB1 unless forced with vers=1.0. (kernel 4.13.y did not support multi-protocol negotiation and simply enforced SMB3).