綾小路龍之介の素人思考

[debian] schrootとdebootstrapで一般ユーザから呼び出せるchroot環境を構築

schrootを使うことでchrootの時に必要だったさまざまなことを自動的に行ってくれるので捗るよ。

ホスト側で、schrootとdebootstrapをインストールする。

# aptitude install schroot debootstrap
The following NEW packages will be installed:
  debootstrap libboost-filesystem1.42.0{a} libboost-program-options1.42.0{a} libboost-system1.42.0{a} liblockdev1{a} schroot schroot-common{a}
0 packages upgraded, 7 newly installed, 0 to remove and 3 not upgraded.
Need to get 1463 kB of archives. After unpacking 4325 kB will be used.
Do you want to continue? [Y/n/?] y
Get:1 http://ftp.jp.debian.org/debian/ squeeze/main libboost-system1.42.0 i386 1.42.0-4 [30.8 kB]
Get:2 http://ftp.jp.debian.org/debian/ squeeze/main libboost-filesystem1.42.0 i386 1.42.0-4 [52.3 kB]
Get:3 http://ftp.jp.debian.org/debian/ squeeze/main libboost-program-options1.42.0 i386 1.42.0-4 [144 kB]
Get:4 http://ftp.jp.debian.org/debian/ squeeze/main liblockdev1 i386 1.0.3-1.4 [13.3 kB]
Get:5 http://ftp.jp.debian.org/debian/ squeeze/main schroot-common all 1.4.19-1+squeeze1 [252 kB]
Get:6 http://ftp.jp.debian.org/debian/ squeeze/main schroot i386 1.4.19-1+squeeze1 [914 kB]
Get:7 http://ftp.jp.debian.org/debian/ squeeze/main debootstrap all 1.0.26+squeeze1 [57.5 kB]
Fetched 1463 kB in 0s (3179 kB/s)
Selecting previously deselected package libboost-system1.42.0.
(Reading database ... 60918 files and directories currently installed.)
Unpacking libboost-system1.42.0 (from .../libboost-system1.42.0_1.42.0-4_i386.deb) ...
Selecting previously deselected package libboost-filesystem1.42.0.
Unpacking libboost-filesystem1.42.0 (from .../libboost-filesystem1.42.0_1.42.0-4_i386.deb) ...
Selecting previously deselected package libboost-program-options1.42.0.
Unpacking libboost-program-options1.42.0 (from .../libboost-program-options1.42.0_1.42.0-4_i386.deb) ...
Selecting previously deselected package liblockdev1.
Unpacking liblockdev1 (from .../liblockdev1_1.0.3-1.4_i386.deb) ...
Selecting previously deselected package schroot-common.
Unpacking schroot-common (from .../schroot-common_1.4.19-1+squeeze1_all.deb) ...
Selecting previously deselected package schroot.
Unpacking schroot (from .../schroot_1.4.19-1+squeeze1_i386.deb) ...
Selecting previously deselected package debootstrap.
Unpacking debootstrap (from .../debootstrap_1.0.26+squeeze1_all.deb) ...
Processing triggers for man-db ...
Setting up libboost-system1.42.0 (1.42.0-4) ...
Setting up libboost-filesystem1.42.0 (1.42.0-4) ...
Setting up libboost-program-options1.42.0 (1.42.0-4) ...
Setting up liblockdev1 (1.0.3-1.4) ...
Setting up schroot-common (1.4.19-1+squeeze1) ...
Setting up schroot (1.4.19-1+squeeze1) ...
Setting up debootstrap (1.0.26+squeeze1) ...

ホスト側で、chroot環境を作るディレクトリを作成

# mkdir -p /home/chroot/testing

ホスト側で、debootstrapを用いて先ほど作成したディレクトリの中にchroot環境を作る。

