jails and update 6.2 to 7.0

either that way, or do it outside the jail, similarly like you have build your jail the first time (however do not forget to run mergemaster for the jail).

By the way, you might have a look at the sysutils/ezjail tool.
 
I need to create new jail.
There is solution in man:
Code:
D=/here/is/the/jail
cd /usr/src
mkdir -p $D
make world DESTDIR=$D
make distribution DESTDIR=$D
mount_devfs devfs $D/dev
Whether I can create new jail with another configuration of kernel ? (base system - GENERIC, jail- MYKERNEL) ?
 
stasmus said:
I need to create new jail.
There is solution in man:
Code:
D=/here/is/the/jail
cd /usr/src
mkdir -p $D
make world DESTDIR=$D
make distribution DESTDIR=$D
mount_devfs devfs $D/dev
You forgot about (this is required for upgrade)
Code:
mergemaster -i -C -D $D
Here is step by step tutorial:
http://www.cyberciti.biz/faq/how-to-upgrade-freebsd-jail-vps/
Whether I can create new jail with another configuration of kernel ? (base system - GENERIC, jail- MYKERNEL) ?
Usually I create /etc/jail.make.conf in /etc and then build everything as follows:
Code:
D=/jail/192.168.1.10
cd /usr/src
mkdir -p $D
make world DESTDIR=$D __MAKE_CONF=/etc/jail.make.conf
make distribution DESTDIR=$D __MAKE_CONF=/etc/jail.make.conf
devfs -m $D/dev rule -s 4 applyset

Here is my /etc/jail.make.conf
Code:
NO_ACPI=       true    # do not build acpiconf(8) and related programs
NO_BOOT=       true    # do not build boot blocks and loader
NO_BLUETOOTH=  true    # do not build Bluetooth related stuff
NO_FORTRAN=    true    # do not build g77 and related libraries
NO_GDB=        true    # do not build GDB
NO_GPIB=       true    # do not build GPIB support
NO_I4B=        true    # do not build isdn4bsd package
NO_IPFILTER=   true    # do not build IP Filter package
NO_PF=         true    # do not build PF firewall package
NO_AUTHPF=     true    # do not build and install authpf (setuid/gid)
NO_KERBEROS=   true    # do not build and install Kerberos 5 (KTH Heimdal)
NO_LPR=        true    # do not build lpr and related programs
NO_MAILWRAPPER=true    # do not build the mailwrapper(8) MTA selector
NO_MODULES=    true    # do not build modules with the kernel
NO_NETCAT=     true    # do not build netcat
NO_NIS=        true    # do not build NIS support and related programs
NO_SENDMAIL=   true    # do not build sendmail and related programs
NO_SHAREDOCS=  true    # do not build the 4.4BSD legacy docs
NO_USB=        true    # do not build usbd(8) and related programs
NO_VINUM=      true    # do not build Vinum utilities
NO_ATM=        true    # do not build ATM related programs and libraries
NO_CRYPT=      true    # do not build any crypto code
NO_GAMES=      true    # do not build games (games/ subdir)
#NO_INFO=       true    # do not make or install info files
NO_MAN=        true    # do not build manual pages
NO_PROFILE=    true    # Avoid compiling profiled libraries

# BIND OPTIONS
NO_BIND=               true    # Do not build any part of BIND
NO_BIND_DNSSEC=        true    # Do not build dnssec-keygen, dnssec-signzone
NO_BIND_ETC=           true    # Do not install files to /etc/namedb
NO_BIND_LIBS_LWRES=    true    # Do not install the lwres library
NO_BIND_MTREE=         true    # Do not run mtree to create chroot directories
NO_BIND_NAMED=         true    # Do not build named, rndc, lwresd, etc.
 
stasmus said:
Whether I can create new jail with another configuration of kernel ? (base system - GENERIC, jail- MYKERNEL) ?
No, the jail uses the kernel of the host.
 
stasmus said:
It is necessary for me to do make world and make kernel in jail ?

I wrote a simple script to handle this for you. Originally posted here: http://daemonforums.org/showthread.php?t=1887

Code:
#!/bin/sh

# Author: anomie
# Date  : 2008-09-06

# Please see copyright at bottom of script

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin

# Initialize MYJAILS1 with your Jails!   
# Do not use trailing slashes (/). 
########################################
MYJAILS1="/usr/home/jail/10.5.5.101 \
          /usr/home/jail/10.5.5.102 \
          /usr/home/jail/10.5.5.103" 
########################################

# Functions

chatter() {

  echo ${MSG1}
  echo '<Press Enter>'
  read DUMMY1
  echo ' ----------- '
  echo 'Working...'

}

# Quick audit to make sure Jails are stopped. 

JCHK1=$(jls)

if [ -n "${JCHK1}" ] ] ; then
    MSG1="Bad Jail directory ${I} - skipping..."
    chatter
    continue 
  fi 

  if [ -e ${I}.dup ] ; then 
    chflags -R 0 ${I}.dup
    rm -rf ${I}.dup
  fi

  cpdup ${I} ${I}.dup

  if [ $? -ne 0 ] ; then 
    MSG1="Problem backing up ${I} - skipping to next Jail..."
    chatter
    continue 
  fi

  MSG1="Done backing up ${I}" 
  chatter

  cd /usr/src && make installworld DESTDIR=${I}

  if [ $? -ne 0 ] ; then 
    MSG1="installworld problem for ${I} - skipping to next Jail..."
    chatter
    continue 
  fi

  MSG1="Done installing world for ${I}"
  chatter

  mergemaster -iU -D ${I}

  if [ $? -ne 0 ] ; then 
    MSG1="merge problem for ${I} - skipping to next Jail..."
    chatter
    continue
  fi

  MSG1="Done merging files for ${I}"
  chatter

done

echo 'Finished!'

exit 0

# ---------------------------------
#  Copyright (c) 2008 anomie
#  All rights reserved.
#
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that the following conditions
#  are met:
#  1. Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
#  2. Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
#  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
#  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
#  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
#  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
#  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
#  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
#  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
#  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#  SUCH DAMAGE.

In addition to understanding the script before using it, please read the original post and its caveats.
 
Back
Top