Stateless Systems, Factory Reset, Golden Master Systems and systemd - - PowerPoint PPT Presentation

stateless systems factory reset golden master systems and
SMART_READER_LITE
LIVE PREVIEW

Stateless Systems, Factory Reset, Golden Master Systems and systemd - - PowerPoint PPT Presentation

Stateless Systems, Factory Reset, Golden Master Systems and systemd LinuxCon Europe, Duesseldorf October 2014 Stateless Systems, Factory Reset, Golden Master Systems and Factory Reset? Stateless Systems, Factory Reset, Golden Master Systems


slide-1
SLIDE 1

Stateless Systems, Factory Reset, Golden Master Systems and systemd

LinuxCon Europe, Duesseldorf October 2014

Stateless Systems, Factory Reset, Golden Master Systems and

slide-2
SLIDE 2

Factory Reset?

Stateless Systems, Factory Reset, Golden Master Systems and

slide-3
SLIDE 3

Factory Reset? The procedure to bring a system back into the state that is was shipped in.

Stateless Systems, Factory Reset, Golden Master Systems and

slide-4
SLIDE 4

Stateless System?

Stateless Systems, Factory Reset, Golden Master Systems and

slide-5
SLIDE 5

Stateless System? A system where every single boot-up is as if a factory reset was just completed.

Stateless Systems, Factory Reset, Golden Master Systems and

slide-6
SLIDE 6

Golden Master? The one master image a factory reset returns the state to.

Stateless Systems, Factory Reset, Golden Master Systems and

slide-7
SLIDE 7

Golden Master? The one master image a factory reset returns the state to. The same image is usually shared between a multitude of systems.

Stateless Systems, Factory Reset, Golden Master Systems and

slide-8
SLIDE 8

Where do you want this?

Stateless Systems, Factory Reset, Golden Master Systems and

slide-9
SLIDE 9

Where do you want this? Containers,

Stateless Systems, Factory Reset, Golden Master Systems and

slide-10
SLIDE 10

Where do you want this? Containers, servers,

Stateless Systems, Factory Reset, Golden Master Systems and

slide-11
SLIDE 11

Where do you want this? Containers, servers, laptops/desktops/tablets,

Stateless Systems, Factory Reset, Golden Master Systems and

slide-12
SLIDE 12

Where do you want this? Containers, servers, laptops/desktops/tablets, mobile,

Stateless Systems, Factory Reset, Golden Master Systems and

slide-13
SLIDE 13

Where do you want this? Containers, servers, laptops/desktops/tablets, mobile, embedded

Stateless Systems, Factory Reset, Golden Master Systems and

slide-14
SLIDE 14

Where do you want this? Containers, servers, laptops/desktops/tablets, mobile, embedded Verifiable setups

Stateless Systems, Factory Reset, Golden Master Systems and

slide-15
SLIDE 15

Where do you want this? Containers, servers, laptops/desktops/tablets, mobile, embedded Verifiable setups Apps

Stateless Systems, Factory Reset, Golden Master Systems and

slide-16
SLIDE 16

Tons of prior art: Android, ChromeOS, CoreOS, virtualization infrastructure, and many embedded systems

Stateless Systems, Factory Reset, Golden Master Systems and

slide-17
SLIDE 17

Our goal with working on this in the systemd context: to solve this in a modular and generic way, for all usecases

Stateless Systems, Factory Reset, Golden Master Systems and

slide-18
SLIDE 18

Our goal with working on this in the systemd context: to solve this in a modular and generic way, for all usecases Right in the OS itself.

Stateless Systems, Factory Reset, Golden Master Systems and

slide-19
SLIDE 19

Let’s seperate state from OS resources!

Stateless Systems, Factory Reset, Golden Master Systems and

slide-20
SLIDE 20

Let’s seperate state from OS resources! /etc: configuration

Stateless Systems, Factory Reset, Golden Master Systems and

slide-21
SLIDE 21

Let’s seperate state from OS resources! /etc: configuration /var: state

Stateless Systems, Factory Reset, Golden Master Systems and

slide-22
SLIDE 22

Let’s seperate state from OS resources! /etc: configuration /var: state /usr: vendor OS resources

Stateless Systems, Factory Reset, Golden Master Systems and

slide-23
SLIDE 23

Let’s seperate state from OS resources! /etc: configuration /var: state /usr: vendor OS resources (after the /usr merge)

Stateless Systems, Factory Reset, Golden Master Systems and

slide-24
SLIDE 24

Flushing /etc, /var, just keeping /usr: full factory reset Flushing just /var, keeping /usr and /etc: keeping settings, but dropping collected state

Stateless Systems, Factory Reset, Golden Master Systems and

slide-25
SLIDE 25

Booting with /var empty?

Stateless Systems, Factory Reset, Golden Master Systems and

slide-26
SLIDE 26

Booting with /var empty? Mostly just works, just a few more tmpfiles rules

Stateless Systems, Factory Reset, Golden Master Systems and

slide-27
SLIDE 27

