1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
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 |
|
---|
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 |
|
---|
58 | <para>Next, fix compatibility with linux-6.9 and later:</para>
|
---|
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 |
|
---|
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 |
|
---|
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 \
|
---|
86 | -Dlogind=false \
|
---|
87 | -Dvconsole=false \
|
---|
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>
|
---|
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>
|
---|
138 | </variablelist>
|
---|
139 |
|
---|
140 | <para>Get the list of the shipped udev helpers and save it into an
|
---|
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>
|
---|
143 |
|
---|
144 | <screen><userinput remap="make">export udev_helpers=$(grep "'name' :" ../src/udev/meson.build | \
|
---|
145 | awk '{print $3}' | tr -d ",'" | grep -v 'udevadm')</userinput></screen>
|
---|
146 |
|
---|
147 | <para>Only build the components needed for udev:</para>
|
---|
148 |
|
---|
149 | <screen><userinput remap="make">ninja udevadm systemd-hwdb \
|
---|
150 | $(ninja -n | grep -Eo '(src/(lib)?udev|rules.d|hwdb.d)/[^ ]*') \
|
---|
151 | $(realpath libudev.so --relative-to .) \
|
---|
152 | $udev_helpers</userinput></screen>
|
---|
153 |
|
---|
154 | <para>Install the package:</para>
|
---|
155 |
|
---|
156 | <screen><userinput remap="install">install -vm755 -d {/usr/lib,/etc}/udev/{hwdb.d,rules.d,network}
|
---|
157 | install -vm755 -d /usr/{lib,share}/pkgconfig
|
---|
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/
|
---|
167 | install -vm644 $(find ../rules.d/*.rules \
|
---|
168 | -not -name '*power-switch*') /usr/lib/udev/rules.d/
|
---|
169 | install -vm644 hwdb.d/* ../hwdb.d/{*.hwdb,README} /usr/lib/udev/hwdb.d/
|
---|
170 | install -vm755 $udev_helpers /usr/lib/udev
|
---|
171 | install -vm644 ../network/99-default.link /usr/lib/udev/network</userinput></screen>
|
---|
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 |
|
---|
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. -->
|
---|
183 | <screen><userinput remap="install">tar -xf ../../systemd-man-pages-&systemd-man-version;.tar.xz \
|
---|
184 | --no-same-owner --strip-components=1 \
|
---|
185 | -C /usr/share/man --wildcards '*/udev*' '*/libudev*' \
|
---|
186 | '*/systemd.link.5' \
|
---|
187 | '*/systemd-'{hwdb,udevd.service}.8
|
---|
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 |
|
---|
193 | sed 's/systemd\(\\\?-\)/udev\1/' /usr/share/man/man8/systemd-hwdb.8 \
|
---|
194 | > /usr/share/man/man8/udev-hwdb.8
|
---|
195 |
|
---|
196 | sed 's|lib.*udevd|sbin/udevd|' \
|
---|
197 | /usr/share/man/man8/systemd-udevd.service.8 \
|
---|
198 | > /usr/share/man/man8/udevd.8
|
---|
199 |
|
---|
200 | rm /usr/share/man/man*/systemd*</userinput></screen>
|
---|
201 |
|
---|
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". -->
|
---|
206 | <screen><userinput remap="install">unset udev_helpers</userinput></screen>
|
---|
207 |
|
---|
208 | </sect2>
|
---|
209 |
|
---|
210 | <!-- - - - - - - - - - -->
|
---|
211 | <!-- Multilib - 32bit -->
|
---|
212 | <!-- - - - - - - - - - -->
|
---|
213 | <sect2 arch="ml_32,ml_all" role="installation">
|
---|
214 | <title>Installation of Udev - 32bit</title>
|
---|
215 |
|
---|
216 | <para>Clean previous build (while still in the build directory):</para>
|
---|
217 |
|
---|
218 | <screen><userinput remap="pre">rm -rf *</userinput></screen>
|
---|
219 |
|
---|
220 | <para>Prepare Udev for compilation:</para>
|
---|
221 |
|
---|
222 | <screen><userinput remap="configure">PKG_CONFIG_PATH="/usr/lib32/pkgconfig" \
|
---|
223 | CC="gcc -m32 -march=i686" \
|
---|
224 | CXX="g++ -m32 -march=i686" \
|
---|
225 | LANG=en_US.UTF-8 \
|
---|
226 | meson setup \
|
---|
227 | --prefix=/usr \
|
---|
228 | --buildtype=release \
|
---|
229 | -Dmode=release \
|
---|
230 | -Ddev-kvm-mode=0660 \
|
---|
231 | -Dlink-udev-shared=false \
|
---|
232 | -Dlogind=false \
|
---|
233 | -Dvconsole=false \
|
---|
234 | ..</userinput></screen>
|
---|
235 |
|
---|
236 | <para>Compile the package:</para>
|
---|
237 |
|
---|
238 | <screen><userinput remap="make">ninja \
|
---|
239 | $(grep -o -E "^build (src/libudev|src/udev)[^:]*" \
|
---|
240 | build.ninja | awk '{ print $2 }') \
|
---|
241 | $(realpath libudev.so --relative-to .)</userinput></screen>
|
---|
242 |
|
---|
243 | <para>Install the package:</para>
|
---|
244 |
|
---|
245 | <screen><userinput remap="install">mkdir -pv /usr/lib32/pkgconfig &&
|
---|
246 | cp -av libudev.so{,*[0-9]} /usr/lib32/ &&
|
---|
247 | sed -e "s;/usr/lib;&32;g" src/libudev/libudev.pc > /usr/lib32/pkgconfig/libudev.pc</userinput></screen>
|
---|
248 |
|
---|
249 | </sect2><!-- m32 -->
|
---|
250 |
|
---|
251 | <!-- - - - - - - - - - -->
|
---|
252 | <!-- Multilib - x32bit -->
|
---|
253 | <!-- - - - - - - - - - -->
|
---|
254 | <sect2 arch="ml_x32,ml_all" role="installation">
|
---|
255 | <title>Installation of Udev - x32bit</title>
|
---|
256 | <para>Clean previous build (while still in the build directory):</para>
|
---|
257 |
|
---|
258 | <screen><userinput remap="pre">rm -rf *</userinput></screen>
|
---|
259 |
|
---|
260 | <para>Prepare Udev for compilation:</para>
|
---|
261 |
|
---|
262 | <screen><userinput remap="configure">PKG_CONFIG_PATH="/usr/libx32/pkgconfig" \
|
---|
263 | CC="gcc -mx32" \
|
---|
264 | CXX="g++ -mx32" \
|
---|
265 | CFLAGS+=" -Wno-error=shift-overflow" \
|
---|
266 | CXXFLAGS+=" -Wno-error=shift-overflow" \
|
---|
267 | LANG=en_US.UTF-8 \
|
---|
268 | meson setup \
|
---|
269 | --prefix=/usr \
|
---|
270 | --buildtype=release \
|
---|
271 | -Dmode=release \
|
---|
272 | -Ddev-kvm-mode=0660 \
|
---|
273 | -Dlink-udev-shared=false \
|
---|
274 | -Dlogind=false \
|
---|
275 | -Dvconsole=false \
|
---|
276 | ..</userinput></screen>
|
---|
277 |
|
---|
278 | <para>Compile the package:</para>
|
---|
279 |
|
---|
280 | <screen><userinput remap="make">ninja \
|
---|
281 | $(grep -o -E "^build (src/libudev|src/udev)[^:]*" \
|
---|
282 | build.ninja | awk '{ print $2 }') \
|
---|
283 | $(realpath libudev.so --relative-to .)</userinput></screen>
|
---|
284 |
|
---|
285 | <para>Install the package:</para>
|
---|
286 |
|
---|
287 | <screen><userinput remap="install">mkdir -pv /usr/libx32/pkgconfig &&
|
---|
288 | cp -av libudev.so{,*[0-9]} /usr/libx32/ &&
|
---|
289 | sed -e "s;/usr/lib;&x32;g" src/libudev/libudev.pc > /usr/libx32/pkgconfig/libudev.pc</userinput></screen>
|
---|
290 |
|
---|
291 | </sect2><!-- mx32 -->
|
---|
292 |
|
---|
293 | <sect2 id="conf-udev" role="configuration">
|
---|
294 | <title>Configuring Udev</title>
|
---|
295 |
|
---|
296 | <indexterm zone="conf-udev">
|
---|
297 | <primary sortas="a-Udev">Udev</primary>
|
---|
298 | <secondary>configuring</secondary>
|
---|
299 | </indexterm>
|
---|
300 |
|
---|
301 | <indexterm zone="conf-udev">
|
---|
302 | <primary sortas="e-/etc/udev/hwdb.bin">/etc/udev/hwdb.bin</primary>
|
---|
303 | </indexterm>
|
---|
304 |
|
---|
305 | <para>Information about hardware devices is maintained in the
|
---|
306 | <filename class="directory">/etc/udev/hwdb.d</filename> and
|
---|
307 | <filename class="directory">/usr/lib/udev/hwdb.d</filename> directories.
|
---|
308 | <application>Udev</application> needs that information to be compiled
|
---|
309 | into a binary database <filename>/etc/udev/hwdb.bin</filename>. Create the
|
---|
310 | initial database:</para>
|
---|
311 |
|
---|
312 | <screen><userinput>udev-hwdb update</userinput></screen>
|
---|
313 |
|
---|
314 | <para>This command needs to be run each time the hardware information is
|
---|
315 | updated.</para>
|
---|
316 |
|
---|
317 | </sect2>
|
---|
318 |
|
---|
319 | <sect2 id="contents-udev" role="content">
|
---|
320 | <title>Contents of Udev</title>
|
---|
321 |
|
---|
322 | <segmentedlist>
|
---|
323 | <segtitle>Installed programs</segtitle>
|
---|
324 | <segtitle>Installed libraries</segtitle>
|
---|
325 | <segtitle>Installed directories</segtitle>
|
---|
326 |
|
---|
327 | <seglistitem>
|
---|
328 | <seg>udevadm, udevd (symlink to udevadm), and udev-hwdb</seg>
|
---|
329 |
|
---|
330 | <seg>libudev.so</seg>
|
---|
331 |
|
---|
332 | <seg>/etc/udev and /usr/lib/udev</seg>
|
---|
333 | </seglistitem>
|
---|
334 | </segmentedlist>
|
---|
335 |
|
---|
336 | <variablelist>
|
---|
337 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
338 | <?dbfo list-presentation="list"?>
|
---|
339 | <?dbhtml list-presentation="table"?>
|
---|
340 | <varlistentry id="udevadm" revision="sysv">
|
---|
341 | <term><command>udevadm</command></term>
|
---|
342 | <listitem>
|
---|
343 | <para>Generic udev administration tool: controls the udevd daemon,
|
---|
344 | provides info from the Udev database, monitors uevents, waits for
|
---|
345 | uevents to finish, tests Udev configuration, and triggers uevents
|
---|
346 | for a given device</para>
|
---|
347 | <indexterm zone="ch-system-udev udevadm">
|
---|
348 | <primary sortas="b-udevadm">udevadm</primary>
|
---|
349 | </indexterm>
|
---|
350 | </listitem>
|
---|
351 | </varlistentry>
|
---|
352 |
|
---|
353 | <varlistentry id="udevd">
|
---|
354 | <term><command>udevd</command></term>
|
---|
355 | <listitem>
|
---|
356 | <para>A daemon that listens for uevents on the netlink socket,
|
---|
357 | creates devices and runs the configured external programs in
|
---|
358 | response to these uevents</para>
|
---|
359 | <indexterm zone="ch-system-udev udevd">
|
---|
360 | <primary sortas="b-udevd">udevd</primary>
|
---|
361 | </indexterm>
|
---|
362 | </listitem>
|
---|
363 | </varlistentry>
|
---|
364 |
|
---|
365 | <varlistentry id="udev-hwdb">
|
---|
366 | <term><command>udev-hwdb</command></term>
|
---|
367 | <listitem>
|
---|
368 | <para>Updates or queries the hardware database.</para>
|
---|
369 | <indexterm zone="ch-system-udev udev-hwdb">
|
---|
370 | <primary sortas="b-udev-hwdb">udev-hwdb</primary>
|
---|
371 | </indexterm>
|
---|
372 | </listitem>
|
---|
373 | </varlistentry>
|
---|
374 |
|
---|
375 | <varlistentry id="libudev">
|
---|
376 | <term><filename class="libraryfile">libudev</filename></term>
|
---|
377 | <listitem>
|
---|
378 | <para>A library interface to udev device information</para>
|
---|
379 | <indexterm zone="ch-system-udev libudev">
|
---|
380 | <primary sortas="c-libudev">libudev</primary>
|
---|
381 | </indexterm>
|
---|
382 | </listitem>
|
---|
383 | </varlistentry>
|
---|
384 |
|
---|
385 | <varlistentry id="etc-udev">
|
---|
386 | <term><filename class="directory">/etc/udev</filename></term>
|
---|
387 | <listitem>
|
---|
388 | <para>Contains Udev configuration files,
|
---|
389 | device permissions, and rules for device naming</para>
|
---|
390 | <indexterm zone="ch-system-udev etc-udev">
|
---|
391 | <primary sortas="e-/etc/udev">/etc/udev</primary>
|
---|
392 | </indexterm>
|
---|
393 | </listitem>
|
---|
394 | </varlistentry>
|
---|
395 |
|
---|
396 | </variablelist>
|
---|
397 |
|
---|
398 | </sect2>
|
---|
399 |
|
---|
400 | </sect1>
|
---|