Introduction
Project Utopia is a term coined by Robert Love and Joe Shaw that refers to the goal of implementing a unified solution to Linux hardware and device management. Specifically, Project Utopia is associated with the udev, hotplug,dbus, hal, and gnome-volume-manager projects. See Robert Love's post for some insight into the project. There is also a Project Utopia mailing list if you are interested. Project Utopia's primary aim is to succeed poorly implemented methods such as autofs and supermount. Freedesktop.org is an umbrella organization that hosts many of the core components of Project Utopia.
This guide should help you reach that coveted moment of inserting your usb stick and having it automatically mount.
Initial Requirements
Udev and hotplug are required for things to work correctly. Fortunately, the Gentoo Developers have already written a comprehensive doc
Note: Do make sure you emerge hotplug (Code Listing 2.2: Installing optional hotplug scripts)
Portage's Status:
Eventually you will simply be able to do:
emerge dbus hal gnome-volume-manager
Unfortunately, those ebuilds are not mature as of yet. In fact, they're all hard-masked, indicating you really shouldn't be using them. As of 8/31/2004:
Code: Select all
sys-apps/dbus-0.22 (masked by: package.mask)
sys-apps/hal-0.2.97 (masked by: package.mask)
Within bmg-main (Break-My-Gentoo Installation Guide)package.mask: the package is listed in the package.mask file, meaning that it breaks something, crashes your system, has severe security issues or worse
Code: Select all
sys-apps/dbus-cvs-0.22-r3 (masked by: -* keyword)
sys-apps/hal-cvs-0.3-r2 (masked by: -* keyword)
So, for now, it's probably best to just compile from CVS. It's really not that hard and you'll probably need to do it at some point anyway.-* Known not to work or being extremely dangerous on any architecture
Note on CVS installations.
I like to let packages I install manually stay in /usr/local (default for the autotool system). This keeps us from cluttering our main system and physically separates official installations from the manual ones. This means that we'll need to edit the init files for /usr/local.
Installing dbus
Dbus is an IPC (Inter Process Communication) protocol being developed by freedesktop.org. In the future, dbus will likely be a de-facto standard for many Linux systems.
Code: Select all
cd <your src directory> (I use /usr/local/src)
cvs -d :pserver:anoncvs@pdx.freedesktop.org:/cvs login
<enter> (Password is Blank)
cvs -d :pserver:anoncvs@pdx.freedesktop.org:/cvs co dbus
cd dbus/dbus
./autogen.sh \
--enable-python \
--enable-glib \
--with-system-pid-file=/var/run/dbus.pid \
--with-system-socket=/var/lib/dbus/system_bus_socket \
--with-session-socket-dir=/tmp \
--disable-doxygen-docs \
--disable-xml-docs \
--disable-mono-docs
make
sudo make install (If you don't have sudo then su before make install)
The config options are loosely based on the dbus ebuild. I omitted X,gtk,qt, mono, xml, and test options as I'd rather leave things to the package default. Browse /usr/portage/sys-apps/dbus/dbus-0.22.ebuild if you're interested. The dbus dialog claims:
Probably not to big an issue for now, we know things are unstable.NOTE: building with unit tests increases the size of the installed library and renders it insecure.
NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance.
NOTE: building with assertions increases library size and decreases performance.
The messagebus user:
dbus uses the messagebus user defined in etc/system.conf; you probably shouldn't change this. For some reason, dbus does not give an error when you attempt to start if the user does not exists, anyhow, we need to create the user.
Code: Select all
(As Root)
useradd messagebus
The stock init file provided in the dbus cvs tree will not work on gentoo systems (dbus/bus/messagebus)
We can simply copy the init script from the currently broken ebuild and edit it.
Code: Select all
(As Root)
cp /usr/portage/sys-apps/dbus/files/dbus /etc/init.d/dbus
edit the dbus file under /etc/init.d and change
/usr/bin/dbus-daemon-1 to /usr/local/bin/dbus-daemon-1 in this line:
start-stop-daemon --start --pidfile /var/run/dbus.pid --exec /usr/bin/dbus-daemon-1 -- --system
chmod +x /etc/init.d/dbus
mkdir /var/lib/dbus
Code: Select all
(As Root)
/etc/init.d/dbus start
ps -A|grep dbus-daemon-1
rc-update add dbus default
Hal (Hardware Abstraction Layer) provides an interface to the hardware on a Linux system. The work on Hal is inspired by Havoc's article "Making Hardware Just Work" according to the author. Hal does not actually DO anything in the sense of mounting devices. Applications such as gnome-volume-manager use HAL to do this. Take a look at the Hal specifications if you are interested.
Code: Select all
cd <your src directory> - I use /usr/local/src
cvs -d :pserver:anoncvs@pdx.freedesktop.org:/cvs login
<enter> (Password is Blank)
cvs -d :pserver:anoncvs@pdx.freedesktop.org:/cvs co hal
cd hal/hal
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./autogen.sh \
--disable-doxygen-docs \
--disable-docbook-docs
make
(As Root)
useradd haldaemon
groupadd haldaemon
make install (If you don't have sudo then su before make install)
Since you'll probably be updating cvs often you may want to add PKG_CONFIG_PATH to the environment permanently.
Code: Select all
(As Root)
edit /etc/env.d/99pkgconfig and add the following line
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
env-update
source /etc/profile
Code: Select all
(As Root)
cp /usr/portage/sys-apps/hal/files/hald /etc/init.d/hald
edit the hald file under /etc/init.d and change
/usr/sbin/hald to /usr/local/sbin/hald in this line:
start-stop-daemon --start -q --exec /usr/sbin/hald
chmod +x /etc/init.d/hald
Code: Select all
(As Root)
/etc/init.d/hald start
rc-update add hald default
hal-device-manager is a program that comes with hal which lets you view all the information associated with your devices.
Note:
hal-device-manager may fail to start because python cannot import dbus. This is likely because you installed dbus in another prefix, probably /usr/local. Python can be told other locations to import from by setting the PYTHON_PATH variable.
Code: Select all
(As Root)
edit /etc/env.d/99python
Add line
PYTHON=/usr/local/lib/python2.3/site-packages
env-update
source /etc/profile
Code: Select all
hal-device-managerGnome-Volume-Manager is the policy part of Project Utopia. It uses hal's information to automatically mount CDs, pendrives, run DVDs, etc.
Code: Select all
cd <your src directory> - I use /usr/local/src
cvs -d :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome login
<enter> (Password is Blank)
cvs -d :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome co gnome-volume-manager
cd gnome-volume-manager
This option will probably appear in gnome-volume-properties soon, but for now if you want to use a file-manager other than Nautilus you may want to change this line under src/manager.c:
For myself, I changed the line to:
#define NAUTILUS_COMMAND "/usr/bin/rox %m"
Code: Select all
./autogen.sh && make && sudo make installCode: Select all
gnome-volume-manager & Code: Select all
gnome-volume-propertiesIvman is an alternative to gnome-volume-manager without any of the gnome stuff. I would use the break-my-gentoo ivman-cvs ebuild. There is also a guide in the forums by Redeeman, but his ebuild links are down.
Maintaining CVS (For those unfamiliar)
You may want to update from cvs often, do this
Code: Select all
cd <pkg_src_directory>
cvs update
make && sudo make install
Code: Select all
make distclean ; ./autogen.sh && make && sudo make install
A few Notes:
- You need to change your /etc/fstab file to fit what hal claims your devices should be. The easiest way is to use hal-device-manager, find your device and look at the block_device string. For example, my cd-ROM is /dev/sr0
- There is a component of hal called fstab-sync that you might take a look at.
- Pressing the eject button on the cd-ROM will not work yet.
- Pulling out a pen-drive before unmounting first is dangerous. (Hence the reason windows has "Safely Remove Device")
- Dbus seems fairly stable but sometimes hald goes down for now apparent reason. If things aren't working, check that the processes exist and restart the neccesary ones.
Code: Select all
ps -A | grep -e hald -e dbus-daemon -e gnome-volume (If hald is gone) /etc/init.d/hald zap start [*]I haven't found how to access hald's logs yet. I'll update this guide when I do.[/list]




