tracker
tracker copied to clipboard
TKLBAM failing with: OSError: [Errno 2] No such file or directory: '/var/spool/postfix/<redacted_path>'
A user has just reported that twice in a row a TKLBAM backup failed. Both times it choked on files in /var/spool/postfix/...
. I assume because the spooled mails had sent and/or been deferred.
TBH, I'm not really sure why it's not an issue more often (I can only assume that TKLBAM already has some mitigation for this, but it's imperfect).
Regardless, a hook script to stop/start postfix when running a backup might be the best way to go?!
I think we should revisit this topic and see if it's something that's still relevant. We could try reaching back out to the user if you remember, or try to recreate the issue to see if it's been fixed.
I'm not that user, but my TKLBAM backup often fails on /var/spool/postfix/deferred/...
Here is a typical log.
Traceback (most recent call last):
File "/usr/bin/tklbam-backup", line 443, in main
opt_resume, True, dump_path if dump_path else "/")
File "/usr/lib/tklbam/backup.py", line 237, in __init__
self._create_extras(extras_paths, profile_paths, backup_conf)
File "/usr/lib/tklbam/backup.py", line 175, in _create_extras
conf.overrides.fs)
File "/usr/lib/tklbam/backup.py", line 111, in _write_whatchanged
changes = whatchanged(dirindex, paths)
File "/usr/lib/tklbam/changes.py", line 265, in whatchanged
changes += [ Change.Overwrite(path) for path in new + edited ]
File "/usr/lib/tklbam/changes.py", line 92, in __init__
self.uid = self.stat.st_uid
File "/usr/lib/tklbam/changes.py", line 67, in stat
self._stat = os.lstat(self.path)
OSError: [Errno 2] No such file or directory: '/var/spool/postfix/deferred/6/6BA501027C8
Thanks for your report/followup @trinkletrait
My guess is that between the time that tklbam determines which files to backup and then collecting those files, the deferred email(s) are successfully sent (this don't exist).
I'm not sure, but I think that the proper way to resolve this is for tklbam
to just warn on files missing from /var/spool/postfix
?
On the flip side, backing up any deferred emails may mean that emails get sent twice. I.e. if a deferred email is included in a backup, but then is later sent (after the backup is done), when the backup is restored, then the deferred email will be resent. TBH, I'm not sure which is the best approach is, although I guess sending emails twice is better than not send them at all?
Regardless, a workaround for the error you are seeing is to add the below line to your overrides
file (/etc/tklbam/overrides
). Note that that will stop any deferred emails from being backed up. That means that there is a risk that deferred emails may never be sent.
-/var/spool/postfix/deferred
How about turning Postfix off at the start of Tklbam Backup, then back On when it completes?
Landis
From: "Jeremy Davis" @.> To: "turnkeylinux" @.> Cc: "Subscribed" @.***> Sent: Wednesday, March 13, 2024 2:55:51 PM Subject: Re: [turnkeylinux/tracker] TKLBAM failing with: OSError: [Errno 2] No such file or directory: '/var/spool/postfix/<redacted_path>' (#1379)
Thanks for your report/followup [ https://github.com/trinkletrait | @trinkletrait ]
My guess is that between the time that tklbam determines which files to backup and collecting those files, the deferred email(s) are successfully sent.
I'm not sure, but I think that the proper way to resolve this is for tklbam to just warn on files missing from /var/spool/postfix .
On the flip side, backing up any deferred emails may mean that emails get sent twice. I.e. if a deferred email is included in a backup, but then is later sent (after the backup is done), when the backup is restored, then the deferred will be resent. TBH, I'm not sure which is the best approach is, although I guess sending emails twice is better than not send them at all?
Regardless, a workaround for the error you are seeing is to add the below line to your overrides file ( /etc/tklbam-overrides ). Note that that will top any deferred emails from being backed up. That means that there is a risk that deferred emails may never be sent. -/var/spool/postfix/deferred
— Reply to this email directly, [ https://github.com/turnkeylinux/tracker/issues/1379#issuecomment-1995781863 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/ABLJD2BCBQWKRKAKJYRIKK3YYC4NPAVCNFSM4JNGTIR2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJZGU3TQMJYGYZQ | unsubscribe ] . You are receiving this because you are subscribed to this thread. Message ID: @.***>
Great suggestion @l-arnold. I think that you are right. Stopping postfix while the backup occurs is a great solution to this issue that I had not considered.