# debootstrap --arch i386 testing /home/chroot/testing/ http://ftp.jp.debian.org/debian/
I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Found additional required dependencies: insserv libbz2-1.0 libdb5.1 libsemanage-common libsemanage1 libslang2 libustr-1.0-1 multiarch-support ucf
I: Found additional base dependencies: libclass-isa-perl libgcrypt11 libgnutls26 libgpg-error0 libidn11 libnfnetlink0 libp11-kit0 libsqlite3-0 libswitch-perl libtasn1-3 perl perl-modules
I: Checking component main on http://ftp.jp.debian.org/debian...
I: Retrieving libacl1
I: Validating libacl1
I: Retrieving adduser
I: Validating adduser
I: Retrieving apt
I: Validating apt
I: Retrieving apt-utils
I: Validating apt-utils
I: Retrieving libapt-inst1.5
I: Validating libapt-inst1.5
I: Retrieving libapt-pkg4.12
I: Validating libapt-pkg4.12
I: Retrieving aptitude
I: Validating aptitude
I: Retrieving libattr1
I: Validating libattr1
I: Retrieving base-files
I: Validating base-files
I: Retrieving base-passwd
I: Validating base-passwd
I: Retrieving bash
I: Validating bash
I: Retrieving libboost-iostreams1.46.1
I: Validating libboost-iostreams1.46.1
I: Retrieving libboost-iostreams1.48.0
I: Validating libboost-iostreams1.48.0
I: Retrieving libboost-iostreams1.49.0
I: Validating libboost-iostreams1.49.0
I: Retrieving bsdmainutils
I: Validating bsdmainutils
I: Retrieving libbz2-1.0
I: Validating libbz2-1.0
I: Retrieving coreutils
I: Validating coreutils
I: Retrieving cpio
I: Validating cpio
I: Retrieving cron
I: Validating cron
I: Retrieving libcwidget3
I: Validating libcwidget3
I: Retrieving dash
I: Validating dash
I: Retrieving libdb5.1
I: Validating libdb5.1
I: Retrieving debconf
I: Validating debconf
I: Retrieving debconf-i18n
I: Validating debconf-i18n
I: Retrieving debian-archive-keyring
I: Validating debian-archive-keyring
I: Retrieving debianutils
I: Validating debianutils
I: Retrieving diffutils
I: Validating diffutils
I: Retrieving dmidecode
I: Validating dmidecode
I: Retrieving dpkg
I: Validating dpkg
I: Retrieving e2fslibs
I: Validating e2fslibs
I: Retrieving e2fsprogs
I: Validating e2fsprogs
I: Retrieving libcomerr2
I: Validating libcomerr2
I: Retrieving libss2
I: Validating libss2
I: Retrieving libc-bin
I: Validating libc-bin
I: Retrieving libc6
I: Validating libc6
I: Retrieving multiarch-support
I: Validating multiarch-support
I: Retrieving findutils
I: Validating findutils
I: Retrieving gcc-4.5-base
I: Validating gcc-4.5-base
I: Retrieving gcc-4.6-base
I: Validating gcc-4.6-base
I: Retrieving gcc-4.7-base
I: Validating gcc-4.7-base
I: Retrieving libgcc1
I: Validating libgcc1
I: Retrieving libstdc++6
I: Validating libstdc++6
I: Retrieving libgdbm3
I: Validating libgdbm3
I: Retrieving gnupg
I: Validating gnupg
I: Retrieving gpgv
I: Validating gpgv
I: Retrieving libgnutls26
I: Validating libgnutls26
I: Retrieving grep
I: Validating grep
I: Retrieving groff-base
I: Validating groff-base
I: Retrieving gzip
I: Validating gzip
I: Retrieving hostname
I: Validating hostname
I: Retrieving ifupdown
I: Validating ifupdown
I: Retrieving insserv
I: Validating insserv
I: Retrieving iproute
I: Validating iproute
I: Retrieving iptables
I: Validating iptables
I: Retrieving iputils-ping
I: Validating iputils-ping
I: Retrieving isc-dhcp-client
I: Validating isc-dhcp-client
I: Retrieving isc-dhcp-common
I: Validating isc-dhcp-common
I: Retrieving kmod
I: Validating kmod
I: Retrieving libkmod2
I: Validating libkmod2
I: Retrieving libclass-isa-perl
I: Validating libclass-isa-perl
I: Retrieving libept1.4.12
I: Validating libept1.4.12
I: Retrieving libgcrypt11
I: Validating libgcrypt11
I: Retrieving libgpg-error0
I: Validating libgpg-error0
I: Retrieving libidn11
I: Validating libidn11
I: Retrieving liblocale-gettext-perl
I: Validating liblocale-gettext-perl
I: Retrieving libnfnetlink0
I: Validating libnfnetlink0
I: Retrieving libpipeline1
I: Validating libpipeline1
I: Retrieving libselinux1
I: Validating libselinux1
I: Retrieving libsemanage-common
I: Validating libsemanage-common
I: Retrieving libsemanage1
I: Validating libsemanage1
I: Retrieving libsepol1
I: Validating libsepol1
I: Retrieving libsigc++-2.0-0c2a
I: Validating libsigc++-2.0-0c2a
I: Retrieving libswitch-perl
I: Validating libswitch-perl
I: Retrieving libtasn1-3
I: Validating libtasn1-3
I: Retrieving libtext-charwidth-perl
I: Validating libtext-charwidth-perl
I: Retrieving libtext-iconv-perl
I: Validating libtext-iconv-perl
I: Retrieving libtext-wrapi18n-perl
I: Validating libtext-wrapi18n-perl
I: Retrieving libusb-0.1-4
I: Validating libusb-0.1-4
I: Retrieving logrotate
I: Validating logrotate
I: Retrieving lsb-base
I: Validating lsb-base
I: Retrieving man-db
I: Validating man-db
I: Retrieving manpages
I: Validating manpages
I: Retrieving mawk
I: Validating mawk
I: Retrieving nano
I: Validating nano
I: Retrieving libncurses5
I: Validating libncurses5
I: Retrieving libncursesw5
I: Validating libncursesw5
I: Retrieving libtinfo5
I: Validating libtinfo5
I: Retrieving ncurses-base
I: Validating ncurses-base
I: Retrieving ncurses-bin
I: Validating ncurses-bin
I: Retrieving net-tools
I: Validating net-tools
I: Retrieving netbase
I: Validating netbase
I: Retrieving netcat-traditional
I: Validating netcat-traditional
I: Retrieving libnewt0.52
I: Validating libnewt0.52
I: Retrieving whiptail
I: Validating whiptail
I: Retrieving libssl1.0.0
I: Validating libssl1.0.0
I: Retrieving libp11-kit0
I: Validating libp11-kit0
I: Retrieving libpam-modules
I: Validating libpam-modules
I: Retrieving libpam-modules-bin
I: Validating libpam-modules-bin
I: Retrieving libpam-runtime
I: Validating libpam-runtime
I: Retrieving libpam0g
I: Validating libpam0g
I: Retrieving perl
I: Validating perl
I: Retrieving perl-base
I: Validating perl-base
I: Retrieving perl-modules
I: Validating perl-modules
I: Retrieving libpopt0
I: Validating libpopt0
I: Retrieving libprocps0
I: Validating libprocps0
I: Retrieving procps
I: Validating procps
I: Retrieving libreadline6
I: Validating libreadline6
I: Retrieving readline-common
I: Validating readline-common
I: Retrieving rsyslog
I: Validating rsyslog
I: Retrieving sed
I: Validating sed
I: Retrieving sensible-utils
I: Validating sensible-utils
I: Retrieving login
I: Validating login
I: Retrieving passwd
I: Validating passwd
I: Retrieving libslang2
I: Validating libslang2
I: Retrieving libsqlite3-0
I: Validating libsqlite3-0
I: Retrieving initscripts
I: Validating initscripts
I: Retrieving sysv-rc
I: Validating sysv-rc
I: Retrieving sysvinit
I: Validating sysvinit
I: Retrieving sysvinit-utils
I: Validating sysvinit-utils
I: Retrieving tar
I: Validating tar
I: Retrieving tasksel
I: Validating tasksel
I: Retrieving tasksel-data
I: Validating tasksel-data
I: Retrieving info
I: Validating info
I: Retrieving install-info
I: Validating install-info
I: Retrieving traceroute
I: Validating traceroute
I: Retrieving tzdata
I: Validating tzdata
I: Retrieving ucf
I: Validating ucf
I: Retrieving libudev0
I: Validating libudev0
I: Retrieving udev
I: Validating udev
I: Retrieving libustr-1.0-1
I: Validating libustr-1.0-1
I: Retrieving bsdutils
I: Validating bsdutils
I: Retrieving libblkid1
I: Validating libblkid1
I: Retrieving libmount1
I: Validating libmount1
I: Retrieving libuuid1
I: Validating libuuid1
I: Retrieving mount
I: Validating mount
I: Retrieving util-linux
I: Validating util-linux
I: Retrieving vim-common
I: Validating vim-common
I: Retrieving vim-tiny
I: Validating vim-tiny
I: Retrieving wget
I: Validating wget
I: Retrieving libxapian22
I: Validating libxapian22
I: Retrieving liblzma5
I: Validating liblzma5
I: Retrieving xz-utils
I: Validating xz-utils
I: Retrieving zlib1g
I: Validating zlib1g
I: Chosen extractor for .deb packages: dpkg-deb
I: Extracting libacl1...
I: Extracting libattr1...
I: Extracting base-files...
I: Extracting base-passwd...
I: Extracting bash...
I: Extracting libbz2-1.0...
I: Extracting coreutils...
I: Extracting dash...
I: Extracting libdb5.1...
I: Extracting debconf...
I: Extracting debconf-i18n...
I: Extracting debianutils...
I: Extracting diffutils...
I: Extracting dpkg...
I: Extracting e2fslibs...
I: Extracting e2fsprogs...
I: Extracting libcomerr2...
I: Extracting libss2...
I: Extracting libc-bin...
I: Extracting libc6...
I: Extracting multiarch-support...
I: Extracting findutils...
I: Extracting gcc-4.5-base...
I: Extracting gcc-4.6-base...
I: Extracting gcc-4.7-base...
I: Extracting libgcc1...
I: Extracting grep...
I: Extracting gzip...
I: Extracting hostname...
I: Extracting insserv...
I: Extracting liblocale-gettext-perl...
I: Extracting libselinux1...
I: Extracting libsemanage-common...
I: Extracting libsemanage1...
I: Extracting libsepol1...
I: Extracting libtext-charwidth-perl...
I: Extracting libtext-iconv-perl...
I: Extracting libtext-wrapi18n-perl...
I: Extracting lsb-base...
I: Extracting mawk...
I: Extracting libncurses5...
I: Extracting libtinfo5...
I: Extracting ncurses-base...
I: Extracting ncurses-bin...
I: Extracting libpam-modules...
I: Extracting libpam-modules-bin...
I: Extracting libpam-runtime...
I: Extracting libpam0g...
I: Extracting perl-base...
I: Extracting sed...
I: Extracting sensible-utils...
I: Extracting login...
I: Extracting passwd...
I: Extracting libslang2...
I: Extracting initscripts...
I: Extracting sysv-rc...
I: Extracting sysvinit...
I: Extracting sysvinit-utils...
I: Extracting tar...
I: Extracting tzdata...
I: Extracting ucf...
I: Extracting libustr-1.0-1...
I: Extracting bsdutils...
I: Extracting libblkid1...
I: Extracting libmount1...
I: Extracting libuuid1...
I: Extracting mount...
I: Extracting util-linux...
I: Extracting liblzma5...
I: Extracting xz-utils...
I: Extracting zlib1g...
I: Installing core packages...
I: Unpacking required packages...
I: Unpacking libacl1:i386...
I: Unpacking libattr1:i386...
I: Unpacking base-files...
I: Unpacking base-passwd...
I: Unpacking bash...
I: Unpacking libbz2-1.0:i386...
I: Unpacking coreutils...
I: Unpacking dash...
I: Unpacking libdb5.1:i386...
I: Unpacking debconf...
I: Unpacking debconf-i18n...
I: Unpacking debianutils...
I: Unpacking diffutils...
I: Unpacking dpkg...
I: Unpacking e2fslibs:i386...
I: Unpacking e2fsprogs...
I: Unpacking libcomerr2:i386...
I: Unpacking libss2:i386...
I: Unpacking libc-bin...
I: Unpacking libc6:i386...
I: Unpacking multiarch-support...
I: Unpacking findutils...
I: Unpacking gcc-4.5-base:i386...
I: Unpacking gcc-4.6-base:i386...
I: Unpacking gcc-4.7-base:i386...
I: Unpacking libgcc1:i386...
I: Unpacking grep...
I: Unpacking gzip...
I: Unpacking hostname...
I: Unpacking insserv...
I: Unpacking liblocale-gettext-perl...
I: Unpacking libselinux1:i386...
I: Unpacking libsemanage-common...
I: Unpacking libsemanage1...
I: Unpacking libsepol1:i386...
I: Unpacking libtext-charwidth-perl...
I: Unpacking libtext-iconv-perl...
I: Unpacking libtext-wrapi18n-perl...
I: Unpacking lsb-base...
I: Unpacking mawk...
I: Unpacking libncurses5:i386...
I: Unpacking libtinfo5:i386...
I: Unpacking ncurses-base...
I: Unpacking ncurses-bin...
I: Unpacking libpam-modules:i386...
I: Unpacking libpam-modules-bin...
I: Unpacking libpam-runtime...
I: Unpacking libpam0g:i386...
I: Unpacking perl-base...
I: Unpacking sed...
I: Unpacking sensible-utils...
I: Unpacking login...
I: Unpacking passwd...
I: Unpacking libslang2:i386...
I: Unpacking initscripts...
I: Unpacking sysv-rc...
I: Unpacking sysvinit...
I: Unpacking sysvinit-utils...
I: Unpacking tar...
I: Unpacking tzdata...
I: Unpacking ucf...
I: Unpacking libustr-1.0-1...
I: Unpacking bsdutils...
I: Unpacking libblkid1:i386...
I: Unpacking libmount1...
I: Unpacking libuuid1:i386...
I: Unpacking mount...
I: Unpacking util-linux...
I: Unpacking liblzma5:i386...
I: Unpacking xz-utils...
I: Unpacking zlib1g:i386...
I: Configuring required packages...
I: Configuring lsb-base...
I: Configuring ncurses-base...
I: Configuring sensible-utils...
I: Configuring libsemanage-common...
I: Configuring gcc-4.7-base:i386...
I: Configuring libc-bin...
I: Configuring gcc-4.5-base:i386...
I: Configuring gcc-4.6-base:i386...
I: Configuring libc6:i386...
I: Configuring libustr-1.0-1...
I: Configuring debianutils...
I: Configuring bsdutils...
I: Configuring tar...
I: Configuring base-passwd...
I: Configuring mawk...
I: Configuring hostname...
I: Configuring insserv...
I: Configuring multiarch-support...
I: Configuring libselinux1:i386...
I: Configuring libsepol1:i386...
I: Configuring zlib1g:i386...
I: Configuring libgcc1:i386...
I: Configuring base-files...
I: Configuring libattr1:i386...
I: Configuring e2fslibs:i386...
I: Configuring libcomerr2:i386...
I: Configuring libacl1:i386...
I: Configuring libslang2:i386...
I: Configuring libss2:i386...
I: Configuring liblzma5:i386...
I: Configuring libdb5.1:i386...
I: Configuring libbz2-1.0:i386...
I: Configuring libtinfo5:i386...
I: Configuring sysvinit-utils...
I: Configuring ncurses-bin...
I: Configuring libsemanage1...
I: Configuring libncurses5:i386...
I: Configuring xz-utils...
I: Configuring dpkg...
I: Configuring dash...
I: Configuring coreutils...
I: Configuring perl-base...
I: Configuring diffutils...
I: Configuring libtext-iconv-perl...
I: Configuring sed...
I: Configuring grep...
I: Configuring findutils...
I: Configuring gzip...
I: Configuring liblocale-gettext-perl...
I: Configuring bash...
I: Configuring libtext-charwidth-perl...
I: Configuring libtext-wrapi18n-perl...
I: Configuring debconf...
I: Configuring libpam0g:i386...
I: Configuring ucf...
I: Configuring sysv-rc...
I: Configuring tzdata...
I: Configuring debconf-i18n...
I: Configuring libpam-modules-bin...
I: Configuring libpam-modules:i386...
I: Configuring passwd...
I: Configuring libpam-runtime...
I: Configuring login...
I: Configuring libuuid1:i386...
I: Configuring libblkid1:i386...
I: Configuring libmount1...
I: Configuring mount...
I: Configuring initscripts...
I: Configuring util-linux...
I: Configuring sysvinit...
I: Configuring e2fsprogs...
I: Unpacking the base system...
I: Unpacking adduser...
I: Unpacking apt...
I: Unpacking apt-utils...
I: Unpacking libapt-inst1.5:i386...
I: Unpacking libapt-pkg4.12:i386...
I: Unpacking aptitude...
I: Unpacking libboost-iostreams1.46.1...
I: Unpacking libboost-iostreams1.48.0...
I: Unpacking libboost-iostreams1.49.0...
I: Unpacking bsdmainutils...
I: Unpacking cpio...
I: Unpacking cron...
I: Unpacking libcwidget3...
I: Unpacking debian-archive-keyring...
I: Unpacking dmidecode...
I: Unpacking libstdc++6:i386...
I: Unpacking libgdbm3:i386...
I: Unpacking gnupg...
I: Unpacking gpgv...
I: Unpacking libgnutls26:i386...
I: Unpacking groff-base...
I: Unpacking ifupdown...
I: Unpacking iproute...
I: Unpacking iptables...
I: Unpacking iputils-ping...
I: Unpacking isc-dhcp-client...
I: Unpacking isc-dhcp-common...
I: Unpacking kmod...
I: Unpacking libkmod2:i386...
I: Unpacking libclass-isa-perl...
I: Unpacking libept1.4.12...
I: Unpacking libgcrypt11:i386...
I: Unpacking libgpg-error0:i386...
I: Unpacking libidn11:i386...
I: Unpacking libnfnetlink0...
I: Unpacking libpipeline1:i386...
I: Unpacking libsigc++-2.0-0c2a...
I: Unpacking libswitch-perl...
I: Unpacking libtasn1-3:i386...
I: Unpacking libusb-0.1-4:i386...
I: Unpacking logrotate...
I: Unpacking man-db...
I: Unpacking manpages...
I: Unpacking nano...
I: Unpacking libncursesw5:i386...
I: Unpacking net-tools...
I: Unpacking netbase...
I: Unpacking netcat-traditional...
I: Unpacking libnewt0.52...
I: Unpacking whiptail...
I: Unpacking libssl1.0.0:i386...
I: Unpacking libp11-kit0:i386...
I: Unpacking perl...
I: Unpacking perl-modules...
I: Unpacking libpopt0:i386...
I: Unpacking libprocps0:i386...
I: Unpacking procps...
I: Unpacking libreadline6:i386...
I: Unpacking readline-common...
I: Unpacking rsyslog...
I: Unpacking libsqlite3-0:i386...
I: Unpacking tasksel...
I: Unpacking tasksel-data...
I: Unpacking info...
I: Unpacking install-info...
I: Unpacking traceroute...
I: Unpacking libudev0:i386...
I: Unpacking udev...
I: Unpacking vim-common...
I: Unpacking vim-tiny...
I: Unpacking wget...
I: Unpacking libxapian22...
I: Configuring the base system...
I: Configuring gpgv...
I: Configuring libssl1.0.0:i386...
I: Configuring libgdbm3:i386...
I: Configuring isc-dhcp-common...
I: Configuring libtasn1-3:i386...
I: Configuring libpopt0:i386...
I: Configuring libusb-0.1-4:i386...
I: Configuring libgpg-error0:i386...
I: Configuring install-info...
I: Configuring vim-common...
I: Configuring libprocps0:i386...
I: Configuring netbase...
I: Configuring dmidecode...
I: Configuring libudev0:i386...
I: Configuring libkmod2:i386...
I: Configuring libclass-isa-perl...
I: Configuring adduser...
I: Configuring traceroute...
I: Configuring manpages...
I: Configuring libsqlite3-0:i386...
I: Configuring iproute...
I: Configuring libidn11:i386...
I: Configuring libnewt0.52...
I: Configuring net-tools...
I: Configuring libpipeline1:i386...
I: Configuring bsdmainutils...
I: Configuring netcat-traditional...
I: Configuring libncursesw5:i386...
I: Configuring info...
I: Configuring iputils-ping...
I: Configuring cron...
I: Configuring nano...
I: Configuring libp11-kit0:i386...
I: Configuring udev...
I: Configuring rsyslog...
I: Configuring cpio...
I: Configuring libstdc++6:i386...
I: Configuring isc-dhcp-client...
I: Configuring vim-tiny...
I: Configuring readline-common...
I: Configuring libnfnetlink0...
I: Configuring libgcrypt11:i386...
I: Configuring procps...
I: Configuring libxapian22...
I: Configuring libboost-iostreams1.46.1...
I: Configuring whiptail...
I: Configuring ifupdown...
I: Configuring kmod...
I: Configuring libapt-pkg4.12:i386...
I: Configuring libept1.4.12...
I: Configuring libboost-iostreams1.48.0...
I: Configuring libapt-inst1.5:i386...
I: Configuring libreadline6:i386...
I: Configuring logrotate...
I: Configuring libboost-iostreams1.49.0...
I: Configuring groff-base...
I: Configuring gnupg...
I: Configuring libsigc++-2.0-0c2a...
I: Configuring libgnutls26:i386...
I: Configuring apt-utils...
I: Configuring iptables...
I: Configuring man-db...
I: Configuring wget...
I: Configuring libcwidget3...
I: Configuring aptitude...
I: Configuring debian-archive-keyring...
I: Configuring apt...
I: Configuring libswitch-perl...
I: Configuring tasksel-data...
I: Configuring perl-modules...
I: Configuring perl...
I: Configuring tasksel...
I: Base system installed successfully.

