1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

devd based AUTOMOUNTER

Discussion in 'Peripheral Hardware' started by vermaden, Feb 17, 2012.

  1. vermaden

    vermaden Member

    Messages:
    2,353
    Likes Received:
    2
    I submited a PR to create/update the Ports tree.
     
  2. nemysis

    nemysis New Member Developer

    Messages:
    12
    Likes Received:
    0
    Only what not works is automounting CD/DVD.

    In /var/log/messages are no messages about CD/DVD. :(
     
  3. vermaden

    vermaden Member

    Messages:
    2,353
    Likes Received:
    2
    Unfortunately there is no devd event that can be 'caught' to automount CD, ask FreeBSD developers to add a devd event about inserting and removing CD from the drive ;)
     
  4. nemysis

    nemysis New Member Developer

    Messages:
    12
    Likes Received:
    0
  5. frig

    frig New Member

    Messages:
    5
    Likes Received:
    0
    Hello there,

    I try to show my problem as short as possible (with as little detours as possible):

    Starting with the thought to enable autmounting on the laptop/netbook of my wife I figured out there were several ways to do it, most of them working with HAL and appropriete FAQs or manual-entries or whatever. After figuring out that HAL probably won't work and also isn't required and I also read in one post it's deprecated, I couldn't then help but feel lost.

    Your thread appeared multiple times and I always avoided this solution because it requested a somehow, more user-intervention-heavy method (after my try I realized it wasn't).

    My point:

    After setting up everything as expected, it's possible to mount one USB thumbdrive (I only have this one to try actually) and it shows up under /media/da0s1 as expected (though the problem exists, that it switches to the appropriate user even though I'm logged in) if I manually umount it, the directory doesn't vanish (as I expected from setting the REMOVEDIR flag) and mounting the device another time fails with no reason (as I think). I am aware that there is not enough evidence to catch the murderer but I actually don't know which logs you need.

    The automount.conf looks like this:
    Code:
    USERMOUNT="YES"
    ATIME="NO"
    REMOVEDIRS="YES"
    I removed the user and fm-flags, removing the problem of user-switching with them.

    The reason should be me, I'm missing a piece of documentation or whatever.

    mfg frig
     
  6. vermaden

    vermaden Member

    Messages:
    2,353
    Likes Received:
    2
    Hi.

    Can you explain more?

    It was a problem with some older version, it was fixed in 1.3.1, I uploaded 1.4 today with improvements towards smartphones which attach th device, but the device is ready to use quite a little later. Check it out at the usual GITHUB place: https://github.com/vermaden/automount/blob/1.4/automount

    Mounting from where? Nautilus? Command line? mount(8)?

    Try 1.4 and if you still have issues, I will tell you what I need ;)
     
  7. frig

    frig New Member

    Messages:
    5
    Likes Received:
    0
    #1 - changing user
    The problem with the user-switching occurs only if the USER and FM variables are set in automount.conf.
    The automount.conf looked like this:
    Code:
    USER="anja"
    FM="thunar"
    USERMOUNT="YES"
    ATIME="NO"
    REMOVEDIRS="YES"
    Everytime I inserted the USB thumbdrive the user switched to the one stated in the automount.conf, it also did this if the user was already logged in, restarting the x-session.
    -> Problem didn't occur again after removing the appropriate flags from the automount.conf

    #2 - REMOVEDIR
    Problem occurred with version 1.3.1. I will test 1.4 once we return home.

    #3 - Mounting from:
    Mounting from Thunar via clicking and command line using mount -v -t msdosfs /dev/da0s1 /media/flash The 'device busy' error (even though the device was not in use) occurred one or two times between my tries.

    As I said above, I will try 1.4 once we're home again =D . But I wanted to clarify my sluggish questions.

    Thanks in advance, frig.
     
  8. vermaden

    vermaden Member

    Messages:
    2,353
    Likes Received:
    2
    That is the purpose of that setting, to mount and change the rights to USER and to use specified FM.

    What did you think it worked/should work like?

    I do not remember changing anything in the remove part, so probably it will be the same at 1.4.


    Device busy means it's already mounted (probably by automount) or the device is not yet ready to mount after insertion.

    Ok, let me know how 1.4 works for you ;)

    Welcome.
     
  9. frig

    frig New Member

    Messages:
    5
    Likes Received:
    0
    #1 - USER and FM
    I actually thought about these flags, that they do nothing other than mount the device in the MNTPREFIX with the appropriate permissions, about the FM I was wrong, I actually thought nothing about this flag. The problem itself still persists, it "changes" to the mentioned user even though the user is logged in, restarting the x-session (though killing all beforehand opened applications) and leaving me with a new empty desktop.

    #2 - busy device
    Probably happened because of my hastened tries.

    Actually automount works quite well, I have tested three different USB drives by now, they were all recognized and mounted correctly and even removing the directories worked. (still using version 1.3.1).

    Sole problem remaining is with the permissions, the device mounts in /media/flash/* where users have rwx permissions, though the newly created directory has only root permissions (even though USER is set correctly), usermount is possible throughout the system.

    Thanks in advance, frig.
     
  10. vermaden

    vermaden Member

    Messages:
    2,353
    Likes Received:
    2
    Interesting, nothing like that happens here, you say that after inserting the pendrive it restarts your X11 session?

    The code responsible for that looks like that:
    Code:
    su - ${USER} -c "env DISPLAY=:0 ${FM} ${MNT} &"
    ... and with these as example:
    Code:
    USER=ver
    FM=nautilus
    MNT=/media/da0s1
    It just does execute this:
    Code:
    su - ver -c "env DISPLAY=:0 nautilus /media/da0s1 &"
    It does not matter which user is logged in, the automount uses the specified in config user.

    I know a problem that nautilus sometimes tries to automount again the already mounted filesystem in /media/ANYTHING, I havent found a way to prevent nautilus from that.

    If you do not set USER, then the mount will be made with root permissions, if you set USER, then it will chmod it to USER:USERGROUP at mount, is it not working like that for you?
     
  11. serjsk8

    serjsk8 New Member

    Messages:
    54
    Likes Received:
    0
    Thank you vermaden, it works great! Mounts the USB drive and CD-ROM with out problems. I have a problem with HAL, it can not mount my DVD-ROM automatically. Your solution saved me!

    But I have a question: how then unmount the device? I have to unmount from the command line, is that right?
     
  12. vermaden

    vermaden Member

    Messages:
    2,353
    Likes Received:
    2
    Welcome ;)

    Interesting, automount automounts CD-ROM? Are you sure? I am asking because automount does not support CD9660 CD-ROM filesystem and does not detect it because there are no devd(8) events to detect the CD insertion/removal.

    My automount does not have anything to do with HAL, it uses FreeBSD's devd(8) instead.

    You can unmount from nautilus or from konqueror file managers, as well as from the command line with umount command, if you just remove the USB drive without unmounting, then it will be unmounted automatically for you by automount.
     
  13. serjsk8

    serjsk8 New Member

    Messages:
    54
    Likes Received:
    0
    Hello,
    Yes, I know. I just wanted to say that my HAL does not mount a CD-ROM when I'm working in KDE4.

    Mmmm... But I can see my DVD-ROM when I insert a disk. I inserted the installation disk with FreeBSD 7.2-RELEASE, and the drive is mounted automatically.

    Code:
    #uname -a
    FreeBSD bsd 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:15:25 UTC 2012     
    root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
    Code:
    # cat /etc/rc.conf
    powerd_enable="YES"
    hald_enable="YES"
    dbus_enable="YES"
    devd_enable="YES"
    automounter_enable=YES
    
    Code:
    # pkg_version -v | grep automoun
    automounter-1.4.4                   =   up-to-date with port
    
    Code:
    # automounter list
    label: <iso9660/FreeBSD_Install> from <cd0>
    
    Code:
    # ls -l /media
    total 8
    drwxr-xr-x  2 root  wheel  512 May 29 14:48 dev
    drwxr-xr-x  2 root  wheel  512 May 29 14:48 iso9660
    bsd# ls -l /media/dev/
    total 0
    lrwxr-xr-x  1 root  wheel  61 May 29 14:48 cd0 -> /var/run/automounter.amd.mnt/bff50c4e90e79a0df3be09ea2c5ad62e
    lrwxr-xr-x  1 root  wheel  61 May 29 14:48 cd0.iso9660 -> /var/run/automounter.amd.mnt/bff50c4e90e79a0df3be09ea2c5ad62e
    bsd# ls -l /media/dev/cd0
    lrwxr-xr-x  1 root  wheel  61 May 29 14:48 /media/dev/cd0 -> /var/run/automounter.amd.mnt/bff50c4e90e79a0df3be09ea2c5ad62e
    bsd# ls -l /media/dev/cd0.iso9660/
    total 539
    -r--r--r--   6 root  wheel     793 May  1  2009 .cshrc
    -r--r--r--   1 root  wheel    1563 May  1  2009 .profile
    dr-xr-xr-x  13 root  wheel    2048 May  1  2009 7.2-RELEASE
    -r--r--r--   3 root  wheel    6197 May  1  2009 COPYRIGHT
    -r--r--r--   1 root  wheel    4877 May  1  2009 ERRATA.HTM
    -r--r--r--   1 root  wheel    3514 May  1  2009 ERRATA.TXT
    -r--r--r--   1 root  wheel  186567 May  1  2009 HARDWARE.HTM
    -r--r--r--   1 root  wheel  114717 May  1  2009 HARDWARE.TXT
    -r--r--r--   1 root  wheel   19736 May  1  2009 README.HTM
    -r--r--r--   1 root  wheel   14311 May  1  2009 README.TXT
    -r--r--r--   1 root  wheel   60037 May  1  2009 RELNOTES.HTM
    -r--r--r--   1 root  wheel   31407 May  1  2009 RELNOTES.TXT
    dr-xr-xr-x   2 root  wheel    6144 May  1  2009 bin
    dr-xr-xr-x   7 root  wheel    4096 May  1  2009 boot
    -r--r--r--   1 root  wheel    2048 May  1  2009 boot.catalog
    -r--r--r--   1 root  wheel      39 May  1  2009 cdrom.inf
    dr-xr-xr-x   2 root  wheel    2048 May  1  2009 dev
    -r--r--r--   1 root  wheel    3704 May  1  2009 docbook.css
    dr-xr-xr-x  20 root  wheel   12288 May  1  2009 etc
    dr-xr-xr-x   2 root  wheel    2048 May  1  2009 floppies
    dr-xr-xr-x   3 root  wheel    8192 May  1  2009 lib
    dr-xr-xr-x   2 root  wheel    2048 May  1  2009 libexec
    dr-xr-xr-x   2 root  wheel    2048 May  1  2009 media
    dr-xr-xr-x   2 root  wheel    2048 May  1  2009 mnt
    dr-xr-xr-x  61 root  wheel    8192 May  1  2009 packages
    dr-xr-xr-x   2 root  wheel    2048 May  1  2009 proc
    dr-xr-xr-x   2 root  wheel   16384 May  1  2009 rescue
    dr-xr-xr-x   2 root  wheel    2048 May  1  2009 root
    dr-xr-xr-x  60 root  wheel    8192 May  1  2009 rr_moved
    dr-xr-xr-x   2 root  wheel   16384 May  1  2009 sbin
    lr-xr-xr-x   1 root  wheel       7 May  1  2009 stand -> /rescue
    lr-xr-xr-x   1 root  wheel      11 May  1  2009 sys -> usr/src/sys
    dr-xr-xr-x   2 root  wheel    2048 May  1  2009 tmp
    dr-xr-xr-x  13 root  wheel    2048 May  1  2009 usr
    dr-xr-xr-x  21 root  wheel    4096 May  1  2009 var
    
    Maybe I'm doing something wrong, and the automounter does not "participate in the game"?
     
  14. vermaden

    vermaden Member

    Messages:
    2,353
    Likes Received:
    2
  15. serjsk8

    serjsk8 New Member

    Messages:
    54
    Likes Received:
    0
    Oooohhhh!!
    You're right, I was wrong.
    Excuse me!
     
  16. pkubaj

    pkubaj Member

    Messages:
    443
    Likes Received:
    1
    Can you explain why automount is better than automounter?
     
  17. vermaden

    vermaden Member

    Messages:
    2,353
    Likes Received:
    2
    I haven't tried automounter yet ;)
     
  18. Crivens

    Crivens Member

    Messages:
    830
    Likes Received:
    2
    Ok, I need to report something.

    After installing this automounter I did not use it for some time. These days I plugged in a USB drive and tried to mount it, only to find I was not allowed. While doing this as root, I found that a bit strange and suspected the last update to have gone a bit sideways. There is the device node, there is the mount point, but I was not able to mount it.

    Checked for logged errors, none.
    Checked for file system mismatches, none found.
    Then it dawned on me that I was not allowed to mount something that was already mounted.

    This then was confirmed by carefully reading the output of 'mount'.

    HOW DARE YOU release something that simply works without bells, whistles, trumpets and brass band? ;)

    Simply putting software onto the unsuspecting user which works over complete updates, does not complain, does not advertise it's existence, which simply does one thing and does it well.

    I have to confess that it took me some minutes to find your automounter again because I totally forgot about it.

    In short: Well Done!
     
  19. vermaden

    vermaden Member

    Messages:
    2,353
    Likes Received:
    2
    @Crivens

    Thanks ;)

    There were no BUG requests, so I did not upload new versions.
     
  20. ORTO-DOX

    ORTO-DOX New Member

    Messages:
    79
    Likes Received:
    0
    vermaden, Thank You for well working automounter
    I have a little feature request:
    Can you add possibility to mount co-existed partitions on the disk. For example, I have Windows + FreeBSD on disk, and when I boot in FreeBSD it is not mounts Windows partition, only new-inserted disks.
    Thank you!
     
  21. vermaden

    vermaden Member

    Messages:
    2,353
    Likes Received:
    2
    @ORTO-DOX

    Thanks ;)

    There is automounter and automount in the Ports.

    I have written/maintain automount which has nothing to do with automounter.

    I made automount to mount every partition/device that appears in the /dev after device attach.

    Is it possible that You use automounter and not 'my' automount? :)
     
  22. ORTO-DOX

    ORTO-DOX New Member

    Messages:
    79
    Likes Received:
    0
    :))) Sorry for mistake :)
    I have automount ofcourse.
    And as You say it mounts every partition/device that appears in the /dev after device attach., but it not mount partition which exists permanently in system.
    As I think, automount triggers on devd events, and as permanently exists in system partitions it does not react to :(
     
  23. vermaden

    vermaden Member

    Messages:
    2,353
    Likes Received:
    2
    Just put that into the /etc/fstab and set the mountpoint to the /media/something, so You will have that filesystem available in the nautilus/konqueror/pcmanfm panel.

    Yup.
     
  24. Crivens

    Crivens Member

    Messages:
    830
    Likes Received:
    2
    Damn! No brass band plugin which posts the contents of my USB drives to my FailBook wall. ;)
    That is a feature reserved for you-know-who :e
     
  25. vermaden

    vermaden Member

    Messages:
    2,353
    Likes Received:
    2
    @Crivens

    Nice one :)