From 16a83172114c3cec5bfdf9604c44f87a5ae7c62b Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 15 Oct 2015 09:41:11 +0800 Subject: [PATCH 1/5] Revert "translated" This reverts commit 6c146196cb80e9d14d31c1aa3ab5d0985c512fbe. --- ... about built-in kernel modules on Linux.md | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/translated/tech/20151012 Linux FAQs with Answers--How to find information about built-in kernel modules on Linux.md b/translated/tech/20151012 Linux FAQs with Answers--How to find information about built-in kernel modules on Linux.md index 3b37ef3c91..d816a975f7 100644 --- a/translated/tech/20151012 Linux FAQs with Answers--How to find information about built-in kernel modules on Linux.md +++ b/translated/tech/20151012 Linux FAQs with Answers--How to find information about built-in kernel modules on Linux.md @@ -1,40 +1,42 @@ -Linux有问必答--如何找出Linux中内置模块的信息 +translating----geekpi + +Linux FAQs with Answers--How to find information about built-in kernel modules on Linux ================================================================================ -> **提问**:我想要知道Linux系统中内核内置的模块,以及每个模块的参数。有什么方法可以得到内置模块和设备驱动的列表,以及它们的详细信息呢? +> **Question**: I would like to know what modules are built into the kernel of my Linux system, and what parameters are available in each module. Is there a way to get a list of all built-in kernel modules and device drivers, and find detailed information about them? -现代Linux内核正在随着时间迅速地增长来支持大量的硬件、文件系统和网络功能。在此期间,“可加载模块”的引入防止内核变得越来越臃肿,以及在不同的环境中灵活地扩展功能及硬件支持,而不必重新构建内核。 +The modern Linux kernel has been growing significantly over the years to support a wide variety of hardware devices, file systems and networking functions. During this time, "loadable kernel modules (LKM)" came into being in order to keep the kernel from getting bloated, while flexibly extending its capabilities and hardware support under different environments, without having to rebuild it. -最新的Linux发型版的内核只带了相对较小的“内置模块”,其余的特定硬件驱动或者自定义功能作为“可加载模块”来让你选择地加载或卸载。 +The Linux kernel shipped with the latest Linux distributions comes with relatively a small number of "built-in modules", while the rest of hardware-specific drivers or custom capabilities exist as "loadable modules" which you can selectively load or unload. -内置模块被静态地编译进了内核。不像可加载内核模块可以动态地使用modprobe、insmod、rmmod、modinfo或者lsmod等命令地加载、卸载、查询模块,内置的模块总是在启动是就加载进了内核,不会被这些命令管理。 +The built-in modules are statically compiled into the kernel. Unlike loadable kernel modules which can be dynamically loaded, unloaded, looked up or listed using commands like modprobe, insmod, rmmod, modinfo or lsmod, built-in kernel modules are always loaded in the kernel upon boot-up, and cannot be managed with these commands. -### 找出内置模块列表 ### +### Find a List of Built-in Kernel Modules ### -要得到内置模块列表,运行下面的命令。 +To get a list of all built-in modules, run the following command. $ cat /lib/modules/$(uname -r)/modules.builtin ![](https://farm1.staticflickr.com/697/21481933835_ef6b9c71e1_c.jpg) -你也可以用下面的命令来查看有哪些内置模块: +You can also get a hint on what modules are built-in by running: ![](https://farm6.staticflickr.com/5643/21295025949_57f5849c36_c.jpg) -### 找出内置模块参数 ### +### Find Parameters of Built-in Kernel Modules ### -每个内核模块无论是内置的还是可加载的都有一系列的参数。对于可加载模块,modinfo命令显示它们的参数信息。然而这个命令不对内置模块管用。你会得到下面的错误。 +Each kernel module, whether it's built-in or loadable, comes with a set of parameters. For loadable kernel modules, the modinfo command will show parameter information about them. However, this command will not work with built-in modules. You will simply get the following error. modinfo: ERROR: Module XXXXXX not found. -如果你想要查看内置模块的参数,以及它们的值,你可以在**/sys/module** 下检查它们的内容。 +If you want to check what parameters are available in a given built-in module, and what their values are, you can instead examine the content in **/sys/module** directory. -在 /sys/module目录下,你可以找到内核模块(包含内置和可加载的)命名的子目录。结合则进入每个模块目录,这里有个“parameters”目录,列出了这个模块所有的参数。 +Under /sys/module directory, you will find sub-directories named after existing kernel modules (both built-in and loadable). Then in each module directory, there is a directory named "parameters", which lists all available parameters for the module. -比如你要找出tcp_cubic(内核默认的TCP实现)模块的参数。你可以这么做: +For example, let's say you want to find out parameters of a built-in module called tcp_cubic (the default TCP implementation of the kernel). Then you can do this: $ ls /sys/module/tcp_cubic/parameters -接着阅读这个文件查看每个参数的值。 +And check the value of each parameter by reading a corresponding file. $ cat /sys/module/tcp_cubic/parameters/tcp_friendliness @@ -45,7 +47,7 @@ Linux有问必答--如何找出Linux中内置模块的信息 via: http://ask.xmodulo.com/find-information-builtin-kernel-modules-linux.html 作者:[Dan Nanni][a] -译者:[geekpi](https://github.com/geekpi) +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7a0670db88d5163da3d39783b5b122d7568d82fa Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 15 Oct 2015 09:47:57 +0800 Subject: [PATCH 2/5] Revert "Revert "translated"" This reverts commit 16a83172114c3cec5bfdf9604c44f87a5ae7c62b. --- ... about built-in kernel modules on Linux.md | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/translated/tech/20151012 Linux FAQs with Answers--How to find information about built-in kernel modules on Linux.md b/translated/tech/20151012 Linux FAQs with Answers--How to find information about built-in kernel modules on Linux.md index d816a975f7..3b37ef3c91 100644 --- a/translated/tech/20151012 Linux FAQs with Answers--How to find information about built-in kernel modules on Linux.md +++ b/translated/tech/20151012 Linux FAQs with Answers--How to find information about built-in kernel modules on Linux.md @@ -1,42 +1,40 @@ -translating----geekpi - -Linux FAQs with Answers--How to find information about built-in kernel modules on Linux +Linux有问必答--如何找出Linux中内置模块的信息 ================================================================================ -> **Question**: I would like to know what modules are built into the kernel of my Linux system, and what parameters are available in each module. Is there a way to get a list of all built-in kernel modules and device drivers, and find detailed information about them? +> **提问**:我想要知道Linux系统中内核内置的模块,以及每个模块的参数。有什么方法可以得到内置模块和设备驱动的列表,以及它们的详细信息呢? -The modern Linux kernel has been growing significantly over the years to support a wide variety of hardware devices, file systems and networking functions. During this time, "loadable kernel modules (LKM)" came into being in order to keep the kernel from getting bloated, while flexibly extending its capabilities and hardware support under different environments, without having to rebuild it. +现代Linux内核正在随着时间迅速地增长来支持大量的硬件、文件系统和网络功能。在此期间,“可加载模块”的引入防止内核变得越来越臃肿,以及在不同的环境中灵活地扩展功能及硬件支持,而不必重新构建内核。 -The Linux kernel shipped with the latest Linux distributions comes with relatively a small number of "built-in modules", while the rest of hardware-specific drivers or custom capabilities exist as "loadable modules" which you can selectively load or unload. +最新的Linux发型版的内核只带了相对较小的“内置模块”,其余的特定硬件驱动或者自定义功能作为“可加载模块”来让你选择地加载或卸载。 -The built-in modules are statically compiled into the kernel. Unlike loadable kernel modules which can be dynamically loaded, unloaded, looked up or listed using commands like modprobe, insmod, rmmod, modinfo or lsmod, built-in kernel modules are always loaded in the kernel upon boot-up, and cannot be managed with these commands. +内置模块被静态地编译进了内核。不像可加载内核模块可以动态地使用modprobe、insmod、rmmod、modinfo或者lsmod等命令地加载、卸载、查询模块,内置的模块总是在启动是就加载进了内核,不会被这些命令管理。 -### Find a List of Built-in Kernel Modules ### +### 找出内置模块列表 ### -To get a list of all built-in modules, run the following command. +要得到内置模块列表,运行下面的命令。 $ cat /lib/modules/$(uname -r)/modules.builtin ![](https://farm1.staticflickr.com/697/21481933835_ef6b9c71e1_c.jpg) -You can also get a hint on what modules are built-in by running: +你也可以用下面的命令来查看有哪些内置模块: ![](https://farm6.staticflickr.com/5643/21295025949_57f5849c36_c.jpg) -### Find Parameters of Built-in Kernel Modules ### +### 找出内置模块参数 ### -Each kernel module, whether it's built-in or loadable, comes with a set of parameters. For loadable kernel modules, the modinfo command will show parameter information about them. However, this command will not work with built-in modules. You will simply get the following error. +每个内核模块无论是内置的还是可加载的都有一系列的参数。对于可加载模块,modinfo命令显示它们的参数信息。然而这个命令不对内置模块管用。你会得到下面的错误。 modinfo: ERROR: Module XXXXXX not found. -If you want to check what parameters are available in a given built-in module, and what their values are, you can instead examine the content in **/sys/module** directory. +如果你想要查看内置模块的参数,以及它们的值,你可以在**/sys/module** 下检查它们的内容。 -Under /sys/module directory, you will find sub-directories named after existing kernel modules (both built-in and loadable). Then in each module directory, there is a directory named "parameters", which lists all available parameters for the module. +在 /sys/module目录下,你可以找到内核模块(包含内置和可加载的)命名的子目录。结合则进入每个模块目录,这里有个“parameters”目录,列出了这个模块所有的参数。 -For example, let's say you want to find out parameters of a built-in module called tcp_cubic (the default TCP implementation of the kernel). Then you can do this: +比如你要找出tcp_cubic(内核默认的TCP实现)模块的参数。你可以这么做: $ ls /sys/module/tcp_cubic/parameters -And check the value of each parameter by reading a corresponding file. +接着阅读这个文件查看每个参数的值。 $ cat /sys/module/tcp_cubic/parameters/tcp_friendliness @@ -47,7 +45,7 @@ And check the value of each parameter by reading a corresponding file. via: http://ask.xmodulo.com/find-information-builtin-kernel-modules-linux.html 作者:[Dan Nanni][a] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a7b6c7ee5c30001c34611715db24f8ebca5bf44d Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 15 Oct 2015 09:54:53 +0800 Subject: [PATCH 3/5] Revert "translated" This reverts commit c6ff7fc4596ef3a0ce963f720ac79c98f4174866. --- ... device permission permanently on Linux.md | 55 +++++++++++++++++++ ... device permission permanently on Linux.md | 54 ------------------ 2 files changed, 55 insertions(+), 54 deletions(-) create mode 100644 sources/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md delete mode 100644 translated/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md diff --git a/sources/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md b/sources/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md new file mode 100644 index 0000000000..4c07c48f90 --- /dev/null +++ b/sources/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md @@ -0,0 +1,55 @@ +translating----geekpi + +Linux FAQs with Answers--How to change USB device permission permanently on Linux +================================================================================ +> **Question**: I am trying to run gpsd on my Linux with a USB GPS receiver. However, I am getting the following errors from gpsd. +> +> gpsd[377]: gpsd:ERROR: read-only device open failed: Permission denied +> gpsd[377]: gpsd:ERROR: /dev/ttyUSB0: device activation failed. +> gpsd[377]: gpsd:ERROR: device open failed: Permission denied - retrying read-only +> +> Looks like gpsd does not have permission to access the USB device (/dev/ttyUSB0). How can I change its default permission mode permanently on Linux? + +When you run a process that wants to read or write to a USB device, the user/group of the process must have appropriate permission to do so. Of course you can change the permission of your USB device manually with chmod command, but such manual permission change will be temporary. The USB device will revert to its default permission mode when you reboot your Linux machine. + +![](https://farm6.staticflickr.com/5741/20848677843_202ff53303_c.jpg) + +As a permanent solution, you can create a udev-based USB permission rule which assigns any custom permission mode of your choice. Here is how to do it. + +First, you need to identify the vendorID and productID of your USB device. For that, use lsusb command. + + $ lsusb -vvv + +![](https://farm1.staticflickr.com/731/20848677743_39f76eb403_c.jpg) + +From the lsusb output, find your USB device's entry, and look for "idVendor" and "idProduct" fields. In this example, we have idVendor (0x067b) and idProduct (0x2303). + +Next, create a new udev rule as follows. + + $ sudo vi /etc/udev/rules.d/50-myusb.rules + +---------- + + SUBSYSTEMS=="usb", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", GROUP="users", MODE="0666" + +Replace "idVendor" and "idProduct" values with your own. **MODE="0666"** indicates the preferred permission of the USB device. + +Now reboot your machine or reload udev rules: + + $ sudo udevadm control --reload + +Then verify the permission of the USB device. + +![](https://farm1.staticflickr.com/744/21282872179_9a4a05d768_b.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/change-usb-device-permission-linux.html + +作者:[Dan Nanni][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/translated/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md b/translated/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md deleted file mode 100644 index 533bbfad5b..0000000000 --- a/translated/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md +++ /dev/null @@ -1,54 +0,0 @@ -Linux有问必答 -- 如何在LInux中永久修改USB设备权限 -================================================================================ -> **提问**:当我尝试在Linux中运行USB GPS接收器时我遇到了下面来自gpsd的错误。 -> -> gpsd[377]: gpsd:ERROR: read-only device open failed: Permission denied -> gpsd[377]: gpsd:ERROR: /dev/ttyUSB0: device activation failed. -> gpsd[377]: gpsd:ERROR: device open failed: Permission denied - retrying read-only -> -> 看上去gpsd没有权限访问USB设备(/dev/ttyUSB0)。我该如何永久修改它在Linux上的权限? - -当你在运行一个会读取或者写入USB设备的进程时,进程的用户/组必须有权限这么做。当然你可以手动用chmod命令改变USB设备的权限,但是手动的权限改变只是暂时的。USB设备会在下次重启时恢复它的默认权限。 - -![](https://farm6.staticflickr.com/5741/20848677843_202ff53303_c.jpg) - -作为一个永久的方式,你可以创建一个基于udev的USB权限规则,它可以根据你的选择分配任何权限模式。下面是该如何做。 - -首先,你需要找出USB设备的vendorID和productID。使用lsusb命令。 - - $ lsusb -vvv - -![](https://farm1.staticflickr.com/731/20848677743_39f76eb403_c.jpg) - -上面lsusb的输出中,找出你的USB设备,并找出"idVendor"和"idProduct"字段。本例中,我们的结果是idVendor (0x067b)和 idProduct (0x2303) - -下面创建一个新的udev规则。 - - $ sudo vi /etc/udev/rules.d/50-myusb.rules - ----------- - - SUBSYSTEMS=="usb", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", GROUP="users", MODE="0666" - -用你自己的"idVendor"和"idProduct"来替换。**MODE="0666"**表示USB设备的权限。 - -现在重启电脑并重新加载udev规则: - - $ sudo udevadm control --reload - -Then verify the permission of the USB device. -接着验证USB设备的权限。 - -![](https://farm1.staticflickr.com/744/21282872179_9a4a05d768_b.jpg) - --------------------------------------------------------------------------------- - -via: http://ask.xmodulo.com/change-usb-device-permission-linux.html - -作者:[Dan Nanni][a] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://ask.xmodulo.com/author/nanni From e35307ccec1bb7f4744cdf42998a280311b74fb2 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 15 Oct 2015 09:57:45 +0800 Subject: [PATCH 4/5] Update 20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md --- ... device permission permanently on Linux.md | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/sources/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md b/sources/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md index 4c07c48f90..533bbfad5b 100644 --- a/sources/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md +++ b/sources/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md @@ -1,30 +1,28 @@ -translating----geekpi - -Linux FAQs with Answers--How to change USB device permission permanently on Linux +Linux有问必答 -- 如何在LInux中永久修改USB设备权限 ================================================================================ -> **Question**: I am trying to run gpsd on my Linux with a USB GPS receiver. However, I am getting the following errors from gpsd. +> **提问**:当我尝试在Linux中运行USB GPS接收器时我遇到了下面来自gpsd的错误。 > > gpsd[377]: gpsd:ERROR: read-only device open failed: Permission denied > gpsd[377]: gpsd:ERROR: /dev/ttyUSB0: device activation failed. > gpsd[377]: gpsd:ERROR: device open failed: Permission denied - retrying read-only > -> Looks like gpsd does not have permission to access the USB device (/dev/ttyUSB0). How can I change its default permission mode permanently on Linux? +> 看上去gpsd没有权限访问USB设备(/dev/ttyUSB0)。我该如何永久修改它在Linux上的权限? -When you run a process that wants to read or write to a USB device, the user/group of the process must have appropriate permission to do so. Of course you can change the permission of your USB device manually with chmod command, but such manual permission change will be temporary. The USB device will revert to its default permission mode when you reboot your Linux machine. +当你在运行一个会读取或者写入USB设备的进程时,进程的用户/组必须有权限这么做。当然你可以手动用chmod命令改变USB设备的权限,但是手动的权限改变只是暂时的。USB设备会在下次重启时恢复它的默认权限。 ![](https://farm6.staticflickr.com/5741/20848677843_202ff53303_c.jpg) -As a permanent solution, you can create a udev-based USB permission rule which assigns any custom permission mode of your choice. Here is how to do it. +作为一个永久的方式,你可以创建一个基于udev的USB权限规则,它可以根据你的选择分配任何权限模式。下面是该如何做。 -First, you need to identify the vendorID and productID of your USB device. For that, use lsusb command. +首先,你需要找出USB设备的vendorID和productID。使用lsusb命令。 $ lsusb -vvv ![](https://farm1.staticflickr.com/731/20848677743_39f76eb403_c.jpg) -From the lsusb output, find your USB device's entry, and look for "idVendor" and "idProduct" fields. In this example, we have idVendor (0x067b) and idProduct (0x2303). +上面lsusb的输出中,找出你的USB设备,并找出"idVendor"和"idProduct"字段。本例中,我们的结果是idVendor (0x067b)和 idProduct (0x2303) -Next, create a new udev rule as follows. +下面创建一个新的udev规则。 $ sudo vi /etc/udev/rules.d/50-myusb.rules @@ -32,13 +30,14 @@ Next, create a new udev rule as follows. SUBSYSTEMS=="usb", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", GROUP="users", MODE="0666" -Replace "idVendor" and "idProduct" values with your own. **MODE="0666"** indicates the preferred permission of the USB device. +用你自己的"idVendor"和"idProduct"来替换。**MODE="0666"**表示USB设备的权限。 -Now reboot your machine or reload udev rules: +现在重启电脑并重新加载udev规则: $ sudo udevadm control --reload Then verify the permission of the USB device. +接着验证USB设备的权限。 ![](https://farm1.staticflickr.com/744/21282872179_9a4a05d768_b.jpg) @@ -47,7 +46,7 @@ Then verify the permission of the USB device. via: http://ask.xmodulo.com/change-usb-device-permission-linux.html 作者:[Dan Nanni][a] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 384797786e73419101306a134dd03bf2ea09cb79 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 15 Oct 2015 09:58:15 +0800 Subject: [PATCH 5/5] Rename sources/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md to translated/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md --- ...s--How to change USB device permission permanently on Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md (100%) diff --git a/sources/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md b/translated/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md similarity index 100% rename from sources/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md rename to translated/tech/20151012 Linux FAQs with Answers--How to change USB device permission permanently on Linux.md