How to make ubuntu 32 bit environment using chroot on Ubuntu 12.04 64 bit


1. Setup basic chroot


$ sudo apt-get install debootstrap
$ sudo apt-get install schroot
$ sudo mkdir /var/chroot/
$ sudo editor /etc/schroot/schroot.conf

Fill /etc/schroot/schroot.conf with below (Assuming your account is king)

[lucid]

description=Ubuntu Lucid

#location=/var/chroot

directory=/var/chroot/

personality=linux32

priority=3

users=king

root-users=king

groups=sbuild

root-groups=root

Note:

  • personality: Enable this line if the host system is 64-bit running on an amd64/x64 computer and the chroot is 32-bit for i386. Otherwise, leave it disabled.


After modifying schroot.conf, donwload lucid data from the Ubuntu repository


$ sudo debootstrap --variant=buildd --arch i386 lucid /var/chroot/ http://kr.archive.ubuntu.com/ubuntu/


Useful settings


$ sudo mount -o bind /proc /var/chroot/proc
$ sudo ln -f /etc/apt/sources.list /var/chroot/etc/apt/sources.list

2. Entering chroot envrinment


After basic installation of Ubuntu Lucid completion, run below command to change to chroot environment with root account.


$ $ sudo chroot /var/chroot
or
$ schroot -c lucid -u root


In chroot, install basic ubuntu package by running below command


# apt-get install ubuntu-minimal # apt-get update


If you notice any error somthing like "GPG error ... public key is not available: KEY_VALUE", then you can run below command to add the public key so that make "apt-get update" end with no such error and rerun "apt-get update" to complete all setup.


# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <KEY_VALUE>

Now you are ready to use full 32 bit app development in Ubuntu Lucid version.


Posted by kevino
,