Quantcast
Viewing latest article 8
Browse Latest Browse All 24

iocage: HOWTO create a basejail from src (instead of from an official release)

Background

So far I have used ezjail to manage FreeBSD jails. I use jails since years to have different parts of a software stack in some kind of a container (in a ZFS dataset for the filesystem side of the container). On one hand to not let dependencies of one part of the software stack have influence of other parts of the software stack. On the other hand to have the possibility to move parts of the software stack to a different system if necessary. Normally I run -stable or –current or more generally speaking, a self-compiled FreeBSD on those systems. In ezjail I like the fact that all jails on a system have one common basejail underlying, so that I update one place for the userland and all jails get the updated code.

Since a while I heard good things about iocage and how it integrates ZFS, so I decided to give it a try myself. As iocage does not come with an official way of creating a basejail (respectively a release) from a self-compiled FreeBSD (at least documented in those places I looked, and yes, I am aware that I can create a FreeBSD release myself and use it, but I do not like to have to create a release additionally to the buildworld I use to update the host system) here now the short HOWTO achieve this.

Invariants

In the following I assume the iocage ZFS parts are already created in dataset ${POOLNAME}/iocage which is mounted on ${IOCAGE_BASE}/iocage. Additionally the buildworld in /usr/src (or wherever you have the FreeBSD source) should be finished.

Pre-requisites

To have the necessary dataset-infrastructure created for own basejails/releases, at least one official release needs to be fetched before. So run the command below (if there is no ${IOCAGE_BASE}/iocage/releases directory) and follow the on-screen instructions.

iocage fetch

HOWTO

Some variables:

POOLNAME=mpool
SRC_REV=r$(cd /usr/src; svnliteversion)
IOCAGE_BASE=””

Creating the iocage basejail-datasets for this ${SRC_REV}:

zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/bin
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/boot
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/lib
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/libexec
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/rescue
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/sbin
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/usr
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/usr/bin
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/usr/include
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/usr/lib
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/usr/lib32
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/usr/libdata
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/usr/libexec
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/usr/sbin
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/usr/share
zfs create –o compression=lz4 ${POOLNAME}/iocage/base/${SRC_REV}-RELEASE/root/usr/src

Install from /usr/src (the executable “chown” is hardlinked across an iocage basejail dataset boundary, this fails in the normal installworld, so we have to ignore this error and install a copy of the chown binary to the place where the hardlink normally is):

cd /usr/src
make –i installworld DESTDIR=${IOCAGE_BASE}/iocage/base/${SRC_REV}-RELEASE/root >&! iocage_installworld_base.log
cp –pv ${IOCAGE_BASE}/iocage/base/${SRC_REV}-RELEASE/root/usr/sbin/chown ${IOCAGE_BASE}/iocage/base/${SRC_REV}-RELEASE/root/usr/bin/chgrp
make distribution DESTDIR=${IOCAGE_BASE}/iocage/base/${SRC_REV}-RELEASE/root »& iocage_installworld_base.log

While we are here, also create a release and not only a basejail:

zfs create –o compression=lz4 ${POOLNAME}/iocage/releases/${SRC_REV}-RELEASE
zfs create –o compression=lz4 ${POOLNAME}/iocage/releases/${SRC_REV}-RELEASE/root
make installworld DESTDIR=${IOCAGE_BASE}/iocage/releases/${SRC_REV}-RELEASE/root >&! iocage_installworld_release.log
make distribution DESTDIR=${IOCAGE_BASE}/iocage/releases/${SRC_REV}-RELEASE/root »& iocage_installworld_release.log

And finally make this the default release which iocage uses when creating new jails (this is optional):

iocage set release=${SRC_REV}-RELEASE default

Now the self-build FreeBSD is available in iocage for new jails.

