SlideShare a Scribd company logo
1 of 24
Download to read offline
www.ciose.fr
1
Démarrage d’un deviceDémarrage d’un device
LinuxLinux
Init System V vs SystemdInit System V vs Systemd
C. CharreyreC. Charreyre
christian.charreyre@ciose.frchristian.charreyre@ciose.fr
http://www.ciose.frhttp://www.ciose.fr
https://twitter.com/CIO_SysEmbhttps://twitter.com/CIO_SysEmb
http://fr.slideshare.net/charreyrehttp://fr.slideshare.net/charreyre
www.ciose.fr
2
Licence
Attribution-Noncommercial-Share Alike 4.0 International
● You are free:
to Share - copy and redistribute the material in any medium or format
to Adapt - remix, transform, and build upon the material
The licensor cannot revoke these freedoms as long as you follow the license terms.
● Under the following conditions:
Attribution — You must give appropriate credit, provide a link to the license, and indicate if
changes were made. You may do so in any reasonable manner, but not in any way that
suggests the licensor endorses you or your use.
NonCommercial — You may not use the material for commercial purposes.
ShareAlike — If you remix, transform, or build upon the material, you must distribute your
contributions under the same license as the original.
● No additional restrictions — You may not apply legal terms or
technological measures that legally restrict others from doing
anything the license permits.
● License text : http://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
www.ciose.fr
3
CIO en quelques mots
● Société d'ingénierie en systèmes embarqués : 
électronique et logiciel
● Au service de nos clients depuis 1990
● 15 spécialistes en embarqué et temps réel
● Expert en Linux embarqué depuis 2000,
OpenEmbedded et Yocto depuis 2008
● CA annuel : 1 500 000 €
● Siège à Saint-Étienne
● Agence à Marseille
● Agréé CIR
www.ciose.fr
4
C. Charreyre en quelques mots
● Associé au sein de CIO
● Responsable des technologies Linux embarqué
● Formateur Linux embarqué (avec Captronic et en
direct)
● 30 ans dans l'embarqué et le monde Unix / Linux
● Fervent promoteur du logiciel libre
● Membre de Medinsoft – Commission Logiciel Libre
www.ciose.fr
5
Démarrage d’une machine x86
Mise sous tension
Vérification BIOS
Boot BIOS
Bootloader GRUB(2)
Mise sous tensionChoix utilisateur
Chargement noyau
Exécution noyau
Montage /
Exécution Init
Décompression initramfs
Montage /dev/ram0
Exécution linuxrc
Démontage /dev/ram0
www.ciose.fr
6
Démarrage d’une machine non x86
Mise sous tension
Bootloader (UBoot)
Chargement noyau
Exécution noyau
Montage /
Exécution Init
Décompression initramfs
Montage /dev/ram0
Exécution linuxrc
Démontage /dev/ram0
www.ciose.fr
7
Mécanisme init traditionnel SystemV
● Init System V = sysvinit
● A partir de Exécution Init, le démarrage s’exécute en
espace User
● init est le 1er processus user lancé par le kernel, il
est en charge de démarrer en espace user le reste de
la machine
● Son PID est 1
www.ciose.fr
8
Mécanisme init traditionnel SystemV
● init piloté par le fichier /etc/inittab
# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $
# The default runlevel.
id:5:initdefault:
# Boot­time system configuration/initialization script.
# This is run first except when booting in emergency (­b) mode.
si::sysinit:/etc/init.d/rcS
# What to do in single­user mode.
~~:S:wait:/sbin/sulogin
# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single­user.
# Runlevels 2­5 are multi­user.
# Runlevel 6 is reboot.
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
7 niveaux de
démarrage
(runlevels)
2. Démarrage en
runlevel 5
au boot
1. Exécution de
/etc/init.d/rcS
www.ciose.fr
9
Mécanisme init traditionnel SystemV
● Le répertoire /etc/init.d/ comprend des scripts
associés aux daemons
● 1 daemon = 1 script
● 1 script = switch case sur paramètre $1
– start
– stop
– status
– restart / reload
● Jeu de liens de /etc/rcN.d/ vers /etc/init.d/
(N=S, 0 à 6)
● /etc/init.d/rcS enchaîne l’appel des scripts
dans /etc/rcS.d/ – ordre alphanumérique
www.ciose.fr
10
Mécanisme init traditionnel SystemV
● Pour le runlevel par défaut D, init enchaîne l’appel
des scripts dans /etc/rcD.d/ – ordre
alphanumérique
● Dans les runlevels 0 à N, succession de liens KnnXXXX
et SnnXXXX où
– XXXX nom du script dans /etc/init.d/
– nn numéro sur 2 digits
● Les KnnXXXX sont des arrêts de daemon ($1 = stop)
● Les SnnXXXX sont des démarrages de daemon ($1 =
start)
● L’ordre alphanumérique enchaîne en séquence les
arrêts ordonnés, puis les démarrages ordonnés
● Pour le runlevel S uniquement des starts :  SnnXXXX
www.ciose.fr
11
Mécanisme init traditionnel SystemV
● Logique induite : 
– Chaque fournisseur de daemon fournit le script de
démarrage / arrêt, ainsi que des consignes de démarrage /
arrêt en fonction des runlevels : 
● Numéro
● Dépendances éventuelles (ex : daemon nécessite le réseau 
actif)
– L’administrateur système ou créateur de distribution met en
place tout le jeu de lien
– init exécute les scripts de démarrage / arrêt
● Tout s’effectue en séquence
● On contrôle finement l’ordre des actions
www.ciose.fr
12
Mécanisme init traditionnel SystemV
● Utilitaire de gestion des liens : update-rc.d 
– Créations des liens : 
update-rc.d apache2 start 20 2 3 4 5 . stop 80 0 1
6 .
Adding system startup for /etc/init.d/apache2 …
/etc/rc0.d/K80apache2 -> ../init.d/apache2
/etc/rc1.d/K80apache2 -> ../init.d/apache2
/etc/rc6.d/K80apache2 -> ../init.d/apache2
/etc/rc2.d/S20apache2 -> ../init.d/apache2
/etc/rc3.d/S20apache2 -> ../init.d/apache2
/etc/rc4.d/S20apache2 -> ../init.d/apache2
/etc/rc5.d/S20apache2 -> ../init.d/apache2
– Suppressions des liens : 
update-rc.d -f apache2 remove
www.ciose.fr
13
Mécanisme init traditionnel SystemV
www.ciose.fr
14
L’arrivée de systemd
● Depuis quelques années systemd remplace
sysvinit dans les distributions majeures : 
– Red Hat : initiateur du projet 
– Fedora
– Open Suse
– ArchLinux
– Debian : grosse controverse dans le monde Debian → fork 
Devuan pour conserver une init sysvinit.
– Ubuntu : abandon de  upstart au profit de systemd à
partir de 15.04
www.ciose.fr
15
L’arrivée de systemd
● Dans les distributions embarqués : 
– Yocto : conservation  sysvinit par défaut
– Angström : passage à  systemd par défaut
www.ciose.fr
16
Systemd vs sysvinit
● Systemd est un démon système qui veut gérer tous les
aspects systèmes de la machine, sur base de technos
« modernes »   
● Basé sur D-bus
● A ce titre : 
– Prend en charge le démarrage / arrêt des daemons =
remplacement sysvinit
– Fournit donc le process init (pid 1)
– Mais gère également réseau, login, montages, logs etc...
– A englobé udev
www.ciose.fr
17
Les init selon systemd
● Plus de script dans /etc/init.d/
● Des fichiers de service dans divers répertoires : 
– /lib/systemd/system ou
/usr/lib/systemd/system
– /run/systemd/system
– /etc/systemd/system (priorité croissante)
● Des initialisations effectuées en parallèle selon des
jeux de contraintes : 
– Directives Before ou After dans les fichiers de service
[Unit]
Description=Create database
After=dbus.service
Before=postgresql.service
[Service]
Type=oneshot
ExecStart=/usr/bin/create­db.sh
TimeoutSec=120
[Install]
WantedBy=multi­user.target
www.ciose.fr
18
Les init selon systemd
● Des cibles qui sont liées aux services : 
– basic.target, multi­user.target, 
graphical.target, emergency.target, 
reboot.target
www.ciose.fr
19
Les init selon systemd
● Lorsqu’une cible est traitée, les divers services
associés sont démarrés en parallèle
● Dépendances entre cibles
www.ciose.fr
20
Les init selon systemd
local-fs-pre.target
|
v
(various mounts and (various swap (various cryptsetup
fsck services...) devices...) devices...) (various low-level (various low-level
| | | services: udevd, API VFS mounts:
v v v tmpfiles, random mqueue, configfs,
local-fs.target swap.target cryptsetup.target seed, sysctl, ...) debugfs, ...)
| | | | |
__________________|_________________ | ___________________|____________________/
|/
v
sysinit.target
|
____________________________________/|________________________________________
/ | | | 
| | | | |
v v | v v
(various (various | (various rescue.service
timers...) paths...) | sockets...) |
| | | | v
v v | v rescue.target
timers.target paths.target | sockets.target
| | | |
v _________________ | ___________________/
|/
v
basic.target
|
____________________________________/| emergency.service
/ | | |
| | | v
v v v emergency.target
display- (various system (various system
manager.service services services)
| required for |
| graphical UIs) v
| | multi-user.target
| | |
_________________ | _________________/
|/
v
graphical.target
www.ciose.fr
21
Les init selon systemd
● La parallélisation fait gagner en temps de démarrage
● Mais on maîtrise beaucoup moins l’ordre relatif : 
– Ordonnancement alphanumérique déterministe remplacé par un
faisceau de contraintes
– Exemple réel : afcher un splash screen en toute fin d’arrêt de machine 
● Trivial avec sysvinit : numéro = 99
● Plus ardu avec systemd
● Chargement des modules kernel peut varier d’un boot à l’autre
– Interfaces eth0 et eth1 peuvent s’inverser
– Nouveau système de nommage interfaces réseau basé sur hardware
● Un utilitaire pour contrôler les services
– systemctl status : donne l’état d’un service et ses logs 
– systemctl disable : désactive un service 
– systemctl enable : active un service 
– systemctl mask: masque un service (lien sur /dev/null dans
/etc/systemd/system)
www.ciose.fr
22
Systemd, ange ou démon ?
● Grosses polémiques autour de systemd
● Fork Debian pour s’en passer
● Prendre les init systemd, c’est aussi prendre la gestion
du reste du système : 
– Nécessité de réapprendre beaucoup de choses pour
l’administrateur ou le créateur de distribution embarquée
– Logs binaires en lieu et place de /var/log/syslog →
comment les relire off line (crash par ex.) ? 
– Identification et démarrage, contrôle du réseau bouleversé
– Gestion de la localisation, de la synchro ntp etc...
“Systemd flies in the face of the Unix philosophy: ‘do one thing and do it well,’ representing a
complex collection of dozens of tightly coupled binaries. Its responsibilities grossly exceed
that of an init system, as it goes on to handle power management, device management,
mount points, cron, disk encryption, socket API/inetd, syslog, network configuration,
login/session management, readahead, GPT partition discovery, container registration,
hostname/locale/time management, mDNS/DNS-SD, the Linux console and other things all
wrapped into one.”
Site Boycott systemd
www.ciose.fr
23
Systemd, ange ou démon ?
Crédit image Wikimedia Commons Claudelepoisson
Creative Commons Attribution-Share Alike 3.0 Unported license
www.ciose.fr
24
Références
● https://wiki.freedesktop.org/www/Software/systemd/
● https://www.freedesktop.org/software/systemd/man/
● https://wiki.archlinux.org/index.php/Systemd
● http://0pointer.de/blog/projects/systemd.html
● http://0pointer.net/blog/projects/systemd-for-admins-1.html
● http://0pointer.net/blog/archives.html
● https://www.linux.com/learn/tutorials/
788613-understanding-and-using-systemd
● http://man7.org/linux/man-pages/man7/bootup.7.html
● https://wiki.debian.org/Debate/initsystem/systemd

