LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   can't mount usb pen drive with hotplug (http://www.linuxquestions.org/questions/slackware-14/cant-mount-usb-pen-drive-with-hotplug-197942/)

dori 06-26-2004 10:34 AM

can't mount usb pen drive with hotplug
 
I used to be able to have my usb pen drive auto mount when inserted using hotplug and a small script in 9.1, but it's not working with 10. The script in question is located at /etc/hotplug/usb/usb-storage and it looks like:
Code:

dori@darkstar:~$ cat /etc/hotplug/usb/usb-storage
#!/bin/sh
if [ "${ACTION}" = "add" ]; then
    mount -t vfat -o uid=dori /dev/sda1 /mnt/usb128
    cp /var/run/usb/remover $REMOVER
fi

the copy command works, and if I run the mount command by hand after the message in /var/log/messages saying "creating device node sda1", the drive mounts fine and I can use it.

Is there a way to check if the mount error is quitting with some error? What else could be wrong?

thanks,
dori

Toth 06-26-2004 10:53 AM

Try changing the mount command to something like this:

Code:

mount -t vfat -o uid=dori /dev/sda1 /mnt/usb128 2> /tmp/mount.errors
That should dump any mount error messages to /tmp/mount.errors allowing you to see them.

dori 06-26-2004 11:28 AM

Ah, thank you, yes there was an error: "mount: special device /dev/sda1 does not exist" it appears that the device is getting created after this script is called. I put a date command in the script and it printed Sat Jun 26 11:26:15 CDT 2004, meanwhile in /var/log/messages I see

Code:

Jun 26 11:26:15 darkstar kernel: usb 1-2: new full speed USB device using address 20
Jun 26 11:26:15 darkstar kernel: scsi18 : SCSI emulation for USB Mass Storage devices
Jun 26 11:26:15 darkstar scsi.agent[6388]: how to add device type= at /devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2:1.0/host18/18:0:0:0 ??
Jun 26 11:26:15 darkstar kernel:  Vendor:          Model: USB DISK 2.0      Rev: 1.1b
Jun 26 11:26:15 darkstar kernel:  Type:  Direct-Access                      ANSI SCSI revision: 02
Jun 26 11:26:15 darkstar kernel: SCSI device sda: 253952 512-byte hdwr sectors (130 MB)
Jun 26 11:26:15 darkstar kernel: sda: assuming Write Enabled
Jun 26 11:26:15 darkstar kernel:  sda: sda1
Jun 26 11:26:15 darkstar kernel: Attached scsi removable disk sda at scsi18, channel 0, id 0, lun 0
Jun 26 11:26:17 darkstar udev[6427]: creating device node '/dev/sda'
Jun 26 11:26:17 darkstar udev[6428]: creating device node '/dev/sda1'

Any help on how I might fix this?

thanks,
dori

Toth 06-26-2004 11:39 AM

One that *might* work, but might not is putting a sleep 5 command before the mount command. That should halt the script for 5 seconds and hopefully give udev enough time to create the device node.

dori 06-26-2004 11:46 AM

thanks, but no such luck, I think they are called serially

dori

HuMJohn 06-26-2004 12:01 PM

read the man page for MAKDEV

then make the following devices:

brw-r----- 1 root disk 8, 0 1995-04-29 03:33 /dev/sda
brw-r----- 1 root disk 8, 1 1995-04-29 03:33 /dev/sda1
brw-r----- 1 root disk 8, 10 1995-04-29 03:33 /dev/sda10
brw-r----- 1 root disk 8, 11 1995-04-29 03:33 /dev/sda11
brw-r----- 1 root disk 8, 12 1995-04-29 03:33 /dev/sda12
brw-r----- 1 root disk 8, 13 1995-04-29 03:33 /dev/sda13
brw-r----- 1 root disk 8, 14 1995-04-29 03:33 /dev/sda14
brw-r----- 1 root disk 8, 15 1995-04-29 03:34 /dev/sda15
brw-r----- 1 root disk 8, 2 1995-04-29 03:33 /dev/sda2
brw-r----- 1 root disk 8, 3 1995-04-29 03:33 /dev/sda3
brw-r----- 1 root disk 8, 4 1995-04-29 03:33 /dev/sda4
brw-r----- 1 root disk 8, 5 1995-04-29 03:33 /dev/sda5
brw-r----- 1 root disk 8, 6 1995-04-29 03:33 /dev/sda6
brw-r----- 1 root disk 8, 7 1995-04-29 03:33 /dev/sda7
brw-r----- 1 root disk 8, 8 1995-04-29 03:33 /dev/sda8
brw-r----- 1 root disk 8, 9 1995-04-29 03:33 /dev/sda9

Toth 06-26-2004 12:16 PM

That doesn't work, HuMJohn. He's using a 2.6 kernel with udev.

Using the above combination, the /dev directory is created dynamically by the udev daemon as devices are added and removed from the system. Using that script might work temporarily, but probably won't work upon reboot.

dori, if you're interested, have a look at my thread on Project Utopia and Slackware 10. One of the uses of those packages is userland automounting.

HuMJohn 06-26-2004 12:45 PM

Thanks, I'll keep this in mind when I add another partition on this system and install 10.0 to use the 2.6.<current> kernel.

baloon 03-02-2007 02:22 AM

how to nautilus from the script
 
hello

how do I start nautilus when the usb pen drive is added through this script. When I put the command in the script, it throws and error saying "... cannot open display: "

how do I patch this up ?

-B


All times are GMT -5. The time now is 11:30 PM.