1

To troubleshoot driver issues I decided on renaming

/etc/udev/rules.d

into

/etc/udev/rules.d.gold

A brilliant idea, because now I am unable to revert my changes:

mkdir: cannot create directory rules.d : file exists

original state

ls -la
total 32
drwxr-xr-x   4 root root  4096 Fev  8 12:50 .
drwxr-xr-x 150 root root 12288 Fev  8 11:15 ..
drwxr-xr-x   2 root root  4096 Abr 12  2016 hwdb.d
-rw-r--r--   1 user user   435 Dez 14  2017 rules.d        <- A FILE
drwxr-xr-x   2 root root  4096 Fev  5 18:59 rules.d        <- A FOLDER
-rw-r--r--   1 root root   153 Abr 12  2016 udev.conf

current state

ls -la
total 32
drwxr-xr-x   4 root root  4096 Fev  8 12:50 .
drwxr-xr-x 150 root root 12288 Fev  8 11:15 ..
drwxr-xr-x   2 root root  4096 Abr 12  2016 hwdb.d
-rw-r--r--   1 user user   435 Dez 14  2017 rules.d        <- A FILE
drwxr-xr-x   2 root root  4096 Fev  5 18:59 rules.d.gold   <- A FOLDER
-rw-r--r--   1 root root   153 Abr 12  2016 udev.conf

Originally, there was a file and a folder with the same name. I cannot recreate that because it is not possible to create a file and a folder with the same name.

Now, what? My OS is Ubuntu 16.04.


Edit:

Looking into my virtual installation of Ubuntu 18.4 the file rules.d does not exist.

I am not sure what this file is doing in my host system, perhaps it should not be there. The content of the file is:

# version 0002
ATTR{idVendor}=="03fd", ATTR{idProduct}=="0008", MODE="666"
ATTR{idVendor}=="03fd", ATTR{idProduct}=="0007", MODE="666"
ATTR{idVendor}=="03fd", ATTR{idProduct}=="0009", MODE="666"
ATTR{idVendor}=="03fd", ATTR{idProduct}=="000d", MODE="666"
ATTR{idVendor}=="03fd", ATTR{idProduct}=="000f", MODE="666"
ATTR{idVendor}=="03fd", ATTR{idProduct}=="0013", MODE="666"
ATTR{idVendor}=="03fd", ATTR{idProduct}=="0015", MODE="666"
  • As you noted yourself, the "original state" is not possible (barring filesystem corruption - not even sure about then). Perhaps your original ls command missed something such as a trailing space or other non-printing character in one or other of the names? – steeldriver Feb 8 '19 at 14:20
2

In /etc folder there is a naming convention - .d in directory names means directory of files.
For example - compare /etc/apt/sources.list (file) with /etc/apt/sources.list.d/ (directory with *.list files). Such naming is used for udev too:

$ ls /etc/udev/ -d
/etc/udev/

$ ls /etc/udev/rules.d/ -d
/etc/udev/rules.d/

Then about restoration - we can check which package installs files to /etc/udev/rules*:

$ dpkg -S /etc/udev/rules*
udev: /etc/udev/rules.d

So we need to reinstall udev package specifying special --force-confmiss option (see man dpkg):

--force-things...
confmiss: If a conffile is missing and the version in the package did change, always install the missing conffile without prompting. This is dangerous, since it means not preserving a change (removing) made to the file.

sudo mv /etc/udev /etc/udev.old
apt-get download udev
sudo dpkg --force-confmiss -i udev_*.deb 

Note: you can read more about Udev rules on ArchLinux wiki.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.