# Unable to copy a CD with K3B 19.08.0 under FreeBSD 12.0 release-p10 (Mate desktop)



## EDU72 (Aug 31, 2019)

Hello,

I have the following error message when I want to copy a cd with K3B ...

******************************************************************************
Devices
-----------------------
TSSTcorp CD/DVDW SH-S183A SB02 (/dev/cd0, CD-R, CD-RW, CD-ROM, DVD-ROM, DVD-R, DVD-RW, DVD-R DL, DVD+R, DVD+RW, DVD+R DL) [DVD-ROM, DVD-R séquentiel, DVD-R double couche séquentiel, DVD+R double couche avec saut, DVD-RAM, DVD-RW à ré-inscription limitée, DVD-RW séquentiel, DVD+RW, DVD+R, DVD+R double couche, CD-ROM, CD-R, CD-RW] [SAO, TAO, RAW, SAO/R96P, SAO/R96R, RAW/R16, RAW/R96P, RAW/R96R, Ré-inscription restreinte, Saut de couche] [%7]

System
-----------------------
K3b Version: 19.8.0
KDE Version: 5.61.0
Qt Version:  5.12.2
Kernel:      12.0-RELEASE-p10

readcd
-----------------------
scsidev: '/dev/cd0'
devname: '/dev/cd0'
scsibus: -2 target: -2 lun: -2
readcd: Invalid argument. Open by 'devname' not supported on this OS. Cannot open or use SCSI driver.
readcd: For possible targets try 'readcd -scanbus'.
readcd: For possible transport specifiers try 'readcd dev=help'.

readcd command:
-----------------------
/usr/local/bin/readcd -v dev=/dev/cd0 f=/home/eric/.tmp/A Trick Of The Tail -clone retries=128 ts=128k[/SIZE]
********************************************************************************************************
`readcd -scanbus`

```
scsibus3:
    3,0,0    300) '' '' '' NON CCS Disk
    3,1,0    301) *
    3,2,0    302) *
    3,3,0    303) *
    3,4,0    304) *
    3,5,0    305) *
    3,6,0    306) *
    3,7,0    307) *
scsibus4:
    4,0,0    400) 'TSSTcorp' 'CD/DVDW SH-S183A' 'SB02' Removable CD-ROM
    4,1,0    401) *
    4,2,0    402) *
    4,3,0    403) *
    4,4,0    404) *
    4,5,0    405) *
    4,6,0    406) *
    4,7,0    407) *
```
`readcd dev=help`

```
Supported SCSI transports for this platform:

Transport name:        CAM
Transport descr.:    Generic transport independent SCSI (Common Access Method)
Transp. layer ind.:    
Target specifier:    bus,target,lun
Target example:        1,2,0
SCSI Bus scanning:    supported
Open via UNIX device:    not supported

Transport name:        RSCSI
Transport descr.:    Remote SCSI
Transp. layer ind.:    REMOTE:
Target specifier:    rscsi@host:bus,target,lun
Target example:        REMOTE:rscsi@host:1,2,0
SCSI Bus scanning:    supported
Open via UNIX device:    not supported
```

if I run the following command in the mate-terminal, we see that it works ... (as user)
`$ /usr/local/bin/readcd -v dev=4,0,0 f=/home/eric/.tmp/copie -clone`


```
scsidev: '4,0,0'
scsibus: 4 target: 0 lun: 0
Read  speed:  8468 kB/s (CD  48x, DVD  6x, BD  1x).
Write speed:  8468 kB/s (CD  48x, DVD  6x, BD  1x).
TOC len: 125. First Session: 1 Last Session: 1.
01 10 00 A0 00 00 00 00 01 00 00 
01 10 00 A1 00 00 00 00 08 00 00 
01 10 00 A2 00 00 00 00 33 19 21 
01 10 00 01 00 00 00 00 00 03 00 
01 10 00 02 00 00 00 00 06 00 2F 
01 10 00 03 00 00 00 00 0C 1C 02 
01 10 00 04 00 00 00 00 12 3A 23 
01 10 00 05 00 00 00 00 1A 21 39 
01 10 00 06 00 00 00 00 20 34 30 
01 10 00 07 00 00 00 00 28 3A 08 
01 10 00 08 00 00 00 00 2D 21 0F 
20 00 00 00 00 00 00 00 00 00 00 
Lead out 1: 231258
Capacity: 231258 Blocks = 462516 kBytes = 451 MBytes = 473 prMB
Sectorsize: 2048 Bytes
readcd: Input/output error. mode select g1: scsi sendcmd: retryable error
CDB:  55 10 00 00 00 00 00 00 14 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 26 00 00 00 00 00
Sense Key: 0x5 Illegal Request, Segment 0
Sense Code: 0x26 Qual 0x00 (invalid field in parameter list) Fru 0x0
Sense flags: Blk 0 (not valid) 
resid: 20
cmd finished after 0.000s timeout 40s
Copy from SCSI (4,0,0) disk to file '/home/eric/.tmp/copie'
end:    231258
addr:   231258 cnt: 14
Time total: 317.167sec
Read 552851,16 kB at 1743,1 kB/sec.
```

