How to see /dev/cd0 from plugins jail?

Status
Not open for further replies.

John Doe

Guru
Joined
Aug 16, 2011
Messages
633
So, I would like to rip all my DVDs to my NAS so I can watch them from my media center whenever I want. I don't know why I can't just have ports and install software directly to FreeNAS like any other BSD distro, it seems stupid to me to have such a restriction. Whatever.

So, I installed the plugins jail and got everything else I needed (libdvd, et al). However, vobcopy fails to find a device, so I look in /dev/ within the jail and sure enough there is no cd0. cd0 is available outside the jail, works great in fact. Too bad I can't install vobcopy outside the jail because FreeNAS doesn't let U install things and comes with nothing that would let U do so manually (a compiler for instance).

I tried adding it as a mount point but that fails miserably, so how do I get to see my DVD drive from within the plugins jail? Or, even better, how do I install software outside of the jail? I find it hard to believe nobody else is asking these things, I guess I suck at searching; must be getting old, I used to be able to find answers so easily. Sigh.

I don't want to have to keep using my Linux desktop to rip these to the NFS mount, the whole point of putting the drive in the NAS box was to not need powerful computers anywhere else. If anyone has ideas on ripping VHS tapes under FreeNAS, that would be helpful too; otherwise I'll have to do that on my Linux box as well (I have a nice USB connector for my VCR that works perfect under Linux, but can't find any info for doing so under BSD; again, seem to suck at searching).

ThanX
 

ChrisFitzFor

Cadet
Joined
Mar 31, 2014
Messages
8
I am trying to make a CD/DVD-ROM Drive (/dev/cd0) available in a virtualbox-jail in order to have a virtual machine ripping my audio cds into ogg.
(Also I am planning to backup certain very important data on DVD-RAM in the future)

My Drive is a SATA-Drive, so it appears as /dev/cd0. (I have a data-cd in it to be able to test easier.)
Using it from within FreeNAS is no problem:
Code:
mount -t cd9660 /dev/cd0 /mnt/cdrom


My idea was, that when the virtualbox-jail can access the drive, I should be able to configure it so that a vm can access it.

Anyhow, I followed the Stackoverflow article from above, read my way through manpages but i simply don't get it going.

What I tried so far:
  1. Adding sysctls-Options for the Jail according to the jail's manpage "allow.mount,allow.mount.devfs,enforce_statfs=1"
  2. Adding this line to /etc/defaults/devfs.rules section [devfsrules_jail=4]: "add path cd0 unhide"
But inside the jail i get:
Code:
root@virtualbox:/ # mount -t cd9660 /dev/cd0 /mnt/cdrom
mount_cd9660: /dev/cd0: Operation not permitted
root@virtualbox:/ # ls -al /dev | grep cd
crw-r----- 1 root operator 0x87 Jan 16 23:10 cd0
root@virtualbox:/ #


Does someone have an idea what I am doing wrong?

What also puzzles me is that even without all these changes, I still have /dev/cd0 inside the jail and get the same operation not permitted response when I try to mount cd0. Also any changes to /etc/defaults/devfs.rules seem not to survive a Host-reboot so I am not sure if thats the right place to adjust things.

Thanks for help in advance!

P.S. I am with FreeNAS 9.3 have 16GB of Ram for my 12TB Raid-Z2[/CODE]
 
Last edited:

keithg

Explorer
Joined
May 15, 2013
Messages
92
Trying to get a similar thing done. I want to rip my cds to my music library from the NAS.

I have a 'standard' Jail running FreeBSD 9.3-RELEASE-p10. I just went through the painful task of getting it updated and posted how I got that done. I installed the abcde program from pkg. It 'runs' but complains of not being able to access the cdrom. Based on what I read here, I edited the /etc/sysctl.conf file in the jail to allow mounts
...
allow.mount,allow.mount.devfs,enforce_statfs=1​

I edited the /etc/devfs.rules on the NAS to allow the jail to see the cdrom
...
add path cd0 unhide
I restarted the jail from the nas using warden stop jail and warden start jail and I cannot access the cdrom/ as a user or as root in the jail

I have an audio CD in the drive and do not know how I go forward with this.
From the nas:
# camcontrol devlist
<SONY CDRWDVD CRX310EE SDK3> at scbus1 target 0 lun 0 (cd0,pass0)​

If I do this from the jail, I also get it listed exactly as above. when I list it, I get:
crw-r----- 1 root operator 0, 101 Mar 2 13:49 /dev/cd0​

If I run abcde as root, it appesrs as though it cannot see the drive:
cd-discid: /dev/cd0: CDROMREADTOCHDR: Device not configured
[ERROR] abcde: CD could not be read. Perhaps there's no CD in the drive?
I know there is a CD in the drive. Any suggestions?
 

keithg

Explorer
Joined
May 15, 2013
Messages
92
So, I tried again last night, but with a data CD. Also no joy. I cannot mount it from the freenas console (accessed via SSH) nor can I mount it from the jail. I get the same error from the jail or the console.

This is an ATAPI DVD. It sees it at boot (All this from the FreeNAS console):

# dmesg | grep cd
cd0 at ata0 bus 0 scbus1 target 0 lun 0
cd0: <SONY CDRWDVD CRX310EE SDK3> Removable CD-ROM SCSI-0 device
cd0: Serial Number 2006021000037636
cd0: 33.300MB/s transfers (UDMA2, ATAPI 12bytes, PIO 65534bytes)
cd0: Attempt to query device size failed: NOT READY, Medium not present
g_vfs_done():cd0[READ(offset=32768, length=2048)]error = 6

(the last error is an attempt to mount a data disc)

Seems to have all the modules loaded:
# camcontrol devlist -v
scbus0 on sbp0 bus 0:
<> at scbus0 target -1 lun -1 ()
scbus1 on ata0 bus 0:
<SONY CDRWDVD CRX310EE SDK3> at scbus1 target 0 lun 0 (cd0,pass0)
<> at scbus1 target -1 lun -1 ()
...​

It seems to be installed and available:
ls -al /dev/cd0
crw-rw-rw- 1 root operator 0x65 Mar 9 16:13 /dev/cd0
ls -al /dev/pass0
crw-rw-rw- 1 root operator 0x60 Mar 9 16:13 /dev/pass0​

Also From the jail:
# camcontrol devlist
<SONY CDRWDVD CRX310EE SDK3> at scbus1 target 0 lun 0 (cd0,pass0)
...
# cdrecord -scanbus
Cdrecord-ProDVD-ProBD-Clone 3.00 (amd64-unknown-freebsd9.3) Copyright (C) 1995-2010 J▒rg Schilling
Using libscg version 'schily-0.9'.
scsibus1:
1,0,0 100) 'SONY ' 'CDRWDVD CRX310EE' 'SDK3' Removable CD-ROM
...​
 

