Solving the automount issue

When you are using a lightweight window manager (fluxbox, openbox, jwm…) the first issue you will probably encounter is how to mount an usb drive. Of course the manual way of doing things as a root or a sudo works (meaning: sudo mount /dev/volume_name mountpoint_name) but it can get a bit frustrating to do it every single time when a new usb appears – so here are two ways to make things automatic.

1. Install Gdm or Lightdm

This solution adds dependencies and makes the system a bit slower. In any case this solution works since those display managers will automatically take charge from mounting the usb devices. This way is not recommended if you want to build a very robust system.

2. Install dbus-x11, thunar and thunar-volman

I use startx to to startup my box so here are entries from my .xinitrc file with explanations

#dbus-launch ck-launch-session exec fluxbox #This was used in Debian Testing/Sid
exec dbus-launch fluxbox #Default

From the two lines I recommend the one, which has the line #Default following it. The first line was problematic in Arch but worked well in Debian Testing/Sid and hence it was left as an example.

EDIT 1 (20th of February): You will most definetely also need to install packages: gvfs and udisks, which are very much needed by Dbus and Thunar if you want to mount devices automatically.

EDIT 2 (20th of February): On some systems adding thunar Р-daemon & to .xinitrc might solve some problems during the startup as Thunar is then automatically run as a daemon on the system background  from the start.


Explaining Dbus and Thunar

Dbus is a rather important software since it makes it possible that a program x can talk to a program y. In practice the previous means that via dbus your computer can send a” singnal” from the appearance of a usb stick to a file-manager, which then mounts the usb as a device.

I recommend using thunar as a filemanager with an extra package called thunar-volman, which is responsible from the mounting of the usb volumes in the filemanager’s end. Once you have installed thunar and thunar-volman open thunar and go to: edit->preferences->advanced and click Enable Volume Management.

Once all the above is done restart your computer so that the changes can most certainly be applied. Now when you return to your desktop and insert an usb stick and then open thunar you should get your usb mounted right away – and this time without losing the valuable resources and space, which might come when installing lightdm or gdm or any other heavy display manager.