cd87 [Solved] ezjail: Mount portstree in basejail - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Base System > General

General General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere.

Reply
 
Thread Tools Display Modes
  #1  
Old May 3rd, 2012, 16:36
bsus bsus is offline
Member
 
Join Date: Feb 2011
Posts: 296
Thanks: 7
Thanked 0 Times in 0 Posts
Default ezjail: Mount portstree in basejail

Hi,

I want to automate the mounting of the ports tree with ezjail. By default ezjail mounts the basejail into each new jail and links some directories up to this one.
Code:
# ls -al /usr/local/jails/build/usr
total 73
drwx------   5 root  wheel  15 May  2 17:46 .
drwx------  12 root  wheel  22 May  2 17:46 ..
lrwxr-xr-x   1 root  wheel  17 May  2 17:46 bin -> /basejail/usr/bin
drwx------   2 root  wheel   2 Jan  3 08:55 games
lrwxr-xr-x   1 root  wheel  21 May  2 17:46 include -> /basejail/usr/include
lrwxr-xr-x   1 root  wheel  17 May  2 17:46 lib -> /basejail/usr/lib
lrwxr-xr-x   1 root  wheel  19 May  2 17:46 lib32 -> /basejail/usr/lib32
lrwxr-xr-x   1 root  wheel  21 May  2 17:46 libdata -> /basejail/usr/libdata
lrwxr-xr-x   1 root  wheel  21 May  2 17:46 libexec -> /basejail/usr/libexec
drwx------   3 root  wheel   3 May  3 17:33 local
drwx------   2 root  wheel   2 Jan  3 08:55 obj
lrwxr-xr-x   1 root  wheel  19 May  2 17:46 ports -> /basejail/usr/ports
lrwxr-xr-x   1 root  wheel  18 May  2 17:46 sbin -> /basejail/usr/sbin
lrwxr-xr-x   1 root  wheel  19 May  2 17:46 share -> /basejail/usr/share
lrwxr-xr-x   1 root  wheel  17 May  2 17:46 src -> /basejail/usr/src
Now it would be the easiest to do following:
mount_nullfs /usr/ports /usr/local/jails/basejail/usr/ports

Logically this should provide all jails with the ports tree (except the distfiles). Unfortunatly this doesn't work. The symlink is still active in the new jail.

How do you solve this issue?

Last edited by bsus; May 5th, 2012 at 20:46.
Reply With Quote
  #2  
Old May 4th, 2012, 20:08
Nukama Nukama is offline
Member
 
Join Date: Feb 2010
Posts: 107
Thanks: 17
Thanked 33 Times in 24 Posts
Default

You are trying to mount a path tree (/usr/ports) on top of a path (/usr/jails/basejail/usr/ports), while /usr/jails/basejail is later mounted inside another path (/usr/jails/build/basejail).
This shrieks for trouble. Piggyback mounting with nullfs isn't supported.

If you want to consolidate both ports-trees from /usr/ports and /usr/jails/basejail/usr/ports just populate /usr/jails/basejail/usr/ports with # ezjail-admin update -P and mount this tree in /usr/ports.

Otherwise rename (or remove) the ports link to ports-basejail and create /usr/jails/build/usr/ports.
Then you are able to mount /usr/ports to this directory inside build jail.

Put your mount points in your /etc/fstab.hostname for automatic mounting.
In your case in /etc/fstab.build:
Code:
/usr/ports /usr/jails/build/usr/ports nullfs ro 0 0
/usr/ports/distfiles /usr/jails/build/var/ports/distfiles nullfs rw 0 0
You can also specify PORTSDIR in /etc/make.conf, if you want to mount under a custom directory.
Reply With Quote
  #3  
Old May 5th, 2012, 07:32
bsus bsus is offline
Member
 
Join Date: Feb 2011
Posts: 296
Thanks: 7
Thanked 0 Times in 0 Posts
Default

So the ports tree is mounted the other way. Actually quite simple and logical

Thank you for the help!

I now just fail fetching the ports tree into the basejail and making this writable for the build jail.

Code:
ezjail-admin update -P
Looking up portsnap.FreeBSD.org mirrors... 4 mirrors found.
Fetching snapshot tag from portsnap1.FreeBSD.org... done.
Fetching snapshot metadata... done.
Updating from Sat May  5 02:33:32 CEST 2012 to Sat May  5 08:40:25 CEST 2012.
Fetching 4 metadata patches... done.
Applying metadata patches... done.
Fetching 0 metadata files... done.
Fetching 11 patches.....10 done.
Applying patches... done.
Fetching 1 new ports or files... done.
/usr/jails/basejail/usr/ports was not created by portsnap.
You must run 'portsnap extract' before running 'portsnap update'.
Error: Updating ports failed.

Last edited by DutchDaemon; May 6th, 2012 at 01:48.
Reply With Quote
  #4  
Old May 5th, 2012, 12:14
Nukama Nukama is offline
Member
 
Join Date: Feb 2010
Posts: 107
Thanks: 17
Thanked 33 Times in 24 Posts
Default

# ezjail-admin update -p should invoke # portsnap -p "${ezjail_jailbase/usr/ports}" extract thus extracting new ports-tree into /usr/jails/basejail/usr/ports.
Reply With Quote
  #5  
Old May 5th, 2012, 20:46
bsus bsus is offline
Member
 
Join Date: Feb 2011
Posts: 296
Thanks: 7
Thanked 0 Times in 0 Posts
Default

I had to build the world and csup sources.

Last edited by DutchDaemon; May 6th, 2012 at 01:49.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ezjail, multiple IP schasd Networking 1 August 17th, 2011 21:32
Memcached and ezjail cgigeek Web & Network Services 1 May 21st, 2011 01:30
ezjail with racoon beaute Networking 3 August 18th, 2010 02:05
Macros With Ezjail? ssanbeg General 1 July 26th, 2010 11:52
[Solved] ezjail clone gpatrick Web & Network Services 1 July 23rd, 2010 23:53


All times are GMT +1. The time now is 02:52.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0