in /etc/group -> user eric

```
wheel:*:0:root,eric
daemon:*:1:
kmem:*:2:
sys:*:3:
tty:*:4:
operator:*:5:root,eric
```

in /etc/rc.conf

```
hostname="PcFreeBSD.domaine.local"
keymap="fr.acc.kbd"
ifconfig_age0="DHCP"
moused_enable="YES"
ntpdate_enable="YES"
ntpd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
defaultrouter="192.168.1.1"
clear_tmp_enable="YES"
sendmail_enable="NONE"
ntpdate_enable="YES"
ntpd_enable="YES"
dbus_enable="YES"
hald_enable="YES"
bsdisks_enable="YES"
lightdm_enable="YES"
cupsd_enable="YES"
devfs_system_ruleset="system"
dsbmd_enable=YES
#autofs_enable="YES"
```

in /boot/loader.conf

```
kern.vty=vt
linux_load="YES"
fuse_load="YES"
nvidia_load="YES"
autoboot_delay="2"
ctl_load="YES"
```

in /etc/sysctl.conf 

```
kern.sched.preempt_thresh=224
vfs.usermount=1
```
in /etc/devfs.conf

```
# Commonly used by many ports
link    cd0    cdrom
link    cd0    dvd

# Allow a user in the wheel group to query the smb0 device
#perm    smb0    0660

# Allow members of group operator to cat things to the speaker
#own    speaker    root:operator
#perm    speaker    0660

# acces aux cdrom
perm    /dev/acd0       0666
perm    /dev/acd1       0666
perm    /dev/cd0        0666
perm    /dev/cd1        0666

# acces au systemes  USB
perm    /dev/da0        0666
perm    /dev/da1        0666
perm    /dev/da2        0666
perm    /dev/da3        0666
perm    /dev/da4        0666
perm    /dev/da5        0666
perm    /dev/da6        0666
perm    /dev/da7        0666
perm    /dev/da8        0666
perm    /dev/da9        0666

# acces au autres systemes
perm    /dev/pass0      0666
perm    /dev/pass1      0666
perm    /dev/pass2      0666
perm    /dev/xpt0       0666
perm    /dev/xpt1       0666
perm    /dev/xpt2       0666
```

in /etc/devfs.rules

```
[system=10]
add path 'ad[0-9]\*'    mode 666
add path 'ada[0-9]\*'    mode 666
add path 'da[0-9]\*'    mode 666
add path 'acd[0-9]\*'    mode 666
add path 'cd[0-9]\*'    mode 666
add path 'mmcsd[0-9]\*'    mode 666
add path 'pass[0-9]\*'    mode 666
add path 'xpt[0-9]\*'    mode 666
add path 'ugen[0-9]\*'    mode 666
add path 'usbctl'        mode 666
add path 'usb/\*'        mode 666
```

`ll readcd cdrecord`

```
-rws--x--x  1 root  operator  502744 28 août  22:46 cdrecord*
-rws--x--x  1 root  operator  322520 28 août  22:46 readcd*
```
how to ask K3b to pass SCSI compatible commands (dev = 4,0,0) to readcd and recordcd?

thank you in advance ...


----------



## pacija (Sep 2, 2019)

Hi,

After almost giving up on burning (mostly audio) CDs on FreeBSD, I figured it out.

In my case, contrary to pkg-message, neither setuid flags nor vfs.usermount are needed.

Device permissions are needed though, and for my unprivileged account, which is in operator group I solved them with devfs.rules:


```
[system=10]
add path 'cd*'   mode 0660 group operator
add path 'pass*' mode 0660 group operator
add path 'usb/*' mode 0660 group operator
add path 'xpt0'  mode 0660 group operator
```

BTW I think your device permissions are downright dangerous 

Finally, it appears that HAL is also needed.

With these in place, all I needed to do to make it work was to get to "Settings -> Configure K3b -> Programs -> User Parameters" and pass information about my drive from `cdrecord -scanbus`:






Hope this helps,


----------



## EDU72 (Sep 2, 2019)

Thank you Pacija,

I did not understand that it was necessary to pass the parameters to external files through the "user parameters" tab.
Now copying CDs works normally without Suid activation. 
As for permission, I will refine them as and when I'm still in the installation phase ...


----------