Image may be NSFW.
Clik here to view.
StumbleUpon
Image may be NSFW.
Clik here to view.
XING
Image may be NSFW.
Clik here to view.
Balatarin
Image may be NSFW.
Clik here to view.
Box.net
Image may be NSFW.
Clik here to view.
Digg
Image may be NSFW.
Clik here to view.
Google Gmail
Image may be NSFW.
Clik here to view.
Netvouz
Image may be NSFW.
Clik here to view.
Plurk
Image may be NSFW.
Clik here to view.
SiteJot
Image may be NSFW.
Clik here to view.
TypePad Post
Image may be NSFW.
Clik here to view.
Yahoo Bookmarks
Image may be NSFW.
Clik here to view.
VK
Image may be NSFW.
Clik here to view.
Slashdot
Image may be NSFW.
Clik here to view.
Pocket
Image may be NSFW.
Clik here to view.
Hacker News
Image may be NSFW.
Clik here to view.
Diigo
Image may be NSFW.
Clik here to view.
BuddyMarks
Image may be NSFW.
Clik here to view.
Reddit
Image may be NSFW.
Clik here to view.
LinkedIn
Image may be NSFW.
Clik here to view.
BibSonomy
Image may be NSFW.
Clik here to view.
Buffer
Image may be NSFW.
Clik here to view.
Email
Image may be NSFW.
Clik here to view.
Hatena
Image may be NSFW.
Clik here to view.
LiveJournal
Image may be NSFW.
Clik here to view.
NewsVine
Image may be NSFW.
Clik here to view.
Print
Image may be NSFW.
Clik here to view.
Viadeo
Image may be NSFW.
Clik here to view.
Yahoo Mail
Image may be NSFW.
Clik here to view.
AIM
Image may be NSFW.
Clik here to view.
Bitty Browser
Image may be NSFW.
Clik here to view.
Care2 News
Image may be NSFW.
Clik here to view.
Evernote
Image may be NSFW.
Clik here to view.
Mail.Ru
Image may be NSFW.
Clik here to view.
PrintFriendly
Image may be NSFW.
Clik here to view.
Wanelo
Image may be NSFW.
Clik here to view.
Yahoo Messenger
Image may be NSFW.
Clik here to view.
Yoolink
Image may be NSFW.
Clik here to view.
Webnews
Image may be NSFW.
Clik here to view.
Stumpedia
Image may be NSFW.
Clik here to view.
Protopage Bookmarks
Image may be NSFW.
Clik here to view.
Odnoklassniki
Image may be NSFW.
Clik here to view.
Mendeley
Image may be NSFW.
Clik here to view.
Instapaper
Image may be NSFW.
Clik here to view.
Fark
Image may be NSFW.
Clik here to view.
CiteULike
Image may be NSFW.
Clik here to view.
Blinklist
Image may be NSFW.
Clik here to view.
AOL Mail
Image may be NSFW.
Clik here to view.
Twitter
Image may be NSFW.
Clik here to view.
Google+
Image may be NSFW.
Clik here to view.
Pinterest
Image may be NSFW.
Clik here to view.
Tumblr
Image may be NSFW.
Clik here to view.
Amazon Wish List
Image may be NSFW.
Clik here to view.
BlogMarks
Image may be NSFW.
Clik here to view.
DZone
Image may be NSFW.
Clik here to view.
Delicious
Image may be NSFW.
Clik here to view.
Flipboard
Image may be NSFW.
Clik here to view.
Folkd
Image may be NSFW.
Clik here to view.
Jamespot
Image may be NSFW.
Clik here to view.
Meneame
Image may be NSFW.
Clik here to view.
Mixi
Image may be NSFW.
Clik here to view.
Oknotizie
Image may be NSFW.
Clik here to view.
Pusha
Image may be NSFW.
Clik here to view.
Svejo
Image may be NSFW.
Clik here to view.
Symbaloo Feeds
Image may be NSFW.
Clik here to view.
WhatsApp
Image may be NSFW.
Clik here to view.
YouMob
Image may be NSFW.
Clik here to view.
diHITT
Image may be NSFW.
Clik here to view.
WordPress
Image may be NSFW.
Clik here to view.
Rediff MyPage
Image may be NSFW.
Clik here to view.
Outlook.com
Image may be NSFW.
Clik here to view.
MySpace
Image may be NSFW.
Clik here to view.
Design Float
Image may be NSFW.
Clik here to view.
Blogger Post
Image may be NSFW.
Clik here to view.
App.net
Image may be NSFW.
Clik here to view.
Diary.Ru
Image may be NSFW.
Clik here to view.
Kindle It
Image may be NSFW.
Clik here to view.
NUjij
Image may be NSFW.
Clik here to view.
Segnalo
Image may be NSFW.
Clik here to view.
Tuenti
Image may be NSFW.
Clik here to view.
Wykop
Image may be NSFW.
Clik here to view.
Twiddla
Image may be NSFW.
Clik here to view.
Sina Weibo
Image may be NSFW.
Clik here to view.
Pinboard
Image may be NSFW.
Clik here to view.
Netlog
Image may be NSFW.
Clik here to view.
Line
Image may be NSFW.
Clik here to view.
Google Bookmarks
Image may be NSFW.
Clik here to view.
Diaspora
Image may be NSFW.
Clik here to view.
Bookmarks.fr
Image may be NSFW.
Clik here to view.
Baidu
Image may be NSFW.
Clik here to view.
Facebook
Image may be NSFW.
Clik here to view.
Google Classroom
Image may be NSFW.
Clik here to view.
Kakao
Image may be NSFW.
Clik here to view.
Qzone
Image may be NSFW.
Clik here to view.
SMS
Image may be NSFW.
Clik here to view.
Telegram
Image may be NSFW.
Clik here to view.
Renren
Image may be NSFW.
Clik here to view.
Known
Image may be NSFW.
Clik here to view.
Yummly
Share/Save


Viewing latest article 8
Browse Latest Browse All 24

Trending Articles