Tag Info

Hot answers tagged

127

/dev/null is a file. A special file. A device file like /dev/sda or /dev/tty that talks to a piece of hardware on your system. The only difference with /dev/null is that no hardware is linked to it. Any data you send to it is silently discarded. Like the following command: $ echo "Hello World" > /dev/null which won't print anything on your terminal ...


28

@Benoit is nearly correct in his answer. You will also need to fix permissions. $ sudo rm /dev/null $ sudo mknod /dev/null c 1 3 $ ls -l /dev/null crw-r--r-- 1 root root 1, 3 Mar 18 08:38 /dev/null $ sudo chmod 666 /dev/null $ ls -l /dev/null crw-rw-rw- 1 root root 1, 3 Mar 18 08:38 /dev/null This restores the permissions. Otherwise, as a non-root user ...


18

I don't know if this helps in reloading the network configuration, but when I modified /etc/udev/rules.d/70-persistent-cd.rules to correct the DVD device link from /dev/dvd1 to /dev/dvd, I had to run sudo udevadm trigger to get have the new links created.


16

Unfortunately there seems to be no easy way. What I will describe is how to create a new Upstart job to set the values on boot through the virtual filesystem under /sys. Find the device path of your trackpoint Run the following in a gnome-terminal (press Alt + F2, type gnome-terminal, and hit Enter): find /sys/devices/platform/i8042 -name name | xargs ...


16

There is a big difference between overwriting a file and writing to a file. When you write something to /dev/null, e.g., $ echo Hello > /dev/null ...it gets silently discarded. For this you need write permissions to /dev/null, which everyone has: $ ls -l /dev/null crw-rw-rw- 1 root root 1, 3 Mar 18 13:17 /dev/null When you overwrite /dev/null, as ...


14

I never did that but I think you need to create a keymap file in /lib/udev/keymaps/ and add a rule for your device to /lib/udev/rules.d/95-keymap.rules Details: An udev keymap maps scan codes to key codes, so you need to find both to create the keymap file. To find the scan codes run the following and press the buttons on the device: sudo ...


13

It seems to work for me in Ubuntu 14.04 with 2 flash keys & android phone as storage and usb network adapter & webcam as other type. (I couldn't test placing a usb hub) Check USB port (which is a parent device for the plugged device) $ udevadm info --name=/dev/sdc --attribute-walk looking at parent device ...


12

In Ubuntu 12.04 (Unity, and presumably Gnome Shell/Classic) automounting is handled by GNOME Desktop/Nautilus, which monitors DBus events for insertion, etc. The gvfs* backend is used, in co-operation with udisks for the low-level mounting, etc. gvfs-mount is used internally, and running it in monitor mode with the -o switch will show, for example: $ ...


11

is there any way I can write a udev rule that fixes the name of each adapter based on which physical port on the hub the adapter is plugged into? Yes there is, as it turns out. Consider the last portion of the device hierarchy shown in the second example above: looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4.5': ...


11

Unfortunately, that's a thing Micro$oft actually got quite right: USB removal... And you'll keep on having this problem until you: Disable auto-mounting If users have to mount manually, it'll be easier to train them to dismount as well. Create a udev rule that turns off all caching on USB disks...


11

The interface names are assigned by udev dynamically or according to the rules declared in the file /etc/udev/rules.d/70-persistent-net.rules. Although udev manages devices dynamically, putting the rules in this file make udev to take persistent decisions about the interfaces defined here. So to change the name of an interface, open the file ...


10

You have to combine all the advice given here in the right order: Bring down the network service networking stop Unload the driver module from the kernel Find the name of the module lspci -v and look for "Kernel driver in use:" modprobe -r <driver module> Reload the udev rules udevadm control --reload-rules Trigger the new rules udevadm trigger ...


10

If you look at /lib/udev/rules.d/60-keyboard.rules you'll see that everything has been messed around with. This is just part of the udev merger into systemd that has gone on. All hardware rules are compiled into a binary hardware database. These follow a really strange format. The existing rules for keyboards that ship with udev live in ...


9

I guess your usb drive is formatted with VFAT/FAT32. This file format does not support execute permissions which is why chmod +x fails. [Edit] Ok, had a bit of a play and search on the net. Lots of 'solutions' suggest that you should change /etc/fstab. This just seems clunky to me, what do you do? change fstab every time you encounter a new usb flash ...


9

Normally, this is done by adding to /etc/udev/rules.d a file maybe named 50-usb-scale.conf with contents like this: SUBSYSTEM=="usb", ATTR{idVendor}=="HEX1", ATTR{idProduct}=="HEX2", MODE="0666" Where HEX1 and HEX2 are replaced with the vendor and product id respectively. To match on the Interface type instead, you could try replacing ...


8

Maybe you should specify which part of the process is interesting to you but let's say a USB stick is added then... kernel detects and initializes the device (see dmesg), then exports all the information it has found via a directory in /sys (see /sys/devices) kernel sends a uevent signal which is picked up by udev daemon udev daemon gathers available info ...


8

This tutorial explain very nice how to do what you want: Creating Custom Symlinks to Devices According to it, there are two approaches to creating symlinks. The first one is to use the model name and the serial number: SUBSYSTEM=="block", ENV{ID_MODEL}=="...", ENV{ID_SERIAL}=="...", ENV{GENERATED}="1", SYMLINK+="dvd" This way, the symlink will stay ...


8

It looks like you have two problems. The first is an ordering problem. Reading the kernel.org manpage on udev, it mentions: All rules files are ... processed in lexical order Meaning rules are processed in alphabetical order. The first rule that triggers for a device creates the device file. It looks like you've named your rule file ...


8

I bought the exact same model (900X4C) a couple of days ago and I've successfully seen the F9/F10 keys work, and I didn't even had to install the Voria / samsung-tools package either - I just fiddled around with the /lib/udev/keymaps/samsung-other file and the corresponding force-release file. Unfortunately, I messed up the install process (I wasn't running ...


8

When you run the command $ sudo mv test_file /dev/null you have replaced the special file /dev/null with your text file. Subsequent attempts to read from /dev/null return the contents of your text file, and programs that attempt to use /dev/null in the normal way will probably break. Replacing or deleting device files in /dev/ requires superuser ...


7

In RUN you must to put a path to a script. See man udev: Add a program to the list of programs to be executed for a specific device. This can only be used for very short running tasks. Running an event process for a long period of time may block all further events for this or a dependent device. Long running tasks ...


7

Using the terminal and gedit First find the ID for your device from a terminal using lsusb when your device is connected (eg 0951:1692). Also you should to find what is the name of your device with lsblk. Let say the name is /dev/sdb1. Create a new script, let say unmount.sh in /lib/udev with sudo -H gedit /lib/udev/unmount.sh and put next lines inside: ...


7

The usual way to create a Unix domain or TCP socket is programatically, via the mknod or socket system calls. The mknod command will not allow you to create a socket. From the command line, use the socket package If you wish to create a Unix/TCP socket from the command-line, try the socket command from the socket package (install it first). Summarizing ...


6

Since I don't have your hardware I can't give you an exact answer. I'd suggest that you go to the device in question, for example: ls -l /dev/ttyUSB0 and obtain the major and minor node numbers. Let's say they are 116, 7 Then go to: ls -l /sys/dev/char/116:7 (char, because a tty is a character device, if you were tracing down a disk device you would ...


6

I believe the contents of /dev are automatically rebuilt when you reboot. To quote someone else: When you start the system, the "udev" facility examines the hardware configuration (according to established rules) and dynamically creates the entries in /dev.


6

To answer your question of what you should have done, to remove a file, you do: rm test_file As others have stated, /dev/null is a destination for the output of programs.


6

For general use, If you would like to run your program for any USB storage. Use the driver for the rule match. Add a udev rules file sudo nano /etc/udev/rules.d/90-detect-storage.rules Add this rule ACTION=="add", DRIVERS=="usb-storage", DRIVER=="sd", RUN+="/pathto/yourprogram" If you want your program to distinguish the disks, so it runs different ...


5

Yesterday I stumbled into the same problem. I upgraded from 14.10 to 15.04 and during the upgrade I got the same errors as you get. Luckily I was able to pinpoint the cause of the issue. There are two ways to fix this: First way (EASY) Go to the terminal and execute the command sudo groupdel input. Now run sudo apt-get update && sudo apt-get ...


5

I've faced before same problem with non effective ignore_device. I couldn't figure out why then I always go with other solutions. Well, ignore_device removed with udev release 148. See release note or changelog If you noticed, all topics suggesting the use of it are old (~ 2009). A quick alternative is to use: ENV{UDISKS_PRESENTATION_HIDE}="1" (Ubuntu ...


5

You can use udev to run an albitrary command. To make it work, create a rule in /etc/udev/rules.d/: sudo nano /etc/udev/rules.d/my-usb-device.rules And enter: ACTION=="add", ATTRS{idProduct}=="XXXX", ATTRS{idVendor}=="YYYY", RUN+="/location/of/my/command" NOTE: The XXXX and YYYY values will be taken from lsusb output.



Only top voted, non community-wiki answers of a minimum length are eligible