You are not logged in.

#1 2018-02-06 17:04:33

jolew
Member
Registered: 2018-02-03
Posts: 10

Unable to access optical drive through ssh

Due to recent system changes, I am no longer able to access /dev/sr0 through ssh.  I previously had ripped cd's on a remote host through ssh -X, but now get an error unable to access /dev/sr0 and the drive doesn't spin up.  VLC also has the same issue.  It works when logged in to the machine locally.

I did make some changes to the system (created a nfs share, changed some ssfs mounts, edited fstab, etc), but I can't figure out what caused this or how to completely back out of all the changes at this point.

I am thinking it may have something to do with automounting, but I'm not clear on how this is supposed to work for an optical drive.  Any ideas on where to look would be appreciated.

Thanks

Offline

#2 2018-02-06 20:13:55

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: Unable to access optical drive through ssh

Actual error messages please and also, in a problematic session:

stat /dev/sr0
id

Offline

#3 2018-02-06 20:42:10

jolew
Member
Registered: 2018-02-03
Posts: 10

Re: Unable to access optical drive through ssh

Thanks for your help

from Asunder
Error: Couldn't open /dev/sr0

from VLC

Playback failure:
DVDRead could not open the disc "/dev/sr0".
Your input can't be opened:
VLC is unable to open the MRL 'dvd:///dev/sr0'. Check the log for details.

the detailed logs from vlc

