~vicamo/systemd/systemd

« back to all changes in this revision

Viewing changes to debian/udev.README.Debian

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-11-06 14:01:26 UTC
  • mfrom: (6.1.21 sid)
  • Revision ID: package-import@ubuntu.com-20131106140126-176udehi2kg210w7
Tags: 204-5ubuntu1
* Merge packaging with current Debian unstable, to greatly reduce the diff
  noise. Ubuntu changes:
  Permanently Ubuntu specific:
  - debian/control, debian/rules, debian/systemd.install,
    debian/systemd-services.install: Split out systemd-services package with
    logind, timedated, hostnamed, and localed. Add
    libpam-systemd.systemd-logind.upstart to bring up logind at boot.
  - debian/rules: Don't build systemd and systemd-sysv packages, not
    approved for universe for now.
  - debian/udev.templates, Drop debconfiscation of udev, not necessary for
    Ubuntu.
  - debian/extra/initramfs.top: Drop $ROOTDELAY, we do that in a more
    sensible way with wait-for-root. (Will get applicable to Debian once
    Debian gets wait-for-root in initramfs-tools.)
  - Add debian/extra/rules/78-graphics-card.rules: Mark graphics devices as
    PRIMARY_DEVICE_FOR_DISPLAY so that we can wait for those in plymouth.
  - Drop debian/extra/{50-udev-default.rules,75-cd-aliases-generator.rules,
    80-networking.rules,91-permissions.rules}, we don't want these in
    Ubuntu.
  - Add debian/extra/udev.py: Apport hook.
  - debian/extra/udev.startup, debian/rules: Don't install/support
    /etc/udev/links.conf, that's a hack (if you want links, create udev
    rules).
  - Various debian/patches/*, see patch headers (unmergeable with Debian).
  - Drop debian/source/{git-patches,options}, we use proper patches.
  - debian/rules: We continue to use the old net iface naming schema for the
    time being. Install old udev rule generator in debian/udev.install.
    (Reconsider post-LTS)
  - debian/rules: Don't install init.d scripts, only the upstart jobs.
  - debian/rules: Add an epoch to libgudev.
  - Drop debian/udev.dirs, not necessary.
  - Drop debian/udev.NEWS, debian/udev.maintscript: Not applicable to
    Ubuntu.
  - debian/udev.{postinst,postrm,preinst,prerm}: Keep our much simpler
    versions (all platforms must support udev, no debconf).
  - debian/libgudev-1.0-0.install: Install into /lib/ (Debian has a patch
    for this to go into /usr/lib/).
  - debian/rules: Drop doc dir symlinking. It creates havoc with dpkg
    upgrades, and we already have the automatic per-file symlinking.

  Applicable to Debian:
  - debian/control, debian/tests/: Add autopkgtest.
  - debian/extra/initramfs.hook, debian/udev.*{pre,post}inst: Divert udevadm
    to udevadm.upgrade during upgrades while udev is unconfigured.
  - Add debian/extra/60-keyboard.hwdb: Latest upstream keymaps, for easy
    backporting.
  - debian/extra/initramfs.bottom: If LVM is installed, settle udev,
    otherwise we get missing LV symlinks. (LP #1185394)
  - debian/extra/rules/75-persistent-net-generator.rules: Add Ravello
    systems (LP #1099278)
  - Add debian/extra/README-{etc,lib}-rules.d documentation, install into
    udev.
  - debian/rules: Run tests during package build.
  - debian/udev.udev-finish.upstart: Fix path to tmp-rules,
    debian/extra/rule_generator.functions creates them in /run/udev/.
  - debian/udev.upstart: Fix path to udevd.
  - debian/shlibs.local: Drop libudev; this unnecessarily generates overly
    strict dependencies, and even wrong ones for our epoched libgudev.
  - debian/udev-udeb.install: Add 64-btrfs.rules and 75-probe_mtd.rules,
    they are potentially useful in a d-i environment.

  Will go away eventually:
  - Add debian/extra/rules/40-hyperv-hotadd.rules: Workaround for LP #1233466
  - Keep debian/extra/firmware.agent and rule in
    debian/extra/rules/80-drivers.rules until this has been tested to not be
    necessary under Ubuntu kernels any more.

  Upgrade fixes, keep until 14.04 LTS release:
  - debian/control: Conflicts/Replaces libpam-xdg-support.
  - debian/libpam-systemd.postinst: Trigger reboot notification for upgrade
    from < 204, due to changed cgroup layout.
  - debian/systemd-services.maintscript: Clean up obsolete
    /etc/init/systemd-logind.conf on upgrades.

* Promote "systemd | systemd-shim" to Depends. (LP: #1221809)
* 0000-upstream-hwdb-keyboard.patch: udev-builtin-keyboard: Fix large scan
  codes on 32 bit architectures. (side issue in LP #1247676)
* Drop systemd init specific Debian patches which we don't need in Ubuntu;
  The Debian package does not track proper patches any more, so it doesn't
  help us keeping the patches around for merging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
How does udev work?
 
2
~~~~~~~~~~~~~~~~~~~
 
3
Short summary: when a driver is loaded it makes some information available
 
4
in /sys/ and a message is sent to udevd which reads them and creates the
 
5
appropriate devices.
 
6
 
 
7
This means that:
 
8
- modules cannot be loaded on demand when applications open their device,
 
9
  because the device is not yet there!
 
10
- since modules are not loaded on demand, if for some reason the drivers
 
11
  cannot be automatically loaded at boot time you will have to add them
 
12
  to /etc/modules.
 
13
- some modules are not hardware drivers and cannot be loaded automatically
 
14
  by udev, so they will have to be listed in /etc/modules as well.
 
15
- some modules for less usual bus types lack the sysfs data needed to be
 
16
  automatically loaded and must be loaded manually.
 
17
  (See #334238 and #337004 for details.)
 
18
 
 
19
udevd also manages the hotplug events and if needed dispatches them to
 
20
other programs using RUN rules, as a replacement of the old /sbin/hotplug.
 
21
 
 
22
 
 
23
Debugging early boot
 
24
~~~~~~~~~~~~~~~~~~~~
 
25
If the system hangs at boot time or fails to boot properly, it may be
 
26
useful to examine in real time what is happening while "udevadm settle"
 
27
is running. A simple way to do this is:
 
28
 
 
29
* boot the system passing "init=/bin/bash" on the kernel command line
 
30
* start a getty on tty2 (or the serial console) with a command like
 
31
  "/sbin/getty 38400 tty2 &"
 
32
* continue the boot process with "exec /sbin/init single"
 
33
 
 
34
The open console can be used to check which processes are running and
 
35
what they are waiting for.
 
36
 
 
37
Setting the kernel command line options documented in udevd(8) may also
 
38
help to identify system-wide troubles caused by specific kernel drivers.
 
39
 
 
40
 
 
41
Required kernel support
 
42
~~~~~~~~~~~~~~~~~~~~~~~
 
43
The required kernel version and features are documented in the README
 
44
file.
 
45
 
 
46
 
 
47
Disabling udev
 
48
~~~~~~~~~~~~~~
 
49
You may configure in /etc/udev/udev.conf a directory other than /dev
 
50
or add UDEV_DISABLED=yes to the kernel command line.
 
51
 
 
52
 
 
53
Manually creating devices
 
54
~~~~~~~~~~~~~~~~~~~~~~~~~
 
55
Device nodes present in /lib/udev/devices/ will be copied to /dev/ at
 
56
boot time.
 
57
 
 
58
 
 
59
The /etc/udev/rules.d/ directory
 
60
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
61
The files are read and processed in alphabetical order, and the directives
 
62
of matching rules are applied in order.
 
63
If a file with the same name is present in more than one of the
 
64
/run/udev/rules.d/, /etc/udev/rules.d/ and /lib/udev/rules.d/ directories
 
65
then the latter(s) file will be ignored.
 
66
Since the order may be important, files have a specific name which
 
67
must be considered when adding custom rules. So far have been defined:
 
68
 
 
69
 - 60: path_id and the other *_id programs are run. persistent links
 
70
   are set.
 
71
 
 
72
 - 70: network interfaces are renamed and generated rules for persistent
 
73
   links are processed.
 
74
 
 
75
 - 75: the rules generators are run if needed.
 
76
 
 
77
 - 80: drivers are loaded.
 
78
 
 
79
 - 91: the default permissions and owners are set.
 
80
 
 
81
 - 95: $REMOVE_CMD is run, and then processing of tty devices
 
82
   is stopped with last_rule.
 
83
 
 
84
The persistent-*.rules files are generated by the *-generator.rules files
 
85
using the /lib/udev/write_*_rules scripts when new devices are detected.
 
86
They set stable names for network interfaces and optical devices aliases.
 
87
 
 
88
 
 
89
How to know the attributes of a device
 
90
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
91
Try something like:
 
92
udevadm info --attribute-walk --path=/sys/class/sound/pcmC0D0c/
 
93
 
 
94
 
 
95
Devices timestamps
 
96
~~~~~~~~~~~~~~~~~~
 
97
Most devices will be created at the beginning of the boot process, and will
 
98
have the creation time of the kernel clock at that moment.
 
99
On systems whose system clock is set on local time instead of UTC, the
 
100
kernel clock will be updated in a later phase of the boot process and for
 
101
a few hours the devices will have a timestamp in the future.
 
102
This is usually not a problem, but if it bothers you it can be fixed by
 
103
running touch(1) in an init script.
 
104
 
 
105
 
 
106
SCSI block and generic devices
 
107
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
108
When you create a custom rule which matches SCSI devices by some sysfs
 
109
attributes, do not forget that it will match not only the sdX device node
 
110
you are probably looking for but also the SCSI generic device node sgX.
 
111
To get the expected behaviour, you need to add KERNEL="sd*" to your rule.
 
112
A typical example for an USB pen drive is:
 
113
 
 
114
SUBSYSTEMS=="usb", KERNEL=="sd*", \
 
115
        ATTRS{manufacturer}=="hardware vendor", ATTRS{product}=="model", \
 
116
        SYMLINK+="pendrive%n"
 
117
 
 
118
If a device does not report media changes (like e.g. many SD card readers)
 
119
you will also need to add the OPTIONS+="all_partitions" attribute to the
 
120
rule. This is not needed if you are using HAL.
 
121
 
 
122
 
 
123
Network Interfaces
 
124
~~~~~~~~~~~~~~~~~~
 
125
After receiving events about network interfaces, net.agent will call
 
126
ifupdown using the --allow=hotplug option. This makes the program act
 
127
only on interfaces marked with the "allow-hotplug" statement.
 
128
E.g: "allow-hotplug eth0" instead of the usual "auto eth0".
 
129
The loopback interface must always be configured with "auto lo".
 
130
 
 
131
The persistent names of network interfaces by default are automatically
 
132
written to /etc/udev/rules.d/70-persistent-net.rules .
 
133
Users can add their own rules there or at any other place before 70.
 
134
MAC addresses matching is literal, so they must be written in lower case.
 
135
To disable persistent naming of network interfaces, create an empty
 
136
/etc/udev/rules.d/75-persistent-net-generator.rules file to override
 
137
the one in /lib/udev/rules.d/ and delete
 
138
/etc/udev/rules.d/70-persistent-net.rules.
 
139
 
 
140
Beware: programs which rename network interfaces like ifrename and nameif
 
141
will let udev relay events for the old names and should not be used.
 
142
 
 
143
Usually network interfaces are renamed after the root file system has
 
144
been mounted, so if the root file system is mounted over the network
 
145
then the 70-persistent-net.rules file must be copied to the initramfs.
 
146
In most cases this is done automatically, but some setups may require
 
147
explicitly setting "export NEED_PERSISTENT_NET=yes" in a file in
 
148
/etc/initramfs-tools/conf.d/ .
 
149
If 70-persistent-net.rules is copied to the initramfs then it must be
 
150
updated every time a new interface is added.
 
151
 
 
152
 
 
153
Using udev with LDAP or NIS
 
154
~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
155
If the rules files reference usernames or groups not present in the
 
156
/etc/{passwd,group} files and the system is configured to use a
 
157
network-based database like LDAP or NIS then udev may fail at boot time
 
158
because users and groups are looked up well before the network has been
 
159
initialized.
 
160
A possible solution is to configure /etc/nsswitch.conf like this:
 
161
 
 
162
  passwd:         files ldap [UNAVAIL=return]
 
163
  group:          files ldap [UNAVAIL=return]
 
164
 
 
165
The nsswitch.conf syntax is documented in the glibc manual.
 
166
 
 
167
 
 
168
Other documentation
 
169
~~~~~~~~~~~~~~~~~~~
 
170
http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
 
171
http://www.reactivated.net/udevrules.php
 
172
http://www.kroah.com/linux/talks/suse_2005_driver_model/
 
173