ホスト側で、下の内容を/etc/schroot/schroot.confに書き込む/procのマウント作業などはchrootのセットアップスクリプトが面倒を見てくれる (type=directoryの場合は) ため、不要。

[testing]
description=Debian testing
type=directory
directory=/home/chroot/testing
users=**********
groups=**********
root-groups=root
aliases=default

ホスト側の一般ユーザ(/etc/schroot/schroot.conf で指定した)でゲスト側(chroot 環境内)のシェルにを使うには、ホスト側で以下のようにする。bashのプロンプトの最初にtestingとでて、ゲスト側にいることがわかる。また、ホームディレクトリもマウントされる。

**@*********************:~$ schroot -c testing
(testing)**@*********************:~$

ホスト側とゲスト側(chroot 環境内)でそれぞれdebian_versionを確認すると異なっていることがわかる。

**@*********************:~$ cat /etc/debian_version
6.0.5
**@*********************:~$ schroot -c testing
(testing)**@*********************:~$ cat /etc/debian_version
wheezy/sid

ゲスト側で、rootになるにはsuコマンドを使う。このときのパスワードはホスト側と同じ。

(testing)**@*********************:~$ su -
Password:
(testing)root@*********************:~#

ゲスト側で、rootになったらaptitideのアップデート。

(testing)root@*********************:~# aptitude update && aptitude -y safe-upgrade && aptitude clean
Get: 1 http://ftp.jp.debian.org testing InRelease [190 kB]
Get: 2 http://ftp.jp.debian.org testing/main i386 Packages/DiffIndex [7876 B]
Get: 3 http://ftp.jp.debian.org testing/main Translation-en [3833 kB]
Fetched 4031 kB in 19s (204 kB/s)

