Exercise 27.1 - udev
I'm not having any luck trying to get the "myusb" symlink to show up in /dev
.
I have double-checked that the rules file is in the correct location (/etc/udev/rules.d
) with the correct name and syntax. I have confirmed that the USB stick is being detected by monitoring dmesg. I have even reloaded udev with udevadm control --reload
.
I'm not sure what else to do.
Comments
-
I just ran the exercise on a RHEL 8 system and it worked perfectly. Can you please tell us what Distribution you are using (name and version) and whether or not this is a physical machine or a virtual machine under a hypervisor. If it is a VM there are a bunch of reasons the USB stick could not be passed through to the VM that have to do with hypervisor settings.
0 -
Hi coop, this is a physical machine and the dynamic hardware detection is working OK, the USB stick is being mounted.
I am using Linux Mint 19.3 and the output of
uname -a
is:
Linux ZeroGravitas 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux0 -
I have no idea and I do not have any ubuntu-based physical machine to test with. I'm sure you have tried a reboot and the --reload command should have accomplished this anyway. It's possible it is a kernel configuration problem, but I doubt that is true as you are using the Mint-supplied kernel. or a systemd problem.
0 -
Hi @herecomesbrod ,
I don't have any Mint system, but I have Ubuntu 18.04, and it looks like it's kind of similar to your distro (somewhere in the middle of your Mint version).
So, with the new udev rule in place, when you connect a usb device, you will be able to see the value you specified in the "SYMLINK+=" parameter, as here:
luis@ubuntu18server:/etc/udev/rules.d$ ls -l /dev/myusb
lrwxrwxrwx 1 root root 15 Kun 24 10:45 /dev/myusb -> bus/usb/001/003Then you unmount the usb device, remove the udev rule, and connect the usb device again. This time you won't get any "myusb" device on /dev/ :
luis@ubuntu18server:/etc/udev/rules.d$ ls -l /dev/my*
ls: cannot access '/dev/my*': No such file or directoryI hope that helps.
Regards,
Luis.0 -
Thanks for your response Luis.
I have already done what you suggested, but it doesn't work. Please see the following. Note that the USB stick is identified as sdc1:
steve@ZeroGravitas:/etc/udev/rules.d$ ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 Jul 24 17:53 /dev/sda
brw-rw---- 1 root disk 8, 1 Jul 24 17:54 /dev/sda1
brw-rw---- 1 root disk 8, 10 Jul 24 17:54 /dev/sda10
brw-rw---- 1 root disk 8, 2 Jul 24 17:53 /dev/sda2
brw-rw---- 1 root disk 8, 3 Jul 24 17:53 /dev/sda3
brw-rw---- 1 root disk 8, 4 Jul 24 17:53 /dev/sda4
brw-rw---- 1 root disk 8, 5 Jul 24 17:53 /dev/sda5
brw-rw---- 1 root disk 8, 6 Jul 24 17:53 /dev/sda6
brw-rw---- 1 root disk 8, 7 Jul 24 17:53 /dev/sda7
brw-rw---- 1 root disk 8, 8 Jul 24 17:53 /dev/sda8
brw-rw---- 1 root disk 8, 9 Jul 24 17:53 /dev/sda9
brw-rw---- 1 root disk 8, 16 Jul 24 17:59 /dev/sdb
steve@ZeroGravitas:/etc/udev/rules.d$
steve@ZeroGravitas:/etc/udev/rules.d$ cat 80-usb_altname.rules
SUBSYSTEM=="usb”, SYMLINK+=”myusb”
< NOW I INSERT THE USB STICK >
steve@ZeroGravitas:/etc/udev/rules.d$ ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 Jul 24 17:53 /dev/sda
brw-rw---- 1 root disk 8, 1 Jul 24 17:54 /dev/sda1
brw-rw---- 1 root disk 8, 10 Jul 24 17:54 /dev/sda10
brw-rw---- 1 root disk 8, 2 Jul 24 17:53 /dev/sda2
brw-rw---- 1 root disk 8, 3 Jul 24 17:53 /dev/sda3
brw-rw---- 1 root disk 8, 4 Jul 24 17:53 /dev/sda4
brw-rw---- 1 root disk 8, 5 Jul 24 17:53 /dev/sda5
brw-rw---- 1 root disk 8, 6 Jul 24 17:53 /dev/sda6
brw-rw---- 1 root disk 8, 7 Jul 24 17:53 /dev/sda7
brw-rw---- 1 root disk 8, 8 Jul 24 17:53 /dev/sda8
brw-rw---- 1 root disk 8, 9 Jul 24 17:53 /dev/sda9
brw-rw---- 1 root disk 8, 16 Jul 24 18:03 /dev/sdb
brw-rw---- 1 root disk 8, 32 Jul 24 18:03 /dev/sdc
brw-rw---- 1 root disk 8, 33 Jul 24 18:03 /dev/sdc1
steve@ZeroGravitas:/etc/udev/rules.d$ ls -l /dev/myusb
ls: cannot access '/dev/myusb': No such file or directory0 -
Hi @herecomesbrod ,
Please try naming the .rule file as follows: -.rules , in this case: 80-myusb.rules. I'm still researching on the need for this.
Regards,
Luis.0 -
Hi Luis,
I tried renaming the rules file to
80-myusb.rules
as advised, rebooted and inserted the USB stick, but it still is not creating the symlink in/dev
.0 -
Hi @herecomesbrod ,
That sounds weird, because I did exactly the same test case. The only last thing that comes to my mind, is to check the "udev" service, as it has to be running for this to work:
luis@ubuntu18server:~$ sudo systemctl status udev
● systemd-udevd.service - udev Kernel Device Manager
Loaded: loaded (/lib/systemd/system/systemd-udevd.service; static; vendor pres
Active: active (running) since Sat 2020-07-25 14:32:42 -05; 1min 18s ago
Docs: man:systemd-udevd.service(8)
man:udev(7)
Main PID: 315 (systemd-udevd)
Status: "Processing with 10 children at max"
Tasks: 1
CGroup: /system.slice/systemd-udevd.service
└─315 /lib/systemd/systemd-udevdKun 25 14:32:42 ubuntu18server systemd[1]: Started udev Kernel Device Manager.
Kun 25 14:32:46 ubuntu18server systemd-udevd[337]: link_config: autonegotiation i
Kun 25 14:32:46 ubuntu18server mtp-probe[739]: checking bus 2, device 2: "/sys/de
Kun 25 14:32:46 ubuntu18server mtp-probe[739]: bus: 2, device: 2 was not an MTP d
Kun 25 14:32:48 ubuntu18server systemd-udevd[346]: link_config: autonegotiation i
Kun 25 14:32:56 ubuntu18server systemd-udevd[1556]: link_config: autonegotiation
Kun 25 14:32:56 ubuntu18server systemd-udevd[1555]: link_config: autonegotiation
Kun 25 14:32:56 ubuntu18server systemd-udevd[1555]: Could not generate persistent
Warning: Journal has been rotated since unit was started. [...]Regards,
Luis.0 -
minor point -- on RHEL you have to do "systemctl status systemd-udevd.service" (not just udevd) I really don't have an answer for why it works fine for me and Luis, it has something to do with your system setup or kernel.
0 -
I have found the problem.
I used the
od
utility to check the contents of the rules file and found that some of the quote (") characters had a different character code:steve@ZeroGravitas:~$ od -c /etc/udev/rules.d/80-myusb.rules
0000000 S U B S Y S T E M = = " u s b 342
0000020 200 235 , S Y M L I N K + = 342 200 235
0000040 m y u s b 342 200 235 \n \n
0000052
I deleted the text, retyped it and checked again:
steve@ZeroGravitas:~$ od -c /etc/udev/rules.d/80-myusb.rules
0000000 S U B S Y S T E M = = " u s b "
0000020 , S Y M L I N K + = " m y u s
0000040 b " \n \n
0000044
I restarted the udev service, plugged in the USB stick and the symlink appeared in
/dev
.Not sure how the weird characters got in the rules file - I use nano for editing.
Thanks for your help.
1 -
This kind of thing can happen when people cut and paste from either pdfs or word processor documents like .docx or even google docs. If you typed it by hand, it falls in the realm of "some mysteries are not understood by modern science."
1 -
Oh, I remember I saw it many years ago when somebody copied a text on Windows. In fact I copied the text from the pdf file and I didn't hit the issue.
I'm glad it's solved now
Regards,
Luis.0 -
I don't know if we warn people enough in this course in the intro chapter, but cut and paste from pdfs causes countless problems and should be avoided by the plague. In particular quote characters (such as ' ") and the backquote (`) are often screwed up, and usually invisibly. NEVER DO THIS And it really does not have much to do with if it is coming from Windows are not, although it does depend on the pdf reader -- evince works much better than acroread which should never ever be used in any circumstance as it is rather defective, probably by design.
We have had this problem repeatedly in many courses, especially the Kubernetes ones and no matter how much we tell people not to do this is a perpetual issue.
1 -
Oh, Acrobat Reader works worse because it hasn't been updated in many years for Linux. But yes, typing is large better. For other scenarios when the text is larger, let's say any yaml file, pasting it to a simple text editor and copying from there may help.
Many regards,
Luis.0 -
I don't even know if it is possible to get acroread for Linux as there has been an updated version for years and Adobe itself does not provide it any more for download. I personally have not seen it anywhere for a long long time
But Acrobat Reader is also defective in Windows at least as far as cut and paste goes. Do not use it for that purpose. To read documents fine, but that is all it is good for
1 -
Hi Luis and coop,
I am aware of the problems with cut-and-paste from word processing applications, so wouldn't normally do that - maybe I just had a blank moment.
FWIW I am not a fan of Adobe software, including Acrobat Reader, having spent many hours watching it install or update at the speed of grass growing and hoovering up system resources like it was on a supercomputer :-)
1
Categories
- All Categories
- 167 LFX Mentorship
- 219 LFX Mentorship: Linux Kernel
- 795 Linux Foundation IT Professional Programs
- 355 Cloud Engineer IT Professional Program
- 179 Advanced Cloud Engineer IT Professional Program
- 82 DevOps Engineer IT Professional Program
- 127 Cloud Native Developer IT Professional Program
- 112 Express Training Courses
- 112 Express Courses - Discussion Forum
- 6.2K Training Courses
- 48 LFC110 Class Forum - Discontinued
- 17 LFC131 Class Forum
- 35 LFD102 Class Forum
- 227 LFD103 Class Forum
- 14 LFD110 Class Forum
- 39 LFD121 Class Forum
- 15 LFD133 Class Forum
- 7 LFD134 Class Forum
- 17 LFD137 Class Forum
- 63 LFD201 Class Forum
- 3 LFD210 Class Forum
- 5 LFD210-CN Class Forum
- 2 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum - Discontinued
- 1 LFD233 Class Forum
- 2 LFD237 Class Forum
- 23 LFD254 Class Forum
- 697 LFD259 Class Forum
- 109 LFD272 Class Forum
- 3 LFD272-JP クラス フォーラム
- 10 LFD273 Class Forum
- 152 LFS101 Class Forum
- 1 LFS111 Class Forum
- 1 LFS112 Class Forum
- 1 LFS116 Class Forum
- 1 LFS118 Class Forum
- LFS120 Class Forum
- 7 LFS142 Class Forum
- 7 LFS144 Class Forum
- 3 LFS145 Class Forum
- 1 LFS146 Class Forum
- 3 LFS147 Class Forum
- 1 LFS148 Class Forum
- 15 LFS151 Class Forum
- 1 LFS157 Class Forum
- 33 LFS158 Class Forum
- 8 LFS162 Class Forum
- 1 LFS166 Class Forum
- 1 LFS167 Class Forum
- 3 LFS170 Class Forum
- 2 LFS171 Class Forum
- 1 LFS178 Class Forum
- 1 LFS180 Class Forum
- 1 LFS182 Class Forum
- 1 LFS183 Class Forum
- 29 LFS200 Class Forum
- 736 LFS201 Class Forum - Discontinued
- 2 LFS201-JP クラス フォーラム
- 14 LFS203 Class Forum
- 102 LFS207 Class Forum
- 1 LFS207-DE-Klassenforum
- 1 LFS207-JP クラス フォーラム
- 301 LFS211 Class Forum
- 55 LFS216 Class Forum
- 48 LFS241 Class Forum
- 42 LFS242 Class Forum
- 37 LFS243 Class Forum
- 15 LFS244 Class Forum
- LFS245 Class Forum
- LFS246 Class Forum
- 50 LFS250 Class Forum
- 1 LFS250-JP クラス フォーラム
- LFS251 Class Forum
- 154 LFS253 Class Forum
- LFS254 Class Forum
- LFS255 Class Forum
- 5 LFS256 Class Forum
- 1 LFS257 Class Forum
- 1.3K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 111 LFS260 Class Forum
- 159 LFS261 Class Forum
- 41 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 20 LFS267 Class Forum
- 24 LFS268 Class Forum
- 29 LFS269 Class Forum
- 1 LFS270 Class Forum
- 199 LFS272 Class Forum
- 1 LFS272-JP クラス フォーラム
- LFS274 Class Forum
- 3 LFS281 Class Forum
- 9 LFW111 Class Forum
- 260 LFW211 Class Forum
- 182 LFW212 Class Forum
- 13 SKF100 Class Forum
- 1 SKF200 Class Forum
- 1 SKF201 Class Forum
- 782 Hardware
- 198 Drivers
- 68 I/O Devices
- 37 Monitors
- 96 Multimedia
- 174 Networking
- 91 Printers & Scanners
- 83 Storage
- 743 Linux Distributions
- 80 Debian
- 67 Fedora
- 15 Linux Mint
- 13 Mageia
- 23 openSUSE
- 143 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 348 Ubuntu
- 461 Linux System Administration
- 39 Cloud Computing
- 70 Command Line/Scripting
- Github systems admin projects
- 90 Linux Security
- 77 Network Management
- 101 System Management
- 46 Web Management
- 64 Mobile Computing
- 17 Android
- 34 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 371 Off Topic
- 114 Introductions
- 174 Small Talk
- 19 Study Material
- 507 Programming and Development
- 285 Kernel Development
- 204 Software Development
- 1.8K Software
- 211 Applications
- 180 Command Line
- 3 Compiling/Installing
- 405 Games
- 309 Installation
- 97 All In Program
- 97 All In Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)