NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.3k stars 13.54k forks source link

K3b doesn't work #19154

Open jagajaga opened 7 years ago

jagajaga commented 7 years ago

Issue description

Hello! I'm trying to write files to a CD and getting error:

cdrecord has no permission to open the device
You may use K3bsetup to solve this problem

Running K3bsetup results in /home/foobar/.nix-profile/bin/k3bsetup: line 16: kcmshell4: command not found.

For example 1 month ago k3b worked 100%.

Steps to reproduce

nix-env -i k3b

Technical details

cc @ttuegel

abbradar commented 7 years ago

Try adding your user to cdrom group. However, k3bsetup is another problem...

ttuegel commented 7 years ago

Attn. @svanderburg @Phreedom (K3B maintainers)

jagajaga commented 7 years ago

@abbradar adding myself to cdrom group doesn't help :(

Taeradan commented 7 years ago

I have the same problem, being in the "cdrom" group doesn't help and k3bsetup results in /run/current-system/sw/bin/k3bsetup: line 16: kcmshell4: command not found

Zer0- commented 7 years ago

At the moment I can't burn a cd. Brasero doesn't list my write device and can only write images to my hard drive, and k3b has the same issue as OP. I don't know how to do it otherwise. I'm in the cdrom group.

I also tried to chown /dev/cdrom to my user without sucess. (I changed it back to root:cdrom).

cpakkala commented 7 years ago

same issue with 17.03 stable

eternaleye commented 7 years ago

Just helped someone work around this; stracing k3b gave the cdrecord command it was running, and invoking that manually produced this:

cdrecord: Operation not permitted. rezero unit: scsi sendcmd: fatal error
CDB:  01 00 00 00 00 00
cdrecord: Operation not permitted. Cannot send SCSI cmd via ioctl.
cdrecord: Operation not permitted. Cannot open or use SCSI driver.
cdrecord: For possible targets try 'cdrecord -scanbus'. Make sure you are root.
cdrecord: For possible transport specifiers try 'cdrecord dev=help'.

Running the command as root did work; reading man 7 capabilities implies that CAP_SYS_ADMIN grants certain privileged block-device ioctls.

My personal suggestion would be to add a CAP_SYS_ADMIN file capability to the cdrecord binary, and make it executable only by the cdrom group.

sjau commented 6 years ago

Still doesn't work in Nixos Small Unstable; running it as root (gksu k3b) works.

18.03pre118346.5f8bbb96f8 (Impala)

nix-env (Nix) 1.11.15

"18.03pre118346.5f8bbb96f8"

build-use-sandbox = false

jluttine commented 6 years ago

I managed to burn a blu-ray with 17.09.2138.48bf1f43cd (Hummingbird) with K3b without using root. K3b showed an error at the end of the burning process (99% done) but the disc seemed perfectly readable by other computers. I think I've had the same issue before NixOS with K3b on other Linux distros too.

jluttine commented 6 years ago

Well, this was weird: After successfully writing two discs, I got the permission error on one project which tried to write multiple files to a blu-ray. When I removed all but one file, the disc wrote ok (see my previous comment). I didn't start debugging whether the issue was the number of files (greater than one), the total size of files (although well below maximum capacity), the file types or something else. But anyway it worked with one file with size around 25-35GB but not with three files totalling to size around 45GB (capacity ~50GB). Anyway, just thought I'd share if this helps someone else.

lukateras commented 6 years ago

k3b package doesn't have K3bsetup executable anymore:

$ ls $(nix-build '<nixpkgs>' -A k3b --no-out-link)/bin
k3b

It also seems to work for me now. Could someone else try it out?

nico202 commented 6 years ago

I'm in the cdrom group but it's still not working for me

Yarny0 commented 6 years ago

Hi, I'm suffering from the same problem (using NixOS 18.03). I discovered that k3b used to use cdrkit instead of cdrtools ( https://github.com/NixOS/nixpkgs/issues/6002 ), but it was -- possibly inadvertently -- changed with this commit: https://github.com/NixOS/nixpkgs/commit/e690c3a8dd566651f5fa237bb6cb1d3166450b50 . I replaced cdrtools with cdrkit in the k3b wrapper script by hand, which fixed the problem on my machine.