core debug: creating demux: access='dvd' demux='any' location='/dev/sr0' file='/dev/sr0'
core debug: looking for access_demux module matching "dvd": 18 candidates
dvdnav warning: cannot open DVD (/dev/sr0)
dvdread error: DVDRead cannot open source: /dev/sr0
core debug: no access_demux modules matched
core debug: creating access 'dvd' location='/dev/sr0', path='/dev/sr0'
core debug: looking for access module matching "dvd": 23 candidates
core debug: no access modules matched
core error: open of `dvd:///dev/sr0' failed
stat /dev/sr0
  File: /dev/sr0
  Size: 0             Blocks: 0          IO Block: 4096   block special file
Device: 6h/6d    Inode: 2147        Links: 1     Device type: b,0
Access: (0660/brw-rw----)  Uid: (    0/    root)   Gid: (   93/ optical)
Access: 2018-02-06 08:37:31.634028638 -0800
Modify: 2018-02-06 08:37:31.634028638 -0800
Change: 2018-02-06 08:37:31.634028638 -0800
 Birth: -
id
uid=1000(john) gid=1000(john) groups=1000(john),10(wheel),1001(staff)

Last edited by jolew (2018-02-06 20:55:51)

Offline

#4 2018-02-06 20:47:23

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: Unable to access optical drive through ssh

a) please wrap the output in "code" tags (bbcode)
b) take a close look at the two outputs I asked for. Do you see why you can't access it?

Offline

#5 2018-02-06 20:58:10

jolew
Member
Registered: 2018-02-03
Posts: 10

Re: Unable to access optical drive through ssh

a) Done!
b) Sorry.  I don't understand.  The outputs are the same as I get when logged in directly and able to access.

Offline

#6 2018-02-06 21:10:41

loqs
Member
Registered: 2014-03-06
Posts: 19,113

Re: Unable to access optical drive through ssh

Offline

#7 2018-02-06 21:12:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: Unable to access optical drive through ssh

The device belongs to root:optical and can not be read (or written) by others and you're (of course) not root nor in the optical group.
Idk what you do as local user (might build on some polkit rule for local users), but there's no chance that this user (as represented by "id") can directly access that file.

Offline

#8 2018-02-06 21:16:25

loqs
Member
Registered: 2014-03-06
Posts: 19,113

Re: Unable to access optical drive through ssh

@seth see /usr/lib/udev/rules.d/70-uaccess.rules
edit:

$ getfacl /dev/sr0 
getfacl: Removing leading '/' from absolute path names
# file: dev/sr0
# owner: root
# group: optical
user::rw-
user:testuser:rw-
group::rw-
mask::rw-
other::---

Last edited by loqs (2018-02-06 21:18:24)

Offline

#9 2018-02-06 21:53:07

jolew
Member
Registered: 2018-02-03
Posts: 10

Re: Unable to access optical drive through ssh

Here is output for me from remote.  It looks like this is ok though.

 getfacl /dev/sr0
getfacl: Removing leading '/' from absolute path names
# file: dev/sr0
# owner: root
# group: optical
user::rw-
user:john:rw-
group::rw-
mask::rw-
other::---

Offline

#10 2018-02-06 22:02:00

loqs
Member
Registered: 2014-03-06
Posts: 19,113

Re: Unable to access optical drive through ssh

What is the output of `tail /dev/sr0` when logged in remotely with media present?

Offline

#11 2018-02-06 22:04:04

jolew
Member
Registered: 2018-02-03
Posts: 10

Re: Unable to access optical drive through ssh

tail /dev/sr0  
tail: error reading '/dev/sr0': Input/output error

Offline

#12 2018-02-06 22:16:22

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: Unable to access optical drive through ssh

Cross test: Add yourself to the optical group (ensure the update applied) and check again. Can you access the file now?

Offline

#13 2018-02-06 22:23:54

jolew
Member
Registered: 2018-02-03
Posts: 10

Re: Unable to access optical drive through ssh

added to 'optical' group

id
uid=1000(john) gid=1000(john) groups=1000(john),10(wheel),93(optical),1001(staff)

tried again same error

tail /dev/sr0
tail: error reading '/dev/sr0': Input/output error

Offline

#14 2018-02-06 22:26:03

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: Unable to access optical drive through ssh

Remove any disc from the device if there is one and try again.

Offline

#15 2018-02-06 22:55:37

jolew
Member
Registered: 2018-02-03
Posts: 10

Re: Unable to access optical drive through ssh

Ok, my bad on the tail command output.  I had an audio cd in so I guess that might have been the source of the error? I tried various disks and I did get an output from tail on some of them. I then tried after removing myself from 'optical' again and it is still working.

I put the original audio cd back in and it was read by asunder with no problem. The only thing I can think is that maybe getfacl sorted out an acl problem?  I will try to reboot and recreate the scenario again later this evening to confirm.

Thanks for your help and I will update after trying to recreate.

Offline

#16 2018-02-07 03:23:42

jolew
Member
Registered: 2018-02-03
Posts: 10

Re: Unable to access optical drive through ssh

I did more testing:

1. Restarting recreates the problem
2. Adding my user to 'optical' group gives access.  This is a workable solution for me.
3. The acl is updating differently at different times.  Now when I remove from optical group, it no longer works.  The acl is different as well.

getfacl /dev/sr0 
getfacl: Removing leading '/' from absolute path names
# file: dev/sr0
# owner: root
# group: optical
user::rw-
group::rw-
other::---

This time it doesn't include the line - user:john:rw-

I will do some more reading and testing to see if I can figure out why the acl is not updating correctly.  Thanks again for your help.

Offline

#17 2018-02-08 01:17:22

jolew
Member
Registered: 2018-02-03
Posts: 10

Re: Unable to access optical drive through ssh

Update:

The reason it started working was I was logged in locally as well as remotely.  I don't run the system with a monitor so it was confusing.  This means after every reboot I have to login locally (kind of a pain) or just add myself to the 'optical' group.

If it was just the cdrom, this would be a fix, however, I now realize it is probably causing me problems with remote sound as well.  I have been struggling to set up pulseaudio networking and I am wondering if it is the same problem.

My question:

Where is the check for local/remote configured and is there any way to change the policy to allow remote access to specific hardware?  I think it is under udev rules, but so far I am having difficulty in figuring out where.

Thanks

Offline

#18 2018-02-08 01:56:28

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: Unable to access optical drive through ssh

What do you use as ssh login? Maybe pam based authentication has to be part of the process in order to start a systemd-logind session that assigns the access rights.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#19 2018-02-08 02:30:31

jolew
Member
Registered: 2018-02-03
Posts: 10

Re: Unable to access optical drive through ssh

Just ssh-keygen.  I'll see if I can get an ssh agent up and running.  I changed this recently while troubleshooting and I need to backtrack and upgrade security.

Thank you.

Offline

Board footer

Powered by FluxBB