auto mount usb flash drive and display to nautilus

Hi guys!

How can I set my freebsd 7.2 amd64 to automount a usb drive to /media/[diskname] and display it to nautilus on a Read Write mode even as a normal user logged in at GNOME desktop. In my current setup, I have to go to a terminal, acquire root privilege and issue the mount -t msdosfs -o rw ...... Just to mount it, and then I manipulate files as root in the terminal. I cant use nautilus since I'm a normal user running it.

Please give me the steps to do it.

Regards
 
I use something as follows under Ubuntu, so I guess it should work under FreeBSD gnome too:

Code:
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool --set /desktop/gnome/volume_manager/automount_media true

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool --set /desktop/gnome/volume_manager/automount_drives true

The automount drives and automount media settings should be set to true to turn on auto mounting for flash and USB hard disks. See
gconftool-2()

Edit: Look like SirDice was faster to type ;)
 
I don't know how to do it with HAL, but it's possible with sysutils/automounter. In that case mounted partitions will have the access rights of the device nodes that can be set using devfs.rules(5).

Note that the access permissions should be set for the geom labels (e.g. msdosfs/*) instead of the da* devices.
 
Ive tried to follow the hal faq and it still doesnt work for me. When I insert the drive it shows in dmesg but it doesnt appear in nautilus. :( Can anyone offer any suggestions?

"edit!" forget my stupid question. I started at the beginning and realized that i needed to make some kernel changes. All is working very well now. Better than I could have hoped for.
 
Doesn't Work For Me

installed base 8.0-RC1 system, installed gnome2 from pkg_add -r and used portupgrade -a to update all installed packages to current versions.

I am unable to have a usb memory stick mount automatically and appear on the desktop. It shows up in dmesg, but will not mount in nautilus.

I have tried everything in the HAL faq and nothing has helped.
 
Code:
$ sysctl -b kern.geom.conftxt
0 DISK da0 16053960192 512 hd 255 sc 63
1 PART da0s1 16053927936 512 i 1 o 32256 ty !12 xs MBR xt 12
2 LABEL msdosfs/16GB 16053927936 512 i 0 o 0
0 DISK ad10 160041885696 512 hd 16 sc 63
1 PART ad10s1 160039240704 512 i 1 o 32256 ty freebsd xs MBR xt 165
2 PART ad10s1f 150528656384 512 i 6 o 9510584320 ty freebsd-ufs xs BSD xt 7
2 PART ad10s1e 536870912 512 i 5 o 8973713408 ty freebsd-ufs xs BSD xt 7
2 PART ad10s1d 4141875200 512 i 4 o 4831838208 ty freebsd-ufs xs BSD xt 7
2 PART ad10s1b 4294967296 512 i 2 o 536870912 ty freebsd-swap xs BSD xt 1
2 PART ad10s1a 536870912 512 i 1 o 0 ty freebsd-ufs xs BSD xt 7

Code:
$ cat /etc/fstab
# Device		Mountpoint	FStype	Options		Dump	Pass#
/dev/ad10s1b		none		swap	sw		0	0
/dev/ad10s1a		/		ufs	rw		1	1
/dev/ad10s1e		/tmp		ufs	rw		2	2
/dev/ad10s1f		/usr		ufs	rw		2	2
/dev/ad10s1d		/var		ufs	rw		2	2
proc			/proc		procfs	rw		0	0
linproc	/usr/compat/linux/proc	linprocfs	rw		0	0

Code:
Copyright (c) 1992-2009 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.0-RC1 #0: Mon Oct 19 19:03:46 PDT 2009
    root@nt-726.7cedars.7cedarscasino.com:/usr/obj/usr/src/sys/NT726
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: AMD Phenom(tm) 9350e Quad-Core Processor (2000.01-MHz 686-class CPU)
  Origin = "AuthenticAMD"  Id = 0x100f23  Stepping = 3
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x802009<SSE3,MON,CX16,POPCNT>
  AMD Features=0xee500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!+,3DNow!>
  AMD Features2=0x7ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS>
  TSC: P-state invariant
real memory  = 4294967296 (4096 MB)
avail memory = 3000369152 (2861 MB)
ACPI APIC Table: <Nvidia NVDAACPI>
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 1 package(s) x 4 core(s)
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
 cpu2 (AP): APIC ID:  2
 cpu3 (AP): APIC ID:  3
ioapic0: Changing APIC ID to 4
ioapic0 <Version 1.1> irqs 0-23 on motherboard
kbd1 at kbdmux0
acpi0: <Nvidia NVDAACPI> on motherboard
acpi0: [ITHREAD]
acpi0: Power Button (fixed)
acpi0: reservation of 0, a0000 (3) failed
acpi0: reservation of 100000, b7de0000 (3) failed
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1008-0x100b on acpi0
acpi_hpet0: <High Precision Event Timer> iomem 0xfeff0000-0xfeff03ff on acpi0
Timecounter "HPET" frequency 25000000 Hz quality 900
acpi_button0: <Power Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pci0: <memory, RAM> at device 0.0 (no driver attached)
isab0: <PCI-ISA bridge> at device 1.0 on pci0
isa0: <ISA bus> on isab0
pci0: <serial bus, SMBus> at device 1.1 (no driver attached)
pci0: <memory, RAM> at device 1.2 (no driver attached)
pci0: <processor> at device 1.3 (no driver attached)
pci0: <memory, RAM> at device 1.4 (no driver attached)
ohci0: <OHCI (generic) USB controller> mem 0xfe02f000-0xfe02ffff irq 22 at device 2.0 on pci0
ohci0: [ITHREAD]
usbus0: <OHCI (generic) USB controller> on ohci0
ehci0: <EHCI (generic) USB 2.0 controller> mem 0xfe02e000-0xfe02e0ff irq 23 at device 2.1 on pci0
ehci0: [ITHREAD]
usbus1: EHCI version 1.0
usbus1: <EHCI (generic) USB 2.0 controller> on ehci0
ohci1: <OHCI (generic) USB controller> mem 0xfe02d000-0xfe02dfff irq 20 at device 4.0 on pci0
ohci1: [ITHREAD]
usbus2: <OHCI (generic) USB controller> on ohci1
ehci1: <EHCI (generic) USB 2.0 controller> mem 0xfe02c000-0xfe02c0ff irq 21 at device 4.1 on pci0
ehci1: [ITHREAD]
usbus3: EHCI version 1.0
usbus3: <EHCI (generic) USB 2.0 controller> on ehci1
atapci0: <nVidia nForce MCP77 UDMA133 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xf000-0xf00f at device 6.0 on pci0
ata0: <ATA channel 0> on atapci0
ata0: [ITHREAD]
ata1: <ATA channel 1> on atapci0
ata1: [ITHREAD]
hdac0: <NVidia MCP78 High Definition Audio Controller> mem 0xfe020000-0xfe023fff irq 22 at device 7.0 on pci0
hdac0: HDA Driver Revision: 20090624_0136
hdac0: [ITHREAD]
pcib1: <ACPI PCI-PCI bridge> at device 8.0 on pci0
pci1: <ACPI PCI bus> on pcib1
atapci1: <nVidia AHCI controller> port 0x9f0-0x9f7,0xbf0-0xbf3,0x970-0x977,0xb70-0xb73,0xdc00-0xdc0f mem 0xfe026000-0xfe027fff irq 23 at device 9.0 on pci0
atapci1: [ITHREAD]
atapci1: AHCI v1.20 controller with 6 3Gbps ports, PM supported
ata2: <ATA channel 0> on atapci1
ata2: [ITHREAD]
ata3: <ATA channel 1> on atapci1
ata3: [ITHREAD]
ata4: <ATA channel 2> on atapci1
ata4: [ITHREAD]
ata5: <ATA channel 3> on atapci1
ata5: [ITHREAD]
ata6: <ATA channel 4> on atapci1
ata6: [ITHREAD]
ata7: <ATA channel 5> on atapci1
ata7: [ITHREAD]
nfe0: <NVIDIA nForce MCP77 Networking Adapter> port 0xd800-0xd807 mem 0xfe02b000-0xfe02bfff,0xfe02a000-0xfe02a0ff,0xfe029000-0xfe02900f irq 20 at device 10.0 on pci0
miibus0: <MII bus> on nfe0
rgephy0: <RTL8169S/8110S/8211B media interface> PHY 3 on miibus0
rgephy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
nfe0: Ethernet address: 00:01:2e:24:23:c3
nfe0: [FILTER]
pcib2: <ACPI PCI-PCI bridge> at device 11.0 on pci0
pci2: <ACPI PCI bus> on pcib2
vgapci0: <VGA-compatible display> port 0xbc00-0xbc7f mem 0xfb000000-0xfbffffff,0xd8000000-0xdfffffff,0xe6000000-0xe7ffffff irq 21 at device 0.0 on pci2
nvidia0: <GeForce 8200> on vgapci0
vgapci0: child nvidia0 requested pci_enable_busmaster
vgapci0: child nvidia0 requested pci_enable_io
vgapci0: child nvidia0 requested pci_enable_io
nvidia0: [GIANT-LOCKED]
nvidia0: [ITHREAD]
pcib3: <ACPI PCI-PCI bridge> irq 16 at device 16.0 on pci0
pci3: <ACPI PCI bus> on pcib3
pcib4: <ACPI PCI-PCI bridge> irq 16 at device 18.0 on pci0
pci4: <ACPI PCI bus> on pcib4
pcib5: <ACPI PCI-PCI bridge> irq 16 at device 19.0 on pci0
pci5: <ACPI PCI bus> on pcib5
pcib6: <ACPI PCI-PCI bridge> irq 16 at device 20.0 on pci0
pci6: <ACPI PCI bus> on pcib6
amdtemp0: <AMD K8 Thermal Sensors> on hostb3
atrtc0: <AT realtime clock> port 0x70-0x71 on acpi0
cpu0: <ACPI CPU> on acpi0
hwpstate0: <Cool`n'Quiet 2.0> on cpu0
cpu1: <ACPI CPU> on acpi0
cpu2: <ACPI CPU> on acpi0
cpu3: <ACPI CPU> on acpi0
pmtimer0 on isa0
orm0: <ISA Option ROM> at iomem 0xd0000-0xd17ff pnpid ORM0000 on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
atkbd0: [ITHREAD]
Timecounters tick every 1.000 msec
usbus0: 12Mbps Full Speed USB v1.0
usbus1: 480Mbps High Speed USB v2.0
usbus2: 12Mbps Full Speed USB v1.0
usbus3: 480Mbps High Speed USB v2.0
ugen0.1: <nVidia> at usbus0
uhub0: <nVidia OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
ugen1.1: <nVidia> at usbus1
uhub1: <nVidia EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
ugen2.1: <nVidia> at usbus2
uhub2: <nVidia OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus2
ugen3.1: <nVidia> at usbus3
uhub3: <nVidia EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus3
uhub0: 6 ports with 6 removable, self powered
uhub2: 6 ports with 6 removable, self powered
ad10: 152627MB <WDC WD1600AAJS-00M0A0 01.03E01> at ata5-master SATA300
hdac0: HDA Codec #0: Realtek ALC662
hdac0: HDA Codec #3: NVidia MCP78 HDMI
pcm0: <HDA Realtek ALC662 PCM #0 Analog> at cad 0 nid 1 on hdac0
pcm1: <HDA Realtek ALC662 PCM #1 Digital> at cad 0 nid 1 on hdac0
pcm2: <HDA NVidia MCP78 HDMI PCM #0 Digital> at cad 3 nid 1 on hdac0
SMP: AP CPU #3 Launched!
SMP: AP CPU #1 Launched!
SMP: AP CPU #2 Launched!
GEOM: ad10s1: geometry does not match label (255h,63s != 16h,63s).
Root mount waiting for: usbus3 usbus1
Root mount waiting for: usbus3 usbus1
uhub1: 6 ports with 6 removable, self powered
uhub3: 6 ports with 6 removable, self powered
Root mount waiting for: usbus1
ugen0.2: <vendor 0x0557> at usbus0
uhub4: <vendor 0x0557 product 0x7000, class 9/0, rev 1.10/1.00, addr 2> on usbus0
ugen1.2: <VIA Networking Technologies, In> at usbus1
Trying to mount root from ufs:/dev/ad10s1a
uhub4: 4 ports with 4 removable, self powered
ugen0.3: <Microsoft> at usbus0
ukbd0: <Microsoft Microsoft Digital Media Pro Ke, class 0/0, rev 2.00/1.10, addr 3> on usbus0
kbd2 at ukbd0
uhid0: <Microsoft Microsoft Digital Media Pro Ke, class 0/0, rev 2.00/1.10, addr 3> on usbus0
ums0: <Microsoft Microsoft Digital Media Pro Ke, class 0/0, rev 2.00/1.10, addr 3> on usbus0
ums0: 5 buttons and [XYZ] coordinates ID=0
nfe0: link state changed to UP
ugen3.2: <vendor 0x0781> at usbus3
umass0: <vendor 0x0781 product 0x5406, class 0/0, rev 2.00/2.00, addr 2> on usbus3
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass0:0:0:-1: Attached to scbus0
(probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 
(probe0:umass-sim0:0:0:0): CAM Status: SCSI Status Error
(probe0:umass-sim0:0:0:0): SCSI Status: Check Condition
(probe0:umass-sim0:0:0:0): UNIT ATTENTION asc:3a,0
(probe0:umass-sim0:0:0:0): Medium not present
(probe0:umass-sim0:0:0:0): Retrying Command (per Sense Data)
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <SanDisk U3 Cruzer Micro 7.01> Removable Direct Access SCSI-0 device 
da0: 40.000MB/s transfers
da0: 15310MB (31355391 512 byte sectors: 255H 63S/T 1951C)
GEOM: da0: partition 1 does not end on a track boundary.
 
Code:
$ cat /usr/local/etc/PolicyKit/PolicyKit.conf
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->

<!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"
"http://hal.freedesktop.org/releases/PolicyKit/1.0/config.dtd">

<!-- See the manual page PolicyKit.conf(5) for file format -->

<config version="0.1">
    <match user="root">
	<return result="yes"/>
    </match>
    <define_admin_auth group="wheel"/>
    <match action="org.freedesktop.hal.storage.mount-removable">
    		<return result="yes"/>
    </match>
    <match action="org.freedesktop.hal.storage.mount-fixed">
      		<return result="yes"/>
    </match>
    <match action="org.freedesktop.hal.storage.eject">
		<return result="yes"/>
    </match>
</config>

Code:
$ ck-list-sessions
Session2:
	unix-user = '1001'
	realname = 'Justin Carver'
	seat = 'Seat1'
	session-type = ''
	active = TRUE
	x11-display = ':0'
	x11-display-device = '/dev/ttyv8'
	display-device = '   ?   '
	remote-host-name = ''
	is-local = TRUE
	on-since = '2009-10-21T01:41:09.041719Z'
	login-session-id = ''
 
If I run
Code:
gnome-mount --block --no-ui --verbose --hal-udi <Device UDI>

It mounts the usb stick under /media/16GB and everything works fine... why won't it do it automatically??

x(
 
I have exactly the same problem, gnome-mount from cli mounts usb drive to /media/KINGSTON. However nothing happens when I plug it, nothing in the hal faq helps either.

If I use gnome-mount, usb stick is visible in Nautilus normally. I can't unmount it from there though, operation not permitted.

gnome-umount from command line unmounts the device properly.

dbus-monitor or hald --verbose=yes --daemon=no don't say a thing when usb is plugged in.

Edit: If the usb stick is plugged in while booting the system, nautilus works just like it should. But if there's no removable media in any usb port it doesn't work at all.

Edit2: If the USB stick is plugged in while starting dbus, gnome works properly. If there's no usb drive in when starting dbus then it will no work
 
Back
Top