Maybe it suffices to replace cdrtools with cdrkit in the k3b build recipe to fix this?

By the way, I also played around with the cdrom group, but it's apparently not needed: Users seem to gain r/w-access to optical drives simply by logging in.

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
turion commented 4 years ago

@jagajaga is this still open?

kmein commented 4 years ago

Still doesn't work for me.

nezumi1503 commented 4 years ago

Still doesn't work for me.

Neither for me.

nezumi1503 commented 4 years ago

OK, It seems that remounting the /nix/store to rw mode (mount -o remount,rw /nix/store) and changing the program permissions in K3b (Settings -> Configure k3b -> programs -> Permissions "tab") fixes the problem. I guess it would be preferable if nix did this during the installation of k3b...

turion commented 4 years ago

@nezumi1503 That's strange. Do you know whether K3b changes anything in the store? (That would be bad.) And what permissions do you need to change?

nezumi1503 commented 4 years ago

@turion No, what I tried to say is that the only way to make k3b function is to let it adjust the permissions of cdrdao, cdrecord and growisofs because those are not set correctly during the installation time. That is done in the setting dialogue below. The screenshot is after allowing the program to change the permission in the nix store. I agree it should not be the way to fix it but I do not know what the best way would be because the three programs even did not belong to cdrom group when they were installed. Screenshot_20200620_225712

cpakkala commented 4 years ago

I'm not keen on how all this policy kit stuff works; but could this be related to #29048?

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

Mic92 commented 3 years ago

OK, It seems that remounting the /nix/store to rw mode (mount -o remount,rw /nix/store) and changing the program permissions in K3b (Settings -> Configure k3b -> programs -> Permissions "tab") fixes the problem. I guess it would be preferable if nix did this during the installation of k3b...

There is also security.wrappers module option for a non-hacky setcap solution

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

pshirshov commented 2 years ago

Still broken...

devvythelopper commented 2 years ago

@ngiger when selecting the cdrecord's security wrapper (with the setuid bit set) in k3b configuration it complains:

cdrecord <= 2.01.01a05 will be run with root privileges on kernel >= 2.6.8
Since Linux kernel 2.6.8 cdrecord <= 2.01.01a05 will not work when run suid root for security reasons anymore.
Solution: Click "Configure K3b..." to solve this problem.
aanderse commented 2 years ago

But it still works, right?

devvythelopper commented 2 years ago

yeah it does

jerith666 commented 1 year ago

I opened #214363 to address that warning.

pshirshov commented 1 year ago

Still broken

❯ cdrecord -v -dao speed=4 dev=/dev/sr0 ./Downloads/test.iso
TOC Type: 1 = CD-ROM
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.
scsidev: '/dev/sr0'
devname: '/dev/sr0'
scsibus: -2 target: -2 lun: -2
wodim: Cannot allocate memory.
Cannot open SCSI driver!
For possible targets try 'wodim --devices' or 'wodim -scanbus'.
For possible transport specifiers try 'wodim dev=help'.
For IDE/ATAPI devices configuration, see the file README.ATAPI.setup from
the wodim documentation.
❯ ls -la /dev/sr0
brw-rw----+ root cdrom 0 B Thu Jun 29 22:48:24 2023 ﰩ /dev/sr0

❯ groups
users wheel disk audio cdrom video networkmanager libvirtd docker input kvm render corectrl adbusers
requaos commented 1 year ago

latest nixpkgs-unstable, still broken

mab-on commented 11 months ago

https://github.com/NixOS/nixpkgs/issues/19154#issuecomment-1613854089

Same for me. It shredded a bunch of discs already 😔

ix0rai commented 8 months ago

k3b is still broken, which sucks because brasero won't recognise any of the discs in my drive. my quick and dirty fix was to run it via sudo k3b in the commandline

really hoping this issue is solved soon!

desttinghim commented 2 months ago

Chiming in to say that k3b still seems to be broken by default. It works if I run K3b as root, but that's far from ideal.

