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:
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:
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:
If you have a CD-Writer with ATAPICAM enabled, you may want to set the write bit as well:
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 # [mybox_rules=100] add path 'acd*' mode 666 add path 'cd*' mode 666
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
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:
# /usr/local/etc/rc.d/dbus start # /usr/local/etc/rc.d/hald start
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" "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"> <match user="BSDKaffee"> <return result="yes"/> </match> </match> </config>
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; 9th October 2008 at 12:22 AM. Reason: add notes for KDE 4.x
|freebsd, hal, kde|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Automounting DVD/USB||rex||FreeBSD General||2||4th September 2008 09:03 PM|
|Automounting USB devices with HAL/KDE||vinegaroon||FreeBSD General||1||13th June 2008 03:16 PM|
|Automounting drives||jwhal||OpenBSD General||4||12th June 2008 06:00 PM|
|Playing DVDs||drhowarddrfine||FreeBSD Ports and Packages||9||30th May 2008 03:46 PM|