keithg

Explorer
Joined
May 15, 2013
Messages
92
Ok, I figured it out. It was a bad drive. I replaced the drive and now I can now see and use the drive from the jail. Now, I need to figure out how to have the drive mounted as nobody:nobody so I can manipulate the files I rip...
Any help appreciated.

Keith
 

keithg

Explorer
Joined
May 15, 2013
Messages
92
Posting more on this. The CD works, though I am a bit unclear why. I can rip audio files to the jail - woo hoo!

Around the internet, there are so many different versions of freenas and freebsd and jails etc. that it is hard to figure out what information is 'current' and what things work or not.

1) with 9.3 (9.2?), you no longer need to mount the root as rw then ro to edit the nas config files. (learned this the hard way)
2) It seems like devfs is the correct thing to mess with to get devices on the NAS available in the jail but I have not yet found any clear explanation of how to correctly modify the nas so that the jails in 9.3 properly 'see' the devices I want them to see. I currently get devfs errors trying to get the cd available in the jail

Editing (in the jail) the /etc/sysctl.conf like this:
...
allow.mount
allow.mount.devfs
enforce_statfs=1

causes these errors in /var/log/messages (in the jail)
Mar 25 13:55:42 Minecraft root: /etc/rc.d/sysctl: WARNING: sysctl allow.mount does not exist.
Mar 25 13:55:42 Minecraft root: /etc/rc.d/sysctl: WARNING: sysctl allow.mount.devfs does not exist.
Mar 25 13:55:42 Minecraft root: /etc/rc.d/sysctl: WARNING: sysctl enforce_statfs does not exist.

It does not seem like it works...

can anyone point me to more than the man pages which are appropriate to freenas 9.3 and devfs and getting it to work, or is this 'old info' which is no longer needed?

Keith
 

gtp04

Dabbler
Joined
Jan 18, 2015
Messages
24
Posting more on this. The CD works, though I am a bit unclear why. I can rip audio files to the jail - woo hoo!

Around the internet, there are so many different versions of freenas and freebsd and jails etc. that it is hard to figure out what information is 'current' and what things work or not.

1) with 9.3 (9.2?), you no longer need to mount the root as rw then ro to edit the nas config files. (learned this the hard way)
2) It seems like devfs is the correct thing to mess with to get devices on the NAS available in the jail but I have not yet found any clear explanation of how to correctly modify the nas so that the jails in 9.3 properly 'see' the devices I want them to see. I currently get devfs errors trying to get the cd available in the jail

Editing (in the jail) the /etc/sysctl.conf like this:
...
allow.mount
allow.mount.devfs
enforce_statfs=1

causes these errors in /var/log/messages (in the jail)
Mar 25 13:55:42 Minecraft root: /etc/rc.d/sysctl: WARNING: sysctl allow.mount does not exist.
Mar 25 13:55:42 Minecraft root: /etc/rc.d/sysctl: WARNING: sysctl allow.mount.devfs does not exist.
Mar 25 13:55:42 Minecraft root: /etc/rc.d/sysctl: WARNING: sysctl enforce_statfs does not exist.

It does not seem like it works...

can anyone point me to more than the man pages which are appropriate to freenas 9.3 and devfs and getting it to work, or is this 'old info' which is no longer needed?

