SystemdUser: Persistent=true runs missed jobs at boot before the network is up, so network jobs fail on every boot

Aperta
#2,785 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
linux, typescript
Ambito
devops, networking

Direzione di ricerca

Start with LIFEOS/TOOLS/lib/SystemdUser.ts and inspect renderService, then look for tests covering generated systemd units. Check how the installer detects nm-online and how calendar, interval, and daemon units are rendered. Done means calendar jobs wait for NetworkManager when available, with a timeout, while interval jobs, daemons, and machines without nm-online keep their current behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What happens

On Linux, LIFEOS/TOOLS/lib/SystemdUser.ts renders each scheduled job as a systemd --user oneshot service plus a timer with Persistent=true. When the machine was off at the scheduled time, Persistent=true runs the missed job as soon as the user manager starts at boot. That is before NetworkManager has connected, so every job that calls the network fails on the first run after each boot.

Observed

Over 12 days, com.lifeos.commitmentsweep and com.lifeos.modelsync failed on each of the three boot catch-up runs and on no other run:

Event Time
user manager starts both jobs 08:20:21
both exit 1 (error connecting to api.github.com) 08:20:22
NetworkManager: state is now CONNECTED_GLOBAL 08:20:28

User units cannot order themselves after the system network-online.target, because the user manager does not see system targets.

Fix we run locally

renderService adds this line to every calendar (OnCalendar=) unit, only when nm-online is found on the machine at install time:

ExecStartPre=-/usr/bin/nm-online -q -t 60

When the network is already up, it returns at once. At boot, it waits the few seconds until NetworkManager connects. The leading - lets a 60 s timeout fall through to the job, which then fails visibly as before. Interval units and daemons are left as they were: offline, an interval job every few minutes would wait 60 s on every run, and none of ours failed at boot. Machines without NetworkManager (for example macOS, or systemd-networkd) render the unit unchanged.

Lingua principale
TypeScript
Stelle
19.9k
Fork
2.5k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di danielmiessler/LifeOS

Tutte le issue di danielmiessler/LifeOS

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.