tracker icon indicating copy to clipboard operation
tracker copied to clipboard

TKLBAM failing with: OSError: [Errno 2] No such file or directory: '/var/spool/postfix/<redacted_path>'

Open JedMeister opened this issue 5 years ago • 5 comments

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?!

JedMeister avatar Nov 14 '19 06:11 JedMeister

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.

Christie018 avatar Jun 27 '23 00:06 Christie018

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

ghost avatar Mar 01 '24 16:03 ghost

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

JedMeister avatar Mar 13 '24 20:03 JedMeister

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: @.***>

l-arnold avatar Mar 20 '24 14:03 l-arnold

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.

JedMeister avatar Mar 25 '24 22:03 JedMeister