Booting with /var empty? Mostly just works, just a few more tmpfiles rules

Stateless Systems, Factory Reset, Golden Master Systems and

slide-28
SLIDE 28

What’s tmpfiles again?

Stateless Systems, Factory Reset, Golden Master Systems and

slide-29
SLIDE 29

What’s tmpfiles again? d /var 0755 - - - L /var/run - - - - ../run d /var/log 0755 - - - f /var/log/wtmp 0664 root utmp - f /var/log/btmp 0600 root utmp - d /var/cache 0755 - - - d /var/lib 0755 - - - d /var/spool 0755 - - -

Stateless Systems, Factory Reset, Golden Master Systems and

slide-30
SLIDE 30

Booting with /etc empty?

Stateless Systems, Factory Reset, Golden Master Systems and

slide-31
SLIDE 31

Booting with /etc empty? More complex

Stateless Systems, Factory Reset, Golden Master Systems and

slide-32
SLIDE 32

Booting with /etc empty? More complex Software is more allergic if configuration files in /etc are missing

Stateless Systems, Factory Reset, Golden Master Systems and

slide-33
SLIDE 33

Booting with /etc empty? More complex Software is more allergic if configuration files in /etc are missing User database!

Stateless Systems, Factory Reset, Golden Master Systems and

slide-34
SLIDE 34

Booting with /etc empty? More complex Software is more allergic if configuration files in /etc are missing User database! Core OS components shipped by systemd are fixed

Stateless Systems, Factory Reset, Golden Master Systems and

slide-35
SLIDE 35

Booting with /etc empty? More complex Software is more allergic if configuration files in /etc are missing User database! Core OS components shipped by systemd are fixed Exception in the core OS: dbus, PAM

Stateless Systems, Factory Reset, Golden Master Systems and

slide-36
SLIDE 36

tmpfiles to the rescue: C /etc/pam.d C /etc/nsswitch.conf Introducing: /usr/share/factory/etc

Stateless Systems, Factory Reset, Golden Master Systems and

slide-37
SLIDE 37

sysusers to the rescue: u root "Super User" /root u nobody 65534 "Nobody"

  • g adm
  • g wheel
  • g kmem
  • g lock
  • g tty

5

  • g utmp
  • g audio
  • g cdrom
  • g dialout -
  • g disk
  • g input
  • g lp
  • g tape
  • g video
  • g users
  • Stateless Systems, Factory Reset, Golden Master Systems and
slide-38
SLIDE 38

systemd-nspawn –volatile=no -b -D /srv/mycontainer

Stateless Systems, Factory Reset, Golden Master Systems and

slide-39
SLIDE 39

systemd-nspawn –volatile=no -b -D /srv/mycontainer systemd-nspawn –volatile=state -b -D /srv/mycontainer

Stateless Systems, Factory Reset, Golden Master Systems and

slide-40
SLIDE 40

systemd-nspawn –volatile=no -b -D /srv/mycontainer systemd-nspawn –volatile=state -b -D /srv/mycontainer systemd-nspawn –volatile=yes -b -D /srv/mycontainer

Stateless Systems, Factory Reset, Golden Master Systems and

slide-41
SLIDE 41

Updating

Stateless Systems, Factory Reset, Golden Master Systems and

slide-42
SLIDE 42

Updating /usr can be updated offline

Stateless Systems, Factory Reset, Golden Master Systems and

slide-43
SLIDE 43

Updating /usr can be updated offline On next boot, /etc and /var are updated

Stateless Systems, Factory Reset, Golden Master Systems and

slide-44
SLIDE 44

Updating /usr can be updated offline On next boot, /etc and /var are updated ConditionNeedsUpdate=

Stateless Systems, Factory Reset, Golden Master Systems and

slide-45
SLIDE 45

Updating /usr can be updated offline On next boot, /etc and /var are updated ConditionNeedsUpdate= ldconfig, sysusers, udev hwdb, . . .

Stateless Systems, Factory Reset, Golden Master Systems and

slide-46
SLIDE 46

Updating /usr can be updated offline On next boot, /etc and /var are updated ConditionNeedsUpdate= ldconfig, sysusers, udev hwdb, . . . All atomic

Stateless Systems, Factory Reset, Golden Master Systems and

slide-47
SLIDE 47

Double Buffering

Stateless Systems, Factory Reset, Golden Master Systems and

slide-48
SLIDE 48

Double Buffering Multiple /usr trees around!

Stateless Systems, Factory Reset, Golden Master Systems and

slide-49
SLIDE 49

RPM? Classic Distributions?

Stateless Systems, Factory Reset, Golden Master Systems and

slide-50
SLIDE 50

Timeframe?

Stateless Systems, Factory Reset, Golden Master Systems and

slide-51
SLIDE 51

Apps!

Stateless Systems, Factory Reset, Golden Master Systems and

slide-52
SLIDE 52

Apps! /usr: os, runtime, framework

Stateless Systems, Factory Reset, Golden Master Systems and

slide-53
SLIDE 53

Apps! /usr: os, runtime, framework /opt/appname: app

