1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Samba VFS recycle bin

Discussion in 'Tomato Firmware' started by Auburnham, Apr 16, 2018.

  1. Auburnham

    Auburnham New Member Member

    Is it possible to enable the Samba VFS recycle bin? I am using Tomato Firmware 1.28.0000 -3.5-140 K26ARM USB AIO-64K on a Netgear R6300v2. I've added the following to Samba Custom Configuration:
    Code:
     vfs object = recycle
     recycle:repository = .deleted/
     recycle:keeptree = Yes
     recycle:touch = No
     recycle:touch_mtime = No
     recycle:versions = Yes
     recycle:maxsixe = 0
     recycle:exclude = *.tmp
     recycle:exclude_dir = /tmp
     recycle:noversions = *.doc
    
    I get the errors:
    Code:
    Can't find a vfs module [recycle]
    smbd_vfs_init: vfs_init_custom failed for recycle
    
    Is it possible to add the missing module to enable this feature? I appreciate any feedback.
     
  2. koitsu

    koitsu Network Guru Member

    This looks like you're using Shibby v140, but I'm not sure. Yes it matters. Toastman vs. Shibby vs. everything else matters tremendously here. I would suggest running smbd -V from the command line and providing the output here. That should disclose the Samba version.

    That said: looking at kille72's firmware, which is based on Shibby v140 but with a large number of changes -- specifically using tomato-RT-AC56U-ARM-2018.1.039-beta-kille72-VPN-64K.trx -- it appears that Samba is 3.6.25.

    Code for vfs_recycle appears to be present in Samba as early as version 3.0.25 (possibly earlier; but it is most definitely not present in Samba 2.x). However, it's a configure and compile-time feature that is based on several things; Samba auto-detects whether or not it can be built/supported, and whether or not it can be loaded dynamically or included statically. configure may be auto-detecting that support for this feature cannot be included (ex. kernel might be too old, etc.), as it requires some specific kernel support, thus the module may not exist -- unsure. The kernel on Tomato cannot be changed/upgraded.

    P.S. -- The directive is actually vfs objects = recycle not vfs object = recycle. Note plural vs. singular.
     
  3. Auburnham

    Auburnham New Member Member

    Thank you for the detailed feedback, koitsu. This is a Shibby v140 build using AdvancedTomato GUI. smbd -V shows version 3.0.37. I will try the samba4x packages from entware, but as you suggested, this may be a kernel support issue since the current smbd version is greater than 3.0.25.

    A few more questions:
    Can you suggest any way to distinguish between kernel support vs. package support (i.e. where recycle.so would be located if the package supported the feature)? If this file is missing, is it possible for me to add it to enable support?

    Can I use the same smb.conf for the entware installation of samba4x to duplicate my previous functionality (with the included syntax correction)? Can you recommend a guide for setting up the entware samba4x instead of the bulit-in functionality so that I don't break something?

    In the event that I'm not able to get the Samba recycle feature to work, are there any alternative approaches to accomplish the same (i.e. move files to a trash directory instead of deleting), other than the manual file operations?
     
  4. koitsu

    koitsu Network Guru Member

    It may be that the feature is simply not compiled in, or cannot be compiled in (re: kernel may not have relevant capability). If the limiting factor is the kernel, absolute nothing can be done about it -- the kernel cannot be upgraded/version changed for several reasons, the biggest being that the wireless drivers provided by Broadcom are strictly tied to the kernel version and ABI. This is the biggest limiting factor (and also why you will find other firmwares like OpenWRT/LEDE as having bad wireless support for Broadcom SoCs -- now you know why). If the limiting factor is not the kernel, then someone may be able to build it and include it (possibly for ARM, where routers tend to have more flash). I can't make any promises.

    Re: packages: is this your first time using Tomato? I'm not aware of "packages", unless you're talking about Optware or Entware-ng? If so: Optware (R.I.P.) and Entware-ng are generic packaging repositories that do not have anything to do with Tomato directly -- kernel-level features that may be required for some operations to function (ex. AIO), and are not something they provide. Kernel space is kernel; Optware/Entware-ng are userland only.

    As for 4.x: I do not provide general support for Samba, especially 4.x. 4.x is a completely different beast, and literally brings in hundreds of megabytes of dependencies (I'm not kidding). Some 3.x configuration directives work, others do not. Samba has mailing lists + other things for that. You should consult them. Respectfully of course, this forum is about Tomato, not Samba (esp. not Samba 4.x). :)

    In general, CIFS/SMB administrators (often Windows folks) and UNIX/*IX folks have the same mentality here: if you delete a file, the file is gone. "Recycle Bin" and "Trash Bin" concepts are generally not for network filesystems. There are major problems with the "Recycle Bin" concept anyway over CIFS/SMB, NFS, or even iSCSI -- who is going to manage it? The disk will eventually fill up given enough delete operations, or if users decide to delete large files ("where is all the space going? How is the disk full?"). It's not the same as a desktop "Recycle Bin" which a user will clear. In general, the attitude presented for decades, I'm sorry to say, is that you need to be careful with delete operations.

    If this is truly a feature you need and it's necessary, I would suggest running a CIFS/SMB server on your local network (ex. a Windows desktop or server, or a Linux/BSD server) and not on your router.
     
  5. Auburnham

    Auburnham New Member Member

    Thanks again for the feedback. I have tried entware packages samba36 & samba4x and continue to get the same error "Can't find a vfs module [recycle]", so perhaps this is a kernel limitation. However, I'm not convinced that I was using the entware smbd instead of the built-in smbd, or that the entware samba packages had the recycle feature included (i.e. I could not find the file "recycle.so" anywhere). While I've installed and used other entware packages successfully, this is the first package I've used that replaces built-in functionality, so I'm not sure I am configuring and running it correctly, although smbd -V did report the correct version afterwards.

    I've exhausted just about all I am able to do, so hopefully someone else that has gotten further comes across this thread and is able to comment. Regarding the philosophy of the recycle feature, there are maximum size and time limit options to resolve many of those issues.
     
  6. koitsu

    koitsu Network Guru Member

    vfs_recycle does not have to be a shared library (.so), it can be compiled in statically. You can normally run smbd -b to see the build flags, however on Tomato this is cleared out/removed due to the need to keep binary size to a minimum.

    Installation of an Entware-ng package does not "automatically integrate" the binary/package (ex. smbd, nmbd, etc.) with Tomato. As I described, Entware-ng packages are entirely 100% independent of Tomato. So no, Tomato will not "automatically use Entware-ng binaries/packages" -- it will always run its own. Can I ask where you read or got the impression that said package would "replace built-in functionality?"

    The reason running smbd -V after installing the Entware-ng package got you version output of what you expected is because of how $PATH works in the shell. This is *IX/UNIX knowledge. By default (and what should be for obvious reasons) $PATH on Tomato defaults to this or something like it (per echo $PATH):

    Code:
    /opt/bin:/opt/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/home/root:/mmc/sbin:/mmc/bin:/mmc/usr/sbin:/mmc/usr/bin
    
    You can see that /opt/bin and /opt/sbin come before system paths. That means that if /opt/bin/smbd or /opt/sbin/smbd exist, and you just type "smbd" in the shell, you're going to run the one from /opt/bin or /opt/sbin and not the one that comes with Tomato (that's /usr/sbin/smbd). You can use the type or which commands to essentially find out which one would get run if you just typed the command by itself and not the fully-qualified path. See the difference for yourself:

    /usr/sbin/smbd -V
    /opt/sbin/smbd -V (or /opt/bin/smbd -- I don't know where Entware-ng installs its smbd binary)

    Tomato is always natively going to to run its own included smbd (/usr/sbin/smbd), even if you see just "smbd" in ps output.

    If you want to use Entware-ng's Samba package binaries, then it's up to you to disable CIFS/SMB support in Tomato (so that it won't start on boot or conflict with Entware-ng's config files/paths/etc.), and start writing the relevant rc.unslung/init.d scripts to get Entware-ng Samba to start up on boot, as well as configure Entware-ng's Samba's configuration file -- it's probably something like /opt/etc/smb.conf, not /etc/smb.conf. You get to edit this file/maintain it by hand. Tomato's web GUI cannot be used for this. Everything in /opt is self-managed, not Tomato-managed.

    Again, once more: Entware-ng has nothing to do with Tomato, and Tomato has nothing to do with Entware-ng; the two do not "interact" or "share" anything. Entware-ng is just a way to get third-party packages/programs on to a device/router/whatever (it can be used on DD-WRT, Tomato, and several others). There's no connection between it and Tomato.
     
  7. Auburnham

    Auburnham New Member Member

    Thanks koitsu. The path priority probably answers the question of which smbd was running, then. I had disabled the built-in functionality and started the service manually through a terminal, which should have defaulted to the /opt/sbin version. I also edited /opt/etc/smb.conf to include "vfs objects = recycle", etc.

    Brief update/request: If anyone can provide a compiled recycle.so library for either 3.6 or 4.7, I can drop it in the expected directory to see if that might work. I know it is a long-shot.
     
    Last edited: Apr 18, 2018 at 12:02 AM
  8. koitsu

    koitsu Network Guru Member

    Regarding Tomato: the Tomato project will not provide this, I can assure you. You're welcome to build a custom firmware yourself and play around with router/Makefile to try and get what you need/want.

    Regarding Entware-ng package: this could be something Entware-ng could provide for their samba4x-server / samba4x-libs package, but I cannot speak for them. It may be that they intentionally do not build it because of kernel incompatibilities (i.e. there's no guarantee the kernel running on the router has the necessary kernel functions/capabilities needed for the module to work), I simply don't know. It does look like samba4x-server has the function reference shims for external tie-in enabled, but the module is not compiled in statically, which means it's possible it could be added as a module:

    Code:
    root@gw:/tmp/home/root# /opt/sbin/smbd -V
    Version 4.7.3
    root@gw:/tmp/home/root# /opt/sbin/smbd -b | less
    ...
    Paths:
       MODULESDIR: /opt/lib/samba
    ...
    Build Options:
    ...
       vfs_recycle_init
    ...
    Builtin modules:
       vfs_default auth_domain auth_builtin auth_sam auth_winbind pdb_smbpasswd pdb_tdbsam auth_unix nss_info_template idmap_tdb idmap_passdb idmap_nss
    root@gw:/tmp/home/root# opkg files samba4x-server | grep -i vfs
    root@gw:/tmp/home/root# opkg files samba4x-libs | grep -i vfs
    root@gw:/tmp/home/root#
    
    It took me a very long while to figure out where the samba4x-* package details were for building. I could not find any reference to "samba4x" in repos Entware, Entware-ng, entware-ng-packages, entware-ng-rtndev, entware-packages, or entware-scripts. I believe this is where it is but I'm not entirely sure; you would need to ask the Entware-ng folks on their GitHub Issues page -- https://github.com/Entware/rtndev/tree/master/samba4x
     
  9. Auburnham

    Auburnham New Member Member

    This is great! Thanks for the reference, koitsu. I will follow up there.
     

Share This Page