source: postlfs/config/devices.xml@ 1f886074

12.0 12.1 kea ken/TL2024 ken/tuningfonts lazarus lxqt plabs/newcss python3.11 rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18 xry111/xf86-video-removal
Last change on this file since 1f886074 was 3f2db3a6, checked in by Pierre Labastie <pierre.labastie@…>, 19 months ago

Remove sect1info tags

They only contain a date tag that is nowhere used.

  • Property mode set to 100644
File size: 8.9 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
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="postlfs-devices" xreflabel="About Devices">
9 <?dbhtml filename="devices.html"?>
10
11
12 <title>About Devices</title>
13
14 <indexterm zone="postlfs-devices">
15 <primary sortas="e-etc-udev-rules">/etc/udev/rules.d</primary>
16 </indexterm>
17
18 <para>
19 Although most devices needed by packages in BLFS and beyond are set up
20 properly by <application>udev</application> using the default rules
21 installed by LFS in <filename
22 class="directory">/etc/udev/rules.d</filename>, there are cases where
23 the rules must be modified or augmented.
24 </para>
25
26 <para condition="html" role="usernotes">User Notes:
27 <ulink url="&blfs-wiki;/aboutdevices"/></para>
28
29 <sect2>
30 <title>Multiple Sound Cards</title>
31
32 <para>
33 If there are multiple sound cards in a system, the "default"
34 sound card becomes random. The method to establish sound card order
35 depends on whether the drivers are modules or not. If the sound card
36 drivers are compiled into the kernel, control is via kernel command line
37 parameters in <filename>/boot/grub/grub.cfg</filename>. For example,
38 if a system has both an FM801 card and a SoundBlaster PCI card, the
39 following can be appended to the command line:
40 </para>
41
42<screen><literal>snd-fm801.index=0 snd-ens1371.index=1</literal></screen>
43
44 <para>
45 If the sound card drivers are built as modules, the order can be
46 established in the <filename>/etc/modprobe.conf</filename> file with:
47 </para>
48
49<screen><literal>options snd-fm801 index=0
50options snd-ens1371 index=1</literal></screen>
51
52 </sect2>
53
54 <sect2 id="usb-device-issues">
55 <title>USB Device Issues</title>
56
57 <para>
58 USB devices usually have two kinds of device nodes associated with them.
59 </para>
60
61 <para>
62 The first kind is created by device-specific drivers (e.g.,
63 usb_storage/sd_mod or usblp) in the kernel. For example, a USB mass
64 storage device would be /dev/sdb, and a USB printer would be
65 /dev/usb/lp0. These device nodes exist only when the device-specific
66 driver is loaded.
67 </para>
68
69 <para>
70 The second kind of device nodes (/dev/bus/usb/BBB/DDD, where BBB is
71 the bus number and DDD is the device number) are created even if the
72 device doesn't have a kernel driver. By using these "raw" USB device
73 nodes, an application can exchange arbitrary USB packets with the
74 device, i.e., bypass the possibly-existing kernel driver.
75 </para>
76
77 <para>
78 Access to raw USB device nodes is needed when a userspace program is
79 acting as a device driver. However, for the program to open the device
80 successfully, the permissions have to be set correctly. By default, due
81 to security concerns, all raw USB devices are owned by user root and
82 group usb, and have 0664 permissions (the read access is needed, e.g.,
83 for lsusb to work and for programs to access USB hubs). Packages (such
84 as SANE and libgphoto2) containing userspace USB device drivers also
85 ship udev rules that change the permissions of the controlled raw USB
86 devices. That is, rules installed by SANE change permissions for known
87 scanners, but not printers. If a package maintainer forgot to write
88 a rule for your device, report a bug to both BLFS (if the package is
89 there) and upstream, and you will need to write your own rule.
90 </para>
91
92 <para>
93 There is one situation when such fine-grained access control with
94 pre-generated udev rules doesn't work. Namely, PC emulators such as KVM,
95 QEMU and VirtualBox use raw USB device nodes to present arbitrary USB
96 devices to the guest operating system (note: patches are needed in order
97 to get this to work without the obsolete /proc/bus/usb mount point
98 described below). Obviously, maintainers of these packages cannot know
99 which USB devices are going to be connected to the guest operating
100 system. You can either write separate udev rules for all needed USB
101 devices yourself, or use the default catch-all "usb" group, members
102 of which can send arbitrary commands to all USB devices.
103 </para>
104
105 <para>
106 Before Linux-2.6.15, raw USB device access was performed not with
107 /dev/bus/usb/BBB/DDD device nodes, but with /proc/bus/usb/BBB/DDD
108 pseudofiles. Some applications (e.g., VMware Workstation) still use only
109 this deprecated technique and can't use the new device nodes. For them to
110 work, use the "usb" group, but remember that members will have
111 unrestricted access to all USB devices. To create the fstab entry for
112 the obsolete usbfs filesystem:
113 </para>
114
115<screen><literal>usbfs /proc/bus/usb usbfs devgid=14,devmode=0660 0 0</literal></screen>
116
117 <note>
118 <para>
119 Adding users to the "usb" group is inherently insecure, as they can
120 bypass access restrictions imposed through the driver-specific USB
121 device nodes. For instance, they can read sensitive data from USB
122 hard drives without being in the "disk" group. Avoid adding users
123 to this group, if you can.
124 </para>
125 </note>
126
127 </sect2>
128
129 <sect2>
130 <title>Udev Device Attributes</title>
131
132 <para>
133 Fine-tuning of device attributes such as group name and permissions
134 is possible by creating extra <application>udev</application> rules,
135 matching on something like this. The vendor and product can be found by
136 searching the <filename class='directory'>/sys/devices</filename>
137 directory entries or using <command>udevadm info</command> after the
138 device has been attached. See the documentation in the current
139 <application>udev</application> directory of <filename
140 class='directory'>/usr/share/doc</filename> for details.
141 </para>
142
143<screen><literal>SUBSYSTEM=="usb_device", SYSFS{idVendor}=="05d8", SYSFS{idProduct}=="4002", \
144 GROUP:="scanner", MODE:="0660"</literal></screen>
145
146 <note>
147 <para>
148 The above line is used for descriptive purposes only. The
149 scanner <application>udev</application> rules are put into place when
150 installing <xref linkend='sane'/>.
151 </para>
152 </note>
153
154 </sect2>
155
156<!--
157 <sect2>
158 <title>Multiple Network Interfaces</title>
159
160
161 </sect2>
162-->
163
164<!-- These instructions are invalid on systemd because we don't use bootscripts.
165 In addition, we should probably verify that these are valid on SysV too.-->
166
167 <sect2 revision="sysv">
168 <title>Devices for Servers</title>
169
170 <para>
171 In some cases, it makes sense to disable
172 <application>udev</application> completely and create static devices.
173 Servers are one example of this situation. Does a server need the
174 capability of handling dynamic devices? Only the system administrator
175 can answer that question, but in many cases the answer will be no.
176 </para>
177
178 <para>
179 If dynamic devices are not desired, then static devices must be
180 created on the system. In the default configuration, the
181 <filename>/etc/rc.d/rcS.d/S10udev</filename> boot script mounts a
182 <systemitem class="filesystem">tmpfs</systemitem> partition over the
183 <filename class="directory">/dev</filename> directory. This problem can
184 be overcome by mounting the root partition temporarily:
185 </para>
186
187 <warning>
188 <para>
189 If the instructions below are not followed carefully, your
190 system could become unbootable.
191 </para>
192 </warning>
193
194
195<screen><userinput>mount --bind / /mnt
196cp -a /dev/* /mnt/dev
197rm /etc/rc.d/rcS.d/{S10udev,S50udev_retry}
198umount /mnt</userinput></screen>
199
200 <para>
201 At this point, the system will use static devices upon the next
202 reboot. Create any desired additional devices using
203 <command>mknod</command>.
204 </para>
205
206 <para>
207 If you want to restore the dynamic devices, recreate the
208 <filename>/etc/rc.d/rcS.d/{S10udev,S50udev_retry}</filename> symbolic
209 links and reboot again. Static devices do not need to be removed
210 (console and null are always needed) because they are covered by the
211 <systemitem class="filesystem">tmpfs</systemitem> partition. Disk
212 usage for devices is negligible (about 20&ndash;30 bytes per entry.)
213 </para>
214
215 </sect2>
216
217 <sect2 id="dev-dvd">
218 <title>Devices for DVD Drives</title>
219
220 <para>
221 If the initial boot process does not set up the
222 <systemitem>/dev/dvd</systemitem> device properly, it can
223 be installed using the following modification to the default udev rules.
224 As the <systemitem class="username">root</systemitem> user, run:
225 </para>
226
227<screen><userinput>sed '1d;/SYMLINK.*cdrom/ a\
228KERNEL=="sr0", ENV{ID_CDROM_DVD}=="1", SYMLINK+="dvd", OPTIONS+="link_priority=-100"' \
229/lib/udev/rules.d/60-cdrom_id.rules > /etc/udev/rules.d/60-cdrom_id.rules</userinput></screen>
230
231 </sect2>
232
233</sect1>
Note: See TracBrowser for help on using the repository browser.