Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 15th May 2008
BSDKaffee's Avatar
BSDKaffee BSDKaffee is offline
Real Name: Jason Hale
Coffee Addict
Join Date: May 2008
Location: Wintersville, Ohio
Posts: 212
Thanked 36 Times in 34 Posts
Default Automounting CDs/DVDs in KDE on FreeBSD

Automounting CDs/DVDs in KDE on FreeBSD

This guide was written for all officially supported versions of FreeBSD with the most current ports versions. If you are having trouble with these instructions, first make sure you are using the latest available versions of the ports mentioned. Specifically, this guide was written for the following ports with the following versions:
  • x11/kdebase3 (3.5.8+) and/or x11/kdebase4 (4.1.1+)
  • sysutils/hal (0.5.11.r2+)
  • sysutils/policykit (0.7+)

1) Hardware Abstraction Layer
KDE uses a system called Hardware Abstraction Layer (HAL) to automatically mount CDs and DVDs. By default, KDE 3.x and KDE 4.x are built with HAL support. The KDE 3.x ports allow you to disable HAL support, so make sure you did not disable it. If you are not sure, try running the following command:
$ find `kde-config --prefix`/lib/kde3/media_propsdlgplugin.so && echo "HAL is enabled."
This will search the prefix that you installed KDE 3.x in (most likely /usr/local) for a certain file that is only installed if HAL is enabled. If HAL is enabled, "HAL is enabled" will be echoed to the screen and you may proceed. If HAL is not enabled, you will see a message from find saying that the file does not exist. At this point, you will have to rebuild x11/kdebase3 with HAL enabled.

2) Permissions / Groups
You will need to be sure you have correct permissions to use the CD/DVD device. You should at least set the read bit for your device, otherwise you will not be able to use the "Eject" feature. If you use ATAPICAM, HAL will make use of the device created by it, so be sure to set the permissions for this device. For example, if you have one ATAPI CD-ROM drive with ATAPICAM enabled, set the following permissions:
# chmod 644 /dev/acd0 /dev/cd0
If you have a CD-Writer with ATAPICAM enabled, you may want to set the write bit as well:
# chmod 666 /dev/acd0 /dev/cd0
You will probably want these permissions set at boot time. Among other methods, you can use rulesets to accomplish this. Rulesets are defined in /etc/devfs.rules and you may have to create this file if it does not already exist. Below is an example /etc/devfs.rules to set read/write permissions on all of the CD drives attached to the computer:
# MYBOX's rules
add path 'acd*' mode 666
add path 'cd*' mode 666
Then add the following line to /etc/rc.conf:
Along with the proper permissions, you also need to be a member of the proper group. Your user must be a member of the operator group. For example if you want to add a user called "BSDKaffee" to the operator group, use the following command:
# pw groupmod operator -m BSDKaffee


3) /etc/fstab
Make sure you DO NOT have lines in /etc/fstab representing your CD/DVD drive. For example, if your fstab looks like this:
# Device	Mountpoint	FStype	Options		Dump	Pass#
/dev/ad0s1b	none		swap	sw		0	0
/dev/ad0s1a	/		ufs	rw		1	1
/dev/ad0s1e	/tmp		ufs	rw		2	2
/dev/ad0s1f	/usr		ufs	rw		2	2
/dev/ad0s1d	/var		ufs	rw		2	2
/dev/acd0	/cdrom		cd9660	ro,noauto	0	0
/dev/cd0	/cdrom		cd9660	ro,noauto	0	0
Then either comment out the lines for /dev/acd0 and /dev/cd0, or remove them. I would recommend just commenting them in case you want to use your drive(s) without HAL later.

4) /etc/rc.conf
You will need to add a few lines to /etc/rc.conf to enable HAL and a few other related services. Add the following lines to /etc/rc.conf:
You will have to start these services manually if you don't want to reboot.
# /usr/local/etc/rc.d/dbus start
# /usr/local/etc/rc.d/hald start
5) PolicyKit
HAL uses PolicyKit to verify that you are authorized to mount the CD/DVD. You will need to edit /usr/local/etc/PolicyKit/PolicyKit.conf and specify that your username is authorized. Below is an example PolicyKit.conf file that authorizes root to do any action and a user named BSDKaffee to mount a CD/DVD.
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->

<!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"

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

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

6) Restart KDE
After making all of these changes, you will need to restart KDE.

7) Desktop Icons
This is optional and only for KDE 3.x, but you may like an icon to automatically appear on your desktop whenever you insert a CD/DVD for easy access. To do this, open the KDE Control Center. Click on Desktop --> Behavior. Click the Device Icons tab. Check the boxes for Mounted CD Writer, Mounted CD-ROM, and Mounted DVD.

Depending on the type of drive you have, you may not need to check all of these boxes but it won't hurt if you do. For example if you just have a plain read-only CD-ROM drive, you will not need to check Mounted CD Writer or Mounted DVD. Now click on Apply.

KDE 4.x uses a device manager which is in the panel by default. The icon looks like a laptop computer. If you click on it, it will show you a list of CDs/DVDs you have in your drive(s). You can chose to mount them, unmount them, and eject them through this interface. Alternatively, Dolphin provides access to your optical media.

I think that's about everything there is to Automounting in KDE. Most of this should apply to other OSes, but I am only familiar with FreeBSD so I can't claim that it will work. Any suggestions to improve this How-To are appreciated.

Last edited by BSDKaffee; 8th October 2008 at 11:22 PM. Reason: add notes for KDE 4.x
Reply With Quote

freebsd, hal, kde

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automounting DVD/USB rex FreeBSD General 2 4th September 2008 08:03 PM
Automounting USB devices with HAL/KDE vinegaroon FreeBSD General 1 13th June 2008 02:16 PM
Automounting drives jwhal OpenBSD General 4 12th June 2008 05:00 PM
Playing DVDs drhowarddrfine FreeBSD Ports and Packages 9 30th May 2008 02:46 PM

All times are GMT. The time now is 04:53 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick