Debian Configuration :: Udev Script To Run Service On Device Insertion
Jan 24, 2010
I have just bought a DVB-T usb dongle to watch some TV. The software I'm using is vdr, which has to be started through the /etc/init.d/vdr service. I have created a udev script that executes the service on device insertion. It works nicely, however now when I boot up the computer it takes ages to get to desktop. I believe it is because of the WAIT_FOR part. But without this part, the service starts too soon because the usb dongle has been inserted but the firmware has not finished loading. Can someone point out an alternative way to do it? The script is here [URL].
I am using a 3rd party kernel driver that does not support udev properly. When I was using wheezy I placed the required device files in /lib/udev/devices.
The udev in jessie does not appear to support this. Is there any way to have udev create these device files or will I have to create then using a script at boot-up?
My touchscreen "LG Display LGD-MultiTouch" will be recognized sometimes as /dev/input/event0 and sometimes as /dev/input/event3. How to hardcode /dev/input/event0 using udev and xorg.conf?
ubuntu could delay kernel module installation until device is inserted?Take my usb ath9271 wifi adapter as an example: when kernel boot up, no ath modules are installed until usb wifi apdapter is inserted, ath related modules are insmod.Could anybody how to achieve this? udev or something else?
I have a problem copying my udev rules from other distro to another pc running debian. My box is running debian without any DE and I want my USB disks to be automounted based on the label; I believe udev is the nicest way to do this task.
Anyways : my rules are (copied from archlinux wiki btw) cat /etc/udev/rules.d/92-my-media-automount.rules # vim:enc=utf-8:nu:ai:si:et:ts=4:sw=4:ft=udevrules: # /etc/udev/rules.d/92-my-media-automount.rules # Only work on sd* KERNEL!="sd[a-z]*", GOTO="my_media_automount_end" ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="my_media_automount_end" .....
I notice the directory is made successfully up inserting the usb HD, but the mount doesn't succeed. If I manually execute above command, the mount goes ok.
I have SSD drives without SCT support, because of this I want to tune /sys/block/device-name/device/timeout in order to force mdadm put these drives offline. So, I can see my drive like this:
Where can I tune /sys/block/device-name/device/timeout from 30 to 7 sec only for these drive? I don't want to use rc.local.
Can I create right udev rules for it in /etc/udev/rules.d?
I want to avoid any conflict with /lib/udev/rules.d.
Code: Select all# udevadm monitor --environment --udev monitor will print the received events for: UDEV - the event which udev sends out after rule processing
I'm trying to allow non-root account to use avrdude to program mucrocontrollers. There are many articles online about how to do that, but it seems not to work for me. Every time i try to execute avrdude it says "permission denied". Here's "$ udevadm info --name=/dev/bus/usb/002/011 --attribute-walk" says looking at device '/devices/pci0000:00/0000:00:1d.1/usb2/2-1':
However, after restarting udev, replugging the device, even rebooting the computer I still get "permission denied". The Vendor and Product match, so what's the problem?
After yesterdays upgrade of Squeeze, my Synaptics touchpad's udev configuration is ignored on my EeePC. It was working fine before. Are there any changes in how it is supposed to be configured or is it just broken?
I've just installed 'Testing' on a VMware server and after I completed the install with no problems, the system booted into the kernel and I noticed the following start up process error:
startpar: service(s) returned failure: udev...failure!
I have not seen this before and am not sure if it's related to the fact that this is a virtual machine and not a physical server or something else.
How to hardcode/fix a udev roule for /dev/input/event0?For example my touchscreen device jumped after restart, sometimes will be recognized as input3 and sometimes as input0.
I have a trayless SATA hotswap bay that is really terrific for quickly attaching and removing SATA hard drives. I'm trying to write a udev rule to create a symbolic link to the device node for the drive that is attached through the hotswap bay (/dev/bay -> /dev/sdX). This eliminates any ambiguity when performing destructive tasks (fdisk, etc). I'm running squeeze amd64. I've read through several tutorials and have it working somewhat. Here's the output of udevadm info for a drive attached via the hotswap bay.
Here is my udev rule DEVPATH=="/devices/pci0000:00/0000:00:11.0/host7/*", SUBSYSTEM=="block", SYMLINK+="bay%n"
This produces the desired behavior and gives me an fdisk-able device node. The problem I am having is that the "host" component of the DEVPATH varies from bootup to bootup. I'm just using on onboard SATA, host2-7, specifically host7. There is also onboard PATA, host0-1. It seems to just be random which "host"s are assigned to which controller. For example, the next time I boot the system, the onboard SATA will be host0-5 and the onboard PATA will be host6-7. In this simple case, I could just write 2 rules, one for each possibility and it would still be correct because of the different PCI addresses of the two controllers. But on systems with more SCSI (uh... libata, actually) controllers, a "host" file can point to different physical ports between bootstraps. This would be bad. Does anyone know of a way to write a rule to tie a device node to a specific physical SATA port on the motherboard/hba?
I want to install a email server so my domain handles it's on email. I understand I need a dns server first. I down loaded dbndns but can not even figure out how to start it. does anyone know how to get this set up. Or where the setup files is for this.
On macbook air 6.2, i've installed a Debian jessie mate DE, dual boot using refind. I'm currently fine-tuning it. I've made a script following powertop advice:
I have accidentally stoped gdm3 service with BootUP-Manager and now i cant enable it again. I can start it from terminal with sudo service gdm3 start i have tryed to dpkg-reconfigure gdm3 and purge/install. This are services running on startup [ + acpid
I've after latest jessie update a problem with service samba restart. If I use "service samba restart", there is a timeout (after long time) and error.
Output of "systemctl status samba.service":
Code: Select all● samba.service - LSB: ensure Samba daemons are started (nmbd and smbd) Loaded: loaded (/etc/init.d/samba) Active: failed (Result: timeout) since Mo 2014-10-20 02:16:57 CEST; 7s ago Process: 6205 ExecStart=/etc/init.d/samba start (code=killed, signal=TERM)
Okt 20 02:16:57 server systemd[1]: samba.service start operation timed out. Terminating. Okt 20 02:16:57 server systemd[1]: Failed to start LSB: ensure Samba daemons are started (nmbd and smbd).
[Code] ....
Whats going wrong. "service samba restart" should bring no error message if the service is not running previously.
I am using Jessie with XFCE and I tried to write a service which executes a script to change my wallpaper. When I try to start the service with systemctl start wallpaper.service it fails and I get the outout below from systemctl status wallpaper.service
I don't think it to be a permissions issue, they are -rw- r-- r--
This service is called by a timer that goes off daily. Below is wallpaper.service
My system goes through slow periods where it just crawls and others where it's fine, but I'm wondering which service settings are OK to just shut off to give me a bit more oomph when I boot up.The others I'm pretty OK with like spam assassin, dictionary server and so on, but some of the others i wonder if they only serve to slow things down..Also..I live in a very dusty environment and I KNOW the fans and other parts get caked with dust and it wouldn't surprise me if the dust got so bad it just stops the fans completely so once in a while I use my air compressor to blow the crud out and I usually get covered myself, but how safe is using the compressor? It's not the type that typically fills up with condensed water droplets so that isn't a super critical issue..It's a small 1 hp deal, elect drive and so on.. Safe enough? It's all I have and/or can afford..
I'm building a Debian based router, I want to add to this router a mail service function. I don't want mail to be sent outside of the network, what I want is the ability for services to send mail to the Debian server and for me to then pick them up from this server via pop3 into my normal mail application. Given I'm not looking for mail to be sent outside of the network and its strictly for services to log notifications via. What of the various mail applications should I setup? i.e. just looking for SMTP + POP3 internally.
I am using debian squeeze server with asterisk 1.6 installed and configured.my problem is non root users need to access the server using ssh and restart asterisk server after making changes in asterisk configuration files.As of now i am giving root username/password for this process (i know it is not at all a good idea) .now how can i create a username and configure it which can only access and modify asterisk configuration files and restart asterisk server without any other privileges.
I have Debian Jessie installed. When I insert a non-encrypted DVD movie DVD into the drive, a pop-up menu appears asking me what I want to do (e.g. "Open with vlc media player, etc.).
When I insert an encrypted DVD movie DVD into the drive, no pop-up menu appears.
I am able to play the encrypted movie DVD in vlc, and libdvdcss2 is installed. So my question is not about playing the DVD but rather about the failure to automatically detect it.
This behaviour happens in Gnome, Mate, and XFCE. (KDE has a Plasma Device Notifier Widget that is able to detect the encrypted DVD).
My other computer with Debian Wheezy is able to automatically recognize the encrypted DVD.
Here are the relevant lines from /var/log/syslog after the insertion of the encrypted DVD:
Code: Select allJun 21 14:52:04 debian-think-pad kernel: [ 2012.208964] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE Jun 21 14:52:04 debian-think-pad kernel: [ 2012.208972] sr 1:0:0:0: [sr0] Jun 21 14:52:04 debian-think-pad kernel: [ 2012.208977] Sense Key : Illegal Request [current] Jun 21 14:52:04 debian-think-pad kernel: [ 2012.208986] Info fld=0x400
[Code] ....
Here are the relevant lines from /var/log/syslog after the insertion of the non-encrypted DVD:
Code: Select allJun 21 14:55:39 debian-think-pad kernel: [ 2226.518955] UDF-fs: INFO Mounting volume 'Check Please', timestamp 2009/06/02 17:43 (1e5c) Jun 21 14:55:39 debian-think-pad udisksd[1161]: Mounted /dev/sr0 at /media/daniel/Check Please on behalf of uid 1000 Jun 21 14:55:39 debian-think-pad org.gtk.Private.UDisks2VolumeMonitor[1081]: index_parse.c:191: indx_parse(): error opening /media/daniel/Check Please/BDMV/index.bdmv Jun 21 14:55:39 debian-think-pad org.gtk.Private.UDisks2VolumeMonitor[1081]: index_parse.c:191: indx_parse(): error opening /media/daniel/Check Please/BDMV/BACKUP/index.bdmv
Whan I run the mount command after inserting the non-encrypted DVD the following line appears in the output:
Code: Select all/dev/sr0 on /media/daniel/Check Please type udf (ro,nosuid,nodev,relatime,uid=1000,gid=1000,umask=77,iocharset=utf8,uhelper=udisks2)
Granted, this issue is not a major problem as I can start vlc and play the DVD. However, it might be useful to some new users to Linux to have the pop-up menu appear. Additionally, it would be interesting to learn why it works in Debian Wheezy and not in Debian Jessie.
I am the author of an internet radio for the Raspberry PI originally running on Debian Wheezy. The radio (radiod) service is started and stopped using the usual service commands:
service radiod start|stop|status
Since upgrading to Debian Jessie the service status and stop routines in my radio daemon are no longer called.
For example:
# service radiod status ● radiod.service - LSB: Raspberry PI Radio Daemon Loaded: loaded (/etc/init.d/radiod) Active: active (running) since Thu 2016-03-31 20:17:07 CEST; 15h ago Process: 380 ExecStart=/etc/init.d/radiod start (code=exited, status=0/SUCCESS) CGroup: /system.slice/radiod.service └─603 python /usr/share/radio/ada_radio.py start
If I call my program (which runs as a daemon) I see the status message from my program
# ./radiod.py status radiod running pid 603
I have established that service stop never calls my program routines to shutdown the radiod daemon when the system is rebooted (I see that from my log files).
The reboot hangs for about 5 minutes whilst stopping the radiod service (because stop never calls my stop routines).
Below is my radiod script, which is fairly conventional, and which has been working all the time until I ported to Debian Jessie.
/etc/init.d/radiod #!/bin/sh # ### BEGIN INIT INFO # Provides: radiod # Should-Start: # Should-Stop:
I have a Linux server that runs the Sybase DB. Sybase suggests using character devices to access raw devices rather than O_DIRECT to block devices, or cooked FS's. So, I went ahead and configured /etc/sysconfig/rawdevices as such:
This works fine. I set 'chkconfig rawdevices on' and all is well. I read that this method is deprecated and went about trying to accomplish the same via Udev rules. I already use udev rules in /etc/udev/rules.d/60-raw.rules to set permissions on these devices, i.e. ACTION=="add", KERNEL=="raw*", OWNER=="sybase", GROUP=="sybase", MODE=="0660"
That works fine. I even set symbolic links: KERNEL=="raw1", SYMLINK+="vg01/rtempdb" KERNEL=="raw2", SYMLINK+="vg01/rtestdb1" KERNEL=="raw3", SYMLINK+="vg01/rfakedb2"
But I cannot seem to get the actual device creation piece to work within udev (it only works using rawdevices). I've tried: ACTION=="add", KERNEL=="vg01/tempdb", RUN+="/bin/raw /dev/raw/raw1 %N"
No errors, but nothing happens. The device just doesn't create. I've also tried doing it by passing major and minor numbers. Is it possible to get all of this into udev rules or am I stuck with rawdevices? I'm also utterly confused as to the future of rawdevices... the raw man page said it was deprecated, and now at v5.5 it has that piece taken out. Also RHEL 5.3 dropped support for rawdevices in initscripts only to add itback in 5.4. I'm an admin, not a DBA, so I cannot say if this is a bad or good way, only that it is the way the vendor supports and recommends, so it is the way that I must go... just trying to make it work as "un-deprecated" and cleanly as possible.
Having finally made the switch from Windows (7 Professional) to Linux (Fedora 13) on my laptop, I'm now trying to get all my devices working, specifically an Olympus VN-4100PC Digital Voice Recorder. I've installed odvr and it works in root, but not as a normal user. The installation instructions say: odvr *requires* access to the user-space USB interface.
It is recommended to place "41-odvr.rules" into "/etc/udev/rules.d" or setup your own udev rules rather than running odvr as root. After changing udev rules, don't forget to run "udevcontrol reload_rules" and to replugin your DVR. Again, root privileges are required unless udev is properly setup. The file "41-odvr.rules" (designed for Ubuntu) has the following content: SUBSYSTEM=="usb", SYSFS{idVendor}=="07b4", SYSFS{idProduct}=="020d", ACTION=="add", GROUP="audio", MODE="0664"
I tried just doing what it said and copying it to "/etc/udev/rules.d" but it didn't seem to work. Looking at other files, I then changed it to: SUBSYSTEM=="usb", ATTR{idVendor}=="07b4", ATTR{idProduct}=="020d", ACTION=="add", GROUP="audio", MODE="0664"
And now if I do "ls -l /dev/bus/usb/002", I get: crw-rw-r--. 1 root audio 189, 134 Oct 15 01:21 007
Which seems to suggest that it is running the "41-odvr.rules" file, since lsusb gives: Bus 002 Device 007: ID 07b4:020d Olympus Optical Co., Ltd Digital Voice Recorder VN-240PC
But odvr still doesn't work as a normal user, giving: Failed to open Olympus device: couldn't claim interface
I need to prevent udev from creating the /dev/v4l/by-path/* and /dev/v4l/by-id/* files upon connecting my webcam. The problem is that Kopete doesn't want to display the video if these files are present. It works fine if I remove them, but I'd rather not have them created in the first place, since they seem to be completely useless anyway.