More Related Content

What's hot

Conférence Shinken à SophiaConf2012 (Jean Gabès)
Conférence Shinken à SophiaConf2012 (Jean Gabès)Conférence Shinken à SophiaConf2012 (Jean Gabès)
Conférence Shinken à SophiaConf2012 (Jean Gabès)Jean Gabès
 
Concevoir un système Linux embarqué avec Yocto Project - Version révisée
Concevoir un système Linux embarqué avec Yocto Project - Version réviséeConcevoir un système Linux embarqué avec Yocto Project - Version révisée
Concevoir un système Linux embarqué avec Yocto Project - Version réviséeChristian Charreyre
 
Linux et le temps réel - Meetup du 15 octobre 2015
Linux et le temps réel - Meetup du 15 octobre 2015Linux et le temps réel - Meetup du 15 octobre 2015
Linux et le temps réel - Meetup du 15 octobre 2015Christian Charreyre
 
Créer une distribution Linux embarqué professionnelle avec Yocto Project
Créer une distribution Linux embarqué professionnelle avec Yocto ProjectCréer une distribution Linux embarqué professionnelle avec Yocto Project
Créer une distribution Linux embarqué professionnelle avec Yocto ProjectChristian Charreyre
 
Yocto une solution robuste pour construire des applications à fort contenu ap...
Yocto une solution robuste pour construire des applications à fort contenu ap...Yocto une solution robuste pour construire des applications à fort contenu ap...
Yocto une solution robuste pour construire des applications à fort contenu ap...Christian Charreyre
 
Embarquer Linux et des systèmes libres, méthodes et apports
Embarquer Linux et des systèmes libres, méthodes et apportsEmbarquer Linux et des systèmes libres, méthodes et apports
Embarquer Linux et des systèmes libres, méthodes et apportsguest3be047
 
Gestion des dépendances dans un projet PHP - Forum PHP 2012
Gestion des dépendances dans un projet PHP - Forum PHP 2012Gestion des dépendances dans un projet PHP - Forum PHP 2012
Gestion des dépendances dans un projet PHP - Forum PHP 2012Jean-Marc Fontaine
 
Open Embedded un framework libre pour assurer la cohérence de son projet
Open Embedded un framework libre pour assurer la cohérence de son projetOpen Embedded un framework libre pour assurer la cohérence de son projet
Open Embedded un framework libre pour assurer la cohérence de son projetChristian Charreyre
 
Présentation de la pile réseau sous gnu linux
Présentation de la pile réseau sous gnu linuxPrésentation de la pile réseau sous gnu linux
Présentation de la pile réseau sous gnu linuxThierry Gayet
 
De la chaîne de production au SI géré par des logiciels
De la chaîne de production au SI géré par des logicielsDe la chaîne de production au SI géré par des logiciels
De la chaîne de production au SI géré par des logicielsJohan Moreau
 
Programmation de systèmes embarqués : BeagleBone Black et Linux embarqué
Programmation de systèmes embarqués : BeagleBone Black et Linux embarquéProgrammation de systèmes embarqués : BeagleBone Black et Linux embarqué
Programmation de systèmes embarqués : BeagleBone Black et Linux embarquéECAM Brussels Engineering School
 
Open Wide : Les interfaces graphiques dans l'embarque
Open Wide : Les interfaces graphiques dans l'embarqueOpen Wide : Les interfaces graphiques dans l'embarque
Open Wide : Les interfaces graphiques dans l'embarqueAlexandre LAHAYE
 
HOWTO Gestion porte-feuilles crypto-monnaies en environnement virtualisé
HOWTO Gestion porte-feuilles crypto-monnaies en environnement virtualiséHOWTO Gestion porte-feuilles crypto-monnaies en environnement virtualisé
HOWTO Gestion porte-feuilles crypto-monnaies en environnement virtualiséAnthony Le Goff
 
Gérer ses environnements de développement avec Vagrant - RMLL 2012
Gérer ses environnements de développement avec Vagrant - RMLL 2012Gérer ses environnements de développement avec Vagrant - RMLL 2012
Gérer ses environnements de développement avec Vagrant - RMLL 2012Jean-Marc Fontaine
 
Gérer ses environnements de développement avec vagrant - PHP Tour Nantes 2012
Gérer ses environnements de développement avec vagrant - PHP Tour Nantes 2012Gérer ses environnements de développement avec vagrant - PHP Tour Nantes 2012
Gérer ses environnements de développement avec vagrant - PHP Tour Nantes 2012Jean-Marc Fontaine
 
Présentation de Vagrant
Présentation de VagrantPrésentation de Vagrant
Présentation de Vagrantclmntlxndr
 
NetBSD operating system: Clean Code, Ports, Anykernel, pkgsrc and Desktop pro...
NetBSD operating system: Clean Code, Ports, Anykernel, pkgsrc and Desktop pro...NetBSD operating system: Clean Code, Ports, Anykernel, pkgsrc and Desktop pro...
NetBSD operating system: Clean Code, Ports, Anykernel, pkgsrc and Desktop pro...jihbed
 

What's hot (20)

Conférence Shinken à SophiaConf2012 (Jean Gabès)
Conférence Shinken à SophiaConf2012 (Jean Gabès)Conférence Shinken à SophiaConf2012 (Jean Gabès)
Conférence Shinken à SophiaConf2012 (Jean Gabès)
 
Concevoir un système Linux embarqué avec Yocto Project - Version révisée
Concevoir un système Linux embarqué avec Yocto Project - Version réviséeConcevoir un système Linux embarqué avec Yocto Project - Version révisée
Concevoir un système Linux embarqué avec Yocto Project - Version révisée
 
Autotools
AutotoolsAutotools
Autotools
 
Linux et le temps réel - Meetup du 15 octobre 2015
Linux et le temps réel - Meetup du 15 octobre 2015Linux et le temps réel - Meetup du 15 octobre 2015
Linux et le temps réel - Meetup du 15 octobre 2015
 
Créer une distribution Linux embarqué professionnelle avec Yocto Project
Créer une distribution Linux embarqué professionnelle avec Yocto ProjectCréer une distribution Linux embarqué professionnelle avec Yocto Project
Créer une distribution Linux embarqué professionnelle avec Yocto Project
 
Licences libres et embarqué
Licences libres et embarquéLicences libres et embarqué
Licences libres et embarqué
 
Yocto une solution robuste pour construire des applications à fort contenu ap...
Yocto une solution robuste pour construire des applications à fort contenu ap...Yocto une solution robuste pour construire des applications à fort contenu ap...
Yocto une solution robuste pour construire des applications à fort contenu ap...
 
Embarquer Linux et des systèmes libres, méthodes et apports
Embarquer Linux et des systèmes libres, méthodes et apportsEmbarquer Linux et des systèmes libres, méthodes et apports
Embarquer Linux et des systèmes libres, méthodes et apports
 
Gestion des dépendances dans un projet PHP - Forum PHP 2012
Gestion des dépendances dans un projet PHP - Forum PHP 2012Gestion des dépendances dans un projet PHP - Forum PHP 2012
Gestion des dépendances dans un projet PHP - Forum PHP 2012
 
Open Embedded un framework libre pour assurer la cohérence de son projet
Open Embedded un framework libre pour assurer la cohérence de son projetOpen Embedded un framework libre pour assurer la cohérence de son projet
Open Embedded un framework libre pour assurer la cohérence de son projet
 
Install party
Install partyInstall party
Install party
 
Présentation de la pile réseau sous gnu linux
Présentation de la pile réseau sous gnu linuxPrésentation de la pile réseau sous gnu linux
Présentation de la pile réseau sous gnu linux
 
De la chaîne de production au SI géré par des logiciels
De la chaîne de production au SI géré par des logicielsDe la chaîne de production au SI géré par des logiciels
De la chaîne de production au SI géré par des logiciels
 
Programmation de systèmes embarqués : BeagleBone Black et Linux embarqué
Programmation de systèmes embarqués : BeagleBone Black et Linux embarquéProgrammation de systèmes embarqués : BeagleBone Black et Linux embarqué
Programmation de systèmes embarqués : BeagleBone Black et Linux embarqué
 
Open Wide : Les interfaces graphiques dans l'embarque
Open Wide : Les interfaces graphiques dans l'embarqueOpen Wide : Les interfaces graphiques dans l'embarque
Open Wide : Les interfaces graphiques dans l'embarque
 
HOWTO Gestion porte-feuilles crypto-monnaies en environnement virtualisé
HOWTO Gestion porte-feuilles crypto-monnaies en environnement virtualiséHOWTO Gestion porte-feuilles crypto-monnaies en environnement virtualisé
HOWTO Gestion porte-feuilles crypto-monnaies en environnement virtualisé
 
Gérer ses environnements de développement avec Vagrant - RMLL 2012
Gérer ses environnements de développement avec Vagrant - RMLL 2012Gérer ses environnements de développement avec Vagrant - RMLL 2012
Gérer ses environnements de développement avec Vagrant - RMLL 2012
 
Gérer ses environnements de développement avec vagrant - PHP Tour Nantes 2012
Gérer ses environnements de développement avec vagrant - PHP Tour Nantes 2012Gérer ses environnements de développement avec vagrant - PHP Tour Nantes 2012
Gérer ses environnements de développement avec vagrant - PHP Tour Nantes 2012
 
Présentation de Vagrant
Présentation de VagrantPrésentation de Vagrant
Présentation de Vagrant
 
NetBSD operating system: Clean Code, Ports, Anykernel, pkgsrc and Desktop pro...
NetBSD operating system: Clean Code, Ports, Anykernel, pkgsrc and Desktop pro...NetBSD operating system: Clean Code, Ports, Anykernel, pkgsrc and Desktop pro...
NetBSD operating system: Clean Code, Ports, Anykernel, pkgsrc and Desktop pro...
 

Viewers also liked

Comment travailler avec les logiciels Open Source
Comment travailler avec les logiciels Open SourceComment travailler avec les logiciels Open Source
Comment travailler avec les logiciels Open SourceChristian Charreyre
 
ERTS 2008 - Using Linux for industrial projects
ERTS 2008 - Using Linux for industrial projectsERTS 2008 - Using Linux for industrial projects
ERTS 2008 - Using Linux for industrial projectsChristian Charreyre
 
BibBase Linked Data Triplification Challenge 2010 Presentation
BibBase Linked Data Triplification Challenge 2010 PresentationBibBase Linked Data Triplification Challenge 2010 Presentation
BibBase Linked Data Triplification Challenge 2010 PresentationReynold Xin
 
ERTS 2008 - Using Linux for industrial projects
ERTS 2008 - Using Linux for industrial projectsERTS 2008 - Using Linux for industrial projects
ERTS 2008 - Using Linux for industrial projectsChristian Charreyre
 
Présentation Yocto - SophiaConf 2015
Présentation Yocto - SophiaConf 2015Présentation Yocto - SophiaConf 2015
Présentation Yocto - SophiaConf 2015Christian Charreyre
 
Using heka
Using hekaUsing heka
Using hekaExotel
 
Python Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & stylePython Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & styleKevlin Henney
 
Making Steaks from Sacred Cows
Making Steaks from Sacred CowsMaking Steaks from Sacred Cows
Making Steaks from Sacred CowsKevlin Henney
 
Logiciels libres en milieu industriel
Logiciels libres en milieu industrielLogiciels libres en milieu industriel
Logiciels libres en milieu industrielChristian Charreyre
 
