[7152faa] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
[a289860] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
| 8 | <sect1 id="ch-system-udev" role="wrap" revision="sysv">
|
---|
| 9 | <?dbhtml filename="udev.html"?>
|
---|
| 10 |
|
---|
| 11 | <sect1info condition="script">
|
---|
| 12 | <productname>udev</productname>
|
---|
| 13 | <productnumber>&systemd-version;</productnumber>
|
---|
| 14 | <address>&systemd-url;</address>
|
---|
| 15 | </sect1info>
|
---|
| 16 |
|
---|
| 17 | <title>Udev from Systemd-&systemd-version;</title>
|
---|
| 18 |
|
---|
| 19 | <indexterm zone="ch-system-udev">
|
---|
| 20 | <primary sortas="a-Udev">Udev</primary>
|
---|
| 21 | </indexterm>
|
---|
| 22 |
|
---|
| 23 | <sect2 role="package">
|
---|
| 24 | <title/>
|
---|
| 25 |
|
---|
| 26 | <para>The Udev package contains programs for dynamic creation of device
|
---|
| 27 | nodes.</para>
|
---|
| 28 |
|
---|
| 29 | <segmentedlist>
|
---|
| 30 | <segtitle>&buildtime;</segtitle>
|
---|
| 31 | <segtitle>&diskspace;</segtitle>
|
---|
| 32 |
|
---|
| 33 | <seglistitem>
|
---|
| 34 | <seg>&udev-fin-sbu;</seg>
|
---|
| 35 | <seg>&udev-fin-du;</seg>
|
---|
| 36 | </seglistitem>
|
---|
| 37 | </segmentedlist>
|
---|
| 38 | </sect2>
|
---|
| 39 |
|
---|
| 40 | <sect2 role="installation">
|
---|
| 41 | <title>Installation of Udev</title>
|
---|
| 42 |
|
---|
| 43 | <para>Udev is part of the systemd-&systemd-version; package. Use
|
---|
| 44 | the systemd-&systemd-version;.tar.xz file as the source tarball.</para>
|
---|
| 45 |
|
---|
| 46 | <para>Remove two unneeded groups,
|
---|
| 47 | <systemitem class="groupname">render</systemitem> and
|
---|
| 48 | <systemitem class="groupname">sgx</systemitem>, from the default udev
|
---|
| 49 | rules:</para>
|
---|
| 50 |
|
---|
| 51 | <screen><userinput remap="pre">sed -i -e 's/GROUP="render"/GROUP="video"/' \
|
---|
| 52 | -e 's/GROUP="sgx", //' rules.d/50-udev-default.rules.in</userinput></screen>
|
---|
| 53 |
|
---|
[f24a041] | 54 | <para>Remove one udev rule requiring a full Systemd installation:</para>
|
---|
| 55 |
|
---|
| 56 | <screen><userinput remap="pre">sed '/systemd-sysctl/s/^/#/' -i rules.d/99-systemd.rules.in</userinput></screen>
|
---|
| 57 |
|
---|
[464fd243] | 58 | <para>Next, fix compatibility with API headers from linux-6.9 and later:</para>
|
---|
[6acfe2e] | 59 |
|
---|
| 60 | <screen><userinput remap="pre">sed -i '/DEVMEM_MAGIC 0/{n;n;a \
|
---|
| 61 | /* cb12fd8e0dabb9a1c8aef55a6a41e2c255fcdf4b (6.8) */ \
|
---|
| 62 | #ifndef PID_FS_MAGIC \
|
---|
| 63 | #define PID_FS_MAGIC 0x50494446 \
|
---|
| 64 | #endif
|
---|
| 65 | }' src/basic/missing_magic.h
|
---|
| 66 |
|
---|
| 67 | sed -i '/OVERLAYFS_SUPER_MAGIC/a \
|
---|
| 68 | pidfs, {PID_FS_MAGIC}' src/basic/filesystems-gperf.gperf</userinput></screen>
|
---|
| 69 |
|
---|
[823fbde] | 70 | <para>Adjust the hardcoded paths to network configuration files for the
|
---|
| 71 | standalone udev installation:</para>
|
---|
| 72 |
|
---|
| 73 | <screen><userinput remap="pre">sed '/NETWORK_DIRS/s/systemd/udev/' -i src/basic/path-lookup.h</userinput></screen>
|
---|
| 74 |
|
---|
[a289860] | 75 | <para>Prepare Udev for compilation:</para>
|
---|
| 76 |
|
---|
| 77 | <screen><userinput remap="configure">mkdir -p build
|
---|
| 78 | cd build
|
---|
| 79 |
|
---|
| 80 | meson setup \
|
---|
| 81 | --prefix=/usr \
|
---|
| 82 | --buildtype=release \
|
---|
| 83 | -Dmode=release \
|
---|
| 84 | -Ddev-kvm-mode=0660 \
|
---|
| 85 | -Dlink-udev-shared=false \
|
---|
[5196dae] | 86 | -Dlogind=false \
|
---|
| 87 | -Dvconsole=false \
|
---|
[a289860] | 88 | ..</userinput></screen>
|
---|
| 89 |
|
---|
| 90 | <variablelist>
|
---|
| 91 | <title>The meaning of the meson options:</title>
|
---|
| 92 |
|
---|
| 93 | <varlistentry>
|
---|
| 94 | <term><parameter>--buildtype=release</parameter></term>
|
---|
| 95 | <listitem>
|
---|
| 96 | <para>This switch overrides the default buildtype
|
---|
| 97 | (<quote>debug</quote>), which produces unoptimized
|
---|
| 98 | binaries.</para>
|
---|
| 99 | </listitem>
|
---|
| 100 | </varlistentry>
|
---|
| 101 |
|
---|
| 102 | <varlistentry>
|
---|
| 103 | <term><parameter>-Dmode=release</parameter></term>
|
---|
| 104 | <listitem>
|
---|
| 105 | <para>Disable some features considered experimental by upstream.
|
---|
| 106 | </para>
|
---|
| 107 | </listitem>
|
---|
| 108 | </varlistentry>
|
---|
| 109 |
|
---|
| 110 | <varlistentry>
|
---|
| 111 | <term><parameter>-Ddev-kvm-mode=0660</parameter></term>
|
---|
| 112 | <listitem>
|
---|
| 113 | <para>The default udev rule would allow all users to access
|
---|
| 114 | <filename class='devicefile'>/dev/kvm</filename>. The editors
|
---|
| 115 | consider it dangerous. This option overrides it.</para>
|
---|
| 116 | </listitem>
|
---|
| 117 | </varlistentry>
|
---|
| 118 |
|
---|
| 119 | <varlistentry>
|
---|
| 120 | <term><parameter>-Dlink-udev-shared=false</parameter></term>
|
---|
| 121 | <listitem>
|
---|
| 122 | <para>This option prevents udev from linking to the internal
|
---|
| 123 | systemd shared library,
|
---|
| 124 | <systemitem class='library'>libsystemd-shared</systemitem>.
|
---|
| 125 | This library is designed to be shared by many Systemd components
|
---|
| 126 | and it's too overkill for a udev-only installation.</para>
|
---|
| 127 | </listitem>
|
---|
| 128 | </varlistentry>
|
---|
[5196dae] | 129 |
|
---|
| 130 | <varlistentry>
|
---|
| 131 | <term><parameter>-Dlogind=false -Dvconsole=false</parameter></term>
|
---|
| 132 | <listitem>
|
---|
| 133 | <para>These options prevent the generation of several udev rule
|
---|
| 134 | files belonging to the other Systemd components that we won't
|
---|
| 135 | install.</para>
|
---|
| 136 | </listitem>
|
---|
| 137 | </varlistentry>
|
---|
[a289860] | 138 | </variablelist>
|
---|
| 139 |
|
---|
[9afac64] | 140 | <para>Get the list of the shipped udev helpers and save it into an
|
---|
[53ed17c] | 141 | environment variable (exporting it is not strictly necessary, but it makes
|
---|
| 142 | building as a regular user or using a package manager easier):</para>
|
---|
[9afac64] | 143 |
|
---|
[53ed17c] | 144 | <screen><userinput remap="make">export udev_helpers=$(grep "'name' :" ../src/udev/meson.build | \
|
---|
[7f6519a] | 145 | awk '{print $3}' | tr -d ",'" | grep -v 'udevadm')</userinput></screen>
|
---|
[9afac64] | 146 |
|
---|
[a289860] | 147 | <para>Only build the components needed for udev:</para>
|
---|
| 148 |
|
---|
[5196dae] | 149 | <screen><userinput remap="make">ninja udevadm systemd-hwdb \
|
---|
| 150 | $(ninja -n | grep -Eo '(src/(lib)?udev|rules.d|hwdb.d)/[^ ]*') \
|
---|
[9afac64] | 151 | $(realpath libudev.so --relative-to .) \
|
---|
[ce07f91d] | 152 | $udev_helpers</userinput></screen>
|
---|
[a289860] | 153 |
|
---|
| 154 | <para>Install the package:</para>
|
---|
| 155 |
|
---|
[823fbde] | 156 | <screen><userinput remap="install">install -vm755 -d {/usr/lib,/etc}/udev/{hwdb.d,rules.d,network}
|
---|
[f7c36d04] | 157 | install -vm755 -d /usr/{lib,share}/pkgconfig
|
---|
[5196dae] | 158 | install -vm755 udevadm /usr/bin/
|
---|
| 159 | install -vm755 systemd-hwdb /usr/bin/udev-hwdb
|
---|
| 160 | ln -svfn ../bin/udevadm /usr/sbin/udevd
|
---|
| 161 | cp -av libudev.so{,*[0-9]} /usr/lib/
|
---|
| 162 | install -vm644 ../src/libudev/libudev.h /usr/include/
|
---|
| 163 | install -vm644 src/libudev/*.pc /usr/lib/pkgconfig/
|
---|
| 164 | install -vm644 src/udev/*.pc /usr/share/pkgconfig/
|
---|
| 165 | install -vm644 ../src/udev/udev.conf /etc/udev/
|
---|
| 166 | install -vm644 rules.d/* ../rules.d/README /usr/lib/udev/rules.d/
|
---|
[4bc51b9] | 167 | install -vm644 $(find ../rules.d/*.rules \
|
---|
| 168 | -not -name '*power-switch*') /usr/lib/udev/rules.d/
|
---|
[5196dae] | 169 | install -vm644 hwdb.d/* ../hwdb.d/{*.hwdb,README} /usr/lib/udev/hwdb.d/
|
---|
[9afac64] | 170 | install -vm755 $udev_helpers /usr/lib/udev
|
---|
[823fbde] | 171 | install -vm644 ../network/99-default.link /usr/lib/udev/network</userinput></screen>
|
---|
[a289860] | 172 |
|
---|
| 173 | <para>Install some custom rules and support files useful in an LFS
|
---|
| 174 | environment:</para>
|
---|
| 175 |
|
---|
| 176 | <screen><userinput remap="install">tar -xvf ../../&udev-lfs-version;.tar.xz
|
---|
| 177 | make -f &udev-lfs-version;/Makefile.lfs install</userinput></screen>
|
---|
| 178 |
|
---|
[cce6c92] | 179 | <para>Install the man pages:</para>
|
---|
| 180 |
|
---|
| 181 | <!-- Please make sure systemd man pages tarball has a common leading
|
---|
| 182 | component in the path. -->
|
---|
[264a80d] | 183 | <screen><userinput remap="install">tar -xf ../../systemd-man-pages-&systemd-man-version;.tar.xz \
|
---|
| 184 | --no-same-owner --strip-components=1 \
|
---|
[cce6c92] | 185 | -C /usr/share/man --wildcards '*/udev*' '*/libudev*' \
|
---|
[823fbde] | 186 | '*/systemd.link.5' \
|
---|
[cce6c92] | 187 | '*/systemd-'{hwdb,udevd.service}.8
|
---|
[823fbde] | 188 |
|
---|
| 189 | sed 's|systemd/network|udev/network|' \
|
---|
| 190 | /usr/share/man/man5/systemd.link.5 \
|
---|
| 191 | > /usr/share/man/man5/udev.link.5
|
---|
| 192 |
|
---|
[264a80d] | 193 | sed 's/systemd\(\\\?-\)/udev\1/' /usr/share/man/man8/systemd-hwdb.8 \
|
---|
| 194 | > /usr/share/man/man8/udev-hwdb.8
|
---|
[823fbde] | 195 |
|
---|
[cce6c92] | 196 | sed 's|lib.*udevd|sbin/udevd|' \
|
---|
| 197 | /usr/share/man/man8/systemd-udevd.service.8 \
|
---|
| 198 | > /usr/share/man/man8/udevd.8
|
---|
[823fbde] | 199 |
|
---|
| 200 | rm /usr/share/man/man*/systemd*</userinput></screen>
|
---|
[cce6c92] | 201 |
|
---|
[164e0dd] | 202 | <para>Finally, unset the <envar>udev_helpers</envar> variable:</para>
|
---|
| 203 |
|
---|
| 204 | <!-- remap="make" seems confusing but we don't have sth. like
|
---|
| 205 | remap="clean". -->
|
---|
[06e65e8] | 206 | <screen><userinput remap="install">unset udev_helpers</userinput></screen>
|
---|
[164e0dd] | 207 |
|
---|
[a289860] | 208 | </sect2>
|
---|
| 209 |
|
---|
| 210 | <sect2 id="conf-udev" role="configuration">
|
---|
| 211 | <title>Configuring Udev</title>
|
---|
| 212 |
|
---|
| 213 | <indexterm zone="conf-udev">
|
---|
| 214 | <primary sortas="a-Udev">Udev</primary>
|
---|
| 215 | <secondary>configuring</secondary>
|
---|
| 216 | </indexterm>
|
---|
| 217 |
|
---|
| 218 | <indexterm zone="conf-udev">
|
---|
| 219 | <primary sortas="e-/etc/udev/hwdb.bin">/etc/udev/hwdb.bin</primary>
|
---|
| 220 | </indexterm>
|
---|
| 221 |
|
---|
| 222 | <para>Information about hardware devices is maintained in the
|
---|
| 223 | <filename class="directory">/etc/udev/hwdb.d</filename> and
|
---|
| 224 | <filename class="directory">/usr/lib/udev/hwdb.d</filename> directories.
|
---|
| 225 | <application>Udev</application> needs that information to be compiled
|
---|
| 226 | into a binary database <filename>/etc/udev/hwdb.bin</filename>. Create the
|
---|
| 227 | initial database:</para>
|
---|
| 228 |
|
---|
| 229 | <screen><userinput>udev-hwdb update</userinput></screen>
|
---|
| 230 |
|
---|
| 231 | <para>This command needs to be run each time the hardware information is
|
---|
| 232 | updated.</para>
|
---|
| 233 |
|
---|
| 234 | </sect2>
|
---|
| 235 |
|
---|
| 236 | <sect2 id="contents-udev" role="content">
|
---|
| 237 | <title>Contents of Udev</title>
|
---|
| 238 |
|
---|
| 239 | <segmentedlist>
|
---|
| 240 | <segtitle>Installed programs</segtitle>
|
---|
| 241 | <segtitle>Installed libraries</segtitle>
|
---|
| 242 | <segtitle>Installed directories</segtitle>
|
---|
| 243 |
|
---|
| 244 | <seglistitem>
|
---|
| 245 | <seg>udevadm, udevd (symlink to udevadm), and udev-hwdb</seg>
|
---|
| 246 |
|
---|
| 247 | <seg>libudev.so</seg>
|
---|
| 248 |
|
---|
| 249 | <seg>/etc/udev and /usr/lib/udev</seg>
|
---|
| 250 | </seglistitem>
|
---|
| 251 | </segmentedlist>
|
---|
| 252 |
|
---|
| 253 | <variablelist>
|
---|
| 254 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 255 | <?dbfo list-presentation="list"?>
|
---|
| 256 | <?dbhtml list-presentation="table"?>
|
---|
| 257 | <varlistentry id="udevadm" revision="sysv">
|
---|
| 258 | <term><command>udevadm</command></term>
|
---|
| 259 | <listitem>
|
---|
| 260 | <para>Generic udev administration tool: controls the udevd daemon,
|
---|
| 261 | provides info from the Udev database, monitors uevents, waits for
|
---|
| 262 | uevents to finish, tests Udev configuration, and triggers uevents
|
---|
| 263 | for a given device</para>
|
---|
| 264 | <indexterm zone="ch-system-udev udevadm">
|
---|
| 265 | <primary sortas="b-udevadm">udevadm</primary>
|
---|
| 266 | </indexterm>
|
---|
| 267 | </listitem>
|
---|
| 268 | </varlistentry>
|
---|
| 269 |
|
---|
| 270 | <varlistentry id="udevd">
|
---|
| 271 | <term><command>udevd</command></term>
|
---|
| 272 | <listitem>
|
---|
| 273 | <para>A daemon that listens for uevents on the netlink socket,
|
---|
| 274 | creates devices and runs the configured external programs in
|
---|
| 275 | response to these uevents</para>
|
---|
| 276 | <indexterm zone="ch-system-udev udevd">
|
---|
| 277 | <primary sortas="b-udevd">udevd</primary>
|
---|
| 278 | </indexterm>
|
---|
| 279 | </listitem>
|
---|
| 280 | </varlistentry>
|
---|
| 281 |
|
---|
| 282 | <varlistentry id="udev-hwdb">
|
---|
| 283 | <term><command>udev-hwdb</command></term>
|
---|
| 284 | <listitem>
|
---|
[4ca4e8b] | 285 | <para>Updates or queries the hardware database.</para>
|
---|
[a289860] | 286 | <indexterm zone="ch-system-udev udev-hwdb">
|
---|
| 287 | <primary sortas="b-udev-hwdb">udev-hwdb</primary>
|
---|
| 288 | </indexterm>
|
---|
| 289 | </listitem>
|
---|
| 290 | </varlistentry>
|
---|
| 291 |
|
---|
| 292 | <varlistentry id="libudev">
|
---|
| 293 | <term><filename class="libraryfile">libudev</filename></term>
|
---|
| 294 | <listitem>
|
---|
| 295 | <para>A library interface to udev device information</para>
|
---|
| 296 | <indexterm zone="ch-system-udev libudev">
|
---|
| 297 | <primary sortas="c-libudev">libudev</primary>
|
---|
| 298 | </indexterm>
|
---|
| 299 | </listitem>
|
---|
| 300 | </varlistentry>
|
---|
| 301 |
|
---|
| 302 | <varlistentry id="etc-udev">
|
---|
| 303 | <term><filename class="directory">/etc/udev</filename></term>
|
---|
| 304 | <listitem>
|
---|
| 305 | <para>Contains Udev configuration files,
|
---|
| 306 | device permissions, and rules for device naming</para>
|
---|
| 307 | <indexterm zone="ch-system-udev etc-udev">
|
---|
| 308 | <primary sortas="e-/etc/udev">/etc/udev</primary>
|
---|
| 309 | </indexterm>
|
---|
| 310 | </listitem>
|
---|
| 311 | </varlistentry>
|
---|
| 312 |
|
---|
| 313 | </variablelist>
|
---|
| 314 |
|
---|
| 315 | </sect2>
|
---|
| 316 |
|
---|
| 317 | </sect1>
|
---|