Stateless Systems, Factory Reset, Golden Master Systems and

slide-54
SLIDE 54

OS: a /usr one can boot up a system with

Stateless Systems, Factory Reset, Golden Master Systems and

slide-55
SLIDE 55

OS: a /usr one can boot up a system with Runtime: a /usr one can run executables against

Stateless Systems, Factory Reset, Golden Master Systems and

slide-56
SLIDE 56

OS: a /usr one can boot up a system with Runtime: a /usr one can run executables against Framework: a /usr one can build executables with

Stateless Systems, Factory Reset, Golden Master Systems and

slide-57
SLIDE 57

OS, Runtime, Framework, Instance, Apps

Stateless Systems, Factory Reset, Golden Master Systems and

slide-58
SLIDE 58

OS, Runtime, Framework, Instance, Apps All in multiple versions on the same system

Stateless Systems, Factory Reset, Golden Master Systems and

slide-59
SLIDE 59

OS, Runtime, Framework, Instance, Apps All in multiple versions on the same system btrfs subvolumes

Stateless Systems, Factory Reset, Golden Master Systems and

slide-60
SLIDE 60

btrfs???

Stateless Systems, Factory Reset, Golden Master Systems and

slide-61
SLIDE 61

Clear naming Scheme for subvolumes

Stateless Systems, Factory Reset, Golden Master Systems and

slide-62
SLIDE 62

Clear naming Scheme for subvolumes usr:vendorid:architecture:version

Stateless Systems, Factory Reset, Golden Master Systems and

slide-63
SLIDE 63

Clear naming Scheme for subvolumes usr:vendorid:architecture:version root:name:vendorid:architecture

Stateless Systems, Factory Reset, Golden Master Systems and

slide-64
SLIDE 64

Clear naming Scheme for subvolumes usr:vendorid:architecture:version root:name:vendorid:architecture runtime:vendorid:architecture:version

Stateless Systems, Factory Reset, Golden Master Systems and

slide-65
SLIDE 65

Clear naming Scheme for subvolumes usr:vendorid:architecture:version root:name:vendorid:architecture runtime:vendorid:architecture:version framework:vendorid:architecture:version

Stateless Systems, Factory Reset, Golden Master Systems and

slide-66
SLIDE 66

Clear naming Scheme for subvolumes usr:vendorid:architecture:version root:name:vendorid:architecture runtime:vendorid:architecture:version framework:vendorid:architecture:version app:vendorid:runtime:architecture:version

Stateless Systems, Factory Reset, Golden Master Systems and

slide-67
SLIDE 67

Namespaces!

Stateless Systems, Factory Reset, Golden Master Systems and

slide-68
SLIDE 68

Namespaces! Dynamic views on the system, for containers and apps

Stateless Systems, Factory Reset, Golden Master Systems and

slide-69
SLIDE 69

Namespaces! Dynamic views on the system, for containers and apps Multiple root subvolumes sharing the same usr subvolume!

Stateless Systems, Factory Reset, Golden Master Systems and

slide-70
SLIDE 70

Namespaces! Dynamic views on the system, for containers and apps Multiple root subvolumes sharing the same usr subvolume! Multiple app subvolumes sharing the same runtime subvolume!

Stateless Systems, Factory Reset, Golden Master Systems and

slide-71
SLIDE 71

Delivery:

Stateless Systems, Factory Reset, Golden Master Systems and

slide-72
SLIDE 72

Delivery: btrfs send/recv deltas via http

Stateless Systems, Factory Reset, Golden Master Systems and

slide-73
SLIDE 73

Delivery: btrfs send/recv deltas via http Same for OS, runtimes, frameworks and apps

Stateless Systems, Factory Reset, Golden Master Systems and

slide-74
SLIDE 74

OS installation:

Stateless Systems, Factory Reset, Golden Master Systems and

slide-75
SLIDE 75

OS installation:

1 Create GPT table with ESP + btrfs

Stateless Systems, Factory Reset, Golden Master Systems and

slide-76
SLIDE 76

OS installation:

1 Create GPT table with ESP + btrfs 2 Deserialize usr tree into btrfs

Stateless Systems, Factory Reset, Golden Master Systems and

slide-77
SLIDE 77

OS installation:

1 Create GPT table with ESP + btrfs 2 Deserialize usr tree into btrfs 3 Install bootloader into ESP

Stateless Systems, Factory Reset, Golden Master Systems and

slide-78
SLIDE 78

OS installation:

1 Create GPT table with ESP + btrfs 2 Deserialize usr tree into btrfs 3 Install bootloader into ESP 4 Profit!

Stateless Systems, Factory Reset, Golden Master Systems and

slide-79
SLIDE 79

http://0pointer.net/blog/projects/stateless.html http://0pointer.net/blog/ revisiting-how-we-put-together-linux-systems.html

Stateless Systems, Factory Reset, Golden Master Systems and

slide-80
SLIDE 80

That’s all, folks!

Stateless Systems, Factory Reset, Golden Master Systems and