Replugging the Modern Desktop



Similar documents
After three years of hanging around on the sidelines, Udev has finally ousted the legacy Dev-FS system. We

USB 2.0 Flash Drive User Manual

Pinos. Wim Taymans. Principal Software Engineer October 8, Wim Taymans. Gstreamer Conference Dublin

User Manual. 2 ) PNY Flash drive 2.0 Series Specification Page 3

How to Replace ASMlib with the udev Device Manager for New and Existing Oracle Instances

istar User Manual for Comsol USB Flash Drive

Timo Müller NFC AND THE VEHICLE. TESTING THE LINUX NFC STACK. BMW Car IT GmbH

############################## # cut from beginning inthere # ############################## Mar 15 00:04:40 linux sudo: andrzej : TTY=pts/3 ;

The Case for SE Android. Stephen Smalley Trust Mechanisms (R2X) National Security Agency

Enterprise Erase LAN

SUSE Linux Enterprise Desktop

10 Red Hat Linux Tips and Tricks

Why Debian needs Upstart

Encrypting Your Files. Because nobody else will And would you trust them if they did?

How To Write A Freesmartphone.Org For Mobile Devices

System administration basics

Host-based Intrusion Prevention on Windows and UNIX. Dr. Rich Murphey White Oak Labs

ThinkServer RD550 and RD650 Operating System Installation Guide

Navigating the Rescue Mode for Linux

Replacing a Laptop Hard Disk On Linux. Khalid Baheyeldin KWLUG, September 2015

PHP on the D-BUS. Welcome!

The Linux Device File-System

Enabling Multi-pathing on ESVA with Red Hat Enterprise Linux 6 Device Mapper

Delivering High Availability Solutions with Red Hat Cluster Suite


USB. 16MB~2GB JetFlash. User s Manual

USB Bare Metal Restore: Getting Started

File System & Device Drive. Overview of Mass Storage Structure. Moving head Disk Mechanism. HDD Pictures 11/13/2014. CS341: Operating System

Configuring Linux to Enable Multipath I/O

Chip Coldwell Senior Software Engineer, Red Hat

Twitter and Notifications of Linux Server Events

System Resources. To keep your system in optimum shape, you need to be CHAPTER 16. System-Monitoring Tools IN THIS CHAPTER. Console-Based Monitoring

GNU/LINUX Forensic Case Study (ubuntu 10.04)

Novell Identity Manager Resource Kit

**Please read this manual carefully before you use the product**

GSE z/os Systems Working Group s390-tools

SSSD. Client side identity management. LinuxAlt 2012 Jakub Hrozek 3. listopadu 2012

Backup Software Technology

TELE 301 Lecture 7: Linux/Unix file

Booting Linux from a USB Flash Device on MPC5200 Systems David Wolfe, Infotainment, Multimedia and Telematics Division

PRINT CONFIGURATION. 1. Printer Configuration

Delivering High Availability Solutions with Red Hat Cluster Suite

Procedure to Create and Duplicate Master LiveUSB Stick

USB FLASH DRIVE. User s Manual. USB 2.0 Compliant. Version A Version A10

BrightStor ARCserve Backup for Linux

Adafruit's Raspberry Pi Lesson 1. Preparing an SD Card for your Raspberry Pi

Automating the deployment of FreeBSD & PC-BSD systems. BSDCan Kris Moore PC-BSD / ixsystems kris@pcbsd.org

Linux Kernel Namespaces (an intro to soft-virtualization) kargig [at] GPG: 79B B8F6 803B EC C E02C

The system-config-printer CUPS administration tool

Creating a Cray System Management Workstation (SMW) Bootable Backup Drive

How to Install Applications (APK Files) on Your Android Phone

Managed Backup Service - Agent for Linux Release Notes

The Linux Kernel Device Model

Using Chroot to Bring Linux Applications to Android

Installing a USB external hard drive backup (Linux)

StarWind iscsi SAN Software: Tape Drives Using StarWind and Symantec Backup Exec

APx4 Wireless System-on-Module 5/8/2013 1

Digital Forensics Tutorials Acquiring an Image with Kali dcfldd

