Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] Samba 4.17.12-Debian vfs_recycle problem (touch_mtime does not work)

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
_track2
Posts: 7
Joined: 2023-07-27 12:30

[Software] Samba 4.17.12-Debian vfs_recycle problem (touch_mtime does not work)

#1 Post by _track2 »

Hello,

I have a problem on several servers with samba vfs_recycle module.
here is part of my smb.conf:

Code: Select all

   recylce:excludedir = tmp temp cache
   recycle:exclude = *.tmp *.temp *.exe *.iso ~$* *.~??
   recycle:minsize = 1
   recycle:versions = Yes
   recycle:touch = Yes
   recycle:touch_mtime = Yes
   recycle:keeptree = Yes
   recycle:directory_mode = 2777
   vfs objects = recycle
Deleted files are placed in the trash, however they are not touched!
So when old files are deleted, they are moved to the trash with their original modification time and such files can be immediately deleted by the trash-clearing script (find /path/to/.trash -type f -mtime +60 -delete).

There is no problem in the version 4.13.13-Debian (with a same config).

Aki
Global Moderator
Global Moderator
Posts: 3086
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 76 times
Been thanked: 418 times

Re: [Software] Samba 4.17.12-Debian vfs_recycle problem (touch_mtime does not work)

#2 Post by Aki »

Hello,

Currently there aren't any bug reports about this in the Debian Bug tracking system.

You can try debugging by increasing samba's debug level to 10 and checking the logs for messages from the vfs_recycle module.

As an example, a specific message is written to the samba log when recycle_touch_mtime functionality is activated [1].

Also check the permissions on the .recycle directory.

Hope this helps.

--
[1] https://sources.debian.org/src/samba/2%3A4.17.12%2Bdfsg-0%2Bdeb12u1/source3/modules/vfs_recycle.c/#L83
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

_track2
Posts: 7
Joined: 2023-07-27 12:30

Re: [Software] Samba 4.17.12-Debian vfs_recycle problem (touch_mtime does not work)

#3 Post by _track2 »

Thanks for the tip with log level increasing.
samba tries to touch the file along the path /srv/samba/.trash/./del2.txt instead of /srv/samba/.trash/del2.txt
However I can cat this file with both paths (cat /srv/samba/.trash/./del2.txt prints content)

Here is log fragment:

Code: Select all

[2024/04/21 01:49:57.967135,  5, pid=18603, effective(1003, 1003), real(1003, 0), class=vfs] ../../source3/smbd/vfs.c:1000(vfs_ChDir)
  vfs_ChDir: vfs_ChDir got /srv/samba/Docs
[2024/04/21 01:49:57.967139, 10, pid=18603, effective(1003, 1003), real(1003, 0)] ../../source3/smbd/open.c:966(fd_openat)
  fd_openat: name /srv/samba/.trash/./del2.txt, flags = 04000 mode = 00, fd = -1. NT_STATUS_OBJECT_NAME_NOT_FOUND
[2024/04/21 01:49:57.967144, 10, pid=18603, effective(1003, 1003), real(1003, 0)] ../../source3/smbd/files.c:534(openat_pathref_fullname)
  openat_pathref_fullname: Opening pathref for [/srv/samba/.trash/./del2.txt] failed: NT_STATUS_OBJECT_NAME_NOT_FOUND
[2024/04/21 01:49:57.967149,  5, pid=18603, effective(1003, 1003), real(1003, 0)] ../../source3/smbd/files.c:1800(file_free)
  file_free: freed files structure 0 (3 used)
[2024/04/21 01:49:57.967153,  3, pid=18603, effective(1003, 1003), real(1003, 0)] ../../source3/smbd/files.c:1199(synthetic_pathref)
  synthetic_pathref: opening [/srv/samba/.trash/./del2.txt] failed
[2024/04/21 01:49:57.967156, 10, pid=18603, effective(1003, 1003), real(1003, 0), class=recycle] ../../source3/modules/vfs_recycle.c:434(recycle_do_touch)
  recycle_do_touch: synthetic_pathref for '/srv/samba/.trash/./del2.txt' failed: NT_STATUS_OBJECT_NAME_NOT_FOUND
[2024/04/21 01:49:57.967162,  5, pid=18603, effective(1003, 1003), real(1003, 0)] ../../source3/smbd/files.c:1800(file_free)
  file_free: freed files structure 0 (2 used)

Aki
Global Moderator
Global Moderator
Posts: 3086
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 76 times
Been thanked: 418 times

Re: [Software] Samba 4.17.12-Debian vfs_recycle problem (touch_mtime does not work)

