You are not logged in.
Hi,
it works fine with my usb key, but my external drive don't mount... Any ideas ?
Anyway, great soft ! Finally an automounter that works for me...
: (){ : |:& };:
Offline
Hello again.
Debugging ldm, in the second call to device_unmount, the "dev" struct in the caller function (udev_device in udev_device_get_devnode) is totally messed up. Here it's a gdb dump of it:
Breakpoint 1, device_unmount (dev=0x805dd90) at ldm.c:490
(gdb) print *dev
$4 = {udev = 0x6d6f682f, parent_device = 0x6f742f65, syspath = 0x6e696e <Address 0x6e696e out of bounds>, devpath = 0x11 <Address 0x11 out of bounds>, sysname = 0x73666e <Address 0x73666e out of bounds>, sysnum = 0xb7f67578 <main_arena+312> "pu\366\267pu\366\267xu\366\267xu\366\267\200u\366\267\200u\366\267\210u\366\267\210u\366\267\220u\366\267\220u\366\267\230u\366\267\230u\366\267\240u\366\267\240u\366\267\250u\366\267\250u\366\267\260u\366\267\260u\366\267\270u\366\267\270u\366\267\300u\366\267\300u\366\267\310u\366\267\310u\366\267\320u\366\267\320u\366\267\330u\366\267\330u\366\267\340u\366\267\340u\366\267\350u\366\267\350u\366\267\360u\366\267\360u\366\267\370u\366\267\370u\366\267", devnode = 0x804eee8 " \337\005\b/sr0", devnode_mode = 209, subsystem = 0x805a130 "204", devtype = 0x804deb8 "", driver = 0x2c656d69 <Address 0x2c656d69 out of bounds>, action = 0x73726576 <Address 0x73726576 out of bounds>, devpath_old = 0x722c333d <Address 0x722c333d out of bounds>, knodename = 0x657a6973 <Address 0x657a6973 out of bounds>, id_filename = 0x3732333d <Address 0x3732333d out of bounds>, envp = 0x772c3836, monitor_buf = 0x657a6973 <Address 0x657a6973 out of bounds>, monitor_buf_len = 926036797, devlinks_list = {udev = 0x6e2c3836, node = {next = 0x656c6d61, prev = 0x35323d6e}, entries = 0x61682c35, entries_cur = 1881957490, entries_max = 1869901682, unique = 61}, properties_list = {udev = 0x6d69742c, node = {next = 0x363d6f65, prev = 0x722c3030}, entries = 0x61727465, entries_cur = 842888046, entries_max = 1667593004, unique = 61}, sysattr_value_list = {udev = 0x756f6d2c, node = {next = 0x6461746e, prev = 0x313d7264}, entries = 0x312e3237, entries_cur = 825306678, entries_max = 808594992, unique = 52}, sysattr_list = {udev = 0x76746e75, node = {next = 0x3d737265, prev = 0x6f6d2c33}, entries = 0x70746e75, entries_cur = 1031041647, entries_max = 875770417, unique = 44}, tags_list = {udev = 0x7270746e, node = {next = 0x3d6f746f, prev = 0x2c706475}, entries = 0x61636f6c, entries_cur = 1869373292, entries_max = 1849518947, unique = 111}, seqnum = 3618414965597430881, usec_initialized = 3328214211925258542, timeout = 3420210, devlink_priority = 208, refcount = 48, devnum = 8227006956519675144, ifindex = 1702521203, watch_handle = 926036797, maj = 1999386678, min = 1702521203, parent_set = 61, subsystem_set = 51, devtype_set = 50, devlinks_uptodate = 55, envp_uptodate = 54, tags_uptodate = 56, driver_set = 44, info_loaded = 110, db_loaded = 97, uevent_loaded = 109, is_initialized = 108, sysattr_list_read = 101, db_persist = 110}
(gdb)
As devnode isn't null but it have bad values, the segfault appear.
I put here the dev struct content in a first right call to the unmount function (both outputs are from the same "eject" event):
Breakpoint 1, device_unmount (dev=0x8059de8) at ldm.c:490
(gdb) print *dev
$3 = {udev = 0x804f208, parent_device = 0x0, syspath = 0x804f958 "/sys/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sr0", devpath = 0x804f95c "/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sr0", sysname = 0x804ed18 "sr0", sysnum = 0x804ed1a "0", devnode = 0x805d918 "/dev/sr0", devnode_mode = 0, subsystem = 0x804f9a8 "block", devtype = 0x804ed08 "disk", driver = 0x0, action = 0x805e098 "change", devpath_old = 0x0, knodename = 0x0, id_filename = 0x0, envp = 0x0, monitor_buf = 0x0, monitor_buf_len = 0, devlinks_list = {udev = 0x804f208, node = {next = 0x805dfd0, prev = 0x8059da8}, entries = 0x805a170, entries_cur = 2, entries_max = 64, unique = true}, properties_list = {udev = 0x804f208, node = {next = 0x805dd48, prev = 0x8059a90}, entries = 0x805a068, entries_cur = 25, entries_max = 64, unique = true}, sysattr_value_list = {udev = 0x804f208, node = {next = 0x8059e6c, prev = 0x8059e6c}, entries = 0x0, entries_cur = 0, entries_max = 0, unique = true}, sysattr_list = {udev = 0x804f208, node = {next = 0x8059e88, prev = 0x8059e88}, entries = 0x0, entries_cur = 0, entries_max = 0, unique = false}, tags_list = {udev = 0x804f208, node = {next = 0x8059ea4, prev = 0x8059ea4}, entries = 0x0, entries_cur = 0, entries_max = 0, unique = true}, seqnum = 1674, usec_initialized = 0, timeout = -1, devlink_priority = 0, refcount = 1, devnum = 2816, ifindex = 0, watch_handle = -1, maj = 0, min = 0, parent_set = false, subsystem_set = true, devtype_set = true, devlinks_uptodate = false, envp_uptodate = false, tags_uptodate = false, driver_set = false, info_loaded = true, db_loaded = false, uevent_loaded = false, is_initialized = false, sysattr_list_read = false, db_persist = false}
(gdb)
Regards.
Offline
Here is the new output after pluging the drive :
[ 3410.778858] usb 4-1.2: new high-speed USB device number 4 using ehci_hcd
[ 3410.988337] scsi13 : usb-storage 4-1.2:1.0
[ 3413.527195] scsi 13:0:0:0: Direct-Access ST950032 5AS 0003 PQ: 0 ANSI: 5
[ 3413.530348] sd 13:0:0:0: [sdd] 976773168 512-byte logical blocks: (500 GB/465 GiB)
[ 3413.531672] sd 13:0:0:0: [sdd] Write Protect is off
[ 3413.531687] sd 13:0:0:0: [sdd] Mode Sense: 23 00 00 00
[ 3413.532571] sd 13:0:0:0: [sdd] No Caching mode page present
[ 3413.532583] sd 13:0:0:0: [sdd] Assuming drive cache: write through
[ 3413.536568] sd 13:0:0:0: [sdd] No Caching mode page present
[ 3413.536583] sd 13:0:0:0: [sdd] Assuming drive cache: write through
[ 3413.640896] sdd: unknown partition table
[ 3413.643686] sd 13:0:0:0: [sdd] No Caching mode page present
[ 3413.643697] sd 13:0:0:0: [sdd] Assuming drive cache: write through
[ 3413.643704] sd 13:0:0:0: [sdd] Attached SCSI disk
I also tried with an microSD card, wich worked perfectly. Can ldm handle smartphones ?
Mine is not detected but I'm not surprised since it's an Android phone...
: (){ : |:& };:
Offline
I's the disk partitioned with GPT or encripted?
Can you put the output of "fdisk -l /dev/sdd"?
Offline
Here is the output of "fdisk -l /dev/sdc" :
Disk /dev/sdc: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
There should be only one partition on the drive, in ext4 or ext3, nothing encrypted.
Thanks for your help.
: (){ : |:& };:
Offline
@tonin
meh, seems that udev is sending the same dev struct that we've unreferenced and destroyed...to be honest using eject on my system issues just one time the device_unmount. can you trace the code path?
@pstree
oblivious question, does it work when you mount it by hand?
also, no, it doesn't handle Android smartphones unless they're using the ums protocol
Offline
I tried to mount my drive with "mount -t ext3 /dev/sdc /media", but it failed. Here is the output of demsg :
[ 1167.824209] usb 4-1.2: new high-speed USB device number 5 using ehci_hcd
[ 1168.033998] scsi8 : usb-storage 4-1.2:1.0
[ 1170.473881] scsi 8:0:0:0: Direct-Access ST950032 5AS 0003 PQ: 0 ANSI: 5
[ 1170.478170] sd 8:0:0:0: [sdc] 976773168 512-byte logical blocks: (500 GB/465 GiB)
[ 1170.479018] sd 8:0:0:0: [sdc] Write Protect is off
[ 1170.479034] sd 8:0:0:0: [sdc] Mode Sense: 23 00 00 00
[ 1170.480018] sd 8:0:0:0: [sdc] No Caching mode page present
[ 1170.480027] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[ 1170.482876] sd 8:0:0:0: [sdc] No Caching mode page present
[ 1170.482886] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[ 1170.587638] sdc: unknown partition table
[ 1170.590500] sd 8:0:0:0: [sdc] No Caching mode page present
[ 1170.590515] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[ 1170.590527] sd 8:0:0:0: [sdc] Attached SCSI disk
[ 1198.793231] EXT4-fs (sdc): VFS: Can't find ext4 filesystem
I don't know why it won't try ext3 even if I state it in the command...
Anyway, it worked fine when I was under Ubuntu, so why not now ?
: (){ : |:& };:
Offline
@tonin
meh, seems that udev is sending the same dev struct that we've unreferenced and destroyed...to be honest using eject on my system issues just one time the device_unmount. can you trace the code path?
Hmmm, in your own code you comment about the fact that ejecting a cdrom calls twice the unmount function because udev send two change events when the eject button is pressed.
In my system, with udev 174 (I don't want to use system.d because my custom linux is very dependent on sysV init system), "udevadm monitor" show two change events when I press the eject button.
Can you test if in your system the change event appears only once? In this way, may be a different udev rule or something like this ....
Regards.
Offline
Sorry my mistake ... the two "change" events are one from the kernel and the other from udev ...
Well, the code path is this:
I put a breakpoint at check_registered_devices in the main loop.
May be that the first or second call to this function when the cdrom was ejected one or two times don't segfault. In a third or fourth call (I stepped all calls), depending on the value of outbounds pointers in dev structure it segfault.
I don't understand the check_registered_devices code. You have a loop with a condition that says "if g_devices[j] isn't NULL and NOT device_is_mounted)", in this way you call to device_unmount function.
¿Why to call device_unmount function if device isn't mounted? I see tha device_unmount do many things in addition to umount the device, but the problem is the first line in device_unmount that calls to udev_device_get_devnode(dev) and if dev have an outbound pointer in devnode field the segfault raise.
Without completely understand your code, I think that if a device is in your g_device array and isn't mounted, you only need to free the associated mallocs that are allocated yet, and put a NULL in the g_device[j] array member.....
Regards.
P.D: I tried to change device_unmount call by device_destroy, but it seems that this isn't right because ldm segfault even mounting a cdrom.
Offline
¿Why to call device_unmount function if device isn't mounted? I see tha device_unmount do many things in addition to umount the device, but the problem is the first line in device_unmount that calls to udev_device_get_devnode(dev) and if dev have an outbound pointer in devnode field the segfault raise.
Without completely understand your code, I think that if a device is in your g_device array and isn't mounted, you only need to free the associated mallocs that are allocated yet, and put a NULL in the g_device[j] array member.....
Meh, I think it's time for a 0.4.1, I discovered that device_change had a really bad logic error if the latest git works fine for you then I'll tag the new version and package it.
Last edited by TheLemonMan (2013-03-02 13:19:27)
Offline
Meh, I think it's time for a 0.4.1, I discovered that device_change had a really bad logic error
if the latest git works fine for you then I'll tag the new version and package it.
Now it works like a charm.
Many thanks for your good job.
Offline
I've been using the non-git version for a while, and recently (sorry not added a usb drive for a few weeks) it's changed its behaviour. I tried the git version and it's the same.
When I unmount a device, ldm immediately remounts it. I've changed some set-up stuff on the machine, mainly systemd stuff and an architecture switch. Not sure whether any of that will have had an effect.
dmesg just shows the initial insertion, any other logs I should post?
Also, is it possible to add the ability to specify the mount point directory - eg. /mnt ?
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Are you sure there's no udev rule that could interfere ? I can't reproduce it here with any usb stick, how are you unmounting it ?
Also, you can adjust the MOUNT_PATH define in ldm.c to /mnt/
Offline
Are you sure there's no udev rule that could interfere ? I can't reproduce it here with any usb stick, how are you unmounting it ?
/etc/udev/rules.d is empty, the /usr/lib/udev/rules.d doesn't have anything I've personally added. Grepping it for "/media", "usb" or "mount" throw up nothing that looks to be the culprit, and the mount path is always the same as under ldm (I'll be double checking that by changing it as per below, at some point).
I've used both:
$ pumount /media/mountdir
# umount /media/mountdir
With both the directory gets deleted, then recreated, and the drive is mounted. I'm assuming that this means it's getting unmounted, then mounted.
I use inotifywait on the media dir to look for dirs created and removed and fire a inotifysend when it happens. So I see the dir deleted then dir created events.
Also, you can adjust the MOUNT_PATH define in ldm.c to /mnt/
I was afraid you'd say that.
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
hrm there's no way ldm could remount the drive by itself, maybe something is getting into the way...
Okay, I'll keep looking, thanks.
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Okay sorry, my fault I think. The disk I was using was a different one to the ones I had been using before - I just grabbed one to test my set-up and it looks like it's corrupted. It occurred to me to check an old, working one (had to go and find it) and it only seems to happen with this one disk.
It's definitely ldm mounting it as nothing happens with ldm stopped, and stopping ldm unmounts the drive and removes the dir.
I ran udevadm, plugged the drive in and unmounted it as part of my tests. I've included it below in case it's any use for you. The first change near the bottom is where I executed the umount.
udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[25573.123954] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5 (usb)
KERNEL[25573.124095] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0 (usb)
KERNEL[25573.125975] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9 (scsi)
KERNEL[25573.126004] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/scsi_host/host9 (scsi_host)
UDEV [25573.761659] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5 (usb)
UDEV [25573.763152] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0 (usb)
UDEV [25573.763178] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9 (scsi)
UDEV [25573.763552] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/scsi_host/host9 (scsi_host)
KERNEL[25574.166510] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0 (scsi)
KERNEL[25574.166577] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0/9:0:0:0 (scsi)
KERNEL[25574.166718] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0/9:0:0:0/scsi_disk/9:0:0:0 (scsi_disk)
KERNEL[25574.166743] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0/9:0:0:0/scsi_device/9:0:0:0 (scsi_device)
UDEV [25574.167141] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0 (scsi)
KERNEL[25574.168066] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0/9:0:0:0/bsg/9:0:0:0 (bsg)
UDEV [25574.168090] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0/9:0:0:0 (scsi)
UDEV [25574.168947] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0/9:0:0:0/scsi_disk/9:0:0:0 (scsi_disk)
UDEV [25574.169722] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0/9:0:0:0/bsg/9:0:0:0 (bsg)
UDEV [25574.169901] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0/9:0:0:0/scsi_device/9:0:0:0 (scsi_device)
KERNEL[25574.577886] add /devices/virtual/bdi/8:16 (bdi)
UDEV [25574.578971] add /devices/virtual/bdi/8:16 (bdi)
KERNEL[25574.615496] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0/9:0:0:0/block/sdb (block)
UDEV [25576.497005] add /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0/9:0:0:0/block/sdb (block)
KERNEL[25577.025515] add /devices/virtual/bdi/8:16-fuseblk (bdi)
UDEV [25577.026098] add /devices/virtual/bdi/8:16-fuseblk (bdi)
KERNEL[25587.711135] change /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0/9:0:0:0/block/sdb (block)
KERNEL[25587.712629] remove /devices/virtual/bdi/8:16-fuseblk (bdi)
UDEV [25587.715982] remove /devices/virtual/bdi/8:16-fuseblk (bdi)
UDEV [25587.794308] change /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/host9/target9:0:0/9:0:0:0/block/sdb (block)
KERNEL[25587.838698] add /devices/virtual/bdi/8:16-fuseblk (bdi)
UDEV [25587.839145] add /devices/virtual/bdi/8:16-fuseblk (bdi)
Last edited by skanky (2013-03-05 16:10:32)
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
hey, got it is it strangely formatted/partitioned isn't it? the kernel detaches it by issuing a change event instead of a remove one, I'll try to reproduce it as soon as I have some spare time
Offline
hey, got it
is it strangely formatted/partitioned isn't it? the kernel detaches it by issuing a change event instead of a remove one, I'll try to reproduce it as soon as I have some spare time
Yes, fdisk doesn't recognise it. At some point I'm going to format it - I have no recollection what I put on it, it's been sitting on my desk for a year.
It's a bit of on edge case though, dealing with a dodgy drive?
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Actually now you mention it that rings a bell. I'll check it when I'm back in the office tomorrow.
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Yep, no idea what it was, as nothing recognised even the partition table. There was also 4 partitions on it and again, nothing recognised them.
Anyway I wiped it, put on a new partition table and new partition and it behaves as expected now. Sorry for the hassle.
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Thank you for this nice piece of software! I've been having screwed up or overblown setups for a while and this one seems really neat.
The only problem I'm having with it: I've encrypted multiple drives with TrueCrypt. One of them is the data partition of my pc (ntfs) which I use on both Windows and Arch.
Whenever I try to mount a TrueCrypt volume (e.g. via truecrypt /dev/sda4), I get the following error:
Failed to write lock '/dev/mapper/truecrypt1': Resource temporarily unavailable
Error opening '/dev/mapper/truecrypt1': Resource temporarily unavailable
Failed to mount '/dev/mapper/truecrypt1': Resource temporarily unavailable
If I issue the truecrypt command a second time, it works - BUT: the new "device" gets mounted with it's UUID in a place like /media/6CE81880E8184AA and not where it usually appears ( /media/truecrypt1 if you don't specify another place manually. I do want to have them there).
If I disable LDM, everything works fine.
Can I somehow exclude truecrypt volumes from being automounted? And why do the three errors concerning /dev/mapper/truecrypt1 happen?
Offline