source: postlfs/config/devices.xml@ eede1a3

11.0 11.1 11.2 11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since eede1a3 was 45ab6c7, checked in by Xi Ruoyao <xry111@…>, 3 years ago

more SVN prop clean up

Remove "$LastChanged$" everywhere, and also some unused $Date$

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