# USB Memory Stick [Solved]

## Mr_Samsonov

Hi,

I have recently performed a full update on my installation 

emerge --update --deep --newuse world

Since doing this I cannot access my USB Memory Stick. When I double click on the Computer icon on the desktop it recognises the disk plugged in. But double clicking on the disk I get the following error:

Unable to mount the selected volume.

mount: can't find /dev/sda1 in /etc/fstab or /etc/mtab

However when i log in as root I can see the USB disk, and can access it. I then log back in as myself and get told I dont have permission to see the drive. However rebooting the computer puts me back to the origonal error... 

Any ideas?Last edited by Mr_Samsonov on Mon Jan 30, 2006 9:20 pm; edited 1 time in total

----------

## BoNd60

I think you have to edit /etc/fstab in order to be able to automount your device and give the permissions to the users to mount it (I think man mount can help you to configure this file  (options, ...) but you will need to respect the format (see the other ones, it's not difficult  :Wink:  )

----------

## Mr_Samsonov

I will give this a go if you think it will help. I just wonder what has changed during my update to cause me to have to put something in fstab, when previosuly it worked without. 

Also as I can see my USB disk by clicking on the Computer icon on the desktop as my user, and I can read it as root, does this not imply it is already mounted? I wonder if it is a permissions thing. 

Does editing my fstab mean the computer will try to mount it the whole time? I dont always have my USB memory stick plugged in.

----------

## BoNd60

no, i think fstab just give some information to mount something, for example, you can just type mount /dev/<whatever_in_fstab> and the disk just get mounted, but if you have problems with the permissions, i think this file can help you (but, anyone can confirm ?)

----------

## mazirian

Because I am in the same boat, I assume that what's really going on is that the poster is using hal/dbus/gnome-volume-manager.  A recent update (of all three of those) just left me with the same problem.  You shouldn't need to add an entry into your fstab.  Indeed, that would defeat the whole point of automounting.  Any other ideas.

EDIT: just read elsewhere that updating your kernel to the most recent stable sources will help with this issue.  Giving it a go now.

----------

## clintpatty

check /dev/uba1 instead of /dev/sda1 after a kernel update or maybe some other stuff too

----------

## mazirian

Bah.  For me all it turned out to be was that I didn't belong to the plugdev group. Apparently this is necessary upon upgrading to gnome 2.12.

----------

## Erlend

Hmm, I've got this problem, although I'm not a gnome user - happened after I did emerge -uD world.  Basically hal's stopped writing to /etc/fstab, and I no longer get mount points created.

Erlend

----------

## mazirian

Are you a member of the plugdev group?  And are you running a 2.6.15 kernel?  That combination of things worked to fix it for me (although it broke lirc :( )  Too many upgrades in the stable tree recently to keep track of what's responsible for breaking what.

----------

## Erlend

 *Quote:*   

> Are you a member of the plugdev group?

 

Yes.  Although I never used to be, and it worked fine.

 *Quote:*   

> And are you running a 2.6.15 kernel?

 

No, and I can't upgrade yet because of at-drivers.

 *Quote:*   

> Too many upgrades in the stable tree recently to keep track of what's responsible for breaking what.

 

I thought the whole point in things being stable is that they don't break!

Does hal still use /usr/share/hal/fdi/90storagepolicy/storage-policy.fdi ?  There were some configuration changes with the upgrade, but I don't know what they were.[/quote]

Erlend

----------

## mazirian

 *Erlend wrote:*   

>  *Quote:*   Are you a member of the plugdev group? 
> 
> Yes.  Although I never used to be, and it worked fine.

 

Right, same for me too.  It suddenly became necessary with recent upgrades. I appreciate that is not your problem, however.

 *Erlend wrote:*   

>  *Quote:*   Too many upgrades in the stable tree recently to keep track of what's responsible for breaking what. 
> 
> I thought the whole point in things being stable is that they don't break!

 

It seems to me that stable has become a sort of wasteland.  The real work appears to be going into ~arch. It's mostly impossible to run a pure stable system 386 system on gentoo now.  To avoid breakage you almost always have to make exceptions in package.{use,mask}.  That's fine, but over time the system get increasingly mixed and more prone to problems with each update.  I think running ~arch is probably only marginally better.  I have only ever had one install of gentoo.  It's almost four years old now and getting increasingly difficult to maintain.  Oh well....

 *Erlend wrote:*   

> 
> 
> Does hal still use /usr/share/hal/fdi/90storagepolicy/storage-policy.fdi ?  There were some configuration changes with the upgrade, but I don't know what they were.

 

Well, I dunno what my config dir used to look like but now I have:

/usr/share/hal/fdi/90defaultpolicy/storage-policy.fdi and no 90storagepolicy directory.

----------

## Erlend

This is my /usr/share/hal/fdi/90defaultpolicy/storage-policy.fdi.  Is it the same as yours?

```
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- --> 

<deviceinfo version="0.2">

  <!-- Default policies merged onto computer root object  -->

  <device>

    <match key="info.udi" string="/org/freedesktop/Hal/devices/computer">

      <merge key="storage.policy.default.mount_root" type="string">/media</merge>

      <merge key="storage.policy.default.use_managed_keyword" type="bool">true</merge>

      <merge key="storage.policy.default.managed_keyword.primary" type="string">managed</merge>

      <merge key="storage.policy.default.managed_keyword.secondary" type="string">kudzu</merge>

      <merge key="storage.policy.default.mount_option.noauto" type="bool">true</merge>

      <merge key="storage.policy.default.mount_option.pamconsole" type="bool">false</merge>

      <merge key="storage.policy.default.mount_option.user" type="bool">true</merge>

      <merge key="storage.policy.default.mount_option.exec" type="bool">true</merge>

    </match>

  </device>

  <device>

    <!-- Whitelist bus types of storage devices we care about  -->

    <match key="info.category" string="storage">

      <match key="storage.bus" string="usb">

   <merge key="storage.policy.should_mount" type="bool">true</merge>      

      </match>

      <match key="storage.bus" string="ide">

   <merge key="storage.policy.should_mount" type="bool">true</merge>

      </match>

      <match key="storage.bus" string="ieee1394">

   <merge key="storage.policy.should_mount" type="bool">true</merge>

      </match>

      <match key="storage.bus" string="sata">

   <merge key="storage.policy.should_mount" type="bool">true</merge>

      </match>

      <match key="storage.bus" string="platform">

   <merge key="storage.policy.should_mount" type="bool">true</merge>

      </match>

    </match>

    <!-- Also add SCSI optical drives -->

    <match key="storage.bus" string="scsi">

      <match key="storage.drive_type" string="cdrom">

        <merge key="storage.policy.should_mount" type="bool">true</merge>

      </match>

    </match>

    <!-- Handle drives with non-partitioned media  -->

    <match key="storage.no_partitions_hint" bool="true">

      <!-- optical drives -->

      <match key="storage.drive_type" string="cdrom">

   <merge key="storage.policy.mount_filesystem" type="string">auto</merge>

   <merge key="storage.policy.desired_mount_point" type="string">cdrom</merge>

   <match key="storage.cdrom.cdr" bool="true">

     <merge key="storage.policy.desired_mount_point" type="string">cdrecorder</merge>

   </match>

   <match key="storage.cdrom.cdrw" bool="true">

     <merge key="storage.policy.desired_mount_point" type="string">cdrecorder</merge>

   </match>

   <match key="storage.cdrom.dvdplusr" bool="true">

     <merge key="storage.policy.desired_mount_point" type="string">cdrecorder</merge>

   </match>

   <match key="storage.cdrom.dvdplusrw" bool="true">

     <merge key="storage.policy.desired_mount_point" type="string">cdrecorder</merge>

   </match>

   <match key="storage.cdrom.dvdram" bool="true">

     <merge key="storage.policy.desired_mount_point" type="string">cdrecorder</merge>

   </match>

   <match key="storage.cdrom.dvdr" bool="true">

     <merge key="storage.policy.desired_mount_point" type="string">cdrecorder</merge>

   </match>

   <match key="storage.cdrom.dvdrw" bool="true">

     <merge key="storage.policy.desired_mount_point" type="string">cdrecorder</merge>

   </match>

   <match key="/org/freedesktop/Hal/devices/computer:linux.is_selinux_enabled" bool="true">

     <merge key="storage.policy.mount_option.fscontext=system_u:object_r:removable_t" type="bool">true</merge>

   </match>

      </match>

      <!-- floppy drives -->

      <match key="storage.drive_type" string="floppy">

   <merge key="storage.policy.mount_filesystem" type="string">auto</merge>

   <merge key="storage.policy.desired_mount_point" type="string">floppy</merge>

   <match key="/org/freedesktop/Hal/devices/computer:linux.is_selinux_enabled" bool="true">

     <merge key="storage.policy.mount_option.fscontext=system_u:object_r:removable_t" type="bool">true</merge>

   </match>

      </match>

      <!-- zip drives -->

      <match key="storage.drive_type" string="zip">

   <merge key="storage.policy.mount_filesystem" type="string">auto</merge>

   <merge key="storage.policy.desired_mount_point" type="string">zip</merge>

   <match key="/org/freedesktop/Hal/devices/computer:linux.is_selinux_enabled" bool="true">

     <merge key="storage.policy.mount_option.fscontext=system_u:object_r:removable_t" type="bool">true</merge>

   </match>

      </match>

      <!-- jaz drives -->

      <match key="storage.drive_type" string="jaz">

   <merge key="storage.policy.mount_filesystem" type="string">auto</merge>

   <merge key="storage.policy.desired_mount_point" type="string">jaz</merge>

   <match key="/org/freedesktop/Hal/devices/computer:linux.is_selinux_enabled" bool="true">

     <merge key="storage.policy.mount_option.fscontext=system_u:object_r:removable_t" type="bool">true</merge>

   </match>

      </match>

    </match>

    <!-- Normal volumes; use volume label, uuid or drive_type -->

    <match key="block.is_volume" bool="true">

      <match key="volume.fsusage" string="filesystem">

   <!-- skip for drives with the no partitions hint (they are handled above) -->

   <match key="@block.storage_device:storage.no_partitions_hint" bool="false">

     <merge key="volume.policy.should_mount" type="bool">true</merge>

     <merge key="volume.policy.mount_filesystem" type="copy_property">volume.fstype</merge>

     

     <!-- Fallback is '<storage.bus>', appended with 'disk', e.g. usbdisk,

          idedisk, scsidisk etc. -->

     <merge key="volume.policy.desired_mount_point" type="copy_property">@block.storage_device:storage.bus</merge>

     <append key="volume.policy.desired_mount_point" type="string">disk</append>

         <!-- zip drives -->

         <match key="storage.drive_type" string="zip">

       <merge key="storage.policy.desired_mount_point" type="string">zip</merge>

         </match>

     

          <!-- Best: If available use filesystem label -->

          <match key="volume.label" empty="false">

            <!-- unless it's a path (e.g. /boot, /, /home etc) -->

            <match key="volume.label" is_absolute_path="false">

         <!-- and only if the label is ascii -->

              <match key="volume.label" is_ascii="true">

      <merge key="volume.policy.desired_mount_point" type="copy_property">volume.label</merge>

              </match>

            </match>

          </match>

     

     <!-- Should never mount Apple Bootstrap partitions (it would be

          a security hole) - should use the bootable flag from the

          Mac partition table instead -->

     <match key="volume.fstype" string="hfs">

       <match key="volume.label" string="bootstrap">

         <merge key="volume.policy.should_mount" type="bool">false</merge>

       </match>

     </match>

     

     <!-- Use selinux mount options for hotpluggable and removable

          volumes -->

     <match key="/org/freedesktop/Hal/devices/computer:linux.is_selinux_enabled" bool="true">

       <match key="@block.storage_device:storage.hotpluggable" bool="true">

         <merge key="volume.policy.mount_option.fscontext=system_u:object_r:removable_t" type="bool">true</merge>

       </match>

       <match key="@block.storage_device:storage.removable" bool="true">

         <merge key="volume.policy.mount_option.fscontext=system_u:object_r:removable_t" type="bool">true</merge>

       </match>

     </match>

      <!-- I've turned sync off because it slows down my iAudio g3 -->

     <!-- Use noatime and sync options for all hotpluggable or removable

          volumes smaller than 2GB -->

     <match key="volume.size" compare_lt="2147483648">

       <match key="@block.storage_device:storage.hotpluggable" bool="true">

         <merge key="volume.policy.mount_option.sync" type="bool">false</merge>

         <merge key="volume.policy.mount_option.noatime" type="bool">true</merge>

       </match>

       <match key="@block.storage_device:storage.removable" bool="true">

         <merge key="volume.policy.mount_option.sync" type="bool">true</merge>

         <merge key="volume.policy.mount_option.noatime" type="bool">true</merge>

       </match>

     </match>

     <!-- Use UTF-8 charset for vfat -->

     <match key="volume.fstype" string="vfat">

       <merge key="volume.policy.mount_option.utf8" type="bool">true</merge>

     </match>

     

     <!-- whitelist of partition table id's, if from a msdos partition table -->

     <match key="volume.partition.msdos_part_table_type" exists="true">

       <!-- Default to no mount and punch holes -->

       <merge key="volume.policy.should_mount" type="bool">false</merge>

       <!-- Linux -->

       <match key="volume.partition.msdos_part_table_type" int="0x83">

         <merge key="volume.policy.should_mount" type="bool">true</merge>

       </match>

       <!-- FAT12 -->

       <match key="volume.partition.msdos_part_table_type" int="0x01">

         <merge key="volume.policy.should_mount" type="bool">true</merge>

       </match>

       <!-- FAT16 <32M -->

       <match key="volume.partition.msdos_part_table_type" int="0x04">

         <merge key="volume.policy.should_mount" type="bool">true</merge>

       </match>

       <!-- FAT16 -->

       <match key="volume.partition.msdos_part_table_type" int="0x06">

         <merge key="volume.policy.should_mount" type="bool">true</merge>

       </match>

       <!-- HPFS/NTFS -->

       <match key="volume.partition.msdos_part_table_type" int="0x07">

         <merge key="volume.policy.should_mount" type="bool">true</merge>

       </match>

       <!-- W95 FAT32 -->

       <match key="volume.partition.msdos_part_table_type" int="0x0b">

         <merge key="volume.policy.should_mount" type="bool">true</merge>

       </match>

       <!-- W95 FAT32 (LBA) -->

       <match key="volume.partition.msdos_part_table_type" int="0x0c">

         <merge key="volume.policy.should_mount" type="bool">true</merge>

       </match>

       <!-- W95 FAT16 (LBA) -->

       <match key="volume.partition.msdos_part_table_type" int="0x0e">

         <merge key="volume.policy.should_mount" type="bool">true</merge>

       </match>

     </match>     

   </match>

      </match>

    </match>

    

  </device>

  <!-- Dont want to mount non-hotpluggable fixed disks since ideraid

       detection isnt complete as hald wrongly detects e.g. partitions

       from some IDE RAID controllers -->

  <device>

    <match key="storage.hotpluggable" bool="false">

      <match key="storage.removable" bool="false">

   <merge key="storage.policy.should_mount" type="bool">false</merge>

      </match>

    </match>

  </device>

</deviceinfo>

```

It's quite annoying, and I can't see any bugs about it either.  Nothing in dmesg.[/profile]

Erlend

----------

## Mr_Samsonov

Well I am totally confused now... 

Last night go to bed - memory stick not working as my user. 

Get in from work tonight, and my memory stick now works perfectly! I have not updated or changed a thing since last night. And in case anyone thinks it was the reboot over night, I rebooted after trying things last night. Even shutting down and restarting, just in case that helped. 

So my problem is solved, though I have no idea why?

----------

## Mr_Samsonov

Further probing around it seems somewhere along the line I have been added to the plugdev group - so I guess it was this that has solved the problem. Though how this happened remains a mystery!

----------

## frozenJim

For hot-plugging with KDE, here's all you need:

hald

dbus

hotplug

Just make sure that they are all running at boot and your hot-plug stuff (like usb-keys) will appear by magic in KDE.  It is just that easy.

```
rc-update add hald default

rc-update add dbus default

rc-update add hotplug default
```

But don't I need IVMAN (or any other program that I read about)?

You can get all fancy with IVMAN - but if you don't know why you need it, then you don't need it.  There are lots of other optional things you can do - but they are optional.  Worry about them AFTER you have your usb-key working in KDE.

HOWEVER

Yesterday I emerged KDE 3.5.  Everything is working fine EXCEPT that when I tried to mount my usb-key and got the error:

```
mount: can't find /dev/sda1 in /etc/fstab or /etc/mtab 
```

After reading through this thread, I checked to see if I had a NEW GROUP called plugdev.  It turns out that I do.  I didn't put it there and it was not there yesterday.

SOLUTION

I added my name to the plugdev group 

```
gpasswd -a james plugdev
```

I choked a bit when I still couldn't mount my usb-key.  Then I logged out and back in again.  Now it works. (whew!)

EXPLANATION(?)

My guess: KDE 3.5 has made some changes to hotplugging - I believe that this is one of the goals of 3.5.  I suspect that this new group came along with the KDE 3.5 update (or one of the tools that was required in it's installation).

I would like to know for sure WHICH program created this little "change in the rules".  I hate it when my computer breaks because of some obscure change that nobody told me had been made.

----------

## mazirian

It's really not a KDE specific group, I believe it is a hal/dbus specific group.  Anyway, I'd have been spared a lot of trouble had I known this document existed.

----------

## frozenJim

Aha.  I believe that DBUS was upgraded along with KDE.

----------

## Erlend

I'm in the plugdev group.

```
groups

adm wheel floppy audio cdrom users portage plugdev

```

I have dbus, hald, and hotplug all started at boot.

No error messages.

Usbdisk is created in /dev/sd** when inserted, but the mountpoint /media/... isn't created, and /etc/fstab isn't updated.

It worked before upgrading a week or so ago.

Erlend

PS: it isn't really relevant, but I use xfce, so there is no automounting of anything, i'm just using original hal.

----------

## mazirian

Erlend, I don't know how to explain the fact that it worked for you previously, but I thought you needed more than simply dbus/hal to get automounting to work. In gnome's case, you need to run gnome-volume-manager.  KDE has its own built in solution, and there is also ivman.  I use e17 as a window manager, and have to run gnome-volume-manager to get automounting to work correctly.

----------

## Erlend

Sorry, not automounting, just automatic creation of the mount points.  Hald does that for you I think.

----------

## pvocong

Hello,

I have updated my Gentoo box (emerge -uvDN world) as of a couple of days ago. 

I forgot how to mount my usb memory stick.

I found the related forum thread here.

I still use kernel 2.6.13-gentoo-r5.

As somebody suggests above, the group plugdev is there.

 I am using KDE.

I plug the usb memory stick: Nothing is happening (no automount).

So, I am looking if the device was recognized by using KinfoCenter or usbview. The device was indeed recognized.

By looking at:

```
ls -l /dev/sd*

brw-rw----  1 root disk 8,  0 Feb  2 10:36 /dev/sda

brw-rw----  1 root disk 8,  1 Apr 13  2004 /dev/sda1

brw-rw----  1 root disk 8, 10 Apr 13  2004 /dev/sda10

brw-rw----  1 root disk 8, 11 Apr 13  2004 /dev/sda11

```

I know that the device, just recognized  is /dev/sda (Feb 2).

Hence, I mount the detected device:

```
#mount /dev/sda /usb

```

Where /usb was created some time ago.

I am able to access the usb memory stick.

Conclusions:

I should use my time to make automount work, with the help of this forum thread.

Thanks.

----------

## saturday

I am having the same problem. It is working now on one machine with adding me to the plugdev-group, but that doesn't solve things on the second.   :Confused: 

Kernel 2.6.15, Kde 3.4.3 on both machines. Hald, dbus and hotplug running.

----------

## 01mf02

Hi! As most of you here I've upgraded dbus (to dbus-0.60-r3), and automatic mountpoint creation in /media doesn't seem to work anymore.

However, I don't have a group plugdev! Any ideas?

----------

## 01mf02

I've downgraded to dbus-0.23.4-r1, but this brought many problems, because hal wanted a newer version of dbus and didn't find a dbus shared library even after recompiling hal.

On the other side, an update to the newest dbus didn't help too.

----------

## Erlend

 *Quote:*   

> However, I don't have a group plugdev! Any ideas?

 

Try re-emerging hal and dbus.

----------

## 01mf02

That didn't help unfortunately.

----------

## sawatts

 *mazirian wrote:*   

> Anyway, I'd have been spared a lot of trouble had I known this document existed.

 

I've just followed that document and automount is now working for the first time in ages!  I once again have my IPOD and USBDISK as icons on the desktop.    :Very Happy: 

Previously, problems had started with having to use some '~arch' packages, which lead to having to use '~arch' versions of 'hal' and 'ubus' not compatible with Gnome 2.10.

When Gnome 2.12 was marked stable, this didnt solve automount; neither did just joining the 'plugdev' group.

Going through the above upgrade doc, making sure that all USE flags where present (I think I lacked one, but had most), rebuilding with '--newuse', etc., has finally worked.

This with kernel 2.6.14

```
Linux betelgeux 2.6.14-gentoo-r2 #2 SMP PREEMPT Thu Dec 29 16:41:29 GMT 2005 i686 AMD Athlon(tm) MP 1900+ AuthenticAMD GNU/Linux
```

----------

## 01mf02

Okay, I've solved my problem by downgrading hal and dbus now.

----------

## saturday

I solved my problem as well. I had to emerge pmount. I think it should be installed as a dependancy of kdebase-kioslaves not only for 3.5, but also for 3.4.3!

----------

## seventhguardian

Same problem here..

A question: shouldn't there be an utility caller fstab-sync on $PATH ? How do we configure things to use pmount instead? I say this because I don't have it in my $PATH, but I believe it used to be there..   :Confused: 

----------

## Erlend

 *Quote:*   

> A question: shouldn't there be an utility caller fstab-sync on $PATH ?

 

I think it got removed with the upgrade.  There was a message about it in the emerge output.

----------

## seventhguardian

 *Erlend wrote:*   

>  *Quote:*   A question: shouldn't there be an utility caller fstab-sync on $PATH ? 
> 
> I think it got removed with the upgrade.  There was a message about it in the emerge output.

 

On the output from which package?

----------

## Erlend

Well I thought it was the output from hal, but looking through the ebuilds I cannot see anything.

There is some output in an older ebuild about fstab-sync being a security risk, so maybe it was removed??

I take it that it's still hal's job to make mountpoints?

I've just upgraded to 2.6.15 - and same problem.  I've put a bug up about it too.

----------

## Mr. Garr

hi

i have a strange problem, when i plug in my usb stick for the firs time after a reboot everything is ok but if i plug it in for the second time it's not working, even dmesg doesn't show that i plugged anything

----------

## Erlend

Maybe you need to umount after the first time?

----------

## Mr. Garr

tried it, doesn't help

----------

## Drone1

Can anyone who posted in here shed light on my problem over here?

http://gentoo-wiki.com/HOWTO_D-BUS%2C_HAL%2C_KDE_media:/

I put it in hardware, cause well, it deals with mounting hardware ... strictly at shell concerning this, no gui .....

----------