The Architecture of Uncertainty
The Architecture of UncertaintyThe Architecture of Uncertainty
The Architecture of UncertaintyKevlin Henney
 
#Gophercon Talk by Smita Vijayakumar - Go's Context Library
#Gophercon Talk by Smita Vijayakumar - Go's Context Library#Gophercon Talk by Smita Vijayakumar - Go's Context Library
#Gophercon Talk by Smita Vijayakumar - Go's Context LibraryExotel
 
Working at Exotel
Working at ExotelWorking at Exotel
Working at ExotelExotel
 
Contrat 2010-2013 Scduag
Contrat 2010-2013 ScduagContrat 2010-2013 Scduag
Contrat 2010-2013 Scduagscduag
 
Setting A Culture of Technical Excellence
Setting A Culture of Technical ExcellenceSetting A Culture of Technical Excellence
Setting A Culture of Technical ExcellenceExotel
 
Exotel For Last Mile Logistics
Exotel For Last Mile LogisticsExotel For Last Mile Logistics
Exotel For Last Mile LogisticsExotel
 
Stanford CS347 Guest Lecture: Apache Spark
Stanford CS347 Guest Lecture: Apache SparkStanford CS347 Guest Lecture: Apache Spark
Stanford CS347 Guest Lecture: Apache SparkReynold Xin
 
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...Reynold Xin
 
Cloud Communication for E-commerce & Last Mile Logistics
Cloud Communication for E-commerce & Last Mile LogisticsCloud Communication for E-commerce & Last Mile Logistics
Cloud Communication for E-commerce & Last Mile LogisticsExotel
 
Client-Side Performance Testing
Client-Side Performance TestingClient-Side Performance Testing
Client-Side Performance TestingAnand Bagmar
 

Viewers also liked (20)

Comment travailler avec les logiciels Open Source
Comment travailler avec les logiciels Open SourceComment travailler avec les logiciels Open Source
Comment travailler avec les logiciels Open Source
 
ERTS 2008 - Using Linux for industrial projects
ERTS 2008 - Using Linux for industrial projectsERTS 2008 - Using Linux for industrial projects
ERTS 2008 - Using Linux for industrial projects
 
BibBase Linked Data Triplification Challenge 2010 Presentation
BibBase Linked Data Triplification Challenge 2010 PresentationBibBase Linked Data Triplification Challenge 2010 Presentation
BibBase Linked Data Triplification Challenge 2010 Presentation
 
ERTS 2008 - Using Linux for industrial projects
ERTS 2008 - Using Linux for industrial projectsERTS 2008 - Using Linux for industrial projects
ERTS 2008 - Using Linux for industrial projects
 
Présentation Yocto - SophiaConf 2015
Présentation Yocto - SophiaConf 2015Présentation Yocto - SophiaConf 2015
Présentation Yocto - SophiaConf 2015
 
Using heka
Using hekaUsing heka
Using heka
 
Python Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & stylePython Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & style
 
Making Steaks from Sacred Cows
Making Steaks from Sacred CowsMaking Steaks from Sacred Cows
Making Steaks from Sacred Cows
 
Logiciels libres en milieu industriel
Logiciels libres en milieu industrielLogiciels libres en milieu industriel
Logiciels libres en milieu industriel
 
The Architecture of Uncertainty
The Architecture of UncertaintyThe Architecture of Uncertainty
The Architecture of Uncertainty
 
#Gophercon Talk by Smita Vijayakumar - Go's Context Library
#Gophercon Talk by Smita Vijayakumar - Go's Context Library#Gophercon Talk by Smita Vijayakumar - Go's Context Library
#Gophercon Talk by Smita Vijayakumar - Go's Context Library
 
Working at Exotel
Working at ExotelWorking at Exotel
Working at Exotel
 
Contrat 2010-2013 Scduag
Contrat 2010-2013 ScduagContrat 2010-2013 Scduag
Contrat 2010-2013 Scduag
 
Setting A Culture of Technical Excellence
Setting A Culture of Technical ExcellenceSetting A Culture of Technical Excellence
Setting A Culture of Technical Excellence
 
Exotel For Last Mile Logistics
Exotel For Last Mile LogisticsExotel For Last Mile Logistics
Exotel For Last Mile Logistics
 
Stanford CS347 Guest Lecture: Apache Spark
Stanford CS347 Guest Lecture: Apache SparkStanford CS347 Guest Lecture: Apache Spark
Stanford CS347 Guest Lecture: Apache Spark
 
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...
 
Cloud Communication for E-commerce & Last Mile Logistics
Cloud Communication for E-commerce & Last Mile LogisticsCloud Communication for E-commerce & Last Mile Logistics
Cloud Communication for E-commerce & Last Mile Logistics
 
Client-Side Performance Testing
Client-Side Performance TestingClient-Side Performance Testing
Client-Side Performance Testing
 
Javaで和暦と元号
Javaで和暦と元号Javaで和暦と元号
Javaで和暦と元号
 

Similar to Meetup Systemd vs sysvinit

Principes de fonctionnement unix
Principes de fonctionnement unixPrincipes de fonctionnement unix
Principes de fonctionnement unixwebreaker
 
systemd red hat linux examen Ex200 rh124
systemd red hat linux examen Ex200 rh124systemd red hat linux examen Ex200 rh124
systemd red hat linux examen Ex200 rh124loffyhacker
 
Gestion-des-parcs-informatiques Windows et Linux.pptx
Gestion-des-parcs-informatiques Windows et Linux.pptxGestion-des-parcs-informatiques Windows et Linux.pptx
Gestion-des-parcs-informatiques Windows et Linux.pptxssusercbaa22
 
Comment analyser une machine linux compromise
Comment analyser une machine linux compromiseComment analyser une machine linux compromise
Comment analyser une machine linux compromiseTarek MOHAMED
 
Power shell saturday Paris 2017 Omiossec
Power shell saturday  Paris 2017 OmiossecPower shell saturday  Paris 2017 Omiossec
Power shell saturday Paris 2017 OmiossecOlivier Miossec
 