K3b debug log output ``` Devices ----------------------- hp DVD-RAM GH40L RB0A (/dev/sr0, 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 Sequential, DVD-R Dual Layer Sequential, DVD-R Dual Layer Jump, DVD-RAM, DVD-RW Restricted Overwrite, DVD-RW Sequential, DVD+RW, DVD+R, DVD+R Dual Layer, CD-ROM, CD-R, CD-RW] [SAO, TAO, RAW, SAO/R96P, SAO/R96R, RAW/R96R, Restricted Overwrite, Layer Jump] [%7] System ----------------------- K3b Version: 23.8.5 KDE Version: 5.116.0 Qt Version: 5.15.12 Kernel: 6.6.32 Used versions ----------------------- cdrecord: 3.2a09 cdrecord ----------------------- cdrecord: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits. cdrecord: Cannot allocate memory. WARNING: Cannot do mlockall(2). cdrecord: WARNING: This causes a high risk for buffer underruns. cdrecord: Operation not permitted. WARNING: Cannot set RR-scheduler. cdrecord: Permission denied. WARNING: Cannot set priority using setpriority(). cdrecord: WARNING: This causes a high risk for buffer underruns. cdrecord: Insufficient 'file read' privileges. You will not be able to open all needed devices. cdrecord: Insufficient 'file write' privileges. You will not be able to open all needed devices. cdrecord: Insufficient 'device' privileges. You may not be able to send all needed SCSI commands, this my cause various unexplainable problems. cdrecord: Insufficient 'memlock' privileges. You may get buffer underruns. cdrecord: Insufficient 'priocntl' privileges. You may get buffer underruns. cdrecord: Insufficient 'network' privileges. You will not be able to do remote SCSI. scsidev: '/dev/sr0' devname: '/dev/sr0' scsibus: -2 target: -2 lun: -2 Warning: Open by 'devname' is unintentional and not supported. Linux sg driver version: 3.5.27 SCSI buffer size: 64512 Text len: 2160 Cdrecord-ProDVD-ProBD-Clone 3.02a09 (x86_64-pc-linux-gnu) Copyright (C) 1995-2016 Joerg Schilling TOC Type: 0 = CD-DA Using libscg version 'schily-0.9'. Driveropts: 'burnfree' atapi: 1 Device type : Removable CD-ROM Version : 5 Response Format: 2 Capabilities : Vendor_info : 'hp ' Identifikation : 'DVD-RAM GH40L ' Revision : 'RB0A' Device seems to be: Generic mmc2 DVD-R/DVD-RW/DVD-RAM. Current: CD-R Profile: DVD-RAM Profile: DVD-R sequential recording Profile: DVD-R/DL sequential recording Profile: DVD-R/DL layer jump recording Profile: DVD-RW sequential recording Profile: DVD-RW restricted overwrite Profile: DVD+RW Profile: DVD+R Profile: DVD+R/DL Profile: DVD-ROM Profile: CD-R (current) Profile: CD-RW Profile: CD-ROM Profile: Removable Disk Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr). Driver flags : MMC-3 SWABAUDIO BURNFREE Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R96R LAYER_JUMP Drive buf size : 1053696 = 1029 KB Drive pbuf size: 1966080 = 1920 KB Drive DMA Speed: 16087 kB/s 91x CD 11x DVD 3x BD FIFO size : 4194304 = 4096 KB cdrecord: Operation not permitted. rezero unit: scsi sendcmd: fatal error CDB: 01 00 00 00 00 00 cdrecord: Operation not permitted. Cannot send SCSI cmd via ioctl. cdrecord: Operation not permitted. Cannot open or use SCSI driver. cdrecord: For possible targets try 'cdrecord -scanbus'. Make sure you are root. cdrecord: For possible transport specifiers try 'cdrecord dev=help'. pregap1: -1 Track 01: audio 11 MB (01:10.42) no preemp swab copy Track 02: audio 12 MB (01:15.69) no preemp swab copy Track 03: audio 14 MB (01:25.00) no preemp swab copy Track 04: audio 7 MB (00:46.41) no preemp swab copy Track 05: audio 24 MB (02:24.29) no preemp swab copy Track 06: audio 20 MB (01:59.00) no preemp swab copy Track 07: audio 8 MB (00:47.80) no preemp swab copy Track 08: audio 20 MB (02:00.76) no preemp swab copy Track 09: audio 18 MB (01:50.02) no preemp swab copy Track 10: audio 22 MB (02:13.00) no preemp swab copy Track 11: audio 7 MB (00:44.00) no preemp swab copy Track 12: audio 22 MB (02:11.10) no preemp swab copy Track 13: audio 17 MB (01:42.00) no preemp swab copy Track 14: audio 20 MB (02:01.61) no preemp swab copy Track 15: audio 17 MB (01:43.42) no preemp swab copy Track 16: audio 16 MB (01:36.09) no preemp swab copy Track 17: audio 8 MB (00:48.50) no preemp swab copy Track 18: audio 20 MB (02:02.89) no preemp swab copy Track 19: audio 20 MB (01:59.00) no preemp swab copy Track 20: audio 15 MB (01:32.77) no preemp swab copy Track 21: audio 19 MB (01:55.80) no preemp swab copy Track 22: audio 16 MB (01:37.29) no preemp swab copy Track 23: audio 21 MB (02:10.29) no preemp swab copy Track 24: audio 20 MB (02:04.78) no preemp swab copy Track 25: audio 15 MB (01:32.97) no preemp swab copy Track 26: audio 19 MB (01:56.00) no preemp swab copy Track 27: audio 20 MB (02:02.82) no preemp swab copy Track 28: audio 19 MB (01:54.76) no preemp swab copy Track 29: audio 85 MB (08:28.50) no preemp swab copy Total size: 564 MB (55:57.06) = 251780 sectors Lout start: 565 MB (55:59/05) = 251780 sectors cdrecord command: ----------------------- /nix/store/fqs9jx9v1py5vw8jg25z9kkf79h87cf6-cdrtools-3.02a09/bin/cdrecord -v gracetime=2 dev=/dev/sr0 speed=40 -sao driveropts=burnfree textfile=/tmp/k3b.UgjQcy -useinfo -audio /home/desttinghim/Videos/k3b_audio_0_01.inf /home/desttinghim/Videos/k3b_audio_0_02.inf /home/desttinghim/Videos/k3b_audio_0_03.inf /home/desttinghim/Videos/k3b_audio_0_04.inf /home/desttinghim/Videos/k3b_audio_0_05.inf /home/desttinghim/Videos/k3b_audio_0_06.inf /home/desttinghim/Videos/k3b_audio_0_07.inf /home/desttinghim/Videos/k3b_audio_0_08.inf /home/desttinghim/Videos/k3b_audio_0_09.inf /home/desttinghim/Videos/k3b_audio_0_10.inf /home/desttinghim/Videos/k3b_audio_0_11.inf /home/desttinghim/Videos/k3b_audio_0_12.inf /home/desttinghim/Videos/k3b_audio_0_13.inf /home/desttinghim/Videos/k3b_audio_0_14.inf /home/desttinghim/Videos/k3b_audio_0_15.inf /home/desttinghim/Videos/k3b_audio_0_16.inf /home/desttinghim/Videos/k3b_audio_0_17.inf /home/desttinghim/Videos/k3b_audio_0_18.inf /home/desttinghim/Videos/k3b_audio_0_19.inf /home/desttinghim/Videos/k3b_audio_0_20.inf /home/desttinghim/Videos/k3b_audio_0_21.inf /home/desttinghim/Videos/k3b_audio_0_22.inf /home/desttinghim/Videos/k3b_audio_0_23.inf /home/desttinghim/Videos/k3b_audio_0_24.inf /home/desttinghim/Videos/k3b_audio_0_25.inf /home/desttinghim/Videos/k3b_audio_0_26.inf /home/desttinghim/Videos/k3b_audio_0_27.inf /home/desttinghim/Videos/k3b_audio_0_28.inf /home/desttinghim/Videos/k3b_audio_0_29.inf ```