Hi-Speed USB 2.0 Flash Disk. User s Manual

ThinkServer RD540 and RD640 Operating System Installation Guide

Analysis of Open Source Drivers for IEEE WLANs

Linux Storage Management Petros Koutoupis

Configuration Tool and Utilities Operation Manual. for Fusion RAID Storage Systems

Ubuntu bit + 64 bit Server Software RAID Recovery and Troubleshooting.

Hi-Speed USB Flash Disk User s Manual Guide

RocketRAID 2640/2642 SAS Controller Ubuntu Linux Installation Guide

Intel Rapid Storage Technology (Intel RST) in Linux*

Update on filesystems for flash storage

Mentor Embedded IVI Solutions

Fastboot Techniques for x86 Architectures. Marcus Bortel Field Application Engineer QNX Software Systems

USB Flash Drive User s Manual

Linux Embedded devices with PicoDebian Martin Noha

Ubuntu Professional Training Course Overview (E-learning, Ubuntu LTS)

Lab 0 (Setting up your Development Environment) Week 1

NI Real-Time Hypervisor for Windows

ThinkServer RD350 and RD450 Operating System Installation Guide

F.A.Q. Mustek A3 scanners

RocketRAID 174x SATA Controller Ubuntu Linux Installation Guide

15 May 2013 Version 5. for Mac OS X. Public version. Gemfor s.r.o. Tyršovo nám Roztoky Czech Republic

SIB relays C++ API SQL API. Kernel. Hardware Desc. XML. XML Parser parser.h. State. Misc. Mgmt. I/O Manager iomgr.h. Data Acq. XCR. Batt. Mgmt.

Extended installation documentation

SyAM Software, Inc. Server Monitor Desktop Monitor Notebook Monitor V3.2 Local System Management Software User Manual

Version 1.0. File System. Network Settings

Red Hat System Administration 1(RH124) is Designed for IT Professionals who are new to Linux.

ThinkServer RS140 Operating System Installation Guide

Capturing a Forensic Image. By Justin C. Klein Keane <jukeane@sas.upenn.edu> 12 February, 2013

V:Drive - Costs and Benefits of an Out-of-Band Storage Virtualization System

DATAGUARD T5R/R4 5-Bay+1/1U 4-bay Desktop High-performance Network Attached Storage

Capture and analysis of wireless traffic

Implementing SAN & NAS with Linux by Mark Manoukian & Roy Koh

Professional Xen Visualization

Safety measures in Linux

Linux Boot Camp. Our Lady of the Lake University Computer Information Systems & Security Department Kevin Barton Artair Burnett

Block I/O Layer Tracing: blktrace

HP ProLiant DL380 G5 High Availability Storage Server

Transcription:

Replugging the Modern Desktop Kay Sievers <kay.sievers@suse.de> David Zeuthen <davidz@redhat.com> Linux Plumbers Conference Portland, OR, Sept 2009

History Back in the day /sbin/hotplug, scan entire /dev, /proc/scsi/scsi, /proc/partitions magicdev, supermount, subfs User conf / passwords stored in /etc or hard-coded Millions of LOC running as uid 0

History Back in the day /sbin/hotplug, scan entire /dev, /proc/scsi/scsi, /proc/partitions magicdev, supermount, subfs User conf / passwords stored in /etc or hard-coded Millions of LOC running as uid 0 Early Desktop Integration HAL, D-Bus, PolicyKit Separate Mechanism and Policy But... Implementation too complex, not scalable, not focused, too many abstractions

Cutting the same cake in a different way 1 st piece: Move device discovery/enumeration, classification, quirks, probing, event propagation to udev 2 nd piece: Write libudev 3 rd piece: Dedicated system services for major subsystems DeviceKit-disks, DeviceKit-power, NetworkManager, PulseAudio, Bluez, Gypsy,... 4 th piece: Port the world to subsystem services Apps using simple subsystems use libudev (Cheese)

Application Application libudev libudev Login Session udevd Kernel Kernel Space

Application Application libdbus Login Session Subsystem Application Services System Space libudev udevd Kernel Kernel Space

Application Application Application Application Application Application libudev libudev libudev libudev Session 1 Session 2 libdbus... Subsystem Application Services System Space libudev udevd Kernel Kernel Space

Application Application Application Application Application Application libudev libudev libudev libudev Session 1 Session 2 libdbus... Other Services: System Message Bus (D-Bus) Session Tracking (ConsoleKit) Subsystem Application Services libudev System Space... Authority (PolicyKit) udevd Kernel Kernel Space

kernel devices show up in a device tree in /sys /sys/devices -- pci0000:00... -- 0000:00:1f.2 -- driver ->../../../bus/pci/drivers/ahci... -- host0 -- subsystem ->../../../../bus/scsi -- target0:0:0 -- subsystem ->../../../../bus/scsi... -- 0:0:0:0 -- subsystem ->../../../../bus/scsi... -- block `-- sda -- subsystem ->../../../../../../../../../class/block -- alignment_offset -- capability -- dev

new devices and changes are announced over netlink with uevents: recvmsg(3, {msg_name(12)={sa_family=af_netlink, pid=0, groups=00000001}, msg_iov(1)=[{"add@/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/...\0 ACTION=add\0 DEVPATH=/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/...\0 SUBSYSTEM=block\0 MAJOR=8\0 MINOR=0\0 DEVNAME=sda\0 DEVTYPE=disk\0 SEQNUM=1584\0"},...],...

udev rules to: add properties to store in database create meaningful symlinks run programs to configure/setup the device SUBSYTEM=="block", KERNEL=="sd*", ENV{DEVTYPE}=="disk", \ IMPORT{program}="ata_id --export $tempnode" /lib/udev/ata_id --export /dev/sda ID_TYPE=disk ID_BUS=ata ID_MODEL=SAMSUNG_MMCQE28G8MUP-0VA ID_MODEL_ENC=SAMSUNG\x20MMCQE28G8MUP-0VA ID_REVISION=VAM08L1Q ID_SERIAL=SAMSUNG_MMCQE28G8MUP-0VA_SE837A4759 ID_SERIAL_SHORT=SE837A4759 SUBSYTEM=="block", KERNEL=="sd*", ENV{DEVTYPE}=="disk", \ ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"

send event back to multiple listeners: recvmsg(3, {msg_name(12)={sa_family=af_netlink, pid=-4226, groups=00000002}, msg_iov(1)=[{"udev-147\0\0\0\0\0\0\0\0\312\376\35\352 \0m\3\20\306\320B\1\214\272\31 UDEV_LOG=3\0 ACTION=add\0 DEVPATH=/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda\0 SUBSYSTEM=block\0 DEVNAME=/dev/sda\0 DEVTYPE=disk\0 SEQNUM=1584\0 MAJOR=8\0 MINOR=0\0 DEVLINKS=/dev/block/8:0 \ /dev/disk/by-id/ata-samsung_mmcqe28g8mup-0va_se837a4759 \ /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0\0 ID_TYPE=disk\0 ID_BUS=ata\0 ID_MODEL=SAMSUNG_MMCQE28G8MUP-0VA\0 ID_MODEL_ENC=SAMSUNG\\x20MMCQE28G8MUP-0VA\0 ID_REVISION=VAM08L1Q\0 ID_SERIAL=SAMSUNG_MMCQE28G8MUP-0VA_SE837A4759\0 ID_SERIAL_SHORT=SE837A4759\0 ID_PATH=pci-0000:00:1f.2-scsi-0:0:0:0\0 DKD_ATA_SMART_IS_AVAILABLE=1\0},...],...

receive event with libudev: struct udev_monitor *monitor; struct udev_device *device; monitor = udev_monitor_new_from_netlink(udev, "udev"); udev_monitor_enable_receiving(monitor); udev_monitor_filter_add_match_subsystem_devtype(monitor, "block", "disk"); device = udev_monitor_receive_device(monitor); message multiplexing in the kernel messages filtered inside the kernel with berkeley packet filter

libgudev javascript example

Storage Subsystem Daemon DeviceKit-disks Consumes udev information Started on demand High-level API w/ progress reporting Mount, Unmount, Eject, Poll, Fsck Partitioning, Formatting, FS Label ATA SMART monitoring MD-RAID (Create, Start/Stop, Check,...) Drive spindown

Login Session Authentication Agent (PolicyKit-Gnome) File Manager (Nautilus) GIO / GVfs Disk Utility (Palimpsest) Login Session System Message Bus (D-Bus) Session Tracking (ConsoleKit) Authority (PolicyKit) Storage Daemon (DeviceKit-disks) libudev System Space udevd Kernel Kernel Space

Palimpsest Demo (d-feet, fs labels, mkfs, ATA SMART from USB, new-ui)

Kernel / udev Authority Disk Daemon Disk Utility / File Manager Authentication Agent Add /sys/class/block/sda1 CheckAuthorization() DeviceAdded(sda1) signal Mount(sda1,...) BeginAuthentication()... CheckAuthorization() result AuthenticationAgentResponse() Mount() result

Desktop Integration GVfs volume monitor GNOME Power Manager

Formatting

MD RAID

Questions?

Docs / References http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/ http://www.kernel.org/pub/linux/utils/kernel/hotplug/gudev/ http://hal.freedesktop.org/docs/devicekit-disks/ http://hal.freedesktop.org/docs/devicekit-power/ http://hal.freedesktop.org/docs/polkit/

Replugging the Modern Desktop Kay Sievers <kay.sievers@suse.de> David Zeuthen <davidz@redhat.com> Linux Plumbers Conference Portland, OR, Sept 2009 1

History Back in the day /sbin/hotplug, scan entire /dev, /proc/scsi/scsi, /proc/partitions magicdev, supermount, subfs User conf / passwords stored in /etc or hard-coded Millions of LOC running as uid 0 2

History Back in the day /sbin/hotplug, scan entire /dev, /proc/scsi/scsi, /proc/partitions magicdev, supermount, subfs User conf / passwords stored in /etc or hard-coded Millions of LOC running as uid 0 Early Desktop Integration HAL, D-Bus, PolicyKit Separate Mechanism and Policy But... Implementation too complex, not scalable, not focused, too many abstractions 3

Cutting the same cake in a different way 1 st piece: Move device discovery/enumeration, classification, quirks, probing, event propagation to udev 2 nd piece: Write libudev 3 rd piece: Dedicated system services for major subsystems DeviceKit-disks, DeviceKit-power, NetworkManager, PulseAudio, Bluez, Gypsy,... 4 th piece: Port the world to subsystem services Apps using simple subsystems use libudev (Cheese) 4

Application Application libudev libudev Login Session udevd Kernel Kernel Space 5

Application Application libdbus Login Session Subsystem Application Services System Space libudev udevd Kernel Kernel Space 6

Application Application Application Application Application Application libudev libudev libudev libudev Session 1 Session 2 libdbus... Subsystem Application Services System Space libudev udevd Kernel Kernel Space 7

Application Application Application Application Application Application libudev libudev libudev libudev Session 1 Session 2 libdbus... Other Services: System Message Bus (D-Bus) Session Tracking (ConsoleKit)... Authority (PolicyKit) Subsystem Application Services libudev udevd System Space Kernel Kernel Space 8

kernel devices show up in a device tree in /sys /sys/devices -- pci0000:00... -- 0000:00:1f.2 -- driver ->../../../bus/pci/drivers/ahci... -- host0 -- subsystem ->../../../../bus/scsi -- target0:0:0 -- subsystem ->../../../../bus/scsi... -- 0:0:0:0 -- subsystem ->../../../../bus/scsi... -- block `-- sda -- subsystem ->../../../../../../../../../class/block -- alignment_offset -- capability -- dev 9

new devices and changes are announced over netlink with uevents: recvmsg(3, {msg_name(12)={sa_family=af_netlink, pid=0, groups=00000001}, msg_iov(1)=[{"add@/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/...\0 ACTION=add\0 DEVPATH=/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/...\0 SUBSYSTEM=block\0 MAJOR=8\0 MINOR=0\0 DEVNAME=sda\0 DEVTYPE=disk\0 SEQNUM=1584\0"},...],... 10

udev rules to: add properties to store in database create meaningful symlinks run programs to configure/setup the device SUBSYTEM=="block", KERNEL=="sd*", ENV{DEVTYPE}=="disk", \ IMPORT{program}="ata_id --export $tempnode" /lib/udev/ata_id --export /dev/sda ID_TYPE=disk ID_BUS=ata ID_MODEL=SAMSUNG_MMCQE28G8MUP-0VA ID_MODEL_ENC=SAMSUNG\x20MMCQE28G8MUP-0VA ID_REVISION=VAM08L1Q ID_SERIAL=SAMSUNG_MMCQE28G8MUP-0VA_SE837A4759 ID_SERIAL_SHORT=SE837A4759 SUBSYTEM=="block", KERNEL=="sd*", ENV{DEVTYPE}=="disk", \ ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" 11

send event back to multiple listeners: recvmsg(3, {msg_name(12)={sa_family=af_netlink, pid=-4226, groups=00000002}, msg_iov(1)=[{"udev-147\0\0\0\0\0\0\0\0\312\376\35\352 \0m\3\20\306\320B\1\214\272\31 UDEV_LOG=3\0 ACTION=add\0 DEVPATH=/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda\0 SUBSYSTEM=block\0 DEVNAME=/dev/sda\0 DEVTYPE=disk\0 SEQNUM=1584\0 MAJOR=8\0 MINOR=0\0 DEVLINKS=/dev/block/8:0 \ /dev/disk/by-id/ata-samsung_mmcqe28g8mup-0va_se837a4759 \ /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0\0 ID_TYPE=disk\0 ID_BUS=ata\0 ID_MODEL=SAMSUNG_MMCQE28G8MUP-0VA\0 ID_MODEL_ENC=SAMSUNG\\x20MMCQE28G8MUP-0VA\0 ID_REVISION=VAM08L1Q\0 ID_SERIAL=SAMSUNG_MMCQE28G8MUP-0VA_SE837A4759\0 ID_SERIAL_SHORT=SE837A4759\0 ID_PATH=pci-0000:00:1f.2-scsi-0:0:0:0\0 DKD_ATA_SMART_IS_AVAILABLE=1\0},...],... 12

receive event with libudev: struct udev_monitor *monitor; struct udev_device *device; monitor = udev_monitor_new_from_netlink(udev, "udev"); udev_monitor_enable_receiving(monitor); udev_monitor_filter_add_match_subsystem_devtype(monitor, "block", "disk"); device = udev_monitor_receive_device(monitor); message multiplexing in the kernel messages filtered inside the kernel with berkeley packet filter 13

libgudev javascript example 14

Storage Subsystem Daemon DeviceKit-disks Consumes udev information Started on demand High-level API w/ progress reporting Mount, Unmount, Eject, Poll, Fsck Partitioning, Formatting, FS Label ATA SMART monitoring MD-RAID (Create, Start/Stop, Check,...) Drive spindown 15

Login Session Authentication Agent (PolicyKit-Gnome) File Manager (Nautilus) GIO / GVfs Disk Utility (Palimpsest) Login Session System Message Bus (D-Bus) Session Tracking (ConsoleKit) Authority (PolicyKit) Storage Daemon (DeviceKit-disks) libudev System Space udevd Kernel Kernel Space 16

Palimpsest Demo (d-feet, fs labels, mkfs, ATA SMART from USB, new-ui) 17

18

19

20

21

22

23

24

Kernel / udev Authority Disk Daemon Disk Utility / File Manager Authentication Agent Add /sys/class/block/sda1 CheckAuthorization() DeviceAdded(sda1) signal Mount(sda1,...) BeginAuthentication()... CheckAuthorization() result AuthenticationAgentResponse() Mount() result 25

Desktop Integration GVfs volume monitor GNOME Power Manager 26

Formatting 27

MD RAID 28

29

Questions? 30

Docs / References http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/ http://www.kernel.org/pub/linux/utils/kernel/hotplug/gudev/ http://hal.freedesktop.org/docs/devicekit-disks/ http://hal.freedesktop.org/docs/devicekit-power/ http://hal.freedesktop.org/docs/polkit/ 31