Keith
did you get anywhere on this Im interested in doing something similar with dvd ripping...

Dan
 

cbrherms

Dabbler
Joined
Jan 23, 2016
Messages
10
Was this ever sorted?
Currently trying to make a physically attached bluray drive readable by a phpvirtualbox ubuntu vm for ripping.
 

binzyw

Cadet
Joined
Nov 13, 2016
Messages
2
I'd also like to mount a CD-Rom drive in a jail. Has anyone been able to solve this?
 

cbrherms

Dabbler
Joined
Jan 23, 2016
Messages
10
I'd also like to mount a CD-Rom drive in a jail. Has anyone been able to solve this?

Mounting in a jail shouldn't be too hard, and is explained above (the issues were a bad drive) not sure if it's the same in FreeNAS 11 though.
I had the drive readable within my jail using the info in post #4, though my problem after that was then getting it visible in the ubuntu vm, which I couldn't figure out at the time.
But, potentially post #4, plus the info here might help you
 

binzyw

Cadet
Joined
Nov 13, 2016
Messages
2
I followed the above instructions but still get the following:
Code:
$ sudo mount -t cd9660 /dev/cd0 /mnt/cd0/
Password:
mount_cd9660: /dev/cd0: Operation not permitted


I'm able to mount and browse the drive on the host just fine. So I don't think it's a cd drive is the issue.

My host /etc/devfs.rules:
Code:
[usbrules=100]
add path 'usbctl' mode 660 group uucp
add path 'usb/*' mode 660 group uucp
add path 'ttyU*' mode 660 group uucp
add path 'cd0' mode 770 group wheel


I think that is actually being overridden by: /etc/defaults/devfs.rules
Code:
[devfsrules_hide_all=1]
add hide

# Basic devices typically necessary.
# Requires: devfsrules_hide_all
#
[devfsrules_unhide_basic=2]
add path log unhide
add path null unhide
add path zero unhide
add path crypto unhide
add path random unhide
add path urandom unhide

# Devices typically needed to support logged-in users.
# Requires: devfsrules_hide_all
#
[devfsrules_unhide_login=3]
add path 'ptyp*' unhide
add path 'ptyq*' unhide
add path 'ptyr*' unhide
add path 'ptys*' unhide
add path 'ptyP*' unhide
add path 'ptyQ*' unhide
add path 'ptyR*' unhide
add path 'ptyS*' unhide
add path 'ptyl*' unhide
add path 'ptym*' unhide
add path 'ptyn*' unhide
add path 'ptyo*' unhide
add path 'ptyL*' unhide
add path 'ptyM*' unhide
add path 'ptyN*' unhide
add path 'ptyO*' unhide
add path 'ttyp*' unhide
add path 'ttyq*' unhide
add path 'ttyr*' unhide
add path 'ttys*' unhide
add path 'ttyP*' unhide
add path 'ttyQ*' unhide
add path 'ttyR*' unhide
add path 'ttyS*' unhide
add path 'ttyl*' unhide
add path 'ttym*' unhide
add path 'ttyn*' unhide
add path 'ttyo*' unhide
add path 'ttyL*' unhide
add path 'ttyM*' unhide
add path 'ttyN*' unhide
add path 'ttyO*' unhide
add path ptmx unhide
add path pts unhide
add path 'pts/*' unhide
add path fd unhide
add path 'fd/*' unhide
add path stdin unhide
add path stdout unhide
add path stderr unhide

# Devices usually found in a jail.
#
[devfsrules_jail=4]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add path zfs unhide
add path cd0 mode 0770 group wheel


Warden get flags returns:
allow.raw_sockets=true,allow.mount=true,allow.mount.nullfs=true,allow.mount.devfs=true,enforce_statfs=0

The jail's sysctl.conf is:
Code:
allow.mount=1
allow.mount.devfs=1
allow.mount.nullfs=1
enforce_statfs=0


I can see the cd0 drive in the jail under /dev. The permissions and groups from the devfs.rules don't seem to take effect though. This is what I get there:
Code:
$ ll /dev | grep cd0
crw-r-----   1 root  operator  -	 0x83 Dec  5 21:27 cd0


As you said this should be fairly easy, but I just cant seem to crack it. Maybe my problem is with some change in FreeNAS 11 that hasn't made itself apparent in the forums yet.

If needed I can start a new thread, but this is the one that I found as I was searching the issue.
 
Joined
Mar 21, 2018
Messages
1
I struggled to get this working as well, and I can tell what I've found in hopes it saves someone else some time. If you run lsvfs, you can see that cd9660 is not listed a "jail-friendly" format. As I understand it, this means you can never mount a cd in a jail. However, you want to run Handbrake or something, you don't need to mount it, you just need access to /dev/cd0. So if you're trying to figure out if everything's working, you should run "head /dev/cd0" instead of trying to mount it.

To get this working, I think all I needed to do was add "enforce_statfs=1" to the jail's Sysctls. Then I was able to "head /dev/cd0" when logged into root. Then I added my non-root user to the operator group and now I can use Handbrake from my jail.
 
Status
Not open for further replies.
Top