You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Snapper每小时生成重复快照问题咨询:同一PID触发两次快照

Troubleshooting Duplicate Snapper Hourly Snapshots (HH:00 & HH:01)

Alright, let's tackle this weird Snapper duplicate snapshot issue you're seeing. For two years it's worked flawlessly, now suddenly every hour you get two snapshots—one on the dot, one a minute later, both from the same PID. No errors in the logs either? That's definitely odd, but let's break down the most likely causes and how to debug them:

1. Check for Conflicting Systemd Timer/Service Configs

Since the same PID is triggering both snapshots, we can rule out multiple independent processes running the task. But systemd timers sometimes have subtle configuration issues that cause duplicate triggers:

  • First, list all Snapper-related timers to see what's active:
    systemctl list-timers | grep snapper
    
  • Inspect the timer's configuration file (usually either /usr/lib/systemd/system/snapper-timeline.timer or a custom one in /etc/systemd/system/):
    cat /usr/lib/systemd/system/snapper-timeline.timer
    
    Pay close attention to the OnCalendar directive—make sure it's only set to *-*-* *:00:00 (hourly on the minute) and doesn't have an extra rule for *:01:00, or wildcards that might accidentally match both times.
  • Also check if there's a duplicate timer file in /etc/systemd/system/ that's overriding or supplementing the default one.

2. Audit Snapper's Timeline Configuration

Snapper's own timeline settings might have a misconfiguration that's causing the same task to run twice in quick succession:

  • Open your Snapper config file (located in /etc/snapper/configs/, typically named after your target like root):
    cat /etc/snapper/configs/root
    
    Look for parameters like TIMELINE_CREATE, TIMELINE_INTERVAL, and TIMELINE_MIN_AGE. Ensure TIMELINE_INTERVAL is set to 60 (minutes) and there's no conflicting logic that would trigger an extra snapshot immediately after the first.
  • If you've made recent changes to this config, reverting to a known-good version (or the default) could help isolate the issue.

3. Dig Into Systemd's Detailed Logs

Even if Snapper's own logs look clean, systemd might have clues about why the service is being triggered twice:

  • Pull the recent logs for the Snapper timeline service:
    journalctl -u snapper-timeline.service --since "3 hours ago"
    
    Look for two start events within a minute of each other—note the trigger reason (e.g., timer elapses vs. some other event). This can tell you if the timer is firing twice, or if something else is kicking off the service.
  • You can also check the timer's current status to see its scheduled triggers:
    systemctl status snapper-timeline.timer
    

4. Rule Out Cron Overlaps

It's easy to forget about old cron jobs that might be conflicting with the systemd timer:

  • Check the system crontab:
    cat /etc/crontab
    
  • Check root's user crontab:
    crontab -l -u root
    
    Look for any entries that run snapper create or call a script that does—if there's one set for 0 * * * * and another for 1 * * * *, that's your culprit. Even if the cron job ends up reusing the same Snapper process (unlikely, but possible), it could explain the duplicate snapshots.

5. Test a Manual Trigger

To narrow down whether the issue is with the trigger mechanism or Snapper itself:

  • Stop the systemd timer temporarily:
    systemctl stop snapper-timeline.timer
    
  • Manually run the timeline service once:
    systemctl start snapper-timeline.service
    
  • Check the snapshot list:
    snapper list
    
    If this manual run creates two snapshots, the problem is in Snapper's internal logic—try updating to the latest version or checking for known bugs. If it only creates one, the issue is definitely with the timer/cron trigger setup.

内容的提问来源于stack exchange,提问作者MountainX

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:31:00