Systemd Ui Binære Alternativer
Starte Syncthing automatisk. Det finnes for øyeblikket ingen offisiell installer tilgjengelig for Windows. Det finnes imidlertid en rekke enkle løsninger. Oppgaveplanlegger. Opprett en ny oppgave Handlingsmeny - Opprett Oppgave. Generell Tab. Name Oppgaven for eksempel Syncthing. Check Kjør om bruker er logget på eller ikke. Triggers Tab. Set Begynn oppgaven til Ved oppstart. valgfritt velg en forsinkelse. Kontroller at Aktivert er merket. Handlingen bør settes som Start et program. Skriv inn banen til i Programskript. valgfri Enter - no-konsoll-ikke-nettleser for Legg til argumenter optional. Settings Tab. anbefalt Hold avkrysningsruten på Tillat oppgave å bli kjørt på forespørsel. Fjern avkrysningsruten fra Stopp oppgave hvis den går lengre enn. anbefalt Hold ikke Start en ny forekomst for Hvis oppgaven allerede kjører, gjelder følgende regel. Skriv inn passord for brukeren. Tredje partverktøy. Det finnes en rekke tredjepartsverktøy som tar sikte på å løse dette problemet. Disse typisk gi en installatør, la Syncthing starte automatisk og en mer polert brukeropplevelse, for eksempel ved å oppføre seg som et riktig Windows-program, i stedet for å tvinge deg til å starte nettleseren din til å samhandle med Syncthing. Start på Login. Starting Syncthing ved innlogging uten et konsollvindu eller nettleseråpningen på start, er relativt enkel. Finn den riktige koblingen til Windows-binæret fra Syncthing-webområdet, velg amd64 hvis du har en 64-biters versjon av Windows. Ekstrafilene i mappen syncthing-windows-i zip til mappe C syncthing. Gå til C syncthing mappen, lag en fil oppkalt. Rett-klikk filen og velg Rediger Filen skal åpnes i Notisblokk eller standard tekst editor. Paste følgende kommando i filen og lagre chang es start Syncthing - no-konsoll-ikke-nettleser. Høyreklikk på og trykk Opprett snarvei. Høyreklikk snarvei-filen - snarvei og klikk Copy. Click Start klikk Alle programmer og klikk deretter Oppstart Høyreklikk Oppstart og klikk deretter Åpne. Lim inn snarveien høyreklikk i mappen og velg Lim inn eller trykk CTRL V. Synkronisering starter nå automatisk neste gang du åpner en ny Windows-økt. Ingen konsoll eller nettleservindu vil pop-up. Få tilgang til grensesnittet ved å bla til. Hvis du foretrekker langsommere indeksering, men et mer responsivt system under skanninger, kopier følgende kommando i stedet for kommandoen i trinn 5.Run som en tjeneste uavhengig av brukerlogging. Det er viktige sikkerhetshensyn med denne tilnærmingen Hvis du ikke sikrer Syncthing s GUI og REST API , så kan enhver prosess som kjører med noen tillatelser lese skrive en fil på filsystemet ditt ved å åpne en forbindelse med Syncthing. Derfor må du sørge for at du angir et GUI-passord, eller kjøre Syncthing som en privilegert bruker. Med ovennevnte konfigurasjon, starter Syncthing bare når en bruker logger på maskinen Dette er ikke optimal på servere der en maskin kan kjøre lenge etter en omstart uten at noen er logget inn. I dette tilfellet er det best å opprette en tjeneste som kjører så snart Windows starter Dette kan oppnås ved å bruke NSSM, Non-Sucking Service Manager. Merk at startende Syncthing ved innlogging er den foretrukne tilnærmingen til nesten hvilket som helst sluttbruker scenario. Det eneste scenariet der Syncthing som en tjeneste er fornuftig, er for det meste hodeløse servere, administrert av en sysadmin som vet nok for å forstå sikkerhetsimplikasjonene. Last ned og hent nssm til en mappe der den kan være. NSSM kjørbar utfører administrasjon så vel som å utføre som Windows-tjenesten, slik at den må beholdes på et passende sted. Fra en administrator Kommandoprompt, CD til NSSM-mappen og kjør installer synkroniserings service navn. Applikasjon Tab. Set Path til din og skriv - no-restart-no-browser - home banen til Syncthing mappen en s Argumenter Merk Logging er satt senere på - loggfilen her vil ikke bli brukt. Detaljer Tab. Optional Set Oppstartstype til Automatisk Forsinket Start for å forsinke starten på Syncthing når systemet starter oppstart, for å forbedre oppstartshastigheten. Skriv inn brukerkontoen for å løpe Synktering som Denne brukeren må ha full tilgang til Syncthing-kjørbar og dens overordnede mappe, konfigurasjonsfiler, databasemappe og synkroniserte mapper. Du kan la dette være som Lokalt system, men dette medfører sikkerhetsrisiko. Hvis du setter dette til din Windows-brukerkonto, reduseres dette ideelt. en dedikert brukerkonto med minimal tillatelser. Prosess Tab. Optional Endre prioritet til Lav hvis du vil ha et mer responsivt system til kostnaden for noe lengre synkroniseringstid når systemet er opptatt. Optimal For å aktivere logging aktiverer Console window. Shutdown Tab. To sikre Syncthing er lukket ned grasiøst, velg alle avmerkingsboksene og sett alle Timeouts til 10000ms. Exit Actions Tab. Set Restart Action for å stoppe tjenesten oneshot-modus Spesifikke innstillinger er brukes senere til å håndtere Syncthing-utganger, starter på nytt og oppgraderer. Optimal For å aktivere loggsettet Utgang stdout til filen som er ønsket for logging. Feilfeltet blir automatisk satt til samme fil. Rotasjonsfane. Optional Still inn rotasjonsinnstillingene til dine preferanser. Klikk Installer service-knappen. For å sikre at Syncthing-utganger, omstart og oppgraderinger håndteres riktig av Windows-serviceadministratoren, er det nødvendig med noen endelige innstillinger. Kjør disse i samme Commant Prompt. nssm sett synkroniserende AppExit Standard Exit. nssm sett synkroniserende AppExit 0 Exit. Sett inn synkroniseringsprogrammet AppExit 3 Restart. nssm sett synkroniserende AppExit 4 Restart. Start tjenesten via sc start syncthing i Command Prompt. Connect til Syncthing brukergrensesnittet, aktiver og sett et sikkert brukernavn og passord. Bruk homebrew. brew installere syncthing. Følg informasjon presentert ved brygge til autostart Syncthing ved hjelp av launchctl. Without homebrew. Copy sync binær filen du vil åpne for å starte Syncthing i en katalog calle d bin i din hjemmekatalog jeg er inn i hjemmet brukernavn bin Hvis bin ikke eksisterer, opprett den. Åpne i etc macosx-launchd Erstatt fire forekomster av Brukere USERNAME med din faktiske hjemmekatalog plassering. Kopier filen til. Library LaunchAgents Hvis du har problemer med å finne denne plasseringen, velg Go-menyen i Finder og velg Gå til mappe, og skriv deretter inn. Library LaunchAgents Kopierer til. Library LaunchAgents vil kreve admin passord i de fleste tilfeller. Log ut og tilbake igjen eller, hvis du ikke vil logge ut, kan du kjøre denne kommandoen i terminal launchctl load. Note Du vil sannsynligvis slå av Start Browser i web GUI innstillinger for å unngå at det åpnes et nettleservindu på hver innlogging. Da får du tilgang til GUI-typen 127 0 0 1 8384 som standard i Safari. På Ubuntu-lignende systemer. Start programmet Startup Applications. Fill ut skjemaet. Syncthingmand-banen til syncthing binær-no-browser - home. Using Supervisord. Add følgende til din supervisor config file. The filen er plassert på Debian Ubuntu or. Using systemd. systemd er en serie av systemadministrasjon daemoner, biblioteker og verktøy utformet som en sentral ledelse og konfigurasjonsplattform for Linux-operativsystemet. Det gir også brukere muligheten til å administrere tjenester under brukerens kontroll med en systemd-forekomst per bruker, slik at brukerne kan starte, stoppe, aktivere og deaktivere egne enheter. Servicefiler for systemd er levert av Syncthing og kan finnes i etc linux-systemd. You har to primære alternativer Du kan konfigurere Syncthing som en systemtjeneste eller en brukertjeneste. Å kjøre Syncthing som systemtjeneste sikrer at Syncthing kjøres ved oppstart selv om Syncthing-brukeren har ingen aktiv økt Siden systemtjenesten fortsetter å synkronisere Syncthing selv uten en aktiv brukersesjon, er den ment å brukes på en server. Å kjøre Syncthing som brukertjeneste sikrer at Syncthing bare starter etter at brukeren har logget på systemet. f. eks. via det grafiske innloggingsskjermbildet eller ssh Således er brukertjenesten ment å brukes på en multiuser-stasjonær datamaskin. Det unngår unødvendig å kjøre Syncthing-forekomster. Alle distroer inkludert arch Linux leverer de nødvendige tjenestefilene med Syncthing-pakken. Hvis distroen gir en systemd servicefil for Syncthing, kan du hoppe over trinn 2 når du konfigurerer enten systemtjenesten eller brukertjenesten, som beskrevet nedenfor. Hvordan sette opp en systemtjeneste. spiste brukeren som skal kjøre tjenesten, eller velg en eksisterende. Kopier synkroniseringssystemets synkroniseringsfil i lastbanen til systemeksemplet. Slå på og start tjenesten Skift myuser med den faktiske Syncthing-brukeren etter. Hvordan sette opp en brukertjeneste. Opprett brukeren som skal kjøre tjenesten eller velg en eksisterende. Sannsynligvis vil dette være din egen brukerkonto. Kopier filen inn i lastbanen til brukereksemplet For å gjøre dette uten root-privilegier kan du bare bruke denne mappen under din hjemmekatalog. Begynn og start tjenesten. Kontroller tjenestestatusen. For å sjekke om Syncthing kjører riktig, kan du bruke statuskommandoen for å kontrollere statusen til en systemtjeneste. Systemd er en pakke med grunnleggende byggesteiner for et Linux-system. gir en system - og serviceadministrator som kjører som PID 1 og starter resten av systemsystemet gir aggressive parallelliseringsfunksjoner, bruker stikkontakt og D-Bus-aktivering for å starte tjenester, tilbyr on demand etterspørsel av daemoner , holder styr på prosesser ved hjelp av Linux-kontrollgrupper opprettholder monterings - og automountpoeng, og implementerer en forseggjort transaksjonsavhengighetsbasert servicekontrolllogikk systemd støtter SysV - og LSB init-skript og fungerer som en erstatning for sysvinit Andre deler inkluderer en logging-demon, verktøy for å kontrollere grunnleggende systemkonfigurasjon som vertsnavn, dato, lokalitet, vedlikeholde en liste over innloggede brukere og kjørerbeholdere og virtuelle maskiner, systemkontoer, runtime-kataloger og innstillinger og daemoner for å administrere enkel nettverkskonfigurasjon, nettverkssynkronisering, loggforsendelse og navn oppløsning. Notat For en detaljert forklaring på hvorfor Arch har flyttet til systemd se dette forumet post. Basic systemctl bruk. Hovedkommandoen som brukes til å introspektere og kontrollere systemd er systemctl Noen av dens bruksområder er å undersøke systemtilstanden og administrere systemet og tjenester Se mann systemctl for flere detaljer. Du kan bruke alle de følgende systemctl kommandoer med - H bruker vert swi tch å styre en systemd-forekomst på en ekstern maskin Dette vil bruke SSH til å koble til den eksterne systemd-forekomsten. systemadm er den offisielle grafiske frontend for systemctl og leveres av systemd-ui-pakken. Plasma-brukere kan installere systemd-kcm som en grafisk fronted for systemctl Etter installasjon vil modulen bli lagt under System administrasjon. Analysere system state. Show systemstatus using. List running units. List mislykkede units. The tilgjengelige enhedsfiler kan ses i usr lib systemd system og etc systemd system sistnevnte har forrang Liste over installerte enhedsfiler ved bruk av enheter. Utenheter kan for eksempel være tjenester, monteringspunkter, enheter eller stikkontakter. Når du bruker systemctl må du generelt angi enhetens fullstendig navn, inkludert dets suffiks, for eksempel There er imidlertid noen få korte skjemaer når du angir enheten i følgende systemctl kommandoer. Hvis du ikke spesifiserer suffikset, vil systemctl anta For eksempel netctl og er tilsvarende. Mount pointe ts vil automatisk bli oversatt til riktig enhet. For eksempel er spesifisering av hjemme tilsvarende. På samme måte som monteringspunkter, blir enheter automatisk oversatt til riktig enhet, og derfor spesifiserer dev sda2 tilsvarende. Se mann for detaljer. Merk Noen enheter navner inneholder et tegn, for eksempel navnestreng, dette betyr at de er forekomster av en mal-enhet, hvis egentlige filnavn ikke inneholder strengdelen, f. eks. streng kalles forekomstidentifikatoren og ligner på et argument som sendes til malenheten når det kalles med systemctl-kommandoen i enhedsfilen vil den erstatte jeg-spesifisereren. For å være mer nøyaktig, vil systemd faktisk se etter en enhet med det nøyaktige filnavnet, men etter konvensjon skjer et slikt sammenfall sjelden, dvs. de fleste Enhetsfiler som inneholder et tegn er ment å være maler. Hvis en mal-enhet kalles uten en forekomstidentifikator, vil den bare mislykkes, siden jeg-spesifiseringen ikke kan være su bstituted. Most av de følgende kommandoene fungerer også hvis flere enheter er spesifisert, se mann systemctl for mer informasjon. - Nytt bryter kan brukes sammen med aktivere deaktivere og maske til henholdsvis starte, stoppe eller maske umiddelbart enheten snarere enn etter neste oppstart. En pakke kan tilby enheter til forskjellige formål. Hvis du nettopp har installert en pakke, kan pacman - Qql pakke grep - Fe - e brukes til å sjekke og finne dem. Start en enhet umiddelbart. Stopp en enhet umiddelbart. enhet for å laste inn sin konfigurasjon. Show statusen til en enhet, inkludert om den kjører eller ikke. Kontroller om en enhet allerede er aktivert eller ikke. Enaktiver en enhet som skal startes ved oppstart. Disable en enhet som ikke starter under oppstart. Mask en enhet som gjør det umulig å starte det. Show den manuelle siden som er tilknyttet en enhet, dette må støttes av enhetsfilen. Reload systemd-skanning for nye eller endrede enheter. Power management. polkit er nødvendig for strømstyring som en ubehøvlet bruker Hvis du er i en lokal systemd-log-brukerøkten og ingen annen økt er aktiv, vil følgende kommandoer fungere uten root-privilegier. Hvis ikke for eksempel fordi en annen bruker er logget inn i en tty, vil systemd automatisk spørre deg om root-passordet. Slå av og start systemet på nytt . Slå av og slå av systemet. Sluk systemet. Sett systemet i dvalemodus. Sett systemet i hybrid-sovestatus eller suspendere til begge. Skrive enhetfiler. Syntaksen til systemets s-filer er inspirert av XDG Desktop Entry Specification-filer, som igjen er inspirert av Microsoft Windows-filer Enhetsfiler er lastet fra to steder Fra laveste til høyeste prioritet de er. usr lib systemd system enheter levert av installerte pakker. etc systemd-systemenheter installert av systemadministratoren. Lastveiene er helt forskjellige når du kjører systemd i brukermodus. Systemd-enhetnavn kan bare inneholde ASCII-alfanumeriske tegn, understreker og perioder. Alle andre tegn må erstattes av C-stil x2d rømmer. Se mann og man systemd-escape for mer informasjon. Se på enhetene som er installert av pakkene dine for eksempler, så vel som det annoterte eksempel-avsnittet av man. Tippkommentarer som er forhåndsdefinert med, kan også brukes i enhedsfiler, men bare i nye linjer. ikke bruk sluttlinjebeskrivelser etter systemd-parametere, eller enheten vil mislykkes. Aktiveringsavhengigheter. Med systemdjerfiler kan løses ved å designe enhetens filer riktig. Det mest typiske tilfellet er at enheten A krever at enheten B kjører før A er startet I det tilfellet legger til, krever B og etter B til enhetsdelen av A Hvis avhengigheten er valgfri, legger du til Vil B og Etter B Vær oppmerksom på at Vil og Krever ikke innebærer Etter meanin g at hvis etter ikke er spesifisert, blir de to enhetene startet parallelt. Tiltakene er vanligvis plassert på tjenester og ikke på mål. For eksempel blir det trukket inn uansett hvilken tjeneste som konfigurerer nettverksgrensesnittene, og bestiller derfor din tilpassede enhet etter at den er tilstrekkelig siden er startet anyway. Service types. There er flere forskjellige oppstartstyper å vurdere når du skriver en egendefinert servicefil Dette er satt med Type-parameteren i Service-delen. Type enkel standard systemd vurderer tjenesten å starte opp umiddelbart Prosessen må ikke gaffel Ikke bruk denne typen hvis andre tjenester må bestilles på denne tjenesten, med mindre det er satt i stikkontakt. Typeforking systemd vurderer tjenesten startet når prosessgaffel og foreldre har gått For klassiske daemoner, bruk denne typen med mindre du vet at det ikke er nødvendig Du bør også spesifisere PIDFile slik at systemd kan holde styr på hovedprosessen. Typeshot Dette er nyttig for skript som gjør en enkelt jobb a nd deretter avslutte Du vil kanskje også sette inn RemainAfterExit ja, slik at systemd fortsatt anser tjenesten som aktiv etter at prosessen har gått ut. Tildesigner identisk med Type enkel, men med bestemmelsen om at demonen sender et signal til systemd når det er klart Referanseimplementasjonen for dette varslet er gitt av. Type dbus tjenesten betraktes som klar når den angitte BusName vises på DBus s systembuss. Type inaktiv systemd vil forsinke utførelsen av tjenesten binærtil alle jobber sendes. Annet enn at oppførselen er svært lik for å skrive enkelt. Se mannens side for en mer detaljert forklaring av Type-verdiene. Ved å bruke de oppgitte enhetene. For å unngå konflikter med pacman, bør enhetslister som leveres av pakker ikke redigeres direkte. Det er to sikre måter å modifisere en enhet uten å berøre original fil opprette en ny enhet fil som overstyrer den opprinnelige enheten eller opprette drop-in stykker som brukes på toppen av den opprinnelige enheten For begge metodene må du re last inn enheten etterpå for å bruke endringene dine. Dette kan gjøres enten ved å redigere enheten med systemctl edit som laster opp enheten automatisk eller ved å laste inn alle enhetene med. Du kan bruke systemd-delta for å se hvilke enhedsfiler som er blitt overstyrt eller utvidet, og hva har nettopp blitt endret. Bruk systemcat-cat-enhet til å se innholdet i en enhedsfil og alle tilhørende innløpssnutt. Syntaxutheving for systemd-enhetfiler i Vim kan aktiveres ved å installere vim-systemd. Replacement unit files. To bytte ut enheten fil usr lib systemd system enhet lage filen etc systemd system enhet og reenable enheten for å oppdatere symlinks. This opens etc systemd system enhet i editoren din kopierer den installerte versjonen hvis den ikke eksisterer ennå og automatisk laster den på nytt når du er ferdig med redigering. Merk Pacman oppdaterer ikke erstatningsenhetsfilene når originalene oppdateres, slik at denne metoden kan gjøre systemvedlikehold vanskeligere. Derfor anbefales neste tilnærming. op-in files. To opprette drop-in filer for enhet filen usr lib systemd system enhet lage mappen etc systemd system enhet d og plassere filer der for å overstyre eller legge til nye alternativer systemd vil analysere disse filene og bruke dem på toppen av original enhet. Den enkleste måten å gjøre dette på er å kjøre. Dette åpner filen etc systemd system enhet i tekstredigerer opprette det hvis nødvendig og automatisk laster på enheten når du er ferdig redigering. Vend til leverandør versjon. Til å endre eventuelle endringer til En enhet som er laget med systemktl redigere gjør. For eksempel, hvis du bare vil legge til en ekstra avhengighet til en enhet, kan du opprette følgende fil. Som et annet eksempel, for å erstatte ExecStart-direktivet for en enhet som ikke er av typen oneshot lager følgende fil. Legg merke til hvordan ExecStart må slettes før den blir tildelt igjen 1 Det samme gjelder for hvert element som kan angis flere ganger, f. eks. OnCalendar for timere. Et annet eksempel for å starte en tjeneste automatisk igjen. Denne artikkelen eller delen n eeds språk, wiki syntaks eller stil forbedringer. Reason Uklart beskrivelse, kopimateriale uttrykkelig nevner Fedora Diskuter i Talk Systemd Lag seksjon Mål mer tydelig. systemd bruker mål som tjener et lignende formål som runlevels, men virker litt forskjellige Hvert mål er oppkalt i stedet av nummerert og er ment å tjene et bestemt formål med muligheten for å ha flere aktive samtidig. Noen mål s er implementert ved å arve alle tjenestene til et annet mål og legge til flere tjenester til det. Det er systemd mål s som etterligner vanlige SystemVinit runleveller slik at du fortsatt kan bytte mål s ved hjelp av den kjente telinit RUNLEVEL kommandoen. Få gjeldende mål. Følgende skal brukes under systemd i stedet for å kjøre runlevel. Create tilpasset target. The runlevels som hadde en definert betydning under sysvinit dvs. 0, 1 , 3, 5 og 6 har en 1 1 kartlegging med et bestemt systemd-mål. Dessverre er det ikke en god måte å gjøre det samme for bruker - definerte runleveller som 2 og 4 Hvis du bruker dem, foreslås det at du lager et nytt navngitt systemd mål som etc systemd-systemet ditt mål som tar en av de eksisterende runlevelene som en base du kan se på som et eksempel, lage en katalog etc systemd system målet ditt og deretter symlink de ekstra tjenestene fra usr lib systemd systemet som du ønsker å aktivere. Mål tabell. Endre nåværende target. In systemd mål blir utsatt via mål enheter Du kan endre dem som dette. Dette vil bare endre dagens mål og har ingen effekt på neste oppstart Dette tilsvarer kommandoer som telinit 3 eller telinit 5 i Sysvinit. Endre standardmål for å starte inn. Standardmålet er som aliaset som standard som tilsvarer det gamle runlevel 5 Hvis du vil endre standardmålet ved oppstartstid, legger du til en av følgende kjerneparametere i oppstartslasteren. som grovt tilsvarer det gamle runlevel 3. som omtrent svarer til det gamle runlevel 1.Alternativt, kan du la bootloaderen stå alene og endre. Dette kan gjøres ved hjelp av systemctl. For å kunne overstyre det tidligere settet, bruk kraftalternativet. Effekten av denne kommandoen er utført av systemctl en symlink til det nye standardmålet er laget på. systemd-tmpfiles oppretter, sletter og rydder opp flyktige og midlertidige filer og kataloger. Det leser konfigurasjonsfiler i etc tmpfiles d og usr lib tmpfiles d for å oppdage hvilke handlinger som skal utføres Konfigurasjonsfiler i den tidligere katalogen har forrang enn de i sistnevnte katalog. Konfigurasjon filer leveres vanligvis sammen med servicefiler, og de er navngitt i stil med usr lib tmpfiles d program For eksempel forventer Samba-demonen at katalogkjøringen samba skal eksistere og for å få de riktige tillatelsene. Samba-pakken sendes med denne konfigurasjonen . Konfigurasjonsfiler kan også brukes til å skrive verdier til bestemte filer ved oppstart. Hvis du for eksempel pleide å deaktivere wakeup fra USB-enheter med ekko USBE proc acpi wakeup, kan du bruke følgende tmpfile instead. See systemd-tmpfiles 8 og tmpfiles d 5 man sider for detaljer. Merknad Denne metoden kan ikke fungere for å angi alternativer i sys siden systemd-tmpfiles-oppsett tjenesten kan kjøre før den riktige dev ismoduler er lastet I dette tilfellet kan du sjekke om modulen har en parameter for alternativet du vil angi med modinfo-modulen og sett dette alternativet med en config-fil i etc modprobe d Ellers må du skrive en udev-regel for å stille inn passende attributt så snart enheten vises. A Timer er en enhetskonfigurasjonsfil hvis navn slutter med og koder informasjon om en tidsurstyrt og overvåket av systemd for timerbasert aktivering Se systemd Timers. Since systemd er en erstatning for System V init, Det er ansvaret for monteringene som er spesifisert i etc fstab Faktisk går det utover de vanlige fstab-funksjonene, implementering av spesielle monteringsalternativer prefixed med x-systemd Se Fstab Automount med systemd for et eksempel på automatisk montering på forespørsel ved bruk av disse utvidelsene Se 2 for fullstendig dokumentasjon av disse utvidelsene. systemd har sitt eget loggingssystem kalt journalen, derfor er det ikke lenger nødvendig å kjøre en syslog-demon. For å lese loggen, bruk. In Arch Linux, katalogen var loggboken er en del av systemd-pakken, og journalen når Lagring er satt til automatisk, vil skrive til var loggbok Hvis du eller et program sletter den katalogen, vil systemd ikke gjenskape den automatisk og i stedet vil skrive dens logger for å kjøre systemd journal på en nonpersistent måte Men mappen vil bli gjenskapt når du angir Lagring vedvarende og kjøre systemctl restart systemd-journald eller reboot. Systemd journal klassifiserer meldinger etter prioritetsnivå og Facility Logging klassifisering tilsvarer klassisk Syslog protokoll RFC 5424.Prioritetsnivå. En syslog alvorlighets kode i systemd heter prioritet brukes til å markere betydningen av en melding RFC 5424 § 6 2 1.Så, nyttige fasiliteter for å se 0,1,3,4,9,10,15.Filterutgang. journalctl gir deg mulighet til å filtrere utdataene med bestemte felt. Vær oppmerksom på at hvis det er mange meldinger å vise eller filtrere med stor tidsperiode, må utgangen av denne kommandoen bli forsinket i ganske lang tid. Tips Mens journalen er lagret i et binært format, blir innholdet av lagrede meldinger ikke endret. Det betyr at det kan ses med strenger, for eksempel for gjenoppretting i et miljø som ikke har systemd installert. Eksempelkommando. Show alle meldinger fra denne oppstarten, men ofte en er interessert i meldinger ikke fra gjeldende, men fra forrige oppstart, for eksempel hvis et uopprettelig systemkrasj skjedde Dette er mulig gjennom valgfri offset-parameter for - b-flagget journalctl - b -0 viser meldinger fra gjeldende oppstart, journalktl - b - 1 fra forrige oppstart, journalktl - b -2 fra den andre forrige og så videre. Se man 1 journalktl for full beskrivelse, semantikken er mye kraftig. Vis alle meldinger fra dato og valgfri tid. Vis alle meldinger siden 20 minutter siden. Følg nye meldinger. Show alle meldinger av en bestemt kjørbar. Show alle meldinger av en bestemt prosess. Show alle meldinger av en bestemt enhet. Show kjernen ring buffer. Show bare feil, kritisk og varsel prioritet meldinger Nummer kan også brukes, journalctl - p 3 1 Hvis enkelt nummer søkeord brukt, journalctl - p 3 - alle høyere prioritetsnivåer også inkludert. Show tilsvarende ved å filtrere på syslog facility. See man 1 journalctl man 7 eller Lennart s blogginnlegg for detaljer. Tip Som standard forkortes journalktlinjene lengre enn skjermbredden, men i noen tilfeller kan det være bedre å aktivere innpakning i stedet for avkorting. Dette kan styres av SYSTEMDLESS miljøvariabelen som inneholder alternativer som er overført til mindre standardparator og standard til FRSXMK se mann 1 mindre og man 1 journalktl for detaljer. Hvis du unnlater S-alternativet, blir utgangen pakket inn i stedet for avkortet. For eksempel, start journalkoden som følger. Hvis du vil angi denne oppførselen som standard, eksporter variabelen fra. Journal størrelsesgrense. Hvis journalen er vedvarende ikke-flyktig, er størrelsesgrensen satt til en standardverdi på 10 av størrelsen på det underliggende filsystemet, men begrenset til 4 GiB For eksempel med var loggbok plassert på en 20 GiB p artikkel, kan journaldata ta opptil 2 GiB På en 50 GiB-partisjon, vil den maksimere gi 4 GiB. Maksimal størrelse på den vedvarende journalen kan kontrolleres ved å ikke kommentere og endre følgende. Det er også mulig å bruke innfallet snippets konfigurasjonsoverstyringsmekanisme i stedet for å redigere den globale konfigurasjonsfilen. I dette tilfellet ikke glem å plassere overstyringene under Journal header. See man for mer info. Rengre journalfiler manuelt. Journalfiler kan fjernes globalt fra var loggbok ved hjelp av f. eks. rm eller kan trimmes i henhold til ulike kriterier ved hjelp av journaleksempler. Fjern arkiverte journalfiler til diskplassen de bruker, faller under 100M. Make alle journalfiler inneholder ingen data eldre enn 2 uker. Se mann journalist for mer info. Journald i forbindelse med syslogpatibility med en klassisk, ikke-journaldig klar syslog implementering kan gis ved å la systemd videresende alle meldinger via stikkontakten systemd journal syslog For å gjøre syslog-demonen arbeide med tidsskriftet, det må binde seg til denne kontakten i stedet for dev log-offisiell kunngjøring. Standard for viderekobling til stikkontakten er ForwardToSyslog no for å unngå systemoverhead, fordi rsyslog eller syslog-ng trekker meldingene fra journalen av seg selv. dev tty12.Create en drop-in katalogen og opprett en fil i den. Specify en annen journal for å se. Det kan være behov for å sjekke loggene til et annet system som er død i vannet, for eksempel oppstart fra et levende system for å gjenopprette et produksjonssystem I slike tilfeller kan man montere disken i f. eks. mnt og spesifisere journalsveien via - D - katalog som så. Tips og triks. Enable installerte enheter som standard. Denne artikkelen eller delen trenger utvidelse. Reason Hvordan fungerer det arbeide med instantiated enheter Diskuter i Talk Systemd. Arch Linux leveres med inneholdende disable Dette fører til at systemkredittet er forhåndsinnstilt for å deaktivere alle enheter som standard, slik at når en ny pakke er installert, må brukeren manuelt aktivere enheten. Hvis denne oppførselen ikke er ønsket, simpl y opprett en symlink fra til dev null for å overstyre konfigurasjonsfilen Dette vil føre til at systemktl er forhåndsinnstilt for å aktivere alle enheter som blir installert uavhengig av enhetstypen, med mindre det er angitt i en annen fil i en systemettl forhåndsinnstilte s konfigurasjonsmapper Brukerenhetene er ikke berørt Se manpage for mer informasjon. Notat Aktivering av alle enheter som standard kan føre til problemer med pakker som inneholder to eller flere gjensidig eksklusive enheter systemctl forhåndsinnstilt er designet for å bli brukt av distribusjoner og spinn eller systemadministratorer I tilfelle der to motstridende enheter ville være aktivert, du bør eksplisitt spesifisere hvilken som skal deaktiveres i en forhåndsinnstilt konfigurasjonsfil som angitt i manpage for. Sandboxing applikasjonsmiljøer. Enhetsfil kan opprettes som en sandkasse for å isolere applikasjoner og deres prosesser i et herdet virtuelt miljø systemd utnytter navnerom - blacklisting av evner og kontrollgrupper til containerprosesser gjennom en ekstern siv utførelse miljø konfigurasjon. Utvidelsen av en eksisterende systemd enhet fil med applikasjon sandboxing krever vanligvis prøve-og-feil tester ledsaget av generøs bruk av strace stderr og journalctl feil logging og utgangsfasiliteter Du vil kanskje først søke oppstrøms dokumentasjon for allerede gjort tester til basale forsøk. Noen eksempler på hvordan sandboxing med systemd kan distribueres. KapasitetBoundingSet definerer et hvittliste sett med tillatte funksjoner, men kan også brukes til å svarte en bestemt funksjon for en enhet. CAPSYSADM-evnen, for eksempel, som skal være Et av målene for en sikker sandkasse CapabilityBoundingSet. Unbound Sandboxing viser et fullskala eksempel på systemd-funksjoner for sandboxing. Investigating systemd errors. As et eksempel, vil vi undersøke en feil med systemd-modules-load service.1 Lar vi finne systemd tjenester som ikke klarer å starte.2 Ok, vi fant et problem med systemd-moduler-last service Vi vil vite mer. Hvis Proce ss ID er ikke oppført, bare start opp den mislykkede tjenesten med systemctl restart systemd-modules-load.3 Nå har vi prosess ID PID for å undersøke denne feilen i dybden Skriv inn følgende kommando med gjeldende prosess ID her 15630.4 Vi ser at noen av kjernemodulen konfigs har feil innstillinger Derfor ser vi på disse innstillingene i etc moduler-last d.5 Feilaktig å finne modul svarteliste usblp feilmelding kan være relatert til feil innstilling i Lets deaktivere det ved å sette inn et spor før hver alternativet vi fant via trinn 3.6 Nå, prøv å starte systemd-moduler-load. If det var vellykket, bør dette ikke spørre noe Hvis du ser en feil, gå tilbake til trinn 3 og bruk den nye PID for å løse feilene igjen. Hvis everything is ok, you can verify that the service was started successfully with. Often you can solve these kind of problems like shown above For further investigation look at Diagnosing boot problems. Diagnosing boot problems. systemd has several options for diagn osing problems with the boot process See boot debugging and the systemd debugging documentation. Diagnosing problems with a specific service. The factual accuracy of this article or section is disputed. Reason This may not catch all errors such as missing libraries Discuss in User talk Alucryd Plex. If some systemd service misbehaves and you want to get more information about what is going on, set the SYSTEMDLOGLEVEL environment variable to debug For example, to run the systemd-networkd daemon in debug mode. Or, equivalently, modify the service file temporarily for gathering enough output For example. If debug information is required long-term, add the variable the regular way. Shutdown reboot takes terribly long. If the shutdown process takes a very long time or seems to freeze most likely a service not exiting is to blame systemd waits some time for each service to exit before trying to kill it To find out if you are affected, see this article. Short lived processes do not seem to log any out put. If journalctl - u foounit does not show any output for a short lived service, look at the PID instead For example, if fails, and systemctl status systemd-modules-load shows that it ran as PID 123, then you might be able to see output in the journal for that PID, i e journalctl - b PID 123 Metadata fields for the journal such as SYSTEMDUNIT and COMM are collected asynchronously and rely on the proc directory for the process existing Fixing this requires fixing the kernel to provide this data via a socket connection, similar to SCMCREDENTIALS. Boot time increasing over time. After using systemd-analyze a number of users have noticed that their boot time has increased significantly in comparison with what it used to be After using systemd-analyze blame NetworkManager is being reported as taking an unusually large amount of time to start. The problem for some users has been due to var log journal becoming too large This may have other impacts on performance, such as for systemctl status or journalctl As such the solution is to remove every file within the folder ideally making a backup of it somewhere, at least temporarily and then setting a journal file size limit as described in Journal size limit. fails to start at boot. Starting with systemd 219, specifies ACL attributes for directories under var log journal and, therefore, requires ACL support to be enabled for the filesystem the journal resides on. See Access Control Lists Enabling ACL for instructions on how to enable ACL on the filesystem that houses var log journal. systemctl enable fails for symlinks in etc systemd system. If etc systemd system foo is a symlink and systemctl enable foo is run, it will fail with this error. This is a design choice of systemd As a workaround, enabling by absolute path works. dependent services are not started when starting a service manually. This section is being considered for removal. One in famous example is which needs the to function properly. The dependencies in are defined as. This only defines the necessary dependent sockets to be enabled services i e as autostart , too - but does not start them whenever the DISABLED non-autostarting service ist started manually e g by running systemctl star t libvirtd. Thus the correct way to manually start a service with dependent subservices once instead of at each start of the system probably is. systemd version printed on boot is not the same as installed package version. You need to regenerate your initramfs and the versions should match. Tip A pacman hook can be used to automatically regenerate the initramfs every time systemd is upgraded See this forum thread and Pacman Hooks. Soon enough, hardly any Linux user will be able to escape the ever growing grasp that systemd imposes on Linux, unless they manually opt out systemd has created more technical, emotional, and social issues than any other piece of software as of late This predominantly came to show in the heated discussions also dubbed as the Init Wars , that occupied parts of the Debian developer body for months While the Debian Technical Comittee finally decided to include systemd in Debian 8 Jessie , there were efforts to supersede the decision by a General Resolution, and even threats to the health of developers in favor of systemd. This goes to show how deep systemd interferes with the way of handling Linux systems that has, in large parts, been passed down to us from the Unix days Theorems like one tool for the job are overthrown by the new kid in town Besides substituting sysvinit as init system, it digs deep into system administration For right now a lot of the commands you are used to will keep on working due to the compatibility layer provided by the package systemd-sysv That might change as soon as systemd 214 is uploaded to Debian, destined to be released in the stable branch with Debian 8 Jessie From thereon, users need to utilize the new commands that come with systemd for managing services, processes, switching run levels, and querying the logging system A workaround is to set up aliases in. So let s have a look at how systemd will change your habits of administrating your computers and the pros and cons involved Before making the switch to systemd it is a good security measure to save the old sysvinit to be able to still boot, should systemd fail This will only work as long as systemd-sysv is not yet installed, and can be easily obtained by running. cp - av sbin init. Thusly prepared, in case of emergency, just append. to the kernel boot-time parameters. Basic Usage of systemctl. systemctl is the command that substitutes the old etc init d foo start stop , but also does a lot more, as you can learn from its man page. Some basic use-cases are. systemctl - list all loaded units and their state where unit is the term for a job service. systemctl list-units - list all units. systemctl start NAME - start activate one or more units. systemctl stop NAME - stop deactivate one or more units. systemctl disable NAME - disable one or more unit files. systemctl list-unit-files - show all installed unit files and their state. systemctl --failed - show which units failed during boot. systemctl --type mount - filter for types types could be service, mount, device, socket, target. systemctl enable - start a root shell on TTY 9 for debugging. For more convinience in handling units, there is the package systemd-ui which is started as user with the command systemadm. Switching runlevels, reboot and shutdown are also handled by systemctl. systemctl isolate - take you to what you know as init 5, where your X-server runs. systemctl isolate - take you to what you know as init 3, TTY, no X. systemctl reboot - shut down and reboot the system. systemctl poweroff - shut down the system. All these commands, other than the ones for switching runlevels, can be executed as normal user. Basic Usage of journalctl. systemd does not only boot machines faster than the old init system, it also starts logging much earlier, including messages from the kernel initialization phase, the initial RAM disk, the early boot logic, and the main system runtime So the days where you needed to use a camera to provide the output of a kernel panic or otherwise stalled system for debugging are mostly over. With systemd logs are aggregated in the journal which resides in var log To be able to make full use of the journal, we first need to set it up, as Debian does not do that for you yet. addgroup --system systemd-journal mkdir - p var log journal chown root systemd-journal var log journal gpasswd - a user systemd-journal. That will set up the journal in a way where you can query it as normal user Querying the journal with journalctl offers some advantages over the way syslog works. journalctl --all - show the full journal of the system and all its users. journalctl - f - show a live view of the journal equivalent to tail - f var log messages. journalctl - b - show the log since the last boot. journalctl - k - b -1 - show all kernel logs from the boot before last - b -1.journalctl - b - p err - shows the log of the last boot, limited to the priority ERROR. journalctl --since yesterday - since Linux people normally do not often reboot, this limits the size more than - b would. journalctl - u --since 2014-07-06 07 00 --until 2014-07-06 08 23 - show the log for cron for a defined timeframe. journalctl - p 2 --since today - show the log for priority 2, which covers emerg, alert and crit resembl es syslog priorities emerg 0 , alert 1 , crit 2 , err 3 , warning 4 , notice 5 , info 6 , debug 7.journalctl - copy the binary journal as text into your current directory. Journal and syslog can work side-by-side On the other hand, you can remove any syslog packages like rsyslog or syslog-ng once you are satisfied with the way the journal works. For very detailed output, append to the kernel boot-time parameter list, and then run. Log levels can also be edited in. Analyzing the Boot Process with systemd. systemd allows you to effectively analyze and optimize your boot process. systemd-analyze - show how long the last boot took for kernel and userspace. systemd-analyze blame - show details of how long each service took to start. systemd-analyze critical-chain - print a tree of the time-critical chain of units. systemd-analyze dot dot - Tsvg - put a vector graphic of your boot process requires graphviz package. systemd-analyze plot - generate a graphical timechart of the boot process. systemd has pr etty good documentation for such a young project under heavy developement First of all, there is the 0pointer series by Lennart Poettering The series is highly technical and quite verbose, and holds a wealth of information Another good source is the distro agnostic Freedesktop info page with the largest collection of links to systemd resources, distro specific pages, bugtrackers and documentation A quick glance at. will give you an overview of all systemd man pages The command structure for systemd for various distributions is pretty much the same, differences are found mainly in the packaging. Subscribe to Xmodulo. Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo Enter your email address below, and we will deliver our Linux posts straight to your email box, for free Delivery powered by Google Feedburner. Support Xmodulo. Did you find this tutorial helpful Then please be generous and support Xmodulo. Ferdinand Thommes. I live as linux developer, technical au thor and city guide in Berlin, Germany and Charleston S C Other than being nerdy I dig riding bicycles and love cooking and good literature. The D-Bus API of systemd PID 1.systemd and its auxiliary daemons expose a number of APIs on D-Bus The following describes the various APIs exposed by the system and service manager itself, and does not cover the auxiliary daemons. The service manager exposes a number of objects on the bus one manager object as central entry point for clients and individual objects for each unit and for each queued job The unit objects each implement a generic Unit interface plus a type-specific interface For example, service units implement as well as The manager object can be used to list unit and job objects, or to directly convert a unit name or job id into a bus path of the corresponding D-Bus objects. Note that properties exposing time values are usually encoded in microseconds usec on the bus, even if their corresponding settings in the unit files are in second s. In contrast to most of the other services of the systemd suite PID 1 does not use PolicyKit for controlling access to privileged operations, but relies exclusively on the low-level D-Bus policy language This is done in order to avoid a cyclic dependency between PolicyKit and systemd PID 1 This means that sensitive operations exposed by PID 1 on the bus are generally not available to unprivileged processes directly However some such as shutdown reboot suspend are made available via logind s interfaces. The Manager Object. The main entry point object is available on the fixed org freedesktop systemd1 object path. Read access is generally granted to all clients, but changes may only be made by privileged clients PolicyKit is not used by this service, and access controlled exclusively via the D-Bus policy enforcement. Note that many of the calls exist twice once on the Manager object, and once on the respective unit objects This is to optimize access times so that methods that belong to unit objects do not have to be called with a resolved unit path, but can be called with only the unit id, too. GetUnit may be used to get the unit object path for a unit name It takes the unit name and returns the object path If a unit has not been loaded yet by this name this call will fail. GetUnitByPID may be used to get the unit object path of the unit a process ID belongs to Takes a Unix PID and returns the object path The PID must refer to an existing process of the system. LoadUnit is similar to GetUnit but will load the unit from disk if possible. StartUnit enqeues a start job, and possibly depending jobs Takes the unit to activate, plus a mode string The mode needs to be one of replace, fail, isolate, ignore-dependencies, ignore-requirements If replace the call will start the unit and its dependencies, possibly replacing already queued jobs that conflict with this If fail the call will start the unit and its dependencies, but will fail if this would change an already queued job If iso late the call will start the unit in question and terminate all units that aren t dependencies of it If ignore-dependencies it will start a unit but ignore all its dependencies If ignore-requirements it will start a unit but only ignore the requirement dependencies It is not recommended to make use of the latter two options Returns the newly created job object. StartUnitReplace is similar to StartUnit but replaces a job that is queued for one unit by a job for another. StopUnit is similar to StartUnit but stops the specified unit rather than starting it Note that isolate mode is invalid for this call. ReloadUnit RestartUnit TryRestartUnit ReloadOrRestartUnit ReloadOrTryRestartUnit may be used to restart and or reload a unit, and takes similar arguments as StartUnit Reloading is done only if the unit is already running and fails otherwise If a service is restarted that isn t running it will be started, unless the Try flavor is used in which case a service that isn t running is not affected by the restart The ReloadOrRestart flavors attempt a reload if the unit supports it and use a restart otherwise. KillUnit may be used to kill i e send a signal to all processes of a unit Takes the unit name, an enum who and a UNIX signal number to send The who enum is one of main , control or all If main , only the main process of a unit is killed If control only the control process of the unit is killed, if all all processes are killed A control process is for example a process that is configured via ExecStop and is spawned in parallel to the main daemon process, in order to shut it down. GetJob returns the job object path for a specific job, identified by its id. CancelJob cancels a specific job identified by its numer ID This operation is also available in the Cancel method of Job objects see below , and exists primarily to reduce the necessary round trips to execute this operation Note that this will not have any effect on jobs whose execution has already begun. ClearJobs flushes the job queue, removing all jobs that are still queued Note that this does not have any effect on jobs whose execution has already begun, it only flushes jobs that are queued and have not yet begun execution. ResetFailedUnit resets the failed state of a specific unit. ResetFailed resets the failed state of all units. ListUnits returns an array with all currently loaded units Note that units may be known by multiple names at the same name, and hence there might be more unit names loaded than actual units behind them The array consists of structures with the following elements. The primary unit name as string. The human readable description string. The load state i e whether the unit file has been loaded successfully. The active state i e whether the unit is currently started or not. The sub state a more fine-grained version of the active state that is specific to the unit type, which the active state is not. A unit that is being followed in its state by this unit, if there is any, otherwise the empt y string. The unit object path. If there is a job queued for the job unit the numeric job id, 0 otherwise. The job type as string. The job object path. ListJobs returns an array with all currently queued jobs Returns an array consisting of structures with the following elements. The numeric job id. The primary unit name for this job. The job type as string. The job state as string. The job object path. The unit object path. Subscribe enables most bus signals to be sent out Clients which are interested in signals need to call this function Signals are only sent out if at least one client invoked this function Unsubscribe undoes the signal subscription that Subscribe implements It is not necessary to invoke Unsubscribe as clients are tracked Signals are no longer sent out as soon as all clients which previously asked for Subscribe either closed the bus connection or invoked Unsubscribe. CreateSnapshot creates a snapshot unit for the current system state, and stores it under the specified name It will return the unit object path to the new snapshot If the cleanup boolean is true the snapshot will be removed automatically when it has been activated, otherwise it remains and can be activated multiple times Snapshots are not persistent. RemoveSnapshot removes a snapshot This call is also available in the Remove method of Snapshot objects see below , and exists primarily to reduce the number of required roundtrips for this call. Reload may be invoked to reload all unit files. Reexecute may be invoked to reexecute the main manager process It will serialize its state, reexecute, and deserizalize the state again This is useful for upgrades and is a more comprehensive version of Reload. Exit may be invoked to ask the manager to exit This is not available for the system manager and is useful only for user session managers. Reboot PowerOff Halt KExec may be used to ask for immediate reboot, powering down, halt or kexec based reboot of the system Note that this does not shut down any services and immediately transitions into the reboot process These functions are normally only called as last step of shutdown, and should not be called directly To shut down the machine it is a much better choice generally to invoke Reboot and PoweOff on the logind manager object See On logind for more information. SwitchRoot may be used to transition to a new root directory This is intended to be used by initial RAM disks The call takes two arguments the new root directory which needs to be specified , plus an init binary path which may be left empty, in which case it is automatically searched for The state of the system manager will be serialized before the transition After the transition the manager binary on the main system is invoked and replaces the old PID 1 All state will then be deserialized. SetEnvironment may be used to alter the environment block that is passed to all spawned processes Takes a string array with environment variable assignments Settings passed will override previously set variables. UnsetEnvironment may be used to unset environment variables Takes a string array with environment variable names All variables specified will be unset if they have been set previously and no longer be passed to all spawned processes This call has no effect for variables that were previously not set, but will not fail in that case. UnsetAndSetEnvironment is a combination of UnsetEnvironment and SetEnvironment It takes two lists The first one is a list of variables to unset, the second one of assignments to set If a variable is listed in both the variable is set after this call, i e the set list overrides the unset list. ListUnitFiles returns an array of unit names plus their enablement status Note that ListUnit returns a list of units currently loaded into memory, while ListUnitFiles returns a list of unit files that could be found on disk Note that while most units are read directly from a unit file with the same name some units are not backed by files, and some files template s cannot directly be loaded as units but need to be instantiated. GetUnitFileState returns the current enablement status of specific unit file. EnableUnitFiles may be used to enable one or more units in the system by creating symlinks to them in etc or run It takes a list of unit files to enable either just file names or full absolute paths if the unit files are residing outside the usual unit search paths , and two booleans the first controls whether the unit shall be enabled for runtime only true, run , or persistently false, etc The second one controls whether symlinks pointing to other units shall be replaced if necessary This call returns one boolean and an array with the changes made The boolean signals whether the unit files contained any enablement information i e an Install section The changes list consists of structures with three strings the type of the change one of symlink or unlink , the file name of the symlink and the destination of the symlink Note that most of the follo wing calls return a changes list in the same format. Similar, DisableUnitFiles disables one or more units in the system, i e removes all symlinks to them in etc and run. Similar, ReenableUnitFiles applies the changes to one or more units that would result from disabling and enabling the unit quickly one after the other in an atomic fashion This is useful to apply updated Install information contained in unit files. Similar, LinkUnitFiles links unit files that are located outside of the usual unit search paths into the unit search path. Similar, PresetUnitFiles enables disables one or more units file according to the preset policy See Presets for more information. Similar, MaskUnitFiles masks unit files, and UnmaskUnitFiles unmasks them again. SetDefaultTarget changes the link See bootup 7 for more information. GetDefaultTarget retrieves the name of the unit to which is aliased. SetUnitProperties may be used to modify certain unit properties at runtime Not all properties may be changed at runti me, but many resource management settings primarily those in may The changes are applied instantly, and stored on disk for future boots, unless runtime is true, in which case the settings only apply until the next reboot name is the name of the unit to modify properties are the settings to set, encoded as an array of property name and value pairs Note that this is not a dictionary Note that when setting array properties with this call this usually results in appending to the pre-configured array To reset the configured arrays set the property to an empty array first, then append to it. StartTransientUnit may be used to create and start a transient unit, which will be released as soon as it is not running or referenced anymore or the system is rebooted name is the unit name including suffix, and must be unique mode is the same as in StartUnit properties contains properties of the unit, specified like in SetUnitProperties aux is currently unused and should be passed as empty array See the New Control Group Interfaces for more information how to make use of this functionality for resource control purposes. Note that most signals are sent out only after Subscribe has been invoked by at least one client Make sure to invoke this call when subscribing to these signals. UnitNew and UnitRemoved are sent out each time a new unit is loaded or unloaded Note that this has little to do with whether a unit is available on disk or not, and simply reflects the units that are currently loaded into memory The signals take two parameters the primary unit name and the object path. JobNew and JobRemoved are sent out each time a new job is queued or dequeued Both signals take the numeric job ID, the bus path and the primary unit name for this job as argument JobRemoved also includes a result string, being one of done canceled timeout failed dependency skipped done indicates successful execution of a job canceled indicates that a job has been canceled via CancelJob above before it finished exe cution this doesn t necessarily mean though that the job operation is actually cancelled too, see above timeout indicates that the job timeout was reached failed indicates that the job failed dependency indicates that a job this job has been depending on failed and the job hence has been removed too skipped indicates that a job was skipped because it didn t apply to the units current state. StartupFinished is sent out when startup finished It carries six usec timespan values each indicating how much boot time has been spent in the firmware if known , in the boot loader if known , in the kernel initialization phase, in the initrd if known , in userspace and in total These values may also be calculated from the FirmwareTimestampMonotonic, LoaderTimestampMonotonic, InitRDTimestampMonotonic, UserspaceTimestampMonotonic, FinishTimestampMonotonic properties see below. UnitFilesChanged is sent out each time the list of enabled or masked unit files on disk have changed. Reloading is sent out imme diately before a daemon reload is done with the boolean parameter set to True and after a daemon reload is completed with the boolean parameter set to False This may be used by UIs to optimize UI updates. Most properties simply reflect the respective options in and the kernel command line The others. Version encodes the version string of the running systemd instance Note that the version string is purely informational, it should not be parsed, one may not assume the version to be formatted in any particular way We take the liberty to change the versioning scheme at any time and it is not part of the API. Features encodes the features that have been enabled resp disabled for this build Enabled options are prefixed with , disabled options with. Tainted encodes a couple of taint flags, as colon separated list When systemd detects it is run on a system with certain problems it will set an appropriate taint flag Taints may be used to lower the chance of bogus bug reports The following taints ar e currently known split-usr mtab-not-symlink cgroups-missing local-hwclock split-usr is set if usr is not pre-mounted when systemd is first invoked See Booting Without usr is Broken for details why this is bad mtab-not-symlink indicates that etc mtab is not a symlink to proc self mounts as required cgroups-missing indicates that control groups have not been enabled in the kernel local-hwclock indicates that the local RTC is configured to be in local time rather than UTC. FirmwareTimestamp FirmwareTimestampMonotonic LoaderTimestamp LoaderTimestampMonotonic KernelTimestamp KernelTimestampMonotonic InitRDTimestamp InitRDTimestampMonotonic UserspaceTimestamp UserspaceTimestampMonotonic FinishTimestamp FinishTimestampMonotonic encode CLOCKREALTIME resp CLOCKMONOTONIC usec timestamps taken when the firmware first began execution, when the boot loader first began execution, when the kernel first began execution, when the initrd first began execution, when the main systemd instance began execut ion and finally, when all queued startup jobs finished execution These values are useful for determining boot-time performance Note that as monotonic time begins with the kernel startup the KernelTimestampMonotonic timestamp will always be 0, and FirmwareTimestampMonotonic and LoaderTimestampMonotonic are to be read as negative values Also, not all fields are available, depending on the used firmware, boot loader or initrd implementation In these cases the resp pairs of timestamps are both 0, indicating that no data is available. Similar, the SecurityStartTimestamp GeneratorsStartTimestamp and LoadUnitTimestamp plus their monotonic and stop counterparts expose performance data for uploading the security policies to the kernel such as the SELinux, IMA, or SMACK policies , for running the generator tools and for loading the unit files. NNames encodes how many unit names are currently known This only includes names of units that are currently loaded and can be more than actually loaded unit s since units may have more than one name. NJobs encodes how many jobs are currently queued. NInstalledJobs encodes how many jobs have ever been queued in total. NFailedJobs encodes how many jobs have ever failed in total. Progress encodes boot progress as floating point value between 0 0 and 1 0 This value begins at 0 0 at early-boot and ends at 1 0 when boot is finished and is based on the number of executed and queued jobs After startup this field is always 1 0 indicating a finished boot. Environment encodes the environment block passed to all executed services It may be altered with bus calls such as SetEnvironment see above. UnitPath encodes the currently active unit file search path It is an array of strings, each being one file system path. Virtualization contains a short ID string describing the virtualization technology the system runs in On bare-metal hardware this is the empty string, otherwise an identifier such as kvm , vmware and so on For a full list of IDs see systemd-detect-v irt 1 Note that only the innermost virtualization technology is exported here This detects both full-machine virtualizations VMs and shared-kernel virtualization containers. Architecture contains a short ID string describing the architecture the systemd instance is running on This follows the same vocabulary as ConditionArchitectures. ControlGroup contains the root control group path of this system manager Note that the root path is encoded as empty string here not as , so that it can be appended to sys fs cgroup systemd easily This value will be set to the empty string for the host instance, and some other string for container instances. Unit Objects. All Unit objects implement the generic interface Depending on the unit type they also implement one unit-type-specific interface, as described below. Start Stop Reload Restart TryRestart ReloadOrRestart ReloadOrTryRestart Kill ResetFailed and SetProperties implement the same operation as the respective method calls on the Manager object see a bove , however operate on the unit object and hence do not take a unit name parameter Invoking the methods directly on the Manager object has the advantage of not requiring a GetUnit call to get the unit object for a specific unit name Calling the methods on the Manager object is hence a round trip optimization. Id contains the primary name of the unit. Names contains all names of the unit, including the primary name that is also exposed in Id. Following either contains the empty string or contains the name of another unit that this unit follows in state This is used for some device units which reflect the unit state machine of another unit, and which other unit this is might possibly change. Requires RequiresOverridable Requisite RequisiteOverridable Wants BindsTo RequiredBy RequiredByOverridable WantedBy BoundBy Conflicts ConflictedBy Before After OnFailure Triggers TriggeredBy PropagatesReloadTo RequiresMountsFor contain arrays which encode the dependencies and their inverse dependencie s where this applies , as configured in the unit file or determined automatically. Description contains the human readable description string for the unit. SourcePath contains the path to a configuration file this unit is automatically generated from in case it is not a native unit in which case it contains the empty string For example, all mount units generated from etc fstab have this field set to this value. Documentation contains a string array with URLs of documentation for this unit. LoadState contains a state value that reflects whether the configuration file of this unit has been loaded The following states are currently defined loaded error masked loaded indicates that the configuration was successfully loaded error indicates that the configuration failed to load, the LoadError field see below contains information about the cause of this failure masked indicates that the unit is currently masked out i e symlinked to dev null or suchlike Note that the LoadState is fully orthogonal to the ActiveState see below as units without valid loaded configuration might be active because configuration might have been reloaded at a time where a unit was already active. ActiveState contains a state value that reflects whether the unit is currently active or not The following states are currently defined active reloading inactive failed activating deactivating active indicates that unit is active obviously reloading indicates that the unit is active and currently reloading its configuration inactive indicates that it is inactive and the previous run was successful or no previous run has taken place yet failed indicates that it is inactive and the previous run was not successful more information about the reason for this is available on the unit type specific interfaces, for example for services in the Result property, see below activating indicates that the unit has previously been inactive but is currently in the process of entering an active state Conversely deactivating indi cates that the unit is currently in the process of deactivation. SubState encodes states of the same state machine that ActiveState covers, but knows more fine-grained states that are unit-type-specific Where ActiveState only covers six high-level states, SubState covers possibly many more low-level unit-type-specific states that are mapped to the six high-level states Note that multiple low-level states might map to the same high-level state, but not vice versa Not all high-level states have low-level counterparts on all unit types At this point the low-level states are not documented here, and are more likely to be extended later on than the common high-level states explained above. FragmentPath contains the unit file path this unit was read from, if there is any if not this contains the empty string. UnitFileState encodes the install state of the unit file of FragmentPath It currently knows the following states enabled enabled-runtime linked linked-runtime masked masked-runtime static disabled invalid enabled indicates that a unit file is permanently enabled enable-runtime indicates the unit file is only temporarily enabled, and will no longer be enabled after a reboot that means, it is enabled via run symlinks, rather than etc linked indicates that a unit is linked into etc permanently, linked indicates that a unit is linked into run temporarily until the next reboot masked indicates that the unit file is masked permanently, masked-runtime indicates that it is only temporarily masked in run, until the next reboot static indicates that the unit is statically enabled, i e always enabled and doesn t need to be enabled explicitly invalid indicates that it could not be determined whether the unit file is enabled. InactiveExitTimestamp InactiveExitTimestampMonotonic ActiveEnterTimestamp ActiveEnterTimestampMonotonic ActiveExitTimestamp ActiveExitTimestampMonotonic InactiveEnterTimestamp InactiveEnterTimestampMonotonic contain CLOCKREALTIME and CLOCKMONOTONIC 64bit usec ti mestamps of the last time a unit left the inactive state, entered the active state, exited the active state, or entered an inactive state These are the points in time where the unit transitioned inactive failed activating activating active active deactivating and finally deactivating inactive failed The fields are 0 in case such a transition has not been recording on this boot yet. CanStart CanStop CanReload encodes as booleans whether the unit supports the start, stop or reload operations Even if a unit supports such an operation the client might not necessary have the right privileges to execute them. CanIsolate encodes as boolean whether the unit may be started in isolation mode. Job encodes the job ID and job object path of the job currently scheduled or executed for this unit, if there is any If no job is scheduled or executed the job id field will be 0.StopWhenUnneeded RefuseManualStart RefuseManualStop AllowIsolate DefaultDependencies OnFailureIsolate IgnoreOnIsolate IgnoreOnSn apshot map directly to the corresponding configuration booleans in the unit file. DefaultControlGroup contains the main control group of this unit as a string This refers to a group in systemd s own name systemd hierarchy, which systemd uses to watch and manipulate the unit and all its processes. NeedDaemonReload is a boolean that indicates whether the configuration file this unit is loaded from i e FragmentPath or SourcePath has changed since the configuration was read and hence whether a configuration reload is recommended. JobTimeoutUSec maps directly to the corresponding configuration setting in the unit file. ConditionTimestamp and ConditionTimestampMonotonic contain the CLOCKREALTIME CLOCKMONOTONIC usec timestamps of the last time the configured conditions of the unit have been checked, or 0 if they have never been checked Conditions are checked when a unit is requested to start. ConditionResult contains the condition result of the last time the configured conditions of this unit were checked. Conditions contains all configured conditions of the unit For each condition five fields are given condition type e g ConditionPathExists , whether the condition is a trigger condition, whether the condition is reversed, the right hand side of the condtion e g the path in case of ConditionPathExists , and the status The status can be 0, in which case the condition hasn t been checked yet, a positive value, in which case the condition passed, or a negative value, in which case the condition failed Currently only 0, 1, and -1 are used, but additional values may be used in the future, retaining the meaning of zero positive negative values. LoadError contains a pair of strings If the unit failed to load as encoded in LoadState see above , then this will include a D-Bus error pair consisting of the error ID and an explanatory human readable string of what happened If it succeeded to load this will be a pair of empty strings. Transient contains a boolean that indicates whether the uni t was created as transient unit i e via CreateTransientUnit on the manager object. Service Unit Objects. All service unit objects implement the interface described here in addition to the generic interface see above. Most properties of the Service interface map directly to the corresponding settings in service unit files For the sake of brevity, here s a list of all exceptions only. WatchdogTimestamp and WatchdogTimestampMonotonic contain CLOCKREALTIME CLOCKMONOTONIC usec timestamps of the last watchdog ping received from the service, or 0 if none was ever received. ExecStartPre ExecStart ExecStartPost ExecReload ExecStop ExecStop each are arrays of structures each containing the binary path to execute an array with all arguments to pass to the executed command, starting with argument 0 a boolean whether it should be considered a failure if the process exits uncleanly two pairs of CLOCKREALTIME CLOCKMONOTONIC usec timestamps when the process began and finished running the last time, or 0 if it never ran or never finished running the PID of the process, or 0 if it has not run yet the exit code and status of the last run This field hence maps more or less to the corresponding setting in the service unit file but is augmented with runtime data. LimitCPU and related properties map more or less directly to the corresponding settings in the service unit files, however are set to 18446744073709551615 i e -1 if they aren t set. Capabilities contains the configured capabilities, as formatted with captotext. SecureBits CapabilityBoundingSet MountFlags also correspond to the configured settings of the unit files, but are encoded as the actual binary flag fields they are, rather than formatted as string. ExecMainStartTimestamp ExecMainStartTimestampMonotonic ExecMainExitTimestamp ExecMainExitTimestampMonotonic ExecMainPID ExecMainCode ExecMainStatus contain information about the main process of the service as far as it is known This is often the same runtime information that is stored i n ExecStart However, it deviates for Type forking services where the main process of the service is not forked off systemd directly These fields either contain information of the last run of the process or of the current running process. MainPID and ControlPID contain the main and control PID of the service The main PID is the current main PID of the service and is 0 when the service currently has no main PID The control PID is the PID of the current start stop reload process running and is 0 if no such process is currently running That means that ExecMainPID and MainPID differ in the way that the latter immediately reflects whether a main process is currently running while the latter possible contains information collected from the last run even if the process is no longer around. StatusText contains the status text passed to the service manager via a call to sdnotify This may be used by services to inform the service manager about its internal state with a nice explanatory string. Resul t encodes the execution result of the last run of the service It is useful to determine the reason a service failed if it is in failed state see ActiveState above The following values are currently known success is set if the unit didn t fail resources indicates that not enough resources have been available to fork off and execute the service processes timeout indicates that a time-out occurred while executing a service operation exit-code indicates that a service process exited with an unclean exit code signal indicates that a service process exited with an uncaught signal core-dump indicates that a service process exited uncleanly and dumped core watchdog indicates that a service did not send out watchdog ping messages often enough start-limit indicates that a service has been started too frequently in a time frame as configured in StartLimitInterval StartLimitBurst. ControlGroup indicates the control group path the processes of this service unit are placed in. Socket Unit Objects. All socket unit objects implement the interface described here in addition to the generic interface see above. Most of the properties map directly to the corresponding settings in socket unit files As socket units can include ExecStartPre and similar fields which contain information about processes to execute They also share most of the fields related to the execution context that Service objects expose see above In addition to these properties there are the following. NAccepted contains the accumulated number of connections ever accepted on this socket This only applies to sockets with Accept set to true i e those where systemd is responsible for accepted connections. Similarly NConnections contains the number of currently open connections on this socket, and also applies only to socket with Accept set to true. Result encodes the reason why a socket unit failed if it is in failed state see ActiveState above The values success resources timeout exit-code signal and core-dump have the same mean ing as they have for the corresponding field of service units see above In addition to that the value service-failed-permanent indicates that the service of this socket failed continuously. Target Unit Objects. All target unit objects implement the interface described here in addition to the generic interface see above. Target units have neither type-specific methods nor properties. Device Unit Objects. All device unit objects implement the interface described here in addition to the generic interface see above. Device units only expose a single type-specific property. SysFSPath contains the sysfs path of the kernel device this object corresponds to. Mount Unit Objects. All mount unit objects implement the interface described here in addition to the generic interface see above. Most of the properties map directly to the corresponding settings in mount unit files As mount units invoke the usr bin mount command their bus objects include implicit ExecMount and similar fields which contain informati on about processes to execute They also share most of the fields related to the execution context that Service objects expose see above In addition to these properties there are the following. ControlPID contains the PID of the currently running usr bin mount or usr bin umount command if there is one running, otherwise 0.Result contains a value explaining why a mount unit failed if it failed It can take the values success resources timeout exit-code signal core-dump which have the identical meaning as the corresponding values of the corresponding field of service unit objects see above. Automount Unit Objects. All automount unit objects implement the interface described here in addition to the generic interface see above. Most of the properties map directly to the corresponding settings in the automount unit files. Result knows the values success and resources at this time They have the same meanings as the corresponding values of the corresponding field of the Service object. Snapshot Unit Objects. All snapshot unit objects implement the interface described here in addition to the generic interface see above. Remove deletes the snapshot unit This operation is also available in the RemoveSnapshot operation of the Manager object see above , which is sometimes nicer to call, in order to reduce roundtrips. Cleanup is a boolean that indicates that the snapshot unit should be removed automatically after the first time it is activated. Timer Unit Objects. All timer unit objects implement the interface described here in addition to the generic interface see above. Unit contains the name of the unit to activate when the timer elapses. TimersMonotonic contains an array of structs that contain information about all monotonic timers of this timer unit The structs contain a string identifying the timer base, which is one of OnActiveUSec OnBootUSec OnStartupUSec OnUnitActiveUSec OnUnitInactiveUSec which correspond to the settings of the same names in the timer unit files the usec offset from this timer base in monotonic time the next elapsation point on the CLOCKMONOTONIC clock, relative its epoch. TimersCalendar contains an array of structs that contain information about all realtime calendar timers of this timer unit The structs contain a string identifying the timer base, which may only be OnCalendar for now the calendar specification string the next elapsation point on the CLOCKREALTIME clock, relative to its epoch. NextElapseUSecRealtime contains the next elapsation point on the CLOCKREALTIME clock in usec since the epoch, or 0 if this timer event does not include at least one calendar event. Similar, NextElapseUSecMonotonic contains the next elapsation point on the CLOCKMONOTONIC clock in usec since the epoch, or 0 if this timer event does not include at least one monotonic event. Result knows the values success and resources with the same meanings as the matching values of the corresponding property of the service interface. Swap Unit Objects. All swap unit objects imple ment the interface described here in addition to the generic interface see above. Most of the properties map directly to the corresponding settings in swap unit files As mount units invoke the usr bin swapon command their bus objects include implicit ExecActivate and similar fields which contain information about processes to execute They also share most of the fields related to the execution context that Service objects expose see above In addition to these properties there are the following. ControlPID contains the PID of the currently running usr bin swapon or usr bin swapoff command if there is one running, otherwise 0.Result contains a value explaining why a mount unit failed if it failed It can take the values success resources timeout exit-code signal core-dump which have the identical meanings as the corresponding values of the corresponding field of service unit objects see above. Path Unit Objects. All path unit objects implement the interface described here in addition to the ge neric interface see above. Most properties correspond directly with the matching settings in path unit files The others. Paths contains an array of structs Each struct contains the condition to watch, which can be one of PathExists PathExistsGlob PathChanged PathModified DirectoryNotEmpty which correspond directly to the matching settings in the path unit files and the path to watch, possibly including glob expressions. Result contains a result value which can be success or resources which have the same meaning as the corresponding field of the service interface. Slice Unit Objects. All slice unit objects implement the interface described here in addition to the generic interface see above. Most properties correspond directly with the matching settings in slice unit files. Scope Unit Objects. All slice unit objects implement the interface described here in addition to the generic interface see above. All properties correspond directly with the matching properties of service units. Controller con tains the bus name unique or well-known that is notified when the scope unit is to be shut down via a RequestStop signal see below This is set when the scope is created If not set the scope s processes will terminated with SIGTERM directly. Abandon may be used to place a scope unit in the abandoned state This may be used to inform the system manager that the manager that created the scope lost interest in the scope for example, because it is terminating , without wanting to shut down the scope entirely. RequestStop is sent to the peer that is configured in the Controller property when systemd is requested to terminate the scope unit A program registering a scope can use this to cleanly shut down the processes it added to the scope, instead of letting systemd do it with the usual SIGTERM logic. Job Objects. Job objects encapsulate scheduled or running jobs Each unit can have none or one jobs in the execution queue Each job is attached to exactly one unit. Cancel cancels the job Note that thi s will remove a job from the queue if it is not yet executed but generally will not cause a job that is already in the process of being executed to be aborted This operation may also be requested via the CancelJob method of the Manager object see above , which is sometimes useful to reduce roundtrips. Id is the numeric Id of the job During the runtime of a systemd instance each numeric ID is only assigned once. Unit refers to the unit this job belongs two It is a structure consisting of the name of the unit and a bus path to the unit s object. JobType refers to the job s type and is one of start verify-active stop reload restart try-restart reload-or-start Note that later versions might define additional values. State refers to the job s state and is one of waiting and running The former indicates that a job is currently queued but has not begun to execute yet, the latter indicates that a job is currently being executed. Last edited Tue Feb 25 00 31 10 2014. 6710 Fix misspelled systemd conf igure options, added hint in Makefile 1498.Created by bear on 2014-07-12 09 31 28 00 00.Assignee spstarr Status Resolved closed on 2014-08-06 19 03 04 00 00 Target Version 1 11 6 Last Update 2014-08-06 19 03 18 00 00 in Redmine. I ve encountered some issues regarding the configuration of the systemd files that can be used on ArchLinux I ve shared my experience on the mailing list 1 Meanwhile, I ve figured out why configure complains Please see the patch file. Related, but not necessarily depending on it, the output of make without parameters didn t show the possibility for installing the systemd files Additionally, maybe this was intended so the list doesn t get too long For this, I ve done a second patch file addressing the Makefile only. Now I m stuck The systemd configuration files were copied to the right places after issuing make install-systems But there s still the in and in etc sysconfig icinga I don t know when this should be substituted Maybe someone could give me a hint I ve at tached the resulting files please see description field for absolute file path position. Kind regards, Bernd. The patch files were created according to 2.
Comments
Post a Comment