jails Using mdconfig inside jail

ikevin8me

Active Member

Reaction score: 12
Messages: 198

I need to use mdconfig inside a jail, but I'm hit with "Error mdconfig: open(/dev/mdctl): No such file or directory". I think I need to "allow" it in the jail.conf but couldnt figure out what it is. Please help.
 

Alain De Vos

Daemon

Reaction score: 647
Messages: 2,168

I think it is not possible and you have to do it from outside the jail.
Just like you cannot use a unionfs inside a jail.
You could try to add allow.mount.md or allow.mount.mdfs to /etc/jail.conf. But I think it are not allowed commands. Or check if mount.devfs;allow.mount.devfs; in /etc/jail.conf is sufficient.
A workaround is do a md mount outside the jail and a nullfs mount inside the jail.
 
OP
I

ikevin8me

Active Member

Reaction score: 12
Messages: 198

I tried:
Code:
[devfsrules_mdc=6]
add include $devfsrules_jail
add path 'md*' unhide
add path 'md*' mode 0777
in /etc/devfs.rules

and the error changed to:
Code:
Error:mount: /dev/md0 Operation not permitted.
 

covacat

Well-Known Member

Reaction score: 223
Messages: 467

what kind of fs do you want to mount ?
it may need some kld that is not yet loaded
 

Tieks

Well-Known Member

Reaction score: 116
Messages: 282

ikevin8me said:
I'm hit with "Error mdconfig: open(/dev/mdctl): No such file or directory".

File /dev/mdctl does not exist. Is your md driver loadad? Please see man md
 
OP
I

ikevin8me

Active Member

Reaction score: 12
Messages: 198

That error was resolved earlier (after adding devfs.rules) and I’m now stuck with: “Error:mount: /dev/md0 Operation not permitted.”
 

Tieks

Well-Known Member

Reaction score: 116
Messages: 282

ikevin8me said:
That error was resolved earlier
Ah, missed that one. My bad. But there is progress, now it is the mount that fails. As covacat already asked, what is that mount command and if you use /dev/md0 there, what are user and group of it?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,319
Messages: 38,835

in /etc/devfs.rules
Did you actually apply those rules in your jail.conf?
Code:
    devfs_ruleset
             The number of the devfs ruleset that is enforced for mounting
             devfs in this jail.  A value of zero (default) means no ruleset
             is enforced.  Descendant jails inherit the parent jail's devfs
             ruleset enforcement.  Mounting devfs inside a jail is possible
             only if the allow.mount and allow.mount.devfs permissions are
             effective and enforce_statfs is set to a value lower than 2.
             Devfs rules and rulesets cannot be viewed or modified from inside
             a jail.
 
OP
I

ikevin8me

Active Member

Reaction score: 12
Messages: 198

The commands are:
# mdconfig -a -t vnode -f <ISOFILE>.iso
# mount -t cd9660 /dev/md0 /cdrom

The error is: "Error:mount: /dev/md0 Operation not permitted." - when executed inside jail.

Note: I've tried standard user, wheel user and root user - inside jail - and they all show the same error.

Also, just for notes:
- for the .iso file, I've tested with the FreeBSD...disc1.iso file.
- when I execute "mdconfig" inside jail, the memory disks also appear in the host as md0, md1, md2, etc.
- I've tested outside jail (ie. in the host) and it works (ie. it gets mounted)

I need to get this to work inside the jail.

Add: This is probably a related problem.
 

covacat

Well-Known Member

Reaction score: 223
Messages: 467

it seems that only "jail-friendly" file systems can be mounted from inside a jail and cd9660 is not one of them (but fusefs is)
so you may have success with FUSEISO9660
 
Top