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
- 51 LFX Mentorship
- 104 LFX Mentorship: Linux Kernel
- 576 Linux Foundation IT Professional Programs
- 304 Cloud Engineer IT Professional Program
- 125 Advanced Cloud Engineer IT Professional Program
- 53 DevOps Engineer IT Professional Program
- 61 Cloud Native Developer IT Professional Program
- 5 Express Training Courses
- 5 Express Courses - Discussion Forum
- 2.1K Training Courses
- 19 LFC110 Class Forum
- 7 LFC131 Class Forum
- 27 LFD102 Class Forum
- 158 LFD103 Class Forum
- 20 LFD121 Class Forum
- 1 LFD137 Class Forum
- 61 LFD201 Class Forum
- 1 LFD210 Class Forum
- LFD210-CN Class Forum
- 1 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum
- LFD237 Class Forum
- 23 LFD254 Class Forum
- 611 LFD259 Class Forum
- 105 LFD272 Class Forum
- 1 LFD272-JP クラス フォーラム
- 1 LFD273 Class Forum
- 2 LFS145 Class Forum
- 25 LFS200 Class Forum
- 739 LFS201 Class Forum
- 1 LFS201-JP クラス フォーラム
- 11 LFS203 Class Forum
- 75 LFS207 Class Forum
- 300 LFS211 Class Forum
- 54 LFS216 Class Forum
- 47 LFS241 Class Forum
- 41 LFS242 Class Forum
- 37 LFS243 Class Forum
- 11 LFS244 Class Forum
- 37 LFS250 Class Forum
- 1 LFS250-JP クラス フォーラム
- LFS251 Class Forum
- 141 LFS253 Class Forum
- LFS254 Class Forum
- 1.1K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 93 LFS260 Class Forum
- 132 LFS261 Class Forum
- 33 LFS262 Class Forum
- 80 LFS263 Class Forum
- 15 LFS264 Class Forum
- 11 LFS266 Class Forum
- 18 LFS267 Class Forum
- 18 LFS268 Class Forum
- 23 LFS269 Class Forum
- 203 LFS272 Class Forum
- 1 LFS272-JP クラス フォーラム
- LFS274 Class Forum
- LFS281 Class Forum
- 236 LFW211 Class Forum
- 172 LFW212 Class Forum
- 7 SKF100 Class Forum
- SKF200 Class Forum
- 903 Hardware
- 219 Drivers
- 74 I/O Devices
- 44 Monitors
- 116 Multimedia
- 209 Networking
- 101 Printers & Scanners
- 85 Storage
- 763 Linux Distributions
- 88 Debian
- 66 Fedora
- 15 Linux Mint
- 13 Mageia
- 24 openSUSE
- 142 Red Hat Enterprise
- 33 Slackware
- 13 SUSE Enterprise
- 357 Ubuntu
- 479 Linux System Administration
- 41 Cloud Computing
- 70 Command Line/Scripting
- Github systems admin projects
- 95 Linux Security
- 78 Network Management
- 108 System Management
- 49 Web Management
- 68 Mobile Computing
- 23 Android
- 30 Development
- 1.2K New to Linux
- 1.1K Getting Started with Linux
- 538 Off Topic
- 131 Introductions
- 217 Small Talk
- 22 Study Material
- 826 Programming and Development
- 278 Kernel Development
- 514 Software Development
- 928 Software
- 260 Applications
- 184 Command Line
- 3 Compiling/Installing
- 76 Games
- 316 Installation
- 61 All In Program
- 61 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)