symlinks.po 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. # SOME DESCRIPTIVE TITLE
  2. # Copyright (C) YEAR Free Software Foundation, Inc.
  3. # This file is distributed under the same license as the PACKAGE package.
  4. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
  5. #
  6. #, fuzzy
  7. msgid ""
  8. msgstr ""
  9. "Project-Id-Version: PACKAGE VERSION\n"
  10. "POT-Creation-Date: 2020-06-17 12:44+0800\n"
  11. "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  12. "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  13. "Language-Team: LANGUAGE <LL@li.org>\n"
  14. "Language: \n"
  15. "MIME-Version: 1.0\n"
  16. "Content-Type: text/plain; charset=UTF-8\n"
  17. "Content-Transfer-Encoding: 8bit\n"
  18. #. type: Content of: <sect1><title>
  19. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:11
  20. msgid "Managing Devices"
  21. msgstr ""
  22. #. type: Content of: <sect1><sect2><title>
  23. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:15
  24. msgid "Network Devices"
  25. msgstr ""
  26. #. type: Content of: <sect1><sect2><para>
  27. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:17
  28. msgid ""
  29. "Udev, by default, names network devices according to Firmware/BIOS data or "
  30. "physical characteristics like the bus, slot, or MAC address. The purpose of "
  31. "this naming convention is to ensure that network devices are named "
  32. "consistently and not based on the time the network card was discovered. For "
  33. "example, on a computer having two network cards made by Intel and Realtek, "
  34. "the network card manufactured by Intel may become eth0 and the Realtek card "
  35. "becomes eth1. In some cases, after a reboot the cards could get renumbered "
  36. "the other way around."
  37. msgstr ""
  38. #. type: Content of: <sect1><sect2><para>
  39. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:26
  40. msgid ""
  41. "In the new naming scheme, typical network device names would then be "
  42. "something like enp5s0 or wlp3s0. If this naming convention is not desired, "
  43. "the traditional naming scheme or a custom scheme can be implemented."
  44. msgstr ""
  45. #. type: Content of: <sect1><sect2><sect3><title>
  46. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:32
  47. msgid "Disabling Persistent Naming on the Kernel Command Line"
  48. msgstr ""
  49. #. type: Content of: <sect1><sect2><sect3><para>
  50. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:34
  51. msgid ""
  52. "The traditional naming scheme using eth0, eth1, etc can be restored by "
  53. "adding <userinput>net.ifnames=0</userinput> on the kernel command line. "
  54. "This is most appropriate for those systems that have only one ethernet "
  55. "device of the same type. Laptops often have multiple ethernet connections "
  56. "that are named eth0 and wlan0 and are also candidates for this method. The "
  57. "command line is passed in the GRUB configuration file. See <xref "
  58. "linkend=\"grub-cfg\"/>."
  59. msgstr ""
  60. #. type: Content of: <sect1><sect2><sect3><title>
  61. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:45
  62. msgid "Creating Custom Udev Rules"
  63. msgstr ""
  64. #. type: Content of: <sect1><sect2><sect3><para>
  65. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:47
  66. msgid ""
  67. "The naming scheme can be customized by creating custom udev rules. A script "
  68. "has been included that generates the initial rules. Generate these rules by "
  69. "running:"
  70. msgstr ""
  71. #. type: Content of: <sect1><sect2><sect3><screen>
  72. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:51
  73. #, no-wrap
  74. msgid "<userinput>bash /lib/udev/init-net-rules.sh</userinput>"
  75. msgstr ""
  76. #. type: Content of: <sect1><sect2><sect3><para>
  77. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:53
  78. msgid ""
  79. "Now, inspect the "
  80. "<filename>/etc/udev/rules.d/70-persistent-net.rules</filename> file, to find "
  81. "out which name was assigned to which network device:"
  82. msgstr ""
  83. #. type: Content of: <sect1><sect2><sect3><screen>
  84. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:57
  85. #, no-wrap
  86. msgid "<userinput>cat /etc/udev/rules.d/70-persistent-net.rules</userinput>"
  87. msgstr ""
  88. #. type: Content of: <sect1><sect2><sect3><note><para>
  89. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:59
  90. msgid ""
  91. "In some cases such as when MAC addresses have been assigned to a network "
  92. "card manually or in a virtual environment such as Qemu or Xen, the network "
  93. "rules file may not have been generated because addresses are not "
  94. "consistently assigned. In these cases, this method cannot be used."
  95. msgstr ""
  96. #. type: Content of: <sect1><sect2><sect3><para>
  97. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:65
  98. msgid ""
  99. "The file begins with a comment block followed by two lines for each NIC. The "
  100. "first line for each NIC is a commented description showing its hardware IDs "
  101. "(e.g. its PCI vendor and device IDs, if it's a PCI card), along with its "
  102. "driver in parentheses, if the driver can be found. Neither the hardware ID "
  103. "nor the driver is used to determine which name to give an interface; this "
  104. "information is only for reference. The second line is the udev rule that "
  105. "matches this NIC and actually assigns it a name."
  106. msgstr ""
  107. #. type: Content of: <sect1><sect2><sect3><para>
  108. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:73
  109. msgid ""
  110. "All udev rules are made up of several keys, separated by commas and optional "
  111. "whitespace. This rule's keys and an explanation of each of them are as "
  112. "follows:"
  113. msgstr ""
  114. #. type: Content of: <sect1><sect2><sect3><itemizedlist><listitem><para>
  115. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:79
  116. msgid ""
  117. "<literal>SUBSYSTEM==\"net\"</literal> - This tells udev to ignore devices "
  118. "that are not network cards."
  119. msgstr ""
  120. #. type: Content of: <sect1><sect2><sect3><itemizedlist><listitem><para>
  121. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:83
  122. msgid ""
  123. "<literal>ACTION==\"add\"</literal> - This tells udev to ignore this rule for "
  124. "a uevent that isn't an add (\"remove\" and \"change\" uevents also happen, "
  125. "but don't need to rename network interfaces)."
  126. msgstr ""
  127. #. type: Content of: <sect1><sect2><sect3><itemizedlist><listitem><para>
  128. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:88
  129. msgid ""
  130. "<literal>DRIVERS==\"?*\"</literal> - This exists so that udev will ignore "
  131. "VLAN or bridge sub-interfaces (because these sub-interfaces do not have "
  132. "drivers). These sub-interfaces are skipped because the name that would be "
  133. "assigned would collide with their parent devices."
  134. msgstr ""
  135. #. type: Content of: <sect1><sect2><sect3><itemizedlist><listitem><para>
  136. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:94
  137. msgid ""
  138. "<literal>ATTR{address}</literal> - The value of this key is the NIC's MAC "
  139. "address."
  140. msgstr ""
  141. #. type: Content of: <sect1><sect2><sect3><itemizedlist><listitem><para>
  142. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:98
  143. msgid ""
  144. "<literal>ATTR{type}==\"1\"</literal> - This ensures the rule only matches "
  145. "the primary interface in the case of certain wireless drivers which create "
  146. "multiple virtual interfaces. The secondary interfaces are skipped for the "
  147. "same reason that VLAN and bridge sub-interfaces are skipped: there would be "
  148. "a name collision otherwise."
  149. msgstr ""
  150. #. type: Content of: <sect1><sect2><sect3><itemizedlist><listitem><para>
  151. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:105
  152. msgid ""
  153. "<literal>NAME</literal> - The value of this key is the name that udev will "
  154. "assign to this interface."
  155. msgstr ""
  156. #. type: Content of: <sect1><sect2><sect3><para>
  157. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:110
  158. msgid ""
  159. "The value of <literal>NAME</literal> is the important part. Make sure you "
  160. "know which name has been assigned to each of your network cards before "
  161. "proceeding, and be sure to use that <literal>NAME</literal> value when "
  162. "creating your configuration files below."
  163. msgstr ""
  164. #. type: Content of: <sect1><sect2><title>
  165. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:121
  166. msgid "CD-ROM symlinks"
  167. msgstr ""
  168. #. type: Content of: <sect1><sect2><para>
  169. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:123
  170. msgid ""
  171. "Some software that you may want to install later (e.g., various media "
  172. "players) expect the <filename class=\"symlink\">/dev/cdrom</filename> and "
  173. "<filename class=\"symlink\">/dev/dvd</filename> symlinks to exist, and to "
  174. "point to a CD-ROM or DVD-ROM device. Also, it may be convenient to put "
  175. "references to those symlinks into <filename>/etc/fstab</filename>. Udev "
  176. "comes with a script that will generate rules files to create these symlinks "
  177. "for you, depending on the capabilities of each device, but you need to "
  178. "decide which of two modes of operation you wish to have the script use."
  179. msgstr ""
  180. #. type: Content of: <sect1><sect2><para>
  181. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:132
  182. msgid ""
  183. "First, the script can operate in <quote>by-path</quote> mode (used by "
  184. "default for USB and FireWire devices), where the rules it creates depend on "
  185. "the physical path to the CD or DVD device. Second, it can operate in "
  186. "<quote>by-id</quote> mode (default for IDE and SCSI devices), where the "
  187. "rules it creates depend on identification strings stored on the CD or DVD "
  188. "device itself. The path is determined by udev's <command>path_id</command> "
  189. "script, and the identification strings are read from the hardware by its "
  190. "<command>ata_id</command> or <command>scsi_id</command> programs, depending "
  191. "on which type of device you have."
  192. msgstr ""
  193. #. type: Content of: <sect1><sect2><para>
  194. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:142
  195. msgid ""
  196. "There are advantages to each approach; the correct approach to use will "
  197. "depend on what kinds of device changes may happen. If you expect the "
  198. "physical path to the device (that is, the ports and/or slots that it plugs "
  199. "into) to change, for example because you plan on moving the drive to a "
  200. "different IDE port or a different USB connector, then you should use the "
  201. "<quote>by-id</quote> mode. On the other hand, if you expect the device's "
  202. "identification to change, for example because it may die, and you would "
  203. "replace it with a different device with the same capabilities and which is "
  204. "plugged into the same connectors, then you should use the "
  205. "<quote>by-path</quote> mode."
  206. msgstr ""
  207. #. type: Content of: <sect1><sect2><para>
  208. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:153
  209. msgid ""
  210. "If either type of change is possible with your drive, then choose a mode "
  211. "based on the type of change you expect to happen more often."
  212. msgstr ""
  213. #. type: Content of: <sect1><sect2><important><para>
  214. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:159
  215. msgid ""
  216. "External devices (for example, a USB-connected CD drive) should not use "
  217. "by-path persistence, because each time the device is plugged into a new "
  218. "external port, its physical path will change. All externally-connected "
  219. "devices will have this problem if you write udev rules to recognize them by "
  220. "their physical path; the problem is not limited to CD and DVD drives."
  221. msgstr ""
  222. #. type: Content of: <sect1><sect2><para>
  223. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:166
  224. msgid ""
  225. "If you wish to see the values that the udev scripts will use, then for the "
  226. "appropriate CD-ROM device, find the corresponding directory under <filename "
  227. "class=\"directory\">/sys</filename> (e.g., this can be <filename "
  228. "class=\"directory\">/sys/block/hdd</filename>) and run a command similar to "
  229. "the following:"
  230. msgstr ""
  231. #. type: Content of: <sect1><sect2><screen>
  232. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:172
  233. #, no-wrap
  234. msgid "<userinput>udevadm test /sys/block/hdd</userinput>"
  235. msgstr ""
  236. #. type: Content of: <sect1><sect2><para>
  237. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:174
  238. msgid ""
  239. "Look at the lines containing the output of various *_id programs. The "
  240. "<quote>by-id</quote> mode will use the ID_SERIAL value if it exists and is "
  241. "not empty, otherwise it will use a combination of ID_MODEL and "
  242. "ID_REVISION. The <quote>by-path</quote> mode will use the ID_PATH value."
  243. msgstr ""
  244. #. type: Content of: <sect1><sect2><para>
  245. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:179
  246. msgid ""
  247. "If the default mode is not suitable for your situation, then the following "
  248. "modification can be made to the "
  249. "<filename>/etc/udev/rules.d/83-cdrom-symlinks.rules</filename> file, as "
  250. "follows (where <replaceable>mode</replaceable> is one of "
  251. "<quote>by-id</quote> or <quote>by-path</quote>):"
  252. msgstr ""
  253. #. type: Content of: <sect1><sect2><screen>
  254. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:185
  255. #, no-wrap
  256. msgid ""
  257. "<userinput>sed -e 's/\"write_cd_rules\"/\"write_cd_rules "
  258. "<replaceable>mode</replaceable>\"/' \\\n"
  259. " -i /etc/udev/rules.d/83-cdrom-symlinks.rules</userinput>"
  260. msgstr ""
  261. #. type: Content of: <sect1><sect2><para>
  262. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:188
  263. msgid ""
  264. "Note that it is not necessary to create the rules files or symlinks at this "
  265. "time because you have bind-mounted the host's <filename "
  266. "class=\"directory\">/dev</filename> directory into the LFS system and we "
  267. "assume the symlinks exist on the host. The rules and symlinks will be "
  268. "created the first time you boot your LFS system."
  269. msgstr ""
  270. #. type: Content of: <sect1><sect2><para>
  271. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:194
  272. msgid ""
  273. "However, if you have multiple CD-ROM devices, then the symlinks generated at "
  274. "that time may point to different devices than they point to on your host "
  275. "because devices are not discovered in a predictable order. The assignments "
  276. "created when you first boot the LFS system will be stable, so this is only "
  277. "an issue if you need the symlinks on both systems to point to the same "
  278. "device. If you need that, then inspect (and possibly edit) the generated "
  279. "<filename>/etc/udev/rules.d/70-persistent-cd.rules</filename> file after "
  280. "booting, to make sure the assigned symlinks match what you need."
  281. msgstr ""
  282. #. type: Content of: <sect1><sect2><title>
  283. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:207
  284. msgid "Dealing with duplicate devices"
  285. msgstr ""
  286. #. type: Content of: <sect1><sect2><para>
  287. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:209
  288. msgid ""
  289. "As explained in <xref linkend=\"ch-config-udev\"/>, the order in which "
  290. "devices with the same function appear in <filename "
  291. "class=\"directory\">/dev</filename> is essentially random. E.g., if you "
  292. "have a USB web camera and a TV tuner, sometimes "
  293. "<filename>/dev/video0</filename> refers to the camera and "
  294. "<filename>/dev/video1</filename> refers to the tuner, and sometimes after a "
  295. "reboot the order changes. For all classes of hardware except sound cards "
  296. "and network cards, this is fixable by creating udev rules for custom "
  297. "persistent symlinks. The case of network cards is covered separately in "
  298. "<xref linkend=\"ch-config-network\"/>, and sound card configuration can be "
  299. "found in <ulink url=\"&blfs-book;postlfs/devices.html\">BLFS</ulink>."
  300. msgstr ""
  301. #. type: Content of: <sect1><sect2><para>
  302. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:222
  303. msgid ""
  304. "For each of your devices that is likely to have this problem (even if the "
  305. "problem doesn't exist in your current Linux distribution), find the "
  306. "corresponding directory under <filename "
  307. "class=\"directory\">/sys/class</filename> or <filename "
  308. "class=\"directory\">/sys/block</filename>. For video devices, this may be "
  309. "<filename "
  310. "class=\"directory\">/sys/class/video4linux/video<replaceable>X</replaceable></filename>. "
  311. "Figure out the attributes that identify the device uniquely (usually, vendor "
  312. "and product IDs and/or serial numbers work):"
  313. msgstr ""
  314. #. type: Content of: <sect1><sect2><screen>
  315. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:233
  316. #, no-wrap
  317. msgid "<userinput>udevadm info -a -p /sys/class/video4linux/video0</userinput>"
  318. msgstr ""
  319. #. type: Content of: <sect1><sect2><para>
  320. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:235
  321. msgid "Then write rules that create the symlinks, e.g.:"
  322. msgstr ""
  323. #. type: Content of: <sect1><sect2><screen>
  324. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:237
  325. #, no-wrap
  326. msgid ""
  327. "<userinput>cat &gt; /etc/udev/rules.d/83-duplicate_devs.rules &lt;&lt; "
  328. "\"EOF\"\n"
  329. "<literal>\n"
  330. "# Persistent symlinks for webcam and tuner\n"
  331. "KERNEL==\"video*\", ATTRS{idProduct}==\"1910\", ATTRS{idVendor}==\"0d81\", "
  332. "SYMLINK+=\"webcam\"\n"
  333. "KERNEL==\"video*\", ATTRS{device}==\"0x036f\", ATTRS{vendor}==\"0x109e\", "
  334. "SYMLINK+=\"tvtuner\"\n"
  335. "</literal>\n"
  336. "EOF</userinput>"
  337. msgstr ""
  338. #. type: Content of: <sect1><sect2><para>
  339. #: /home/xry111/svn-repos/LFS-BOOK/chapter09/symlinks.xml:245
  340. msgid ""
  341. "The result is that <filename>/dev/video0</filename> and "
  342. "<filename>/dev/video1</filename> devices still refer randomly to the tuner "
  343. "and the web camera (and thus should never be used directly), but there are "
  344. "symlinks <filename>/dev/tvtuner</filename> and "
  345. "<filename>/dev/webcam</filename> that always point to the correct device."
  346. msgstr ""