Installation Et Configuration De Monkey Spider
Installation Et Configuration De Monkey SpiderInstallation Et Configuration De Monkey Spider
Installation Et Configuration De Monkey SpiderMohamed Ben Bouzid
 
Solution d'OTA
Solution d'OTASolution d'OTA
Solution d'OTASidereo
 
Cours sys 2PPT20.pdf
Cours sys 2PPT20.pdfCours sys 2PPT20.pdf
Cours sys 2PPT20.pdfC00LiMoUn
 
Premiers pas avec snort
Premiers pas avec snortPremiers pas avec snort
Premiers pas avec snortFathi Ben Nasr
 
Chapitre2-startup.pdf
Chapitre2-startup.pdfChapitre2-startup.pdf
Chapitre2-startup.pdfBoudarraWalid
 
0081-cours-systemes-exploitations.ppt
0081-cours-systemes-exploitations.ppt0081-cours-systemes-exploitations.ppt
0081-cours-systemes-exploitations.pptDenisKouakou1
 
alphorm.com - Formation proxmoxVE 3
alphorm.com - Formation proxmoxVE 3alphorm.com - Formation proxmoxVE 3
alphorm.com - Formation proxmoxVE 3Alphorm
 
Gestion et surveillance du reseau syslogng
Gestion et surveillance du reseau  syslogngGestion et surveillance du reseau  syslogng
Gestion et surveillance du reseau syslogngKiemde Franck
 
Spring Boot & Containers - Do's & Don'ts
Spring Boot & Containers - Do's & Don'tsSpring Boot & Containers - Do's & Don'ts
Spring Boot & Containers - Do's & Don'tsJulien Wittouck
 
Presentation Pascal
Presentation PascalPresentation Pascal
Presentation Pascalguestb3a127
 
Petit potam slides-rtfm-ossir
Petit potam slides-rtfm-ossirPetit potam slides-rtfm-ossir
Petit potam slides-rtfm-ossirLionelTopotam
 
Virtualiastion des systèmes d'exploitations
Virtualiastion des systèmes d'exploitationsVirtualiastion des systèmes d'exploitations
Virtualiastion des systèmes d'exploitationsSGHIOUAR abdelfettah
 
Cours SE Gestion des périphériques - IG IPSET
Cours SE Gestion des périphériques - IG IPSETCours SE Gestion des périphériques - IG IPSET
Cours SE Gestion des périphériques - IG IPSETMedBechir
 

Similar to Meetup Systemd vs sysvinit (20)

Principes de fonctionnement unix
Principes de fonctionnement unixPrincipes de fonctionnement unix
Principes de fonctionnement unix
 
systemd red hat linux examen Ex200 rh124
systemd red hat linux examen Ex200 rh124systemd red hat linux examen Ex200 rh124
systemd red hat linux examen Ex200 rh124
 
Gestion-des-parcs-informatiques Windows et Linux.pptx
Gestion-des-parcs-informatiques Windows et Linux.pptxGestion-des-parcs-informatiques Windows et Linux.pptx
Gestion-des-parcs-informatiques Windows et Linux.pptx
 
Comment analyser une machine linux compromise
Comment analyser une machine linux compromiseComment analyser une machine linux compromise
Comment analyser une machine linux compromise
 
Power shell saturday Paris 2017 Omiossec
Power shell saturday  Paris 2017 OmiossecPower shell saturday  Paris 2017 Omiossec
Power shell saturday Paris 2017 Omiossec
 
Boot
BootBoot
Boot
 
Installation Et Configuration De Monkey Spider
Installation Et Configuration De Monkey SpiderInstallation Et Configuration De Monkey Spider
Installation Et Configuration De Monkey Spider
 
Solution d'OTA
Solution d'OTASolution d'OTA
Solution d'OTA
 
kaid_nhek
kaid_nhekkaid_nhek
kaid_nhek
 
Cours sys 2PPT20.pdf
Cours sys 2PPT20.pdfCours sys 2PPT20.pdf
Cours sys 2PPT20.pdf
 
Premiers pas avec snort
Premiers pas avec snortPremiers pas avec snort
Premiers pas avec snort
 
Chapitre2-startup.pdf
Chapitre2-startup.pdfChapitre2-startup.pdf
Chapitre2-startup.pdf
 
0081-cours-systemes-exploitations.ppt
0081-cours-systemes-exploitations.ppt0081-cours-systemes-exploitations.ppt
0081-cours-systemes-exploitations.ppt
 
alphorm.com - Formation proxmoxVE 3
alphorm.com - Formation proxmoxVE 3alphorm.com - Formation proxmoxVE 3
alphorm.com - Formation proxmoxVE 3
 
Gestion et surveillance du reseau syslogng
Gestion et surveillance du reseau  syslogngGestion et surveillance du reseau  syslogng
Gestion et surveillance du reseau syslogng
 
Spring Boot & Containers - Do's & Don'ts
Spring Boot & Containers - Do's & Don'tsSpring Boot & Containers - Do's & Don'ts
Spring Boot & Containers - Do's & Don'ts
 
Presentation Pascal
Presentation PascalPresentation Pascal
Presentation Pascal
 
Petit potam slides-rtfm-ossir
Petit potam slides-rtfm-ossirPetit potam slides-rtfm-ossir
Petit potam slides-rtfm-ossir
 
Virtualiastion des systèmes d'exploitations
Virtualiastion des systèmes d'exploitationsVirtualiastion des systèmes d'exploitations
Virtualiastion des systèmes d'exploitations
 
Cours SE Gestion des périphériques - IG IPSET
Cours SE Gestion des périphériques - IG IPSETCours SE Gestion des périphériques - IG IPSET
Cours SE Gestion des périphériques - IG IPSET
 

