Hardware :: Creating An Udev Rule Mounting All Usb Drive As 666?
May 12, 2010i need all my /media/* newly created by insertion of usb drives, chmodded 666.I tried some tips using various threads, but i failed.I'm on Slack 64 13.0.
View 14 Repliesi need all my /media/* newly created by insertion of usb drives, chmodded 666.I tried some tips using various threads, but i failed.I'm on Slack 64 13.0.
View 14 RepliesI 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.
looking at device '/devices/pci0000:00/0000:00:11.0/host7/target7:0:0/7:0:0:0/block/sdb':
KERNEL=="sdb"
SUBSYSTEM=="block"
DRIVER==""
ATTR{range}=="16"
ATTR{ext_range}=="256"
ATTR{removable}=="0"
ATTR{ro}=="0"
ATTR{size}=="156301488"
ATTR{alignment_offset}=="0"
ATTR{capability}=="52" ....
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 am looking for a guide for Fedora 13 that tells me how to:
1. Create an encrypted partition on an an external USB hard drive
2. Tells me how to setup Fedora to ask me for the passphrase when I plug in the drive
3. Automounts the hard drive to a set location
The guide should deal with the situation that the computer can mount without declaring the external hard drive is not there.At present my attempt at mounting my Samsung Story USB2 hard drives does not meet criteria 2 and 3.
I'm running Ubuntu 9.10 (Karmic Koala) on a laptop and would like NumLock to automatically toggle depending on whether my USB keyboard is plugged in (numlock on) or unplugged (numlock off).
To accomplish this, I first installed the "numlockx" package. numlockx on and numlockx off works fine.
To hook into the device system, I thought I'd use udev. I have read "Writing udev rules", but I'm having trouble getting the udev rule to work.
First, here's an example of the dmesg output:
[20906.985102] usb 3-2: new low speed USB device using uhci_hcd and address 6
[20907.166403] usb 3-2: configuration #1 chosen from 1 choice
[20907.192904] input: Microsoft Natural® Ergonomic Keyboard 4000 as /devices/pci0000:00/0000:00:1a.0/usb3/3-2/3-2:1.0/input/input20
[20907.193100] microsoft 0003:045E:00DB.000B: input,hidraw1: USB HID v1.11
[Code]....
I am trying to write a udev rule for my headset but i don't understand where i get the information to make the rule. I know i need to add
Code: RUN+="bash /home/luke-jennings/headset" at the end of it so the script i wrote runs. I don't know how to get any of the identifying info for the headset and which bits to use where. How do I get the information?
I'm trying to set my network interfaces so that they don't get random every boot.(eg assign eth0 to a network interface with a given MAC addr, and eth1 to the other one)I trew in a udev rule (in fact just modified the rules that was automatically generated and set the ethX in it) but the system ignores my udev rule.What am I missing ?Here is all the info :
Code:
$cat /etc/udev/rules.d/70-persistent-net.rules
# This file maintains persistent names for network interfaces.
[code]....
I am not good at writing udev rules. I am using RHEL 4.7, I would like to invoke a file install.sh which is in CDROM as soon as the CDROM is inserted
View 2 Replies View RelatedI have a UDEV rule below that maps a symlink from a specific usb device and 'Should' run a command.
Code:
BUS=="usb",SYSFS{serial}=="1111111111111111111111111111",SYMLINK+="myusbstick_%n",RUN+="/usr/local/bin/my_command"
The symlink part is fine but it does not appear to run the command when I plug the device in. I can run the command "/usr/local/bin/my_command" from the shell fine.
Code:
mount /dev/myusbstick_1 /media/TMPUSB && cryptsetup luksOpen /dev/md5 md5_crypt --key-file=/media/TMPUSB/key && vgscan && vgchange -ay && mount -a && umount /media/TMPUSB
What am I missing. I have tried +x in owner,group and other.By the way what does UDEV run as, I assumned +x on ROOT as that is the owner should be enough.
On Ubuntu 10.04 I would like to setup udev to execute a backup script when a specific USB drive is inserted. Udev detects the USB drive, but my script is executed 7 times instead of just once. Can't figure out what's wrong.
My udev rules file:
Code:
/etc/udev/rules.d# cat 20-stick.rules
ACTION=="add", ATTRS{vendor}=="Kingston", ATTRS{model}=="DataTraveler G2 ", RUN="/usr/local/bin/sync.sh"
Dummy backup script: connecting USB drive results in 7 times date written to /tmp/test
code....
I'm having some trouble with udev, in that it won't create me a symlink for the infrared device which is part of my Hauppauge Nova-TD-500 TV card.I've got the card installed, and for the most part working, but I want to have the infrared device on /dev/ir.I've created a rule in /etc/udev/rules.d/ called 55-dvb_usb_dib0700-ir.rules which contains this:
Code:
SUBSYSTEM=="input", ATTR{name}=="IR-receiver inside an USB DVB receiver", RUN="/bin/date > /home/xbmc/foo", SYMLINK+="ir"
[code]....
I'm trying to configure gpsd 2.96 to start automatically from udev rule on a Slack 13.37 box.1. I've compiled and installed gpsd from sources and made sure it starts manually.2. I've copied the /lib/udev/gpsd.hotplug and /lib/udev/gpsd.hotplug.wrapper scripts in their places from the source tree and made them executable.3. I've copied the gpsd.rules file from sources into /etc/udev/rules.d4. I renamed it 99-persistent-gpsd.rules to run late in the bootup process.5. I've copied the /etc/default/gpsd file from sources and made sure it has the right settings inside.
Now, for the results. If I plug the gps usb dongle in while the system runs, it starts gpsd if it is not started, and it connects to it just as it should. But if I start the system with the dongle in, gpsd doesn't get started during boot. I can't find any relevant message in /var/log/syslog or /var/log/messages for boot time. There is stuff there from when I plug the dongle in while the system is running though. It's like udev ignores the rules for it at boot time.Is there something in the Slackware boot scripts that would prevent running those scriptssd.hotplug.wrapper which in turn runs /lib/udev/gpsd.hotplug which is a Python script)?Here is the contents of 99-persistent-gpsd.rules (ignore the comments referring to Debian, it was meant for a Debian box). My usb gps adapter is the first one - the Prolific chipset one:
Code:
# udev rules for gpsd
# $Id: gpsd.rules 5861 2009-08-03 13:41:01Z bzed $
[code]....
I have a netbook (MSI Wind U100 rebrand) that has one of those card readers built into the handrest. The thing is I've never used it once, and it keeps popping up in powertop as waking the cpu when it should just shut up and be quiet.Aside from breaking open the case and tearing it out, the immediate solution is to browse to /sys/bus/usb/devices/usb1/1-6/ and pipe 1 to the file remove. That disables it until system reboot or resume, at which point I have to do it all over again.
Code:
$ echo 1 | sudo tee /sys/bus/usb/devices/usb1/1-6/remove
Now I'd like to create an udev rule to make it not get initialized at all. A quick Google search found me this article on creating udev rules, and after toying about with the udevadm tool I managed to produce the attributes/properties of the device.
Code:
zorael@lethe:/sys/bus/usb/devices/usb1/1-6$ udevadm info -a -p $(pwd)
Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device.
looking at device '/bus/usb/devices/usb1/1-6':
KERNEL=="1-6"
SUBSYSTEM=="usb"
DRIVER=="usb"
ATTR{configuration}=="CARD READER
[code].....
I am trying to add mail rules in Evolution, Ubuntu. but it blocks all the mails.
View 1 Replies View RelatedI 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:
/dev/raw/raw1 /dev/vg01/tempdb
/dev/raw/raw2 /dev/vg01/testdb
/dev/raw/raw3 /dev/vg01/fakedb ...
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.
Are there any prerequisites which much be met in order for udev to create /dev/usb/hiddev* nodes?
I have two Slack 13.0 systems, each connected to a APC UPS via USB, one of which creates a hiddev0 node and the other doesn't. apcupsd can't find the UPS unless this node is present.
The "working" system has been stable in its current configuration for so long that I honestly can't remember if I had to tweak anything in this regard. I've verified that it doesn't use any local udev rules to create this node, and to the best of my knowledge there are no external scripts or processes which would create it either.
The non-working system has a similar configuration - no local rules and/or scripts which touch usb devices or nodes.
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.
View 4 Replies View RelatedQuestion (and Google results aren't making this clear): Ubuntu has both iptables & ip6tables installed. 1. If I set a rule in iptables, does that rule also apply to ipv6, or just ipv4?
2. If "no" to above, then it would be prudent to *also* set ip6tables rules as well if I want to maintain an active firewall, correct?
3. Does ip6tables rules have the same syntax and behavior (more or less) to iptables rules - i.e. can I just copy my iptables rules & change "iptables" to "ip6tables"?
4. Any gotchas or issues that I should be aware of?
Early in the boot process, system generates message "Creating nodes with udev." After a pause, CPU timeout dumps are listed on the display. Likely it is related to wthe display driver (Intel 845G) as the system can be brought up in failsafe mode. /etc/X11.conf is intact. The system was apparently successfully upgraded online from 11.3 using the zypper method. This issue has appeared a day following the upgrade, after restarting the 11.4 system.
View 1 Replies View RelatedI tried to install OpenSuse 11.3 on my brand new pc, which already had Windows 7 proffessional in it, and I went step by step through the installation without changing anything. It didn't work. I tried for a second time and this error message kept popping up: "Creating device modes with udev 2.0436224] [drm: i915_diver_load]*ERROR*Detected broken BIOS with 262140/2644kb of video memory stolen. 2.0436224] [drm: i915_diver_load]*ERROR*Disabling GEM(try reducing stolen memory or updating the BIOS to fix)"
And then a lot of letters and numbers wich make no sense to me. Now the only way I can initiate OpenSuse is with the OSuse boot dvd and on failsafe mode.
[URL]I was going through this tutorial linked above, but then when I got to the dmesg | grep -i portion, I thought for a moment and said to myself, "Wait, I don't have that kind of output.Which is true,
dmesg | grep -i "SCSI device" outputs
nothing
where
[code].....
I have an 320GB hard drive with F11 installed. Lately, I got a 1.5TB new hard drive, on which I have installed F12. Now I want to use the 320GB as a second hard drive since I have lots of data on it. My question here is as I boot my desktop, how does it recognize to boot from the 1.5TB and consider the 320GB as a secondary? Is there anything I need to setup in BIOS? My motherboard has one extra SATA connection left for a second hard drive.
View 6 Replies View RelatedI am having issues mounting my non-OS hard drive (/dev/sda).I had the following information in my /etc/fstab file:/dev/sda /mnt/storage auto defaults 0 0This worked as expected; however, I decided the modify this so I can have it automounted to my home directory (/home/jesse/storage)./dev/sda /home/jesse/storage auto defaults 0 0This /mnt/storage remains intact even after rebooting the system.
View 6 Replies View RelatedI've got a semi-retired hdd (with a few bad sectors my disk utility tells me) formatted in ext4 that can be mounted onto the Desktop after boot provided root password is offered first. I thought it would be straight forward to mount it at boot with something in etc/fstab like :
Code:
/dev/sdb /home/Jo/Desktop ext4
But this doesn't work, is there a glaring error here ?
Various threads suggest permission restrictions could be the cause but i have had no success with them
I just switched to Fedora (from Ubuntu) and can't seem to get Fedora to automount my old drive (which is my old Ubuntu drive). I tried the following with no luck (in fact, when I did this, it chocked during boot and went into emergency mode:
In /etc/fstab, I entered:
/dev/sdc /media/UBUNTU_DRIVE defaults 0 0
Another odd thing is the UBUNTU_DRIVE directory just disappears after reboot (and I know it was there before rebooting).
I have two additional drives in my tower, and both do show up in gparted, so I'm not sure why they're not getting mounted.
Why can't Fedora auto mount secondary (internal drives) automatically?
What can I do to tell it to auto mount the secondary drives (I have two) automatically?
My USB flash drive has stopped working with Ubuntu.
Normally when I remove it I unmount it first, but the last time I just unplugged it. After I unplugged it, it started not working.
When I put it in a windows machine, it shows up as drive E: but says "no disk" when I try to access it.
In my Ubuntu machine I can see it as USBDrive under Places > Computer, but it's unmounted. When I click mount nothing happens.
I just updated to 10.04 from the previous version and I'm encountering two main problems: First, on boot, after grub, I get the following message: Quote:"Disk drive for /hdba/sda6 is not ready yet or not present" "Continue to wait, or press S to skip mounting or M for manual recovery" It won't go past that (I've waited 30 min) If I press S then I get tis other message but it skips after a few seconds:
Quote: "Disk drive for /hdba/sda7 is not ready yet or not present" "Continue to wait, or press S to skip mounting or M for manual recovery" If I press S then I have an ALMOST working system. You see: I have an external USB hard drive, shared between XP and Ubuntu with all my files in it, and it won't mount. It's a simpletech and it was working just before the update and it loads, mounts and unmounts perfectly on windows and on another laptop I've got running crunchbang!. I can see the disk in "Media" but says I have not enough permissions to see its contents.
[Code]...
I'm having a problem on startup where GRUB seems to time out attempting to mount my main drive. Here is the error it gives me:
Quote:
Gave up waiting for root device. Common problems:
-Boot args (cat /proc/cmdline)
- Check rootdelay= (did the system wait long enough?)
- Check root= (did the system wait for the right device?)
-Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/disk/by-uuid/b1517926-aba4-47d1-81f0-42ca5dd36257 does not exist. Dropping to a shell!
I am given a initramfs shell. Sometimes waiting a couple of minutes and then typing 'exit' works. However, I've noticed if I do this:
Code:
(initramfs) mount /dev/disk/by-uuid/b1517926-aba4-47d1-81f0-42ca5dd36257 /root
(initramfs) exit
my laptop will boot.
I'm really not sure what the issue is, or how to even start to resolve it.. I'm not sure what the issue is, since
My 10.04 is mounting my USB drive at startup. This is fine except sometimes it mounts to drivename_ rather than to drivename. How do I make it always mount to drivename.
View 1 Replies View RelatedRunning Slackware 13.1
Whenever I insert a dvd or a cd, it automatically mounts to /media/[name], Like for example, the DVD I have in now mounts to /media/TBC3.2.0 (TBC3.2.0 is the name of the disc itself).
I'm needing this to mount to a regular point like /media/cdrom0 or whatever. How can I fix this?
I have several HDDs connected to my box. Is there a way to always get them to map to the same /dev/sda. For example HD1 is connected to SATA port1 on my motherboard HD2 is connected to SATA port2 on my motherboard all the way to HD5 connected to Sata port5 on the motherboard. I would like port1 to always map to /dev/sda port2 -> /dev/sdb port3 -> /dev/sdc etc until port5 -> /dev/sde as of right now every time I reboot I get different mappings like port1 -> /dev/sdc port2 -> /dev/sda next reboot I get different mappings again.
View 3 Replies View Related