Samba share: Recycle bin does not / never get cleared

    • OMV 3.x

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Samba share: Recycle bin does not / never get cleared

      Hi there!

      My problem is basically the same as described in this thread: Even though I set the option to empty the recycle bin of my Samba shared folder after 31 days it never happens! The recycle bin just keeps growing and growing until I manuelly delete all the files in it.^^ Unlike in the other thread I do not use the Autoshutdown plugin, however.

      Does anyone else also experience this bug? Any ideas on how to investigate this?

      Best,
      Aiakos
    • Did you ever figured this out?

      I have a similar issue. My samba recycle bin does not get cleaned.

      My settings:

      [IMG:https://s23.postimg.org/7uh9rxvbd/Unbenannt.png?dl=1]


      I realized that in /etc/cron.daily/openmediavault-samba-recycle the scripts in the directory /var/lib/openmediavault/cron.d are being run, so effectively it runs:

      /var/lib/openmediavault/cron.dsamba-recycle-xxxxxxx

      Looking at the script and putting a few debugging prints I figured out that the script thinks it is already running:

      # Exit if another job is running.
      [ -e /var/run/samba-recycle-xxxx ] && exit 0

      I have seen that the file truly exists at the specified location (/var/run), however it is not running anymore.
      Maybe some cleanup fails?

      Manually running the script /var/lib/openmediavault/cron.dsamba-recycle-xxxxxxx does clean the recycle bin correctly and /var/run/samba-recycle-xxx gets cleaned up after script termination.
      However everytime I run "run-parts --report /etc/cron.daily", the /var/run/samba-recycle-xxxx file persists.


      I have not done any fancy weird stuff like special ACLs or shutting down the system at a specified time. It runs for weeks but the recycle bin doesn't get cleared...

      Any ideas?

      The post was edited 3 times, last by 71CHi2OOeuF2 ().

    • Update:

      I asked the question in the debian forums and I got this answer. It looks like the asynchronous call to run-parts will cause the child command to be terminated since the parent / outer command will run the command in background (The &-symbol in "&>"). Mabe we can remove it, or is there any reason for it to run async?

      Also the author of the answer suggests to use mkdir for atomic operations.
    • I having the similar issue.
      I currently have a some files in the recycle bin for my share folder, and I want to empty it manually, but it didn't work.
      When I clicked 'Empty Now', it said "Done." but the files are still there.
      I had to go the the SMB folder, and delete them manually on my Windows 10.

      OMV v3.0.60 x64


      Source Code

      1. File: ‘.recycle/’
      2. Size: 4096 Blocks: 8 IO Block: 4096 directory
      3. Device: 97fh/2431d Inode: 139132945 Links: 2
      4. Access: (2775/drwxrwsr-x) Uid: ( 0/ root) Gid: ( 100/ users)
      5. Access: 2017-02-12 21:00:29.638945888 -0500
      6. Modify: 2017-02-13 19:47:15.793533553 -0500
      7. Change: 2017-02-13 19:47:15.793533553 -0500
      8. Birth: -
      OMV v4.0
      Asus Z97-A/3.1; i3-4370
      32GB RAM Corsair Vengeance Pro
      4x3TB RAID10

      The post was edited 2 times, last by tinh_x7 ().

    • I also had this problem, that the recycle bin was not cleared after the defined time period.

      I found a script in the nas4free forum which deletes the files in recycle bin after a time period, which can be defined within the script.

      In OMV2 the script was executed at shutdown. In OMV3 I didn´t get it to work at shutdown, so I created a hourly cron job for that.
      OMV 3.0.90 (Gray style)
      ASRock Rack C2550D4I - 16GB ECC - 6x WD RED 3TB (ZFS 2x3 Striped RaidZ1)- Fractal Design Node 304

      The post was edited 1 time, last by cabrio_leo ().

    • I don't know if my problem is the same as you describe. I can easily reproduce the steps by calling the same script as cron would from the bash command line and it will return to the command line within milliseconds. It clearly didn't remove the files and a glimpse into ".recycle" on the SMB share had confirmed the presentiment. Removing the ampersand mentioned will however resolve the issue I have and the recycle bin gets cleared.

      Can we get the packet maintainer on board? Maybe there is a reason that things are done the way they are now...
    • I have run into the same phenomenon.
      There are various threads regarding this issue on the board. As recent as from last month.
      This one seems to be the most thorough one, though.
      Thanks for starting the debugging on this, 71CHi2OOeuF2.

      To summarize: when automatic samba recycle bin emptying is enabled, OMV creates /var/lib/openmediavault/cron.d/samba-recycle-$uuid:

      Shell-Script

      1. #!/bin/sh
      2. # This configuration file is auto-generated.
      3. # WARNING: Do not edit this file, your changes will be lost.
      4. set -e
      5. amin=1440
      6. while getopts 'f' option
      7. do
      8. case ${option} in
      9. f)
      10. amin=1 # Force deletion
      11. ;;
      12. esac
      13. done
      14. # Exit if 'recyclemaxage' is zero.
      15. [ "${amin}" -eq "0" ] && exit 0
      16. # Exit if another job is running.
      17. [ -e /var/run/samba-recycle-$uuid ] && exit 0
      18. # Exit if the recycle bin directory does not exist.
      19. [ ! -e "/srv/someshare/.recycle" ] && exit 0
      20. trap "rm -f /var/run/samba-recycle-$uuid; exit" 0 1 2 5 15
      21. touch /var/run/samba-recycle-$uuid
      22. echo "Please wait, empty recyle bin of </srv/someshare> ..."
      23. find "/srv/someshare/.recycle" -mindepth 1 -amin +${amin} -print0 | xargs -0r rm -rfv
      24. # Do a second run to remove empty directories.
      25. find "/srv/someshare/.recycle" -mindepth 1 -type d -empty -print0 | xargs -0r rm -rfv
      Display All


      Which crond calls daily via /etc/cron.daily/openmediavault-samba-recycle:

      Shell-Script

      1. #!/bin/sh
      2. # This configuration file is auto-generated.
      3. # WARNING: Do not edit this file, your changes will be lost.
      4. set -e
      5. run-parts --regex='samba-recycle-*' /var/lib/openmediavault/cron.d &>/dev/null
      The samba-recycle script does various sanity checks, one of which is if the script is already running (by testing for a previously created lockfile):

      Source Code

      1. # Exit if another job is running.
      2. [ -e /var/run/samba-recycle-$uuid ] && exit 0

      From my observations every time I run into the " samba recycle bin emptying not working"-issue, the lockfile exists (preventing any future manual or automatic execution of the recycle script), even though the script is not currently running.
      Manually deleting the lockfile temporarily alleviates the issue.

      Further debugging the scripts I was not able to manually reproduce the conditions that lead to the lockfile /var/run/samba-recycle-$uuid being left over after script termination.
      Any shell magician that could chime in with an insight into what could cause these seemingly sporadic/random issues?


      Edit: as to the ampersand you mentioned, 71CHi2OOeuF2: I don't know why changing I/O redirection (without the &, stderr is no longer redirected to /dev/null) would make any difference on your end.
      At least it does not seem to change or fix the issue for me.
    • 71CHi2OOeuF2 wrote:

      Can we get the packet maintainer on board? Maybe there is a reason that things are done the way they are now...
      I assume this is a functionality of the "basic" OMV system. So the maintainer should be @votdev. The official way would be to create a ticket at bugtracker.openmediavault.org
      OMV 3.0.90 (Gray style)
      ASRock Rack C2550D4I - 16GB ECC - 6x WD RED 3TB (ZFS 2x3 Striped RaidZ1)- Fractal Design Node 304
    • 71CHi2OOeuF2 wrote:

      I asked the question in the debian forums and I got this answer. It looks like the asynchronous call to run-parts will cause the child command to be terminated since the parent / outer command will run the command in background (The &-symbol in "&>"). Mabe we can remove it, or is there any reason for it to run async?
      Please read the man page for bash I/O redirection, then you will find out that there is nothing async. &> redirects stderr and stdout to the specified file.
      Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit
    • I would have already raised the issue on the bugtracker, but I cannot reproduce it.
      Is anyone else who has encountered this able to safely reproduce it?

      From the actual script I cannot even fathom any case - except for maybe the server losing power while the script is still running - where the cleanup trap would not be sprung.
      Yet the lockfile was again present on my 24/7 server this evening, with all the above listed consequences.
      Puzzling..

      The post was edited 1 time, last by heiner ().

    • heiner wrote:

      I would have already raised the issue on the bugtracker, but I cannot reproduce it.
      Is anyone else who has encountered this able to safely reproduce it?

      From the actual script I cannot even fathom any case - except for maybe the server losing power while the script is still running - where the cleanup trap would not be sprung.
      Yet the lockfile was again present on my 24/7 server this evening, with all the above listed consequences.
      Puzzling..

      I don't have time to investigate on this issue now. I have created a cronjob that deletes everything in /var/run/samba-recycle* daily.

      Further things you might check:

      1) Change the shebang line to /bin/bash instead of /bin/sh
      2) Try looking at the following post, maybe it has something to do with it?
      stackoverflow.com/questions/29…tion-and-trap-exit-signal
    • Users Online 1

      1 Guest