Using K3b with FreeBSD

Tags: freebsd, howtos

Published on
« Previous post: Using the Microsoft Windows 7 (or Vista) … — Next post: Using FreeBSD’s BPF device with … »

K3b is a great CD/DVD authoring software. This small tutorial explains how to use it with non-root user accounts. This HOWTO is also applicable if you want to get k9copy working. You can skip setting SUID flags in this case.

Kernel setup

First, let’s check whether you have to do anything about your kernel setup at all. Execute camcontrol devlist in a terminal. If you see your CD/DVD writer, all is well. For example, this is the output of the command when being run on my good old Thinkpad R50e:

/home/bastian % camcontrol devlist
<MATSHITA DVD-RAM UJ-830Sx 1.00>   at scbus1 target 0 lun 0 (pass0,cd0)

If you don’t see your hardware, let’s try something else: This is as easy as it gets: Either add atapicam_load=“YES” in /boot/loader.conf or compile a new kernel that contains device atapicam.

This should do the trick.

DevFs configuration

You need to set the proper permissions for the CD/DVD drive. If you look at the output from camcontrol devlist from above, you will notice the part (pass0,cd0). If you have multiple CD/DVD drives in your computer, the numbers will be different. Substitute the correct numbers for your system in the lines below.

Open /etc/devfs.conf and add the following lines at a convenient location:

# Allow CD/DVD authoring
perm cd0   0660
perm pass0 0660
perm xpt0  0660

If you are the only user of your computer, simply add your account to the operator group (which owns the devices by default).

If you want to enable burning for multiple users, however, I would strongly suggest creating an appropriate user group (e.g. burn) and adding the user accounts that are allowed to burn CDs/DVDs. In this case, in addition to the lines from above, the following lines should also be added to /etc/devfs.conf:

own cd0   root:burn
own pass0 root:burn
own xpt0  root:burn

Set SUID flags

Skip this step if you are trying to install k9copy.

I don’t like it very much, but is necessary to endow cdrdao and cdrecord with root permissions. So, su to root and execute:

chmod u+s /usr/local/bin/cdrdao
chmod u+s /usr/local/bin/cdrecord

Enable DMA

Execute sysctl hw.ata.atapi_dma to check whether DMA is enabled for CD/DVD drives:

/home/bastian % sysctl hw.ata.atapi_dma
hw.ata.atapi_dma: 1

If the output is 0, add hw.ata.atapi_dma=1 to /etc/sysctl.conf.

Conclusion

K3b or k9copy should work now. If you want to enable user mounting of CDs/DVDs, add vfs.usermount=1 to /etc/sysctl.conf.