No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

ゲスト側で、ロケールの設定。en_US.UTF-8のロケールを作成しておく。

(testing)root@*********************:~# aptitude install locales
(testing)root@*********************:~# dpkg-reconfigure locales
(testing)root@*********************:~# echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen
(testing)root@*********************:~# locale-gen
(testing)root@*********************:~# echo 'en_US.UTF-8 UTF-8' > /etc/locale.conf
(testing)root@*********************:~# export LANG=en_US.UTF-8
(testing)root@*********************:~# export LC_ALL=$LANG
(testing)root@*********************:~# locale-gen --purge $LANG
(testing)root@*********************:~# dpkg-reconfigure -f noninteractive locales && /usr/sbin/update-locale LANG=$LANG LC_ALL=$LANG

aptリポジトリの追加と更新、必要なもののインストール。emacsの起動確認

(testing)root@*********************:~# echo 'deb-src http://ftp.jp.debian.org/debian testing main' >> /etc/apt/sources.list
(testing)root@*********************:~# apt-get update && apt-get -y upgrade && apt-get clean
(testing)root@*********************:~# aptitude install locales emacs wl-beta openssl w3m-el emacs-goodies-el
(testing)root@*********************:~# exit
(testing)**@*********************:~$ export LANG=en_US.UTF-8

必要であればデフォルトのマウントテーブルにエントリを追加

$ cat <EOF >> /etc/schroot/default/fstab
UUID=e43a9cd3-aba4-4bbe-8bf7-8c91bb29a830       /****************       ext3    defaults        0       1
/****************       /****************       none    rw,bind         0       0
EOF

リファレンス

  1. D.3. Unix/Linux システムからの Debian GNU/Linux のインストール
  2. schroot - chroot for any users
  3. Ubuntu Manpage: schroot.conf — chroot definition file for schroot
  4. 本を読む UbuntuなノートPC上にDebian sidのchroot環境を作る

ソーシャルブックマーク

  1. はてなブックマーク
  2. Google Bookmarks
  3. del.icio.us

ChangeLog

  1. Posted: 2010-05-18T06:04:32+09:00
  2. Modified: 2010-05-18T06:04:32+09:00
  3. Generated: 2017-06-19T23:09:17+09:00