View previous topic :: View next topic |
Author |
Message |
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Sat Nov 28, 2020 8:56 pm Post subject: [solved] MakeMKV: The program can't find any usable cd-roms |
|
|
Opening a new support request instead of necroposting to Beandog's nearly three year old topic.
I have CONFIG_CHR_DEV_SG compiled into the kernel, not as a module. I have five sg devices. By trial and error, I found which device was actually /dev/sr0 and changed the permissions. I have no problem with the program reading or writing to the DVD drive. I'm VERY hesitant to give any partially closed program carte blanche to read or write any SATA/SCSI drive in general.
this works: Code: | ~ $ ls -l /dev/sg?
crw-rw---- 1 root root 21, 0 Nov 28 08:24 /dev/sg0
crw-rw---- 1 root root 21, 1 Nov 28 08:24 /dev/sg1
crw-rw---- 1 root root 21, 2 Nov 28 08:24 /dev/sg2
crw-rw-r-- 1 root root 21, 3 Nov 28 08:24 /dev/sg3
crw-rw---- 1 root root 21, 4 Nov 28 08:24 /dev/sg4
| But rather than really on the device always being /dev/sg3 or allowing read of any SCSI drive by anyone, or running the closed program as suid, I'd like to demine at boot time whice drive or drives are cdrom/dvd and what is their sg number.
Right now in /etc/local.d/000.start I have: Code: | #fix read permission of sg device of /dev/sr0
chmod 0664 /dev/sg3 |
Last edited by Tony0945 on Sun Nov 29, 2020 12:40 am; edited 1 time in total |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54308 Location: 56N 3W
|
Posted: Sat Nov 28, 2020 9:21 pm Post subject: |
|
|
Tony0945,
Your optical drives should be in the cdrom group, as should users allowed to use them.
Code: | $ ls /dev/sr* -l
brw-rw---- 1 root cdrom 11, 0 Sep 20 2013 /dev/sr0
brw-rw---- 1 root cdrom 11, 1 Sep 20 2013 /dev/sr1
brw-rw-rw- 1 root cdrom 11, 2 Aug 1 2017 /dev/sr2 |
The associated sg node should be Code: | crw-rw---- 1 root cdrom | .
With an optical drive, the black device is used for data transfer in the normal way.
The charatcter device is for control. Hence rw.
Optical media either have no filesystem, or a deliberately broken filesystem, so its not possible to make a copy by using the filesystem.
You read the raw blocks it the right order but the block list has to be read to determine that.
It will all just work for (e)udev users. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Sat Nov 28, 2020 9:41 pm Post subject: |
|
|
Code: | tony@MSI ~ $ ls -l /dev/sr0
brw-rw---- 1 root cdrom 11, 0 Nov 28 09:30 /dev/sr0
tony@MSI ~ $ ls -l /dev/sg?
crw-rw---- 1 root root 21, 0 Nov 28 09:30 /dev/sg0
crw-rw---- 1 root root 21, 1 Nov 28 09:30 /dev/sg1
crw-rw---- 1 root root 21, 2 Nov 28 09:30 /dev/sg2
crw-rw-r-- 1 root root 21, 3 Nov 28 09:30 /dev/sg3
crw-rw---- 1 root root 21, 4 Nov 28 09:30 /dev/sg4
| sg3 is only read by everyone because I forced it /etc/local.d
If I force group instead, how do I know whicg of /dev/sg? to set?
Do you have an example eudev rule?
Last edited by Tony0945 on Sat Nov 28, 2020 9:48 pm; edited 1 time in total |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54308 Location: 56N 3W
|
Posted: Sat Nov 28, 2020 9:46 pm Post subject: |
|
|
Tony0945,
I don't even have udev :)
At least, not on a system with a real optical drive.
-- edit --
The Pi, with a USB optical drive, does not have /dev/sg* at all.
Code: | Pi4_~arm64 ~ # ls -l /dev/sr*
brw-rw---- 1 root cdrom 11, 0 Nov 28 21:47 /dev/sr0
Pi4_~arm64 ~ # ls -l /dev/sg*
ls: cannot access '/dev/sg*': No such file or directory |
It does use eudev though. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Sat Nov 28, 2020 10:08 pm Post subject: |
|
|
By analogy to the scanner rules I made a rule in /etc/udev/rules.d/60-cdrom_id.rules (new file)
Code: | KERNEL=="sg[0-9]*", ATTRS{type}=="5", MODE="0660", GROUP="cdrom"
| It worked. But now I have to run eudev on every boot. Boo!
Thanks for the hint! What would you do? Manual trial and error like I did?
Anyone reading this, I would prefer a script in /etc/local.d to udev. Don't ask why? |
|
Back to top |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1549 Location: South America
|
Posted: Sat Nov 28, 2020 10:49 pm Post subject: |
|
|
Tony0945 wrote: | Anyone reading this, I would prefer a script in /etc/local.d to udev. Don't ask why? |
I think it is going to be harder. I don't know if you can do anything else other than sort of emulate in a script what an udev daemon does already: scan the appropriate subdirectories of /sys, find the one that has the required properties (judging by your udev rule, having a type file containing "5", apparently), find the corresponding /dev/sg* file, and change group and permissions. I don't think it's worth the trouble. |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6102 Location: Dallas area
|
Posted: Sat Nov 28, 2020 11:06 pm Post subject: |
|
|
Not sure why you've got sg* owned by root:root
This is what they look like on my system
Code: | $ dir /dev/sg*
crw-rw---- 1 root disk 21, 0 Sep 3 00:49 /dev/sg0
crw-rw---- 1 root disk 21, 1 Sep 3 00:49 /dev/sg1
crw-rw---- 1 root disk 21, 2 Sep 6 03:48 /dev/sg2 |
_________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Sun Nov 29, 2020 12:37 am Post subject: |
|
|
GDH-gentoo wrote: | I think it is going to be harder. I don't know if you can do anything else other than sort of emulate in a script what an udev daemon does already: scan the appropriate subdirectories of /sys, find the one that has the required properties (judging by your udev rule, having a type file containing "5", apparently), find the corresponding /dev/sg* file, and change group and permissions. I don't think it's worth the trouble. |
Yes, I added the following to my script in /etc/local.d
Code: | #fix read permission of sg device of /dev/sr0
#Fix group of sg drives
chown root:disk /dev/sg0
chown root:disk /dev/sg1
chown root:disk /dev/sg2
chown root:cdrom /dev/sg3 #this one is /dev/sr0
chown root:disk /dev/sg4
| I realized that if the one program that uses it stops. I only have to run eudev one time and fix the defaults. |
|
Back to top |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Sun Nov 29, 2020 12:39 am Post subject: |
|
|
Anon-E-moose wrote: | Not sure why you've got sg* owned by root:root |
Neither do I. I modified the script as noted above. I usually only run mdev. But I do have eudev 1.10 installed. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|