Meetup Systemd vs sysvinit

  • 1. www.ciose.fr 1 Démarrage d’un deviceDémarrage d’un device LinuxLinux Init System V vs SystemdInit System V vs Systemd C. CharreyreC. Charreyre christian.charreyre@ciose.frchristian.charreyre@ciose.fr http://www.ciose.frhttp://www.ciose.fr https://twitter.com/CIO_SysEmbhttps://twitter.com/CIO_SysEmb http://fr.slideshare.net/charreyrehttp://fr.slideshare.net/charreyre
  • 2. www.ciose.fr 2 Licence Attribution-Noncommercial-Share Alike 4.0 International ● You are free: to Share - copy and redistribute the material in any medium or format to Adapt - remix, transform, and build upon the material The licensor cannot revoke these freedoms as long as you follow the license terms. ● Under the following conditions: Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. NonCommercial — You may not use the material for commercial purposes. ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. ● No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. ● License text : http://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
  • 3. www.ciose.fr 3 CIO en quelques mots ● Société d'ingénierie en systèmes embarqués :  électronique et logiciel ● Au service de nos clients depuis 1990 ● 15 spécialistes en embarqué et temps réel ● Expert en Linux embarqué depuis 2000, OpenEmbedded et Yocto depuis 2008 ● CA annuel : 1 500 000 € ● Siège à Saint-Étienne ● Agence à Marseille ● Agréé CIR
  • 4. www.ciose.fr 4 C. Charreyre en quelques mots ● Associé au sein de CIO ● Responsable des technologies Linux embarqué ● Formateur Linux embarqué (avec Captronic et en direct) ● 30 ans dans l'embarqué et le monde Unix / Linux ● Fervent promoteur du logiciel libre ● Membre de Medinsoft – Commission Logiciel Libre
  • 5. www.ciose.fr 5 Démarrage d’une machine x86 Mise sous tension Vérification BIOS Boot BIOS Bootloader GRUB(2) Mise sous tensionChoix utilisateur Chargement noyau Exécution noyau Montage / Exécution Init Décompression initramfs Montage /dev/ram0 Exécution linuxrc Démontage /dev/ram0
  • 6. www.ciose.fr 6 Démarrage d’une machine non x86 Mise sous tension Bootloader (UBoot) Chargement noyau Exécution noyau Montage / Exécution Init Décompression initramfs Montage /dev/ram0 Exécution linuxrc Démontage /dev/ram0
  • 7. www.ciose.fr 7 Mécanisme init traditionnel SystemV ● Init System V = sysvinit ● A partir de Exécution Init, le démarrage s’exécute en espace User ● init est le 1er processus user lancé par le kernel, il est en charge de démarrer en espace user le reste de la machine ● Son PID est 1
  • 8. www.ciose.fr 8 Mécanisme init traditionnel SystemV ● init piloté par le fichier /etc/inittab # /etc/inittab: init(8) configuration. # $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $ # The default runlevel. id:5:initdefault: # Boot­time system configuration/initialization script. # This is run first except when booting in emergency (­b) mode. si::sysinit:/etc/init.d/rcS # What to do in single­user mode. ~~:S:wait:/sbin/sulogin # /etc/init.d executes the S and K scripts upon change # of runlevel. # # Runlevel 0 is halt. # Runlevel 1 is single­user. # Runlevels 2­5 are multi­user. # Runlevel 6 is reboot. l0:0:wait:/etc/init.d/rc 0 l1:1:wait:/etc/init.d/rc 1 l2:2:wait:/etc/init.d/rc 2 l3:3:wait:/etc/init.d/rc 3 l4:4:wait:/etc/init.d/rc 4 l5:5:wait:/etc/init.d/rc 5 l6:6:wait:/etc/init.d/rc 6 7 niveaux de démarrage (runlevels) 2. Démarrage en runlevel 5 au boot 1. Exécution de /etc/init.d/rcS
  • 9. www.ciose.fr 9 Mécanisme init traditionnel SystemV ● Le répertoire /etc/init.d/ comprend des scripts associés aux daemons ● 1 daemon = 1 script ● 1 script = switch case sur paramètre $1 – start – stop – status – restart / reload ● Jeu de liens de /etc/rcN.d/ vers /etc/init.d/ (N=S, 0 à 6) ● /etc/init.d/rcS enchaîne l’appel des scripts dans /etc/rcS.d/ – ordre alphanumérique
  • 10. www.ciose.fr 10 Mécanisme init traditionnel SystemV ● Pour le runlevel par défaut D, init enchaîne l’appel des scripts dans /etc/rcD.d/ – ordre alphanumérique ● Dans les runlevels 0 à N, succession de liens KnnXXXX et SnnXXXX où – XXXX nom du script dans /etc/init.d/ – nn numéro sur 2 digits ● Les KnnXXXX sont des arrêts de daemon ($1 = stop) ● Les SnnXXXX sont des démarrages de daemon ($1 = start) ● L’ordre alphanumérique enchaîne en séquence les arrêts ordonnés, puis les démarrages ordonnés ● Pour le runlevel S uniquement des starts :  SnnXXXX
  • 11. www.ciose.fr 11 Mécanisme init traditionnel SystemV ● Logique induite :  – Chaque fournisseur de daemon fournit le script de démarrage / arrêt, ainsi que des consignes de démarrage / arrêt en fonction des runlevels :  ● Numéro ● Dépendances éventuelles (ex : daemon nécessite le réseau  actif) – L’administrateur système ou créateur de distribution met en place tout le jeu de lien – init exécute les scripts de démarrage / arrêt ● Tout s’effectue en séquence ● On contrôle finement l’ordre des actions
  • 12. www.ciose.fr 12 Mécanisme init traditionnel SystemV ● Utilitaire de gestion des liens : update-rc.d  – Créations des liens :  update-rc.d apache2 start 20 2 3 4 5 . stop 80 0 1 6 . Adding system startup for /etc/init.d/apache2 … /etc/rc0.d/K80apache2 -> ../init.d/apache2 /etc/rc1.d/K80apache2 -> ../init.d/apache2 /etc/rc6.d/K80apache2 -> ../init.d/apache2 /etc/rc2.d/S20apache2 -> ../init.d/apache2 /etc/rc3.d/S20apache2 -> ../init.d/apache2 /etc/rc4.d/S20apache2 -> ../init.d/apache2 /etc/rc5.d/S20apache2 -> ../init.d/apache2 – Suppressions des liens :  update-rc.d -f apache2 remove
  • 14. www.ciose.fr 14 L’arrivée de systemd ● Depuis quelques années systemd remplace sysvinit dans les distributions majeures :  – Red Hat : initiateur du projet  – Fedora – Open Suse – ArchLinux – Debian : grosse controverse dans le monde Debian → fork  Devuan pour conserver une init sysvinit. – Ubuntu : abandon de  upstart au profit de systemd à partir de 15.04
  • 15. www.ciose.fr 15 L’arrivée de systemd ● Dans les distributions embarqués :  – Yocto : conservation  sysvinit par défaut – Angström : passage à  systemd par défaut
  • 16. www.ciose.fr 16 Systemd vs sysvinit ● Systemd est un démon système qui veut gérer tous les aspects systèmes de la machine, sur base de technos « modernes »    ● Basé sur D-bus ● A ce titre :  – Prend en charge le démarrage / arrêt des daemons = remplacement sysvinit – Fournit donc le process init (pid 1) – Mais gère également réseau, login, montages, logs etc... – A englobé udev
  • 17. www.ciose.fr 17 Les init selon systemd ● Plus de script dans /etc/init.d/ ● Des fichiers de service dans divers répertoires :  – /lib/systemd/system ou /usr/lib/systemd/system – /run/systemd/system – /etc/systemd/system (priorité croissante) ● Des initialisations effectuées en parallèle selon des jeux de contraintes :  – Directives Before ou After dans les fichiers de service [Unit] Description=Create database After=dbus.service Before=postgresql.service [Service] Type=oneshot ExecStart=/usr/bin/create­db.sh TimeoutSec=120 [Install] WantedBy=multi­user.target
  • 18. www.ciose.fr 18 Les init selon systemd ● Des cibles qui sont liées aux services :  – basic.target, multi­user.target,  graphical.target, emergency.target,  reboot.target
  • 19. www.ciose.fr 19 Les init selon systemd ● Lorsqu’une cible est traitée, les divers services associés sont démarrés en parallèle ● Dépendances entre cibles
  • 20. www.ciose.fr 20 Les init selon systemd local-fs-pre.target | v (various mounts and (various swap (various cryptsetup fsck services...) devices...) devices...) (various low-level (various low-level | | | services: udevd, API VFS mounts: v v v tmpfiles, random mqueue, configfs, local-fs.target swap.target cryptsetup.target seed, sysctl, ...) debugfs, ...) | | | | | __________________|_________________ | ___________________|____________________/ |/ v sysinit.target | ____________________________________/|________________________________________ / | | | | | | | | v v | v v (various (various | (various rescue.service timers...) paths...) | sockets...) | | | | | v v v | v rescue.target timers.target paths.target | sockets.target | | | | v _________________ | ___________________/ |/ v basic.target | ____________________________________/| emergency.service / | | | | | | v v v v emergency.target display- (various system (various system manager.service services services) | required for | | graphical UIs) v | | multi-user.target | | | _________________ | _________________/ |/ v graphical.target
  • 21. www.ciose.fr 21 Les init selon systemd ● La parallélisation fait gagner en temps de démarrage ● Mais on maîtrise beaucoup moins l’ordre relatif :  – Ordonnancement alphanumérique déterministe remplacé par un faisceau de contraintes – Exemple réel : afcher un splash screen en toute fin d’arrêt de machine  ● Trivial avec sysvinit : numéro = 99 ● Plus ardu avec systemd ● Chargement des modules kernel peut varier d’un boot à l’autre – Interfaces eth0 et eth1 peuvent s’inverser – Nouveau système de nommage interfaces réseau basé sur hardware ● Un utilitaire pour contrôler les services – systemctl status : donne l’état d’un service et ses logs  – systemctl disable : désactive un service  – systemctl enable : active un service  – systemctl mask: masque un service (lien sur /dev/null dans /etc/systemd/system)
  • 22. www.ciose.fr 22 Systemd, ange ou démon ? ● Grosses polémiques autour de systemd ● Fork Debian pour s’en passer ● Prendre les init systemd, c’est aussi prendre la gestion du reste du système :  – Nécessité de réapprendre beaucoup de choses pour l’administrateur ou le créateur de distribution embarquée – Logs binaires en lieu et place de /var/log/syslog → comment les relire off line (crash par ex.) ?  – Identification et démarrage, contrôle du réseau bouleversé – Gestion de la localisation, de la synchro ntp etc... “Systemd flies in the face of the Unix philosophy: ‘do one thing and do it well,’ representing a complex collection of dozens of tightly coupled binaries. Its responsibilities grossly exceed that of an init system, as it goes on to handle power management, device management, mount points, cron, disk encryption, socket API/inetd, syslog, network configuration, login/session management, readahead, GPT partition discovery, container registration, hostname/locale/time management, mDNS/DNS-SD, the Linux console and other things all wrapped into one.” Site Boycott systemd
  • 23. www.ciose.fr 23 Systemd, ange ou démon ? Crédit image Wikimedia Commons Claudelepoisson Creative Commons Attribution-Share Alike 3.0 Unported license
  • 24. www.ciose.fr 24 Références ● https://wiki.freedesktop.org/www/Software/systemd/ ● https://www.freedesktop.org/software/systemd/man/ ● https://wiki.archlinux.org/index.php/Systemd ● http://0pointer.de/blog/projects/systemd.html ● http://0pointer.net/blog/projects/systemd-for-admins-1.html ● http://0pointer.net/blog/archives.html ● https://www.linux.com/learn/tutorials/ 788613-understanding-and-using-systemd ● http://man7.org/linux/man-pages/man7/bootup.7.html ● https://wiki.debian.org/Debate/initsystem/systemd