#4 Post by Aki »

Hello,

According to your log, every attempt to access the file in the vfs_recycle samba bin generates this error:

Code: Select all

/srv/samba/.trash/./del2.txt' failed: NT_STATUS_OBJECT_NAME_NOT_FOUND
This error comes from the smbd daemon.

I don't actually know if the ./ (dot-slash) is a valid path naming convention for the smb protocol (as it is for native Linux filesystems).

According to the Samba vfs_recycle man page [1], the default path of the Samba recycle bin is ".recycle":

Code: Select all

recycle:repository = PATH
Path of the directory where deleted files should be moved.
If this option is not set, the default path .recycle is used.
while in your case it is different (it is ".trash").

Nevertheless, the configuration directives in smb.conf you reported in the first post do not contain the "recycle:repository" directive.

It's probably worth checking how you have configured the "recycle:repository" directive of the vfs_recycle samba module.

Hope this helps. Please let me know.

---
[1] manual page - vfs_recycle — Samba VFS recycle bin
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

_track2
Posts: 7
Joined: 2023-07-27 12:30

Re: [Software] Samba 4.17.12-Debian vfs_recycle problem (touch_mtime does not work)

#5 Post by _track2 »

directive recycle:repository is specified for each shared folder in my configuration (not one in global section), and it works fine with version 4.13.13

Just tried to set the parameter recycle:repository = /srv/samba/.trash in Global section with the same result (NT_STATUS_OBJECT_NAME_NOT_FOUND)

I think is the "dot-slash" problem! I have just turn on log level = 10 on the 4.13.13 and the path is: /home/samba/.trash/Public///photo.reg

Here is log fragment:

Code: Select all

[2024/04/21 12:47:22.460812, 10, pid=36339, effective(2001126, 2000513), real(2001126, 0), class=recycle] ../../source3/modules/vfs_recycle.c:645(recycle_unlink_internal)
  recycle: recycled file name: /home/samba/.trash/Public///photo.reg
[2024/04/21 12:47:22.460841, 10, pid=36339, effective(2001126, 2000513), real(2001126, 0), class=recycle] ../../source3/modules/vfs_recycle.c:681(recycle_unlink_internal)
  recycle: Moving photo.reg to /home/samba/.trash/Public///photo.reg
[2024/04/21 12:47:22.460890, 10, pid=36339, effective(2001126, 2000513), real(2001126, 0), class=recycle] ../../source3/modules/vfs_recycle.c:77(recycle_touch)
  recycle: touch = True
[2024/04/21 12:47:22.460905, 10, pid=36339, effective(2001126, 2000513), real(2001126, 0), class=recycle] ../../source3/modules/vfs_recycle.c:88(recycle_touch_mtime)
  recycle: touch_mtime = True

Aki
Global Moderator
Global Moderator
Posts: 3086
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 76 times
Been thanked: 418 times

Re: [Software] Samba 4.17.12-Debian vfs_recycle problem (touch_mtime does not work)

#6 Post by Aki »

Hello
_track2 wrote: 2024-04-21 17:04 [..] it works fine with version 4.13.13 [..]
Are smbd version 4.13.13 and 4.17.12 tested in the very same (hardware and software) Debian installation ? Or are you using two different Debian installations ?
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

_track2
Posts: 7
Joined: 2023-07-27 12:30

Re: [Software] Samba 4.17.12-Debian vfs_recycle problem (touch_mtime does not work)

#7 Post by _track2 »

It's two different installations (4.13.13 is on Debian 11 and 4.17.12 is Debian 12)

Aki
Global Moderator
Global Moderator
Posts: 3086
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 76 times
Been thanked: 418 times

Re: [Software] Samba 4.17.12-Debian vfs_recycle problem (touch_mtime does not work)

#8 Post by Aki »

Have you compared the Samba configuration files between the working and non-working installations using a tool such as diff or diff3 or meld to see if there are any relevant differences?
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

_track2
Posts: 7
Joined: 2023-07-27 12:30

Re: [Software] Samba 4.17.12-Debian vfs_recycle problem (touch_mtime does not work)

#9 Post by _track2 »

There are many differences in smb.conf (because 4.13.13 is in domain and 4.17.12 is not), but all vfs_recycle options are the same!

Now I plan to install clean Debian 11 (with old samba version) and Debian 12 on my homelab hypervisor and check the behavor with absolutely ident smb.conf

UPD: Just checked on fresh-installed systems with the identical samba config: deleted files are sucessfully touched by 4.13.13 vesion, but not 4.17.12! Looks like a bug ((

Post Reply