<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://doc.lunar-linux.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://doc.lunar-linux.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Keitekk</id>
		<title>Lunar Linux - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://doc.lunar-linux.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Keitekk"/>
		<link rel="alternate" type="text/html" href="http://doc.lunar-linux.org/Special:Contributions/Keitekk"/>
		<updated>2026-05-11T18:01:24Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.18.1</generator>

	<entry>
		<id>http://doc.lunar-linux.org/User:Keitekk</id>
		<title>User:Keitekk</title>
		<link rel="alternate" type="text/html" href="http://doc.lunar-linux.org/User:Keitekk"/>
				<updated>2012-02-23T00:24:09Z</updated>
		
		<summary type="html">&lt;p&gt;Keitekk: Removing all content from page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Keitekk</name></author>	</entry>

	<entry>
		<id>http://doc.lunar-linux.org/Miscellaneous:32BitChroot</id>
		<title>Miscellaneous:32BitChroot</title>
		<link rel="alternate" type="text/html" href="http://doc.lunar-linux.org/Miscellaneous:32BitChroot"/>
				<updated>2012-02-23T00:19:19Z</updated>
		
		<summary type="html">&lt;p&gt;Keitekk: /* Changelog: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an Article about running a 32bit Chroot of Lunar Linux within 64bit Lunar Linux. It's getting updated sometimes and should work on different Distributions, too.&lt;br /&gt;
&lt;br /&gt;
==Lunar Linux 32 Bit Chroot within native 64 Bit Environment==&lt;br /&gt;
&lt;br /&gt;
===Changelog:===&lt;br /&gt;
* (23.02.12) Updated init script to conform with Lunar/LSB (keios)&lt;br /&gt;
* (20.02.12) Added 32bit-kernel configuration and prompt customization tidbits (keios) &lt;br /&gt;
* (22.02.11) Paths of qt4 changed, changed howto accordingly (for skype), fonts needs mkfontscale and mkfontdir (added), added section about ATI graphiccards (3d acceleration), some smaller adjustments.&lt;br /&gt;
* (29.10.10) Added bdftopcf to list of fonts, without that, fonts won't compile (thx to cavalier for helping to find out)  &lt;br /&gt;
* (29.10.10) Added instructions regarding the kernel&lt;br /&gt;
* (29.10.10) Added new (with current applications installed) image (lunarlinuxchroot.tar.bz2)&lt;br /&gt;
* (29.10.10) Added some information at the Test-Stage&lt;br /&gt;
* (29.10.10) Added little side note about lunar optimize in chrooted-environments&lt;br /&gt;
* (29.10.10) Added little notice about the &amp;quot;unofficial image&amp;quot;&lt;br /&gt;
* (11.08.09) Added some Information (Thanks to beko)&lt;br /&gt;
* (10.07.09) 3D Acceleration howto was wrong, corrected thx to Raedwulf for pointing out :)&lt;br /&gt;
* (10.07.09) I rewrote some parts to a hopefully nicer english.&lt;br /&gt;
&lt;br /&gt;
===Todo:===&lt;br /&gt;
* Bash Script which performs the actions below automatically&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
===Why===&lt;br /&gt;
Because. As Lunar Linux is 32bit or 64bit and not multilib, you have to use a chroot for 32bit. I really dislike this but nobody wanted to put time into multilib yet just because of a few guys which would like that and as every day some more apps work using 64bit, multilib will probably not be that useful at all. Anyway, for those of you who want to use 32bit apps within the 64bit environment, this little howto should help a lot.&lt;br /&gt;
&lt;br /&gt;
===Requirements===&lt;br /&gt;
Having an image of a running system could help a lot and reduce the needed time amount. If you like you can use an Image i created originally for use as OpenSolaris Zone. You could also create your own 32bit image (just install 32bit linux using a vm or something and tar cjvf the whole system, without proc, sys, dev..). Anyway, i will explain here how to do it using my image.&lt;br /&gt;
&lt;br /&gt;
== Images ==&lt;br /&gt;
&lt;br /&gt;
These are '''unofficial''' images made by me (wdp).&lt;br /&gt;
&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2 [current]  483M (unpacked 1,8G) - 29.10.2010&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/osol_lunar_zone.tar.gz [outdated!] 570M&lt;br /&gt;
&lt;br /&gt;
These images are quite outdated, so you're far better off making your own 32bit image. If you don't, you could have difficulties during the lunar update process below.&lt;br /&gt;
&lt;br /&gt;
===Switch to root (For the Dummies)===&lt;br /&gt;
Of course you need to be root to run most of the following commands. If you don't know how to switch to the super user (root) in a Linux System you don't want to deal with this Howto. First learn some Basics. However. You can switch to the super user using the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ su -&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setup Environment===&lt;br /&gt;
'''Important: The Image listed below''': The image was created to be used as solaris zone, however its quite fine for chrooted environments, too. Please notice that this image is &amp;quot;unofficial&amp;quot; so you won't get official support for it.&lt;br /&gt;
&lt;br /&gt;
I installed my Chroot within /usr/local/32bit you might want to change that, just replace the &amp;quot;export&amp;quot; line to do so and don't forget to replace the path in the config files i'm later showing. The following lines will create the directory for your chroot, download my image and unpack it within that directory, copy over some files from the host to the chroot (like users, passwords, etc) and finally mount some directories from the host within the chroot (like dev, proc, sys, tmp).&lt;br /&gt;
&amp;lt;pre&amp;gt;export OC=&amp;quot;/usr/local/32bit&amp;quot;&lt;br /&gt;
mkdir -p $OC&lt;br /&gt;
cd $OC&lt;br /&gt;
wget http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2&lt;br /&gt;
tar -xjvf lunarlinuxchroot.tar.bz2&lt;br /&gt;
cp /etc/hosts $OC/etc/hosts&lt;br /&gt;
cp /etc/nsswitch.conf $OC/etc/nsswitch.conf&lt;br /&gt;
cp /etc/passwd $OC/etc/passwd&lt;br /&gt;
cp /etc/shadow $OC/etc/shadow&lt;br /&gt;
cp /etc/resolv.conf $OC/etc/resolv.conf&lt;br /&gt;
mount -o bind /dev $OC/dev&lt;br /&gt;
mount -o bind /dev/pts $OC/dev/pts&lt;br /&gt;
mount -o bind /proc $OC/proc&lt;br /&gt;
mount -o bind /sys $OC/sys&lt;br /&gt;
mount -o bind /tmp $OC/tmp&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Don't copy your current kernel stuff over to the chroot except for your .config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -rva /usr/src/linux/.config $OC/usr/src/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
&lt;br /&gt;
To enter this chrooted environment, simply type in linux32 chroot $OC&lt;br /&gt;
&lt;br /&gt;
===Test #1===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: i686-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=i686-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: x86_64-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=x86_64-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared –disable-multilib&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test #2===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
i686&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
x86_64&amp;lt;/pre&amp;gt;&lt;br /&gt;
as you can see - the chroot picks a not-64bit-gcc and uname -m returns not 64bit within the chroot - It's working ;-)&lt;br /&gt;
&lt;br /&gt;
===Setting up the shell prompt===&lt;br /&gt;
You might want to ensure you don't accidently mistake the chroot environment for your host or vice-versa. Even if you don't think this could ever happen to you, it almost inevitably will if you keep a lot of terminals open at the same time like me (keios). &lt;br /&gt;
&lt;br /&gt;
So to change your default prompt automatically on entering the chroot, add something like this to your .bashrc:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ $(uname -m) = &amp;quot;i686&amp;quot; ]; then&lt;br /&gt;
   # insert whatever works for you between @ and :&lt;br /&gt;
   export PS1=&amp;quot;\u@lunar32:\W&amp;gt; &amp;quot; &lt;br /&gt;
else&lt;br /&gt;
    export PS1=&amp;quot;\u@\h:\W&amp;gt; &amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your default prompt might look different, in that case customize the snippet as you see fit. If you use a colored prompt, changing the color usually should be enough to remind you.&lt;br /&gt;
&lt;br /&gt;
===Updating the Chroot-System===&lt;br /&gt;
My Image might be quite old and it's usually good to have the chroot environment as up to date as the host is. Run the following commands to get new packages/modules:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lin moonbase; lin theedge&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now you can run &amp;quot;lunar&amp;quot; and set some settings. The most important Settings might be the Optimizations. You can either go through: Option -&amp;amp;gt; Optimize Architecture or you run &amp;quot;lunar optimize&amp;quot; at the console.&lt;br /&gt;
&lt;br /&gt;
Modules might need working 32bit kernel headers, so make sure your gcc versions in- and outside the chroot are the same (see Test 1 above). If you need a specific gcc version that's not in the moonbase, use the --want $VERSION option of lin. Then build the kernel - you need the exact same version as you have on your host so you won't run into any trouble when e.g. installing video drivers for 3d acceleration later on:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@mari-chan:/$ lin -cr linux-stable&amp;lt;/pre&amp;gt;&lt;br /&gt;
When it asks you if you want to configure the kernel, say yes. In the menuconfig, use the &amp;quot;Load alternative config&amp;quot; option to load the kernel .config file you've copied to /usr/src earlier. Just enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;../.config&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you've done configuring your lunar installation run:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lunar renew&amp;lt;/pre&amp;gt;&lt;br /&gt;
to update your whole installation. Get a cup of tea or coffee, this might take a while depending on your box and resources. At this state you should have a running 32 Bit Chroot. However we will still need to enhance this a bit. You want for sure X11 within the Chroot.&lt;br /&gt;
&lt;br /&gt;
'''Important Note about lunar optimize''':&lt;br /&gt;
If you select optimizations for your chrooted environment, never ever use &amp;quot;native&amp;quot; as cpu optimization, this will break things. Always go with something safe, like i686 for example.&lt;br /&gt;
&lt;br /&gt;
==Enhancing your Chroot Installation==&lt;br /&gt;
===X11===&lt;br /&gt;
We mounted /tmp from the host to /tmp inside the chroot already. This way we can use the X11 Socket to connect applications within the chroot to our running x11-server within the host. You could also, if this isn’t possible, use TCP Connections. But they come usually with overhead and thus performance of x11 stuff will be bad. Anyway. You don’t need a whole X11-Server within the chroot, just a few x11 libs. Let’s go:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ lin -cr libX11 fixesproto libXxf86vm libXt libXmu libXi mesa-lib xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will install some X11 staff and libraries which are needed. You need now to allow X11-Unix-Socket Connections. Within the Chroot Environment edit your /etc/hostname and set &amp;quot;linux32&amp;quot; or something similar, remember this hostname. On the host type in: xhost +local:linux32 (Replace linux32 with the hostname you've set) or you could use &amp;quot;xhost +&amp;quot; which is insecure. Now you can test your X11 using xclock within your Chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ export DISPLAY=”:0.0″&lt;br /&gt;
wdp@linux32 ~ $ xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
You see the Clock? Fine it worked :)&lt;br /&gt;
&lt;br /&gt;
===3D Acceleration===&lt;br /&gt;
&lt;br /&gt;
If you want to run 32 Bit Games or Emulators like wine which don't work in native 64 Bit you might want to have 3D Acceleration.  The important thing about this is that you have to use exactly the same driver version within your chroot as the driver version in your host, otherwise it will simply not work. Thats why you should try to keep both installations as up to date as possible.&lt;br /&gt;
&lt;br /&gt;
==== nVidia ====&lt;br /&gt;
&lt;br /&gt;
It is really important that you got your kernel files and kernel header from the host, also within the chroot. you can do that by copy (cp) from the host to the chrooted environment or you simply copy over the current kernel configuration to the chroot and compile the kernel within the chroot again. (i will explain this step better when i got more time) - Keep also in mind, by default the kernel is on hold within the lunar installation. you might want to &amp;quot;unhold&amp;quot; it using lvu.&lt;br /&gt;
&lt;br /&gt;
On the Host check which NVIDIA drivers you got installed and what version it is:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lvu installed NVIDIA&lt;br /&gt;
NVIDIA is not installed&lt;br /&gt;
wdp@yulivee ~ $ lvu installed NVIDIA-beta&lt;br /&gt;
185.18.14&lt;br /&gt;
wdp@yulivee ~ $&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, i have NVIDIA-beta installed on the host. Within the Chroot i check now whats the current version of NVIDIA-beta within the moonbase using:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@yulivee /usr/src # lvu version NVIDIA-beta&lt;br /&gt;
185.18.14&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, it's the same version, so everything is fine, issue:&lt;br /&gt;
&amp;lt;pre&amp;gt;lget NVIDIA-beta&amp;lt;/pre&amp;gt;&lt;br /&gt;
and copy the .run from /var/spool/lunar to /usr/src. Make it executable using chmod a+x file.run and run it finally using ./file.run. Of course you have to replace &amp;quot;file&amp;quot; with the real filename.&lt;br /&gt;
&lt;br /&gt;
It will tell you that you run an X-Server and you have to stop this one first. Thats np, close X11, chroot into your chroot on the console and install NVIDIA. Exit the Chroot, start X11 again and everything is fine and should be done. You have to try around a bit with the NVIDIA Installer.&lt;br /&gt;
&lt;br /&gt;
==== ATI (r600/kms enabled) ====&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
===Home directory===&lt;br /&gt;
This is the easiest Task. We just need to mount the home directory with bind:&lt;br /&gt;
&amp;lt;pre&amp;gt;mount -o bind /home $OC/home&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the Chroot you can “su - username” and you’re in your home directory, without any problems or any flaws.&lt;br /&gt;
&lt;br /&gt;
===Init Script===&lt;br /&gt;
These are only examples.. you’ll probably find nicer variants. Anyway, for both scripts you will need a configfile containing at least the variable CHROOTDIR - which should point to your Chroot Directory. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Config&amp;lt;/strong&amp;gt;&lt;br /&gt;
This config will be used by the initscripts below and our “chroot-enter script”.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/lunar32chroot.conf&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
CHROOTDIR=&amp;quot;/usr/local/32bit&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;SysVinit:&amp;lt;/strong&amp;gt;&lt;br /&gt;
This Init Script will mount with --bind some needed directories for the chroot and copy some files which you will most likely want to keep up to date, to have permissions and networking working correctly.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/init.d/lunar32chroot&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# lunar32chroot Initializes the 32 Bit lunar chroot&lt;br /&gt;
#&lt;br /&gt;
# chkconfig: 2345 80 10&lt;br /&gt;
# description: Initializes 32 Bit chroot&lt;br /&gt;
&lt;br /&gt;
CONFIGFILE=&amp;quot;/etc/lunar32chroot.conf&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Starting 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	if [ -e &amp;quot;$CONFIGFILE&amp;quot; ]; then&lt;br /&gt;
    		source /etc/lunar32chroot.conf&lt;br /&gt;
	else&lt;br /&gt;
	    # we need a config...&lt;br /&gt;
    	echo &amp;quot;No config file found!&amp;quot;&lt;br /&gt;
    	echo -e $RESULT_FAIL&lt;br /&gt;
    	exit 0&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Mounting chroot directories...&amp;quot;&lt;br /&gt;
        mount -o bind /dev $CHROOTDIR/dev &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /proc $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /sys $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /tmp $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /home $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
        # optional mounts //TODO: add check&lt;br /&gt;
        [ -d /dev/pts ] &amp;amp;&amp;amp; mount -o bind /dev/pts $CHROOTDIR/dev/pts &amp;gt;/dev/null&lt;br /&gt;
        [ -d /dev/shm ] &amp;amp;&amp;amp; mount -o bind /dev/shm $CHROOTDIR/dev/shm &amp;gt;/dev/null&lt;br /&gt;
        [ -d /proc/bus/usb ] &amp;amp;&amp;amp; mount -o bind /proc/bus/usb $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Copying essential files...&amp;quot;&lt;br /&gt;
        cp -afr /etc/resolv.conf $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/passwd $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/shadow $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/group $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/hosts $CHROOTDIR/etc &amp;gt; /dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/localtime $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/nsswitch.conf $CHROOTDIR/etc &amp;gt;/dev/null &lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stop() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Stopping 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	if [ -e &amp;quot;$CONFIGFILE&amp;quot; ]; then&lt;br /&gt;
    		source /etc/lunar32chroot.conf&lt;br /&gt;
	else&lt;br /&gt;
	    # we need a config...&lt;br /&gt;
    	echo &amp;quot;No config file found!&amp;quot;&lt;br /&gt;
    	echo -e $RESULT_FAIL&lt;br /&gt;
    	exit 0&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Unmounting 32bit chroot directories...&amp;quot;&lt;br /&gt;
        umount -fl $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -f $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/dev &amp;gt;/dev/null&lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
        # optional unmounts //TODO: add check&lt;br /&gt;
        [ -d $CHROOTDIR/proc/bus/usb ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null&lt;br /&gt;
        [ -d $CHROOTDIR/dev/shm ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/dev/shm &amp;gt;/dev/null&lt;br /&gt;
        [ -d $CHROOTDIR/dev/pts ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/dev/pts &amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
. /lib/lsb/init-functions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run “chkconfig --add lunar32chroot” to create the essential init scripts/symlinks for the different runlevels and you’re done.&lt;br /&gt;
&lt;br /&gt;
===Entering Chroot - Script===&lt;br /&gt;
With this Script you just need to type “lunar32″ to enter the chroot environment. Keep in mind the &amp;quot;linux32&amp;quot; command should be available on all boxes, you dont need to install additional software. However its part of &amp;quot;util-linux&amp;quot;.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /usr/bin/lunar32&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# little script to reduce some things to just one command&lt;br /&gt;
# especially for lazy people like me.&lt;br /&gt;
&lt;br /&gt;
source /etc/lunar32chroot.conf&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Entering chroot...&amp;quot;&lt;br /&gt;
linux32 chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Hint from Beko&amp;lt;/strong&amp;gt;&lt;br /&gt;
Beko has shown me a dirty way (as he said) of doing the same using sudo, thus you can enter the environment without beeing root:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
linux32 sudo chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash -c &amp;quot;su $WHOAMI&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Negative Sideeffects: you're landing in / at the start and sudo has to run with NOPASS. Thats why this solution is dirty and might be a security risk. However.. :-) &amp;lt;b&amp;gt;By the way&amp;lt;/b&amp;gt; Of course you want to replace $WHOAMI with your username - or a variable containing the current username.&lt;br /&gt;
&lt;br /&gt;
==Applications==&lt;br /&gt;
===Fonts===&lt;br /&gt;
For most applications you will need some X11 Fonts installed within the Chroot. Its enough if you install these:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr mkfontdir mkfontscale bdftopcf font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-75dpi font-adobe-utopia-100dpi font-adobe-utopia-type1 font-bitstream-100dpi font-bitstream-75dpi font-bh-lucidatypewriter-100dpi font-bh-lucidatypewriter-75dpi&amp;lt;/pre&amp;gt;&lt;br /&gt;
some of them might not be needed, but well doesnt hurt to install them.&lt;br /&gt;
&lt;br /&gt;
===Skype===&lt;br /&gt;
If you want to use Skype you will have to install some more libraries and tools:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd /var/lib/lunar/moonbase&lt;br /&gt;
cp -rva qt4-apps/qt4 zlocal/&lt;br /&gt;
cd zlocal/qt4&lt;br /&gt;
vim DEPENDS&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remove this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;depends  %X&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally install needed stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr dbus alsa-utils videoproto libXv scrnsaverproto libXScrnSaver qt4&amp;lt;/pre&amp;gt;&lt;br /&gt;
It might be needed to install dbus-qt3 (not sure) if so, you have to copy the module to zlocal and edit the DEPENDS file (of qt3 and of dbus-qt3) to remove the X Dependecy.&lt;br /&gt;
&lt;br /&gt;
Skype should now work. You might want to look at the &amp;quot;fonts&amp;quot; Section because skype will display broken fonts :)&lt;br /&gt;
&lt;br /&gt;
==Useful Documentation:==&lt;br /&gt;
* http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&amp;amp;amp;chap=2 [English]&lt;br /&gt;
* http://ubuntuforums.org/showthread.php?t=24575 [English]&lt;br /&gt;
* http://wiki.ubuntuusers.de/32-Bit_chroot [German]&lt;br /&gt;
* http://www.debian-administration.org/article/Installing_apps_in_a_32-bit_chroot_in_AMD64_Debian_system [English]&lt;/div&gt;</summary>
		<author><name>Keitekk</name></author>	</entry>

	<entry>
		<id>http://doc.lunar-linux.org/Miscellaneous:32BitChroot</id>
		<title>Miscellaneous:32BitChroot</title>
		<link rel="alternate" type="text/html" href="http://doc.lunar-linux.org/Miscellaneous:32BitChroot"/>
				<updated>2012-02-23T00:17:40Z</updated>
		
		<summary type="html">&lt;p&gt;Keitekk: /* Init Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an Article about running a 32bit Chroot of Lunar Linux within 64bit Lunar Linux. It's getting updated sometimes and should work on different Distributions, too.&lt;br /&gt;
&lt;br /&gt;
==Lunar Linux 32 Bit Chroot within native 64 Bit Environment==&lt;br /&gt;
&lt;br /&gt;
===Changelog:===&lt;br /&gt;
* (20.02.12) Added 32bit-kernel configuration and prompt customization tidbits (keios) &lt;br /&gt;
* (22.02.11) Paths of qt4 changed, changed howto accordingly (for skype), fonts needs mkfontscale and mkfontdir (added), added section about ATI graphiccards (3d acceleration), some smaller adjustments.&lt;br /&gt;
* (29.10.10) Added bdftopcf to list of fonts, without that, fonts won't compile (thx to cavalier for helping to find out)  &lt;br /&gt;
* (29.10.10) Added instructions regarding the kernel&lt;br /&gt;
* (29.10.10) Added new (with current applications installed) image (lunarlinuxchroot.tar.bz2)&lt;br /&gt;
* (29.10.10) Added some information at the Test-Stage&lt;br /&gt;
* (29.10.10) Added little side note about lunar optimize in chrooted-environments&lt;br /&gt;
* (29.10.10) Added little notice about the &amp;quot;unofficial image&amp;quot;&lt;br /&gt;
* (11.08.09) Added some Information (Thanks to beko)&lt;br /&gt;
* (10.07.09) 3D Acceleration howto was wrong, corrected thx to Raedwulf for pointing out :)&lt;br /&gt;
* (10.07.09) I rewrote some parts to a hopefully nicer english.&lt;br /&gt;
&lt;br /&gt;
===Todo:===&lt;br /&gt;
* Bash Script which performs the actions below automatically&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
===Why===&lt;br /&gt;
Because. As Lunar Linux is 32bit or 64bit and not multilib, you have to use a chroot for 32bit. I really dislike this but nobody wanted to put time into multilib yet just because of a few guys which would like that and as every day some more apps work using 64bit, multilib will probably not be that useful at all. Anyway, for those of you who want to use 32bit apps within the 64bit environment, this little howto should help a lot.&lt;br /&gt;
&lt;br /&gt;
===Requirements===&lt;br /&gt;
Having an image of a running system could help a lot and reduce the needed time amount. If you like you can use an Image i created originally for use as OpenSolaris Zone. You could also create your own 32bit image (just install 32bit linux using a vm or something and tar cjvf the whole system, without proc, sys, dev..). Anyway, i will explain here how to do it using my image.&lt;br /&gt;
&lt;br /&gt;
== Images ==&lt;br /&gt;
&lt;br /&gt;
These are '''unofficial''' images made by me (wdp).&lt;br /&gt;
&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2 [current]  483M (unpacked 1,8G) - 29.10.2010&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/osol_lunar_zone.tar.gz [outdated!] 570M&lt;br /&gt;
&lt;br /&gt;
These images are quite outdated, so you're far better off making your own 32bit image. If you don't, you could have difficulties during the lunar update process below.&lt;br /&gt;
&lt;br /&gt;
===Switch to root (For the Dummies)===&lt;br /&gt;
Of course you need to be root to run most of the following commands. If you don't know how to switch to the super user (root) in a Linux System you don't want to deal with this Howto. First learn some Basics. However. You can switch to the super user using the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ su -&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setup Environment===&lt;br /&gt;
'''Important: The Image listed below''': The image was created to be used as solaris zone, however its quite fine for chrooted environments, too. Please notice that this image is &amp;quot;unofficial&amp;quot; so you won't get official support for it.&lt;br /&gt;
&lt;br /&gt;
I installed my Chroot within /usr/local/32bit you might want to change that, just replace the &amp;quot;export&amp;quot; line to do so and don't forget to replace the path in the config files i'm later showing. The following lines will create the directory for your chroot, download my image and unpack it within that directory, copy over some files from the host to the chroot (like users, passwords, etc) and finally mount some directories from the host within the chroot (like dev, proc, sys, tmp).&lt;br /&gt;
&amp;lt;pre&amp;gt;export OC=&amp;quot;/usr/local/32bit&amp;quot;&lt;br /&gt;
mkdir -p $OC&lt;br /&gt;
cd $OC&lt;br /&gt;
wget http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2&lt;br /&gt;
tar -xjvf lunarlinuxchroot.tar.bz2&lt;br /&gt;
cp /etc/hosts $OC/etc/hosts&lt;br /&gt;
cp /etc/nsswitch.conf $OC/etc/nsswitch.conf&lt;br /&gt;
cp /etc/passwd $OC/etc/passwd&lt;br /&gt;
cp /etc/shadow $OC/etc/shadow&lt;br /&gt;
cp /etc/resolv.conf $OC/etc/resolv.conf&lt;br /&gt;
mount -o bind /dev $OC/dev&lt;br /&gt;
mount -o bind /dev/pts $OC/dev/pts&lt;br /&gt;
mount -o bind /proc $OC/proc&lt;br /&gt;
mount -o bind /sys $OC/sys&lt;br /&gt;
mount -o bind /tmp $OC/tmp&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Don't copy your current kernel stuff over to the chroot except for your .config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -rva /usr/src/linux/.config $OC/usr/src/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
&lt;br /&gt;
To enter this chrooted environment, simply type in linux32 chroot $OC&lt;br /&gt;
&lt;br /&gt;
===Test #1===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: i686-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=i686-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: x86_64-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=x86_64-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared –disable-multilib&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test #2===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
i686&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
x86_64&amp;lt;/pre&amp;gt;&lt;br /&gt;
as you can see - the chroot picks a not-64bit-gcc and uname -m returns not 64bit within the chroot - It's working ;-)&lt;br /&gt;
&lt;br /&gt;
===Setting up the shell prompt===&lt;br /&gt;
You might want to ensure you don't accidently mistake the chroot environment for your host or vice-versa. Even if you don't think this could ever happen to you, it almost inevitably will if you keep a lot of terminals open at the same time like me (keios). &lt;br /&gt;
&lt;br /&gt;
So to change your default prompt automatically on entering the chroot, add something like this to your .bashrc:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ $(uname -m) = &amp;quot;i686&amp;quot; ]; then&lt;br /&gt;
   # insert whatever works for you between @ and :&lt;br /&gt;
   export PS1=&amp;quot;\u@lunar32:\W&amp;gt; &amp;quot; &lt;br /&gt;
else&lt;br /&gt;
    export PS1=&amp;quot;\u@\h:\W&amp;gt; &amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your default prompt might look different, in that case customize the snippet as you see fit. If you use a colored prompt, changing the color usually should be enough to remind you.&lt;br /&gt;
&lt;br /&gt;
===Updating the Chroot-System===&lt;br /&gt;
My Image might be quite old and it's usually good to have the chroot environment as up to date as the host is. Run the following commands to get new packages/modules:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lin moonbase; lin theedge&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now you can run &amp;quot;lunar&amp;quot; and set some settings. The most important Settings might be the Optimizations. You can either go through: Option -&amp;amp;gt; Optimize Architecture or you run &amp;quot;lunar optimize&amp;quot; at the console.&lt;br /&gt;
&lt;br /&gt;
Modules might need working 32bit kernel headers, so make sure your gcc versions in- and outside the chroot are the same (see Test 1 above). If you need a specific gcc version that's not in the moonbase, use the --want $VERSION option of lin. Then build the kernel - you need the exact same version as you have on your host so you won't run into any trouble when e.g. installing video drivers for 3d acceleration later on:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@mari-chan:/$ lin -cr linux-stable&amp;lt;/pre&amp;gt;&lt;br /&gt;
When it asks you if you want to configure the kernel, say yes. In the menuconfig, use the &amp;quot;Load alternative config&amp;quot; option to load the kernel .config file you've copied to /usr/src earlier. Just enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;../.config&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you've done configuring your lunar installation run:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lunar renew&amp;lt;/pre&amp;gt;&lt;br /&gt;
to update your whole installation. Get a cup of tea or coffee, this might take a while depending on your box and resources. At this state you should have a running 32 Bit Chroot. However we will still need to enhance this a bit. You want for sure X11 within the Chroot.&lt;br /&gt;
&lt;br /&gt;
'''Important Note about lunar optimize''':&lt;br /&gt;
If you select optimizations for your chrooted environment, never ever use &amp;quot;native&amp;quot; as cpu optimization, this will break things. Always go with something safe, like i686 for example.&lt;br /&gt;
&lt;br /&gt;
==Enhancing your Chroot Installation==&lt;br /&gt;
===X11===&lt;br /&gt;
We mounted /tmp from the host to /tmp inside the chroot already. This way we can use the X11 Socket to connect applications within the chroot to our running x11-server within the host. You could also, if this isn’t possible, use TCP Connections. But they come usually with overhead and thus performance of x11 stuff will be bad. Anyway. You don’t need a whole X11-Server within the chroot, just a few x11 libs. Let’s go:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ lin -cr libX11 fixesproto libXxf86vm libXt libXmu libXi mesa-lib xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will install some X11 staff and libraries which are needed. You need now to allow X11-Unix-Socket Connections. Within the Chroot Environment edit your /etc/hostname and set &amp;quot;linux32&amp;quot; or something similar, remember this hostname. On the host type in: xhost +local:linux32 (Replace linux32 with the hostname you've set) or you could use &amp;quot;xhost +&amp;quot; which is insecure. Now you can test your X11 using xclock within your Chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ export DISPLAY=”:0.0″&lt;br /&gt;
wdp@linux32 ~ $ xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
You see the Clock? Fine it worked :)&lt;br /&gt;
&lt;br /&gt;
===3D Acceleration===&lt;br /&gt;
&lt;br /&gt;
If you want to run 32 Bit Games or Emulators like wine which don't work in native 64 Bit you might want to have 3D Acceleration.  The important thing about this is that you have to use exactly the same driver version within your chroot as the driver version in your host, otherwise it will simply not work. Thats why you should try to keep both installations as up to date as possible.&lt;br /&gt;
&lt;br /&gt;
==== nVidia ====&lt;br /&gt;
&lt;br /&gt;
It is really important that you got your kernel files and kernel header from the host, also within the chroot. you can do that by copy (cp) from the host to the chrooted environment or you simply copy over the current kernel configuration to the chroot and compile the kernel within the chroot again. (i will explain this step better when i got more time) - Keep also in mind, by default the kernel is on hold within the lunar installation. you might want to &amp;quot;unhold&amp;quot; it using lvu.&lt;br /&gt;
&lt;br /&gt;
On the Host check which NVIDIA drivers you got installed and what version it is:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lvu installed NVIDIA&lt;br /&gt;
NVIDIA is not installed&lt;br /&gt;
wdp@yulivee ~ $ lvu installed NVIDIA-beta&lt;br /&gt;
185.18.14&lt;br /&gt;
wdp@yulivee ~ $&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, i have NVIDIA-beta installed on the host. Within the Chroot i check now whats the current version of NVIDIA-beta within the moonbase using:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@yulivee /usr/src # lvu version NVIDIA-beta&lt;br /&gt;
185.18.14&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, it's the same version, so everything is fine, issue:&lt;br /&gt;
&amp;lt;pre&amp;gt;lget NVIDIA-beta&amp;lt;/pre&amp;gt;&lt;br /&gt;
and copy the .run from /var/spool/lunar to /usr/src. Make it executable using chmod a+x file.run and run it finally using ./file.run. Of course you have to replace &amp;quot;file&amp;quot; with the real filename.&lt;br /&gt;
&lt;br /&gt;
It will tell you that you run an X-Server and you have to stop this one first. Thats np, close X11, chroot into your chroot on the console and install NVIDIA. Exit the Chroot, start X11 again and everything is fine and should be done. You have to try around a bit with the NVIDIA Installer.&lt;br /&gt;
&lt;br /&gt;
==== ATI (r600/kms enabled) ====&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
===Home directory===&lt;br /&gt;
This is the easiest Task. We just need to mount the home directory with bind:&lt;br /&gt;
&amp;lt;pre&amp;gt;mount -o bind /home $OC/home&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the Chroot you can “su - username” and you’re in your home directory, without any problems or any flaws.&lt;br /&gt;
&lt;br /&gt;
===Init Script===&lt;br /&gt;
These are only examples.. you’ll probably find nicer variants. Anyway, for both scripts you will need a configfile containing at least the variable CHROOTDIR - which should point to your Chroot Directory. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Config&amp;lt;/strong&amp;gt;&lt;br /&gt;
This config will be used by the initscripts below and our “chroot-enter script”.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/lunar32chroot.conf&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
CHROOTDIR=&amp;quot;/usr/local/32bit&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;SysVinit:&amp;lt;/strong&amp;gt;&lt;br /&gt;
This Init Script will mount with --bind some needed directories for the chroot and copy some files which you will most likely want to keep up to date, to have permissions and networking working correctly.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/init.d/lunar32chroot&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# lunar32chroot Initializes the 32 Bit lunar chroot&lt;br /&gt;
#&lt;br /&gt;
# chkconfig: 2345 80 10&lt;br /&gt;
# description: Initializes 32 Bit chroot&lt;br /&gt;
&lt;br /&gt;
CONFIGFILE=&amp;quot;/etc/lunar32chroot.conf&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Starting 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	if [ -e &amp;quot;$CONFIGFILE&amp;quot; ]; then&lt;br /&gt;
    		source /etc/lunar32chroot.conf&lt;br /&gt;
	else&lt;br /&gt;
	    # we need a config...&lt;br /&gt;
    	echo &amp;quot;No config file found!&amp;quot;&lt;br /&gt;
    	echo -e $RESULT_FAIL&lt;br /&gt;
    	exit 0&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Mounting chroot directories...&amp;quot;&lt;br /&gt;
        mount -o bind /dev $CHROOTDIR/dev &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /proc $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /sys $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /tmp $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /home $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
        # optional mounts //TODO: add check&lt;br /&gt;
        [ -d /dev/pts ] &amp;amp;&amp;amp; mount -o bind /dev/pts $CHROOTDIR/dev/pts &amp;gt;/dev/null&lt;br /&gt;
        [ -d /dev/shm ] &amp;amp;&amp;amp; mount -o bind /dev/shm $CHROOTDIR/dev/shm &amp;gt;/dev/null&lt;br /&gt;
        [ -d /proc/bus/usb ] &amp;amp;&amp;amp; mount -o bind /proc/bus/usb $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Copying essential files...&amp;quot;&lt;br /&gt;
        cp -afr /etc/resolv.conf $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/passwd $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/shadow $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/group $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/hosts $CHROOTDIR/etc &amp;gt; /dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/localtime $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/nsswitch.conf $CHROOTDIR/etc &amp;gt;/dev/null &lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stop() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Stopping 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	if [ -e &amp;quot;$CONFIGFILE&amp;quot; ]; then&lt;br /&gt;
    		source /etc/lunar32chroot.conf&lt;br /&gt;
	else&lt;br /&gt;
	    # we need a config...&lt;br /&gt;
    	echo &amp;quot;No config file found!&amp;quot;&lt;br /&gt;
    	echo -e $RESULT_FAIL&lt;br /&gt;
    	exit 0&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Unmounting 32bit chroot directories...&amp;quot;&lt;br /&gt;
        umount -fl $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -f $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/dev &amp;gt;/dev/null&lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
        # optional unmounts //TODO: add check&lt;br /&gt;
        [ -d $CHROOTDIR/proc/bus/usb ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null&lt;br /&gt;
        [ -d $CHROOTDIR/dev/shm ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/dev/shm &amp;gt;/dev/null&lt;br /&gt;
        [ -d $CHROOTDIR/dev/pts ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/dev/pts &amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
. /lib/lsb/init-functions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run “chkconfig --add lunar32chroot” to create the essential init scripts/symlinks for the different runlevels and you’re done.&lt;br /&gt;
&lt;br /&gt;
===Entering Chroot - Script===&lt;br /&gt;
With this Script you just need to type “lunar32″ to enter the chroot environment. Keep in mind the &amp;quot;linux32&amp;quot; command should be available on all boxes, you dont need to install additional software. However its part of &amp;quot;util-linux&amp;quot;.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /usr/bin/lunar32&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# little script to reduce some things to just one command&lt;br /&gt;
# especially for lazy people like me.&lt;br /&gt;
&lt;br /&gt;
source /etc/lunar32chroot.conf&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Entering chroot...&amp;quot;&lt;br /&gt;
linux32 chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Hint from Beko&amp;lt;/strong&amp;gt;&lt;br /&gt;
Beko has shown me a dirty way (as he said) of doing the same using sudo, thus you can enter the environment without beeing root:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
linux32 sudo chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash -c &amp;quot;su $WHOAMI&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Negative Sideeffects: you're landing in / at the start and sudo has to run with NOPASS. Thats why this solution is dirty and might be a security risk. However.. :-) &amp;lt;b&amp;gt;By the way&amp;lt;/b&amp;gt; Of course you want to replace $WHOAMI with your username - or a variable containing the current username.&lt;br /&gt;
&lt;br /&gt;
==Applications==&lt;br /&gt;
===Fonts===&lt;br /&gt;
For most applications you will need some X11 Fonts installed within the Chroot. Its enough if you install these:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr mkfontdir mkfontscale bdftopcf font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-75dpi font-adobe-utopia-100dpi font-adobe-utopia-type1 font-bitstream-100dpi font-bitstream-75dpi font-bh-lucidatypewriter-100dpi font-bh-lucidatypewriter-75dpi&amp;lt;/pre&amp;gt;&lt;br /&gt;
some of them might not be needed, but well doesnt hurt to install them.&lt;br /&gt;
&lt;br /&gt;
===Skype===&lt;br /&gt;
If you want to use Skype you will have to install some more libraries and tools:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd /var/lib/lunar/moonbase&lt;br /&gt;
cp -rva qt4-apps/qt4 zlocal/&lt;br /&gt;
cd zlocal/qt4&lt;br /&gt;
vim DEPENDS&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remove this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;depends  %X&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally install needed stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr dbus alsa-utils videoproto libXv scrnsaverproto libXScrnSaver qt4&amp;lt;/pre&amp;gt;&lt;br /&gt;
It might be needed to install dbus-qt3 (not sure) if so, you have to copy the module to zlocal and edit the DEPENDS file (of qt3 and of dbus-qt3) to remove the X Dependecy.&lt;br /&gt;
&lt;br /&gt;
Skype should now work. You might want to look at the &amp;quot;fonts&amp;quot; Section because skype will display broken fonts :)&lt;br /&gt;
&lt;br /&gt;
==Useful Documentation:==&lt;br /&gt;
* http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&amp;amp;amp;chap=2 [English]&lt;br /&gt;
* http://ubuntuforums.org/showthread.php?t=24575 [English]&lt;br /&gt;
* http://wiki.ubuntuusers.de/32-Bit_chroot [German]&lt;br /&gt;
* http://www.debian-administration.org/article/Installing_apps_in_a_32-bit_chroot_in_AMD64_Debian_system [English]&lt;/div&gt;</summary>
		<author><name>Keitekk</name></author>	</entry>

	<entry>
		<id>http://doc.lunar-linux.org/Miscellaneous:32BitChroot</id>
		<title>Miscellaneous:32BitChroot</title>
		<link rel="alternate" type="text/html" href="http://doc.lunar-linux.org/Miscellaneous:32BitChroot"/>
				<updated>2012-02-23T00:15:52Z</updated>
		
		<summary type="html">&lt;p&gt;Keitekk: /* Init Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an Article about running a 32bit Chroot of Lunar Linux within 64bit Lunar Linux. It's getting updated sometimes and should work on different Distributions, too.&lt;br /&gt;
&lt;br /&gt;
==Lunar Linux 32 Bit Chroot within native 64 Bit Environment==&lt;br /&gt;
&lt;br /&gt;
===Changelog:===&lt;br /&gt;
* (20.02.12) Added 32bit-kernel configuration and prompt customization tidbits (keios) &lt;br /&gt;
* (22.02.11) Paths of qt4 changed, changed howto accordingly (for skype), fonts needs mkfontscale and mkfontdir (added), added section about ATI graphiccards (3d acceleration), some smaller adjustments.&lt;br /&gt;
* (29.10.10) Added bdftopcf to list of fonts, without that, fonts won't compile (thx to cavalier for helping to find out)  &lt;br /&gt;
* (29.10.10) Added instructions regarding the kernel&lt;br /&gt;
* (29.10.10) Added new (with current applications installed) image (lunarlinuxchroot.tar.bz2)&lt;br /&gt;
* (29.10.10) Added some information at the Test-Stage&lt;br /&gt;
* (29.10.10) Added little side note about lunar optimize in chrooted-environments&lt;br /&gt;
* (29.10.10) Added little notice about the &amp;quot;unofficial image&amp;quot;&lt;br /&gt;
* (11.08.09) Added some Information (Thanks to beko)&lt;br /&gt;
* (10.07.09) 3D Acceleration howto was wrong, corrected thx to Raedwulf for pointing out :)&lt;br /&gt;
* (10.07.09) I rewrote some parts to a hopefully nicer english.&lt;br /&gt;
&lt;br /&gt;
===Todo:===&lt;br /&gt;
* Bash Script which performs the actions below automatically&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
===Why===&lt;br /&gt;
Because. As Lunar Linux is 32bit or 64bit and not multilib, you have to use a chroot for 32bit. I really dislike this but nobody wanted to put time into multilib yet just because of a few guys which would like that and as every day some more apps work using 64bit, multilib will probably not be that useful at all. Anyway, for those of you who want to use 32bit apps within the 64bit environment, this little howto should help a lot.&lt;br /&gt;
&lt;br /&gt;
===Requirements===&lt;br /&gt;
Having an image of a running system could help a lot and reduce the needed time amount. If you like you can use an Image i created originally for use as OpenSolaris Zone. You could also create your own 32bit image (just install 32bit linux using a vm or something and tar cjvf the whole system, without proc, sys, dev..). Anyway, i will explain here how to do it using my image.&lt;br /&gt;
&lt;br /&gt;
== Images ==&lt;br /&gt;
&lt;br /&gt;
These are '''unofficial''' images made by me (wdp).&lt;br /&gt;
&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2 [current]  483M (unpacked 1,8G) - 29.10.2010&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/osol_lunar_zone.tar.gz [outdated!] 570M&lt;br /&gt;
&lt;br /&gt;
These images are quite outdated, so you're far better off making your own 32bit image. If you don't, you could have difficulties during the lunar update process below.&lt;br /&gt;
&lt;br /&gt;
===Switch to root (For the Dummies)===&lt;br /&gt;
Of course you need to be root to run most of the following commands. If you don't know how to switch to the super user (root) in a Linux System you don't want to deal with this Howto. First learn some Basics. However. You can switch to the super user using the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ su -&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setup Environment===&lt;br /&gt;
'''Important: The Image listed below''': The image was created to be used as solaris zone, however its quite fine for chrooted environments, too. Please notice that this image is &amp;quot;unofficial&amp;quot; so you won't get official support for it.&lt;br /&gt;
&lt;br /&gt;
I installed my Chroot within /usr/local/32bit you might want to change that, just replace the &amp;quot;export&amp;quot; line to do so and don't forget to replace the path in the config files i'm later showing. The following lines will create the directory for your chroot, download my image and unpack it within that directory, copy over some files from the host to the chroot (like users, passwords, etc) and finally mount some directories from the host within the chroot (like dev, proc, sys, tmp).&lt;br /&gt;
&amp;lt;pre&amp;gt;export OC=&amp;quot;/usr/local/32bit&amp;quot;&lt;br /&gt;
mkdir -p $OC&lt;br /&gt;
cd $OC&lt;br /&gt;
wget http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2&lt;br /&gt;
tar -xjvf lunarlinuxchroot.tar.bz2&lt;br /&gt;
cp /etc/hosts $OC/etc/hosts&lt;br /&gt;
cp /etc/nsswitch.conf $OC/etc/nsswitch.conf&lt;br /&gt;
cp /etc/passwd $OC/etc/passwd&lt;br /&gt;
cp /etc/shadow $OC/etc/shadow&lt;br /&gt;
cp /etc/resolv.conf $OC/etc/resolv.conf&lt;br /&gt;
mount -o bind /dev $OC/dev&lt;br /&gt;
mount -o bind /dev/pts $OC/dev/pts&lt;br /&gt;
mount -o bind /proc $OC/proc&lt;br /&gt;
mount -o bind /sys $OC/sys&lt;br /&gt;
mount -o bind /tmp $OC/tmp&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Don't copy your current kernel stuff over to the chroot except for your .config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -rva /usr/src/linux/.config $OC/usr/src/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
&lt;br /&gt;
To enter this chrooted environment, simply type in linux32 chroot $OC&lt;br /&gt;
&lt;br /&gt;
===Test #1===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: i686-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=i686-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: x86_64-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=x86_64-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared –disable-multilib&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test #2===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
i686&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
x86_64&amp;lt;/pre&amp;gt;&lt;br /&gt;
as you can see - the chroot picks a not-64bit-gcc and uname -m returns not 64bit within the chroot - It's working ;-)&lt;br /&gt;
&lt;br /&gt;
===Setting up the shell prompt===&lt;br /&gt;
You might want to ensure you don't accidently mistake the chroot environment for your host or vice-versa. Even if you don't think this could ever happen to you, it almost inevitably will if you keep a lot of terminals open at the same time like me (keios). &lt;br /&gt;
&lt;br /&gt;
So to change your default prompt automatically on entering the chroot, add something like this to your .bashrc:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ $(uname -m) = &amp;quot;i686&amp;quot; ]; then&lt;br /&gt;
   # insert whatever works for you between @ and :&lt;br /&gt;
   export PS1=&amp;quot;\u@lunar32:\W&amp;gt; &amp;quot; &lt;br /&gt;
else&lt;br /&gt;
    export PS1=&amp;quot;\u@\h:\W&amp;gt; &amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your default prompt might look different, in that case customize the snippet as you see fit. If you use a colored prompt, changing the color usually should be enough to remind you.&lt;br /&gt;
&lt;br /&gt;
===Updating the Chroot-System===&lt;br /&gt;
My Image might be quite old and it's usually good to have the chroot environment as up to date as the host is. Run the following commands to get new packages/modules:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lin moonbase; lin theedge&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now you can run &amp;quot;lunar&amp;quot; and set some settings. The most important Settings might be the Optimizations. You can either go through: Option -&amp;amp;gt; Optimize Architecture or you run &amp;quot;lunar optimize&amp;quot; at the console.&lt;br /&gt;
&lt;br /&gt;
Modules might need working 32bit kernel headers, so make sure your gcc versions in- and outside the chroot are the same (see Test 1 above). If you need a specific gcc version that's not in the moonbase, use the --want $VERSION option of lin. Then build the kernel - you need the exact same version as you have on your host so you won't run into any trouble when e.g. installing video drivers for 3d acceleration later on:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@mari-chan:/$ lin -cr linux-stable&amp;lt;/pre&amp;gt;&lt;br /&gt;
When it asks you if you want to configure the kernel, say yes. In the menuconfig, use the &amp;quot;Load alternative config&amp;quot; option to load the kernel .config file you've copied to /usr/src earlier. Just enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;../.config&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you've done configuring your lunar installation run:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lunar renew&amp;lt;/pre&amp;gt;&lt;br /&gt;
to update your whole installation. Get a cup of tea or coffee, this might take a while depending on your box and resources. At this state you should have a running 32 Bit Chroot. However we will still need to enhance this a bit. You want for sure X11 within the Chroot.&lt;br /&gt;
&lt;br /&gt;
'''Important Note about lunar optimize''':&lt;br /&gt;
If you select optimizations for your chrooted environment, never ever use &amp;quot;native&amp;quot; as cpu optimization, this will break things. Always go with something safe, like i686 for example.&lt;br /&gt;
&lt;br /&gt;
==Enhancing your Chroot Installation==&lt;br /&gt;
===X11===&lt;br /&gt;
We mounted /tmp from the host to /tmp inside the chroot already. This way we can use the X11 Socket to connect applications within the chroot to our running x11-server within the host. You could also, if this isn’t possible, use TCP Connections. But they come usually with overhead and thus performance of x11 stuff will be bad. Anyway. You don’t need a whole X11-Server within the chroot, just a few x11 libs. Let’s go:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ lin -cr libX11 fixesproto libXxf86vm libXt libXmu libXi mesa-lib xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will install some X11 staff and libraries which are needed. You need now to allow X11-Unix-Socket Connections. Within the Chroot Environment edit your /etc/hostname and set &amp;quot;linux32&amp;quot; or something similar, remember this hostname. On the host type in: xhost +local:linux32 (Replace linux32 with the hostname you've set) or you could use &amp;quot;xhost +&amp;quot; which is insecure. Now you can test your X11 using xclock within your Chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ export DISPLAY=”:0.0″&lt;br /&gt;
wdp@linux32 ~ $ xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
You see the Clock? Fine it worked :)&lt;br /&gt;
&lt;br /&gt;
===3D Acceleration===&lt;br /&gt;
&lt;br /&gt;
If you want to run 32 Bit Games or Emulators like wine which don't work in native 64 Bit you might want to have 3D Acceleration.  The important thing about this is that you have to use exactly the same driver version within your chroot as the driver version in your host, otherwise it will simply not work. Thats why you should try to keep both installations as up to date as possible.&lt;br /&gt;
&lt;br /&gt;
==== nVidia ====&lt;br /&gt;
&lt;br /&gt;
It is really important that you got your kernel files and kernel header from the host, also within the chroot. you can do that by copy (cp) from the host to the chrooted environment or you simply copy over the current kernel configuration to the chroot and compile the kernel within the chroot again. (i will explain this step better when i got more time) - Keep also in mind, by default the kernel is on hold within the lunar installation. you might want to &amp;quot;unhold&amp;quot; it using lvu.&lt;br /&gt;
&lt;br /&gt;
On the Host check which NVIDIA drivers you got installed and what version it is:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lvu installed NVIDIA&lt;br /&gt;
NVIDIA is not installed&lt;br /&gt;
wdp@yulivee ~ $ lvu installed NVIDIA-beta&lt;br /&gt;
185.18.14&lt;br /&gt;
wdp@yulivee ~ $&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, i have NVIDIA-beta installed on the host. Within the Chroot i check now whats the current version of NVIDIA-beta within the moonbase using:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@yulivee /usr/src # lvu version NVIDIA-beta&lt;br /&gt;
185.18.14&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, it's the same version, so everything is fine, issue:&lt;br /&gt;
&amp;lt;pre&amp;gt;lget NVIDIA-beta&amp;lt;/pre&amp;gt;&lt;br /&gt;
and copy the .run from /var/spool/lunar to /usr/src. Make it executable using chmod a+x file.run and run it finally using ./file.run. Of course you have to replace &amp;quot;file&amp;quot; with the real filename.&lt;br /&gt;
&lt;br /&gt;
It will tell you that you run an X-Server and you have to stop this one first. Thats np, close X11, chroot into your chroot on the console and install NVIDIA. Exit the Chroot, start X11 again and everything is fine and should be done. You have to try around a bit with the NVIDIA Installer.&lt;br /&gt;
&lt;br /&gt;
==== ATI (r600/kms enabled) ====&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
===Home directory===&lt;br /&gt;
This is the easiest Task. We just need to mount the home directory with bind:&lt;br /&gt;
&amp;lt;pre&amp;gt;mount -o bind /home $OC/home&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the Chroot you can “su - username” and you’re in your home directory, without any problems or any flaws.&lt;br /&gt;
&lt;br /&gt;
===Init Script===&lt;br /&gt;
These are only examples.. you’ll probably find nicer variants. Anyway, for both scripts you will need a configfile containing at least the variable CHROOTDIR - which should point to your Chroot Directory. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Config&amp;lt;/strong&amp;gt;&lt;br /&gt;
This config will be used by the initscripts below and our “chroot-enter script”.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/lunar32chroot.conf&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
CHROOTDIR=&amp;quot;/usr/local/32bit&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;SysVinit:&amp;lt;/strong&amp;gt;&lt;br /&gt;
This Init Script will mount with --bind some needed directories for the chroot and copy some files which you will most likely want to keep up to date, to have permissions and networking working correctly.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/init.d/lunar32chroot&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# lunar32chroot Initializes the 32 Bit lunar chroot&lt;br /&gt;
#&lt;br /&gt;
# chkconfig: 2345 80 10&lt;br /&gt;
# description: Initializes 32 Bit chroot&lt;br /&gt;
&lt;br /&gt;
CONFIGFILE=&amp;quot;/etc/lunar32chroot.conf&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Starting 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	if [ -e &amp;quot;$CONFIGFILE&amp;quot; ]; then&lt;br /&gt;
    		source /etc/lunar32chroot.conf&lt;br /&gt;
	else&lt;br /&gt;
	    # we need a config...&lt;br /&gt;
    	echo &amp;quot;No config file found!&amp;quot;&lt;br /&gt;
    	echo -e $RESULT_FAIL&lt;br /&gt;
    	exit 0&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Mounting chroot directories...&amp;quot;&lt;br /&gt;
        mount -o bind /dev $CHROOTDIR/dev &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /proc $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /sys $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /tmp $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /home $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
        # optional mounts //TODO: add check&lt;br /&gt;
        [ -d /dev/pts ] &amp;amp;&amp;amp; mount -o bind /dev/pts $CHROOTDIR/dev/pts &amp;gt;/dev/null&lt;br /&gt;
        [ -d /dev/shm ] &amp;amp;&amp;amp; mount -o bind /dev/shm $CHROOTDIR/dev/shm &amp;gt;/dev/null&lt;br /&gt;
        [ -d /proc/bus/usb ] &amp;amp;&amp;amp; mount -o bind /proc/bus/usb $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Copying essential files...&amp;quot;&lt;br /&gt;
        cp -afr /etc/resolv.conf $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/passwd $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/shadow $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/group $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/hosts $CHROOTDIR/etc &amp;gt; /dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/localtime $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/nsswitch.conf $CHROOTDIR/etc &amp;gt;/dev/null &lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stop() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Stopping 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	if [ -e &amp;quot;$CONFIGFILE&amp;quot; ]; then&lt;br /&gt;
    		source /etc/lunar32chroot.conf&lt;br /&gt;
	else&lt;br /&gt;
	    # we need a config...&lt;br /&gt;
    	echo &amp;quot;No config file found!&amp;quot;&lt;br /&gt;
    	echo -e $RESULT_FAIL&lt;br /&gt;
    	exit 0&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Unmounting 32bit chroot directories...&amp;quot;&lt;br /&gt;
        umount -fl $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -f $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/dev &amp;gt;/dev/null&lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
        # optional unmounts //TODO: add check&lt;br /&gt;
        [ -d $CHROOTDIR/proc/bus/usb ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null&lt;br /&gt;
        [ -d $CHROOTDIR/dev/shm ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/dev/shm &amp;gt;/dev/null&lt;br /&gt;
        [ -d $CHROOTDIR/dev/pts ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/dev/pts &amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
. /lib/lsb/init-functions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run “chkconfig –add lunar32chroot” to create the essential init scripts/symlinks for the different runlevels and you’re done.&lt;br /&gt;
&lt;br /&gt;
===Entering Chroot - Script===&lt;br /&gt;
With this Script you just need to type “lunar32″ to enter the chroot environment. Keep in mind the &amp;quot;linux32&amp;quot; command should be available on all boxes, you dont need to install additional software. However its part of &amp;quot;util-linux&amp;quot;.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /usr/bin/lunar32&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# little script to reduce some things to just one command&lt;br /&gt;
# especially for lazy people like me.&lt;br /&gt;
&lt;br /&gt;
source /etc/lunar32chroot.conf&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Entering chroot...&amp;quot;&lt;br /&gt;
linux32 chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Hint from Beko&amp;lt;/strong&amp;gt;&lt;br /&gt;
Beko has shown me a dirty way (as he said) of doing the same using sudo, thus you can enter the environment without beeing root:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
linux32 sudo chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash -c &amp;quot;su $WHOAMI&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Negative Sideeffects: you're landing in / at the start and sudo has to run with NOPASS. Thats why this solution is dirty and might be a security risk. However.. :-) &amp;lt;b&amp;gt;By the way&amp;lt;/b&amp;gt; Of course you want to replace $WHOAMI with your username - or a variable containing the current username.&lt;br /&gt;
&lt;br /&gt;
==Applications==&lt;br /&gt;
===Fonts===&lt;br /&gt;
For most applications you will need some X11 Fonts installed within the Chroot. Its enough if you install these:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr mkfontdir mkfontscale bdftopcf font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-75dpi font-adobe-utopia-100dpi font-adobe-utopia-type1 font-bitstream-100dpi font-bitstream-75dpi font-bh-lucidatypewriter-100dpi font-bh-lucidatypewriter-75dpi&amp;lt;/pre&amp;gt;&lt;br /&gt;
some of them might not be needed, but well doesnt hurt to install them.&lt;br /&gt;
&lt;br /&gt;
===Skype===&lt;br /&gt;
If you want to use Skype you will have to install some more libraries and tools:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd /var/lib/lunar/moonbase&lt;br /&gt;
cp -rva qt4-apps/qt4 zlocal/&lt;br /&gt;
cd zlocal/qt4&lt;br /&gt;
vim DEPENDS&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remove this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;depends  %X&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally install needed stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr dbus alsa-utils videoproto libXv scrnsaverproto libXScrnSaver qt4&amp;lt;/pre&amp;gt;&lt;br /&gt;
It might be needed to install dbus-qt3 (not sure) if so, you have to copy the module to zlocal and edit the DEPENDS file (of qt3 and of dbus-qt3) to remove the X Dependecy.&lt;br /&gt;
&lt;br /&gt;
Skype should now work. You might want to look at the &amp;quot;fonts&amp;quot; Section because skype will display broken fonts :)&lt;br /&gt;
&lt;br /&gt;
==Useful Documentation:==&lt;br /&gt;
* http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&amp;amp;amp;chap=2 [English]&lt;br /&gt;
* http://ubuntuforums.org/showthread.php?t=24575 [English]&lt;br /&gt;
* http://wiki.ubuntuusers.de/32-Bit_chroot [German]&lt;br /&gt;
* http://www.debian-administration.org/article/Installing_apps_in_a_32-bit_chroot_in_AMD64_Debian_system [English]&lt;/div&gt;</summary>
		<author><name>Keitekk</name></author>	</entry>

	<entry>
		<id>http://doc.lunar-linux.org/Miscellaneous:32BitChroot</id>
		<title>Miscellaneous:32BitChroot</title>
		<link rel="alternate" type="text/html" href="http://doc.lunar-linux.org/Miscellaneous:32BitChroot"/>
				<updated>2012-02-23T00:14:23Z</updated>
		
		<summary type="html">&lt;p&gt;Keitekk: /* Init Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an Article about running a 32bit Chroot of Lunar Linux within 64bit Lunar Linux. It's getting updated sometimes and should work on different Distributions, too.&lt;br /&gt;
&lt;br /&gt;
==Lunar Linux 32 Bit Chroot within native 64 Bit Environment==&lt;br /&gt;
&lt;br /&gt;
===Changelog:===&lt;br /&gt;
* (20.02.12) Added 32bit-kernel configuration and prompt customization tidbits (keios) &lt;br /&gt;
* (22.02.11) Paths of qt4 changed, changed howto accordingly (for skype), fonts needs mkfontscale and mkfontdir (added), added section about ATI graphiccards (3d acceleration), some smaller adjustments.&lt;br /&gt;
* (29.10.10) Added bdftopcf to list of fonts, without that, fonts won't compile (thx to cavalier for helping to find out)  &lt;br /&gt;
* (29.10.10) Added instructions regarding the kernel&lt;br /&gt;
* (29.10.10) Added new (with current applications installed) image (lunarlinuxchroot.tar.bz2)&lt;br /&gt;
* (29.10.10) Added some information at the Test-Stage&lt;br /&gt;
* (29.10.10) Added little side note about lunar optimize in chrooted-environments&lt;br /&gt;
* (29.10.10) Added little notice about the &amp;quot;unofficial image&amp;quot;&lt;br /&gt;
* (11.08.09) Added some Information (Thanks to beko)&lt;br /&gt;
* (10.07.09) 3D Acceleration howto was wrong, corrected thx to Raedwulf for pointing out :)&lt;br /&gt;
* (10.07.09) I rewrote some parts to a hopefully nicer english.&lt;br /&gt;
&lt;br /&gt;
===Todo:===&lt;br /&gt;
* Bash Script which performs the actions below automatically&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
===Why===&lt;br /&gt;
Because. As Lunar Linux is 32bit or 64bit and not multilib, you have to use a chroot for 32bit. I really dislike this but nobody wanted to put time into multilib yet just because of a few guys which would like that and as every day some more apps work using 64bit, multilib will probably not be that useful at all. Anyway, for those of you who want to use 32bit apps within the 64bit environment, this little howto should help a lot.&lt;br /&gt;
&lt;br /&gt;
===Requirements===&lt;br /&gt;
Having an image of a running system could help a lot and reduce the needed time amount. If you like you can use an Image i created originally for use as OpenSolaris Zone. You could also create your own 32bit image (just install 32bit linux using a vm or something and tar cjvf the whole system, without proc, sys, dev..). Anyway, i will explain here how to do it using my image.&lt;br /&gt;
&lt;br /&gt;
== Images ==&lt;br /&gt;
&lt;br /&gt;
These are '''unofficial''' images made by me (wdp).&lt;br /&gt;
&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2 [current]  483M (unpacked 1,8G) - 29.10.2010&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/osol_lunar_zone.tar.gz [outdated!] 570M&lt;br /&gt;
&lt;br /&gt;
These images are quite outdated, so you're far better off making your own 32bit image. If you don't, you could have difficulties during the lunar update process below.&lt;br /&gt;
&lt;br /&gt;
===Switch to root (For the Dummies)===&lt;br /&gt;
Of course you need to be root to run most of the following commands. If you don't know how to switch to the super user (root) in a Linux System you don't want to deal with this Howto. First learn some Basics. However. You can switch to the super user using the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ su -&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setup Environment===&lt;br /&gt;
'''Important: The Image listed below''': The image was created to be used as solaris zone, however its quite fine for chrooted environments, too. Please notice that this image is &amp;quot;unofficial&amp;quot; so you won't get official support for it.&lt;br /&gt;
&lt;br /&gt;
I installed my Chroot within /usr/local/32bit you might want to change that, just replace the &amp;quot;export&amp;quot; line to do so and don't forget to replace the path in the config files i'm later showing. The following lines will create the directory for your chroot, download my image and unpack it within that directory, copy over some files from the host to the chroot (like users, passwords, etc) and finally mount some directories from the host within the chroot (like dev, proc, sys, tmp).&lt;br /&gt;
&amp;lt;pre&amp;gt;export OC=&amp;quot;/usr/local/32bit&amp;quot;&lt;br /&gt;
mkdir -p $OC&lt;br /&gt;
cd $OC&lt;br /&gt;
wget http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2&lt;br /&gt;
tar -xjvf lunarlinuxchroot.tar.bz2&lt;br /&gt;
cp /etc/hosts $OC/etc/hosts&lt;br /&gt;
cp /etc/nsswitch.conf $OC/etc/nsswitch.conf&lt;br /&gt;
cp /etc/passwd $OC/etc/passwd&lt;br /&gt;
cp /etc/shadow $OC/etc/shadow&lt;br /&gt;
cp /etc/resolv.conf $OC/etc/resolv.conf&lt;br /&gt;
mount -o bind /dev $OC/dev&lt;br /&gt;
mount -o bind /dev/pts $OC/dev/pts&lt;br /&gt;
mount -o bind /proc $OC/proc&lt;br /&gt;
mount -o bind /sys $OC/sys&lt;br /&gt;
mount -o bind /tmp $OC/tmp&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Don't copy your current kernel stuff over to the chroot except for your .config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -rva /usr/src/linux/.config $OC/usr/src/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
&lt;br /&gt;
To enter this chrooted environment, simply type in linux32 chroot $OC&lt;br /&gt;
&lt;br /&gt;
===Test #1===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: i686-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=i686-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: x86_64-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=x86_64-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared –disable-multilib&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test #2===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
i686&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
x86_64&amp;lt;/pre&amp;gt;&lt;br /&gt;
as you can see - the chroot picks a not-64bit-gcc and uname -m returns not 64bit within the chroot - It's working ;-)&lt;br /&gt;
&lt;br /&gt;
===Setting up the shell prompt===&lt;br /&gt;
You might want to ensure you don't accidently mistake the chroot environment for your host or vice-versa. Even if you don't think this could ever happen to you, it almost inevitably will if you keep a lot of terminals open at the same time like me (keios). &lt;br /&gt;
&lt;br /&gt;
So to change your default prompt automatically on entering the chroot, add something like this to your .bashrc:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ $(uname -m) = &amp;quot;i686&amp;quot; ]; then&lt;br /&gt;
   # insert whatever works for you between @ and :&lt;br /&gt;
   export PS1=&amp;quot;\u@lunar32:\W&amp;gt; &amp;quot; &lt;br /&gt;
else&lt;br /&gt;
    export PS1=&amp;quot;\u@\h:\W&amp;gt; &amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your default prompt might look different, in that case customize the snippet as you see fit. If you use a colored prompt, changing the color usually should be enough to remind you.&lt;br /&gt;
&lt;br /&gt;
===Updating the Chroot-System===&lt;br /&gt;
My Image might be quite old and it's usually good to have the chroot environment as up to date as the host is. Run the following commands to get new packages/modules:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lin moonbase; lin theedge&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now you can run &amp;quot;lunar&amp;quot; and set some settings. The most important Settings might be the Optimizations. You can either go through: Option -&amp;amp;gt; Optimize Architecture or you run &amp;quot;lunar optimize&amp;quot; at the console.&lt;br /&gt;
&lt;br /&gt;
Modules might need working 32bit kernel headers, so make sure your gcc versions in- and outside the chroot are the same (see Test 1 above). If you need a specific gcc version that's not in the moonbase, use the --want $VERSION option of lin. Then build the kernel - you need the exact same version as you have on your host so you won't run into any trouble when e.g. installing video drivers for 3d acceleration later on:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@mari-chan:/$ lin -cr linux-stable&amp;lt;/pre&amp;gt;&lt;br /&gt;
When it asks you if you want to configure the kernel, say yes. In the menuconfig, use the &amp;quot;Load alternative config&amp;quot; option to load the kernel .config file you've copied to /usr/src earlier. Just enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;../.config&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you've done configuring your lunar installation run:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lunar renew&amp;lt;/pre&amp;gt;&lt;br /&gt;
to update your whole installation. Get a cup of tea or coffee, this might take a while depending on your box and resources. At this state you should have a running 32 Bit Chroot. However we will still need to enhance this a bit. You want for sure X11 within the Chroot.&lt;br /&gt;
&lt;br /&gt;
'''Important Note about lunar optimize''':&lt;br /&gt;
If you select optimizations for your chrooted environment, never ever use &amp;quot;native&amp;quot; as cpu optimization, this will break things. Always go with something safe, like i686 for example.&lt;br /&gt;
&lt;br /&gt;
==Enhancing your Chroot Installation==&lt;br /&gt;
===X11===&lt;br /&gt;
We mounted /tmp from the host to /tmp inside the chroot already. This way we can use the X11 Socket to connect applications within the chroot to our running x11-server within the host. You could also, if this isn’t possible, use TCP Connections. But they come usually with overhead and thus performance of x11 stuff will be bad. Anyway. You don’t need a whole X11-Server within the chroot, just a few x11 libs. Let’s go:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ lin -cr libX11 fixesproto libXxf86vm libXt libXmu libXi mesa-lib xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will install some X11 staff and libraries which are needed. You need now to allow X11-Unix-Socket Connections. Within the Chroot Environment edit your /etc/hostname and set &amp;quot;linux32&amp;quot; or something similar, remember this hostname. On the host type in: xhost +local:linux32 (Replace linux32 with the hostname you've set) or you could use &amp;quot;xhost +&amp;quot; which is insecure. Now you can test your X11 using xclock within your Chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ export DISPLAY=”:0.0″&lt;br /&gt;
wdp@linux32 ~ $ xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
You see the Clock? Fine it worked :)&lt;br /&gt;
&lt;br /&gt;
===3D Acceleration===&lt;br /&gt;
&lt;br /&gt;
If you want to run 32 Bit Games or Emulators like wine which don't work in native 64 Bit you might want to have 3D Acceleration.  The important thing about this is that you have to use exactly the same driver version within your chroot as the driver version in your host, otherwise it will simply not work. Thats why you should try to keep both installations as up to date as possible.&lt;br /&gt;
&lt;br /&gt;
==== nVidia ====&lt;br /&gt;
&lt;br /&gt;
It is really important that you got your kernel files and kernel header from the host, also within the chroot. you can do that by copy (cp) from the host to the chrooted environment or you simply copy over the current kernel configuration to the chroot and compile the kernel within the chroot again. (i will explain this step better when i got more time) - Keep also in mind, by default the kernel is on hold within the lunar installation. you might want to &amp;quot;unhold&amp;quot; it using lvu.&lt;br /&gt;
&lt;br /&gt;
On the Host check which NVIDIA drivers you got installed and what version it is:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lvu installed NVIDIA&lt;br /&gt;
NVIDIA is not installed&lt;br /&gt;
wdp@yulivee ~ $ lvu installed NVIDIA-beta&lt;br /&gt;
185.18.14&lt;br /&gt;
wdp@yulivee ~ $&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, i have NVIDIA-beta installed on the host. Within the Chroot i check now whats the current version of NVIDIA-beta within the moonbase using:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@yulivee /usr/src # lvu version NVIDIA-beta&lt;br /&gt;
185.18.14&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, it's the same version, so everything is fine, issue:&lt;br /&gt;
&amp;lt;pre&amp;gt;lget NVIDIA-beta&amp;lt;/pre&amp;gt;&lt;br /&gt;
and copy the .run from /var/spool/lunar to /usr/src. Make it executable using chmod a+x file.run and run it finally using ./file.run. Of course you have to replace &amp;quot;file&amp;quot; with the real filename.&lt;br /&gt;
&lt;br /&gt;
It will tell you that you run an X-Server and you have to stop this one first. Thats np, close X11, chroot into your chroot on the console and install NVIDIA. Exit the Chroot, start X11 again and everything is fine and should be done. You have to try around a bit with the NVIDIA Installer.&lt;br /&gt;
&lt;br /&gt;
==== ATI (r600/kms enabled) ====&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
===Home directory===&lt;br /&gt;
This is the easiest Task. We just need to mount the home directory with bind:&lt;br /&gt;
&amp;lt;pre&amp;gt;mount -o bind /home $OC/home&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the Chroot you can “su - username” and you’re in your home directory, without any problems or any flaws.&lt;br /&gt;
&lt;br /&gt;
===Init Script===&lt;br /&gt;
These are only examples.. you’ll probably find nicer variants. Anyway, for both scripts you will need a configfile containing at least the variable CHROOTDIR - which should point to your Chroot Directory. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Config&amp;lt;/strong&amp;gt;&lt;br /&gt;
This config will be used by the initscripts below and our “chroot-enter script”.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/lunar32chroot.conf&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
CHROOTDIR=&amp;quot;/usr/local/32bit&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;SysVinit:&amp;lt;/strong&amp;gt;&lt;br /&gt;
This Init Script will mount with --bind some needed directories for the chroot and copy some files which you will most likely want to keep up to date, to have permissions and networking working correctly.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/init.d/lunar32chroot&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# lunar32chroot Initializes the 32 Bit lunar chroot&lt;br /&gt;
#&lt;br /&gt;
# chkconfig: 2345 80 10&lt;br /&gt;
# description: Initializes 32 Bit chroot&lt;br /&gt;
&lt;br /&gt;
CONFIGFILE=&amp;quot;/etc/lunar32chroot.conf&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Starting 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	if [ -e &amp;quot;$CONFIGFILE&amp;quot; ]; then&lt;br /&gt;
    		source /etc/lunar32chroot.conf&lt;br /&gt;
	else&lt;br /&gt;
	    # we need a config...&lt;br /&gt;
    	echo &amp;quot;No config file found!&amp;quot;&lt;br /&gt;
    	echo -e $RESULT_FAIL&lt;br /&gt;
    	exit 0&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Mounting chroot directories...&amp;quot;&lt;br /&gt;
        mount -o bind /dev $CHROOTDIR/dev &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /proc $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /sys $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /tmp $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /home $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
        # optional mounts //TODO: add check&lt;br /&gt;
        [ -d /dev/pts ] &amp;amp;&amp;amp; mount -o bind /dev/pts $CHROOTDIR/dev/pts &amp;gt;/dev/null&lt;br /&gt;
        [ -d /dev/shm ] &amp;amp;&amp;amp; mount -o bind /dev/shm $CHROOTDIR/dev/shm &amp;gt;/dev/null&lt;br /&gt;
        [ -d /proc/bus/usb ] &amp;amp;&amp;amp; mount -o bind /proc/bus/usb $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Copying essential files...&amp;quot;&lt;br /&gt;
        cp -afr /etc/resolv.conf $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/passwd $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/shadow $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/group $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/hosts $CHROOTDIR/etc &amp;gt; /dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/localtime $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/nsswitch.conf $CHROOTDIR/etc &amp;gt;/dev/null &lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stop() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Stopping 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Unmounting 32bit chroot directories...&amp;quot;&lt;br /&gt;
        umount -fl $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -f $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/dev &amp;gt;/dev/null&lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
        # optional unmounts //TODO: add check&lt;br /&gt;
        [ -d $CHROOTDIR/proc/bus/usb ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null&lt;br /&gt;
        [ -d $CHROOTDIR/dev/shm ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/dev/shm &amp;gt;/dev/null&lt;br /&gt;
        [ -d $CHROOTDIR/dev/pts ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/dev/pts &amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
. /lib/lsb/init-functions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run “chkconfig –add lunar32chroot” to create the essential init scripts/symlinks for the different runlevels and you’re done.&lt;br /&gt;
&lt;br /&gt;
===Entering Chroot - Script===&lt;br /&gt;
With this Script you just need to type “lunar32″ to enter the chroot environment. Keep in mind the &amp;quot;linux32&amp;quot; command should be available on all boxes, you dont need to install additional software. However its part of &amp;quot;util-linux&amp;quot;.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /usr/bin/lunar32&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# little script to reduce some things to just one command&lt;br /&gt;
# especially for lazy people like me.&lt;br /&gt;
&lt;br /&gt;
source /etc/lunar32chroot.conf&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Entering chroot...&amp;quot;&lt;br /&gt;
linux32 chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Hint from Beko&amp;lt;/strong&amp;gt;&lt;br /&gt;
Beko has shown me a dirty way (as he said) of doing the same using sudo, thus you can enter the environment without beeing root:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
linux32 sudo chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash -c &amp;quot;su $WHOAMI&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Negative Sideeffects: you're landing in / at the start and sudo has to run with NOPASS. Thats why this solution is dirty and might be a security risk. However.. :-) &amp;lt;b&amp;gt;By the way&amp;lt;/b&amp;gt; Of course you want to replace $WHOAMI with your username - or a variable containing the current username.&lt;br /&gt;
&lt;br /&gt;
==Applications==&lt;br /&gt;
===Fonts===&lt;br /&gt;
For most applications you will need some X11 Fonts installed within the Chroot. Its enough if you install these:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr mkfontdir mkfontscale bdftopcf font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-75dpi font-adobe-utopia-100dpi font-adobe-utopia-type1 font-bitstream-100dpi font-bitstream-75dpi font-bh-lucidatypewriter-100dpi font-bh-lucidatypewriter-75dpi&amp;lt;/pre&amp;gt;&lt;br /&gt;
some of them might not be needed, but well doesnt hurt to install them.&lt;br /&gt;
&lt;br /&gt;
===Skype===&lt;br /&gt;
If you want to use Skype you will have to install some more libraries and tools:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd /var/lib/lunar/moonbase&lt;br /&gt;
cp -rva qt4-apps/qt4 zlocal/&lt;br /&gt;
cd zlocal/qt4&lt;br /&gt;
vim DEPENDS&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remove this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;depends  %X&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally install needed stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr dbus alsa-utils videoproto libXv scrnsaverproto libXScrnSaver qt4&amp;lt;/pre&amp;gt;&lt;br /&gt;
It might be needed to install dbus-qt3 (not sure) if so, you have to copy the module to zlocal and edit the DEPENDS file (of qt3 and of dbus-qt3) to remove the X Dependecy.&lt;br /&gt;
&lt;br /&gt;
Skype should now work. You might want to look at the &amp;quot;fonts&amp;quot; Section because skype will display broken fonts :)&lt;br /&gt;
&lt;br /&gt;
==Useful Documentation:==&lt;br /&gt;
* http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&amp;amp;amp;chap=2 [English]&lt;br /&gt;
* http://ubuntuforums.org/showthread.php?t=24575 [English]&lt;br /&gt;
* http://wiki.ubuntuusers.de/32-Bit_chroot [German]&lt;br /&gt;
* http://www.debian-administration.org/article/Installing_apps_in_a_32-bit_chroot_in_AMD64_Debian_system [English]&lt;/div&gt;</summary>
		<author><name>Keitekk</name></author>	</entry>

	<entry>
		<id>http://doc.lunar-linux.org/Miscellaneous:32BitChroot</id>
		<title>Miscellaneous:32BitChroot</title>
		<link rel="alternate" type="text/html" href="http://doc.lunar-linux.org/Miscellaneous:32BitChroot"/>
				<updated>2012-02-23T00:12:56Z</updated>
		
		<summary type="html">&lt;p&gt;Keitekk: /* Init Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an Article about running a 32bit Chroot of Lunar Linux within 64bit Lunar Linux. It's getting updated sometimes and should work on different Distributions, too.&lt;br /&gt;
&lt;br /&gt;
==Lunar Linux 32 Bit Chroot within native 64 Bit Environment==&lt;br /&gt;
&lt;br /&gt;
===Changelog:===&lt;br /&gt;
* (20.02.12) Added 32bit-kernel configuration and prompt customization tidbits (keios) &lt;br /&gt;
* (22.02.11) Paths of qt4 changed, changed howto accordingly (for skype), fonts needs mkfontscale and mkfontdir (added), added section about ATI graphiccards (3d acceleration), some smaller adjustments.&lt;br /&gt;
* (29.10.10) Added bdftopcf to list of fonts, without that, fonts won't compile (thx to cavalier for helping to find out)  &lt;br /&gt;
* (29.10.10) Added instructions regarding the kernel&lt;br /&gt;
* (29.10.10) Added new (with current applications installed) image (lunarlinuxchroot.tar.bz2)&lt;br /&gt;
* (29.10.10) Added some information at the Test-Stage&lt;br /&gt;
* (29.10.10) Added little side note about lunar optimize in chrooted-environments&lt;br /&gt;
* (29.10.10) Added little notice about the &amp;quot;unofficial image&amp;quot;&lt;br /&gt;
* (11.08.09) Added some Information (Thanks to beko)&lt;br /&gt;
* (10.07.09) 3D Acceleration howto was wrong, corrected thx to Raedwulf for pointing out :)&lt;br /&gt;
* (10.07.09) I rewrote some parts to a hopefully nicer english.&lt;br /&gt;
&lt;br /&gt;
===Todo:===&lt;br /&gt;
* Bash Script which performs the actions below automatically&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
===Why===&lt;br /&gt;
Because. As Lunar Linux is 32bit or 64bit and not multilib, you have to use a chroot for 32bit. I really dislike this but nobody wanted to put time into multilib yet just because of a few guys which would like that and as every day some more apps work using 64bit, multilib will probably not be that useful at all. Anyway, for those of you who want to use 32bit apps within the 64bit environment, this little howto should help a lot.&lt;br /&gt;
&lt;br /&gt;
===Requirements===&lt;br /&gt;
Having an image of a running system could help a lot and reduce the needed time amount. If you like you can use an Image i created originally for use as OpenSolaris Zone. You could also create your own 32bit image (just install 32bit linux using a vm or something and tar cjvf the whole system, without proc, sys, dev..). Anyway, i will explain here how to do it using my image.&lt;br /&gt;
&lt;br /&gt;
== Images ==&lt;br /&gt;
&lt;br /&gt;
These are '''unofficial''' images made by me (wdp).&lt;br /&gt;
&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2 [current]  483M (unpacked 1,8G) - 29.10.2010&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/osol_lunar_zone.tar.gz [outdated!] 570M&lt;br /&gt;
&lt;br /&gt;
These images are quite outdated, so you're far better off making your own 32bit image. If you don't, you could have difficulties during the lunar update process below.&lt;br /&gt;
&lt;br /&gt;
===Switch to root (For the Dummies)===&lt;br /&gt;
Of course you need to be root to run most of the following commands. If you don't know how to switch to the super user (root) in a Linux System you don't want to deal with this Howto. First learn some Basics. However. You can switch to the super user using the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ su -&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setup Environment===&lt;br /&gt;
'''Important: The Image listed below''': The image was created to be used as solaris zone, however its quite fine for chrooted environments, too. Please notice that this image is &amp;quot;unofficial&amp;quot; so you won't get official support for it.&lt;br /&gt;
&lt;br /&gt;
I installed my Chroot within /usr/local/32bit you might want to change that, just replace the &amp;quot;export&amp;quot; line to do so and don't forget to replace the path in the config files i'm later showing. The following lines will create the directory for your chroot, download my image and unpack it within that directory, copy over some files from the host to the chroot (like users, passwords, etc) and finally mount some directories from the host within the chroot (like dev, proc, sys, tmp).&lt;br /&gt;
&amp;lt;pre&amp;gt;export OC=&amp;quot;/usr/local/32bit&amp;quot;&lt;br /&gt;
mkdir -p $OC&lt;br /&gt;
cd $OC&lt;br /&gt;
wget http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2&lt;br /&gt;
tar -xjvf lunarlinuxchroot.tar.bz2&lt;br /&gt;
cp /etc/hosts $OC/etc/hosts&lt;br /&gt;
cp /etc/nsswitch.conf $OC/etc/nsswitch.conf&lt;br /&gt;
cp /etc/passwd $OC/etc/passwd&lt;br /&gt;
cp /etc/shadow $OC/etc/shadow&lt;br /&gt;
cp /etc/resolv.conf $OC/etc/resolv.conf&lt;br /&gt;
mount -o bind /dev $OC/dev&lt;br /&gt;
mount -o bind /dev/pts $OC/dev/pts&lt;br /&gt;
mount -o bind /proc $OC/proc&lt;br /&gt;
mount -o bind /sys $OC/sys&lt;br /&gt;
mount -o bind /tmp $OC/tmp&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Don't copy your current kernel stuff over to the chroot except for your .config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -rva /usr/src/linux/.config $OC/usr/src/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
&lt;br /&gt;
To enter this chrooted environment, simply type in linux32 chroot $OC&lt;br /&gt;
&lt;br /&gt;
===Test #1===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: i686-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=i686-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: x86_64-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=x86_64-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared –disable-multilib&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test #2===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
i686&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
x86_64&amp;lt;/pre&amp;gt;&lt;br /&gt;
as you can see - the chroot picks a not-64bit-gcc and uname -m returns not 64bit within the chroot - It's working ;-)&lt;br /&gt;
&lt;br /&gt;
===Setting up the shell prompt===&lt;br /&gt;
You might want to ensure you don't accidently mistake the chroot environment for your host or vice-versa. Even if you don't think this could ever happen to you, it almost inevitably will if you keep a lot of terminals open at the same time like me (keios). &lt;br /&gt;
&lt;br /&gt;
So to change your default prompt automatically on entering the chroot, add something like this to your .bashrc:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ $(uname -m) = &amp;quot;i686&amp;quot; ]; then&lt;br /&gt;
   # insert whatever works for you between @ and :&lt;br /&gt;
   export PS1=&amp;quot;\u@lunar32:\W&amp;gt; &amp;quot; &lt;br /&gt;
else&lt;br /&gt;
    export PS1=&amp;quot;\u@\h:\W&amp;gt; &amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your default prompt might look different, in that case customize the snippet as you see fit. If you use a colored prompt, changing the color usually should be enough to remind you.&lt;br /&gt;
&lt;br /&gt;
===Updating the Chroot-System===&lt;br /&gt;
My Image might be quite old and it's usually good to have the chroot environment as up to date as the host is. Run the following commands to get new packages/modules:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lin moonbase; lin theedge&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now you can run &amp;quot;lunar&amp;quot; and set some settings. The most important Settings might be the Optimizations. You can either go through: Option -&amp;amp;gt; Optimize Architecture or you run &amp;quot;lunar optimize&amp;quot; at the console.&lt;br /&gt;
&lt;br /&gt;
Modules might need working 32bit kernel headers, so make sure your gcc versions in- and outside the chroot are the same (see Test 1 above). If you need a specific gcc version that's not in the moonbase, use the --want $VERSION option of lin. Then build the kernel - you need the exact same version as you have on your host so you won't run into any trouble when e.g. installing video drivers for 3d acceleration later on:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@mari-chan:/$ lin -cr linux-stable&amp;lt;/pre&amp;gt;&lt;br /&gt;
When it asks you if you want to configure the kernel, say yes. In the menuconfig, use the &amp;quot;Load alternative config&amp;quot; option to load the kernel .config file you've copied to /usr/src earlier. Just enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;../.config&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you've done configuring your lunar installation run:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lunar renew&amp;lt;/pre&amp;gt;&lt;br /&gt;
to update your whole installation. Get a cup of tea or coffee, this might take a while depending on your box and resources. At this state you should have a running 32 Bit Chroot. However we will still need to enhance this a bit. You want for sure X11 within the Chroot.&lt;br /&gt;
&lt;br /&gt;
'''Important Note about lunar optimize''':&lt;br /&gt;
If you select optimizations for your chrooted environment, never ever use &amp;quot;native&amp;quot; as cpu optimization, this will break things. Always go with something safe, like i686 for example.&lt;br /&gt;
&lt;br /&gt;
==Enhancing your Chroot Installation==&lt;br /&gt;
===X11===&lt;br /&gt;
We mounted /tmp from the host to /tmp inside the chroot already. This way we can use the X11 Socket to connect applications within the chroot to our running x11-server within the host. You could also, if this isn’t possible, use TCP Connections. But they come usually with overhead and thus performance of x11 stuff will be bad. Anyway. You don’t need a whole X11-Server within the chroot, just a few x11 libs. Let’s go:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ lin -cr libX11 fixesproto libXxf86vm libXt libXmu libXi mesa-lib xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will install some X11 staff and libraries which are needed. You need now to allow X11-Unix-Socket Connections. Within the Chroot Environment edit your /etc/hostname and set &amp;quot;linux32&amp;quot; or something similar, remember this hostname. On the host type in: xhost +local:linux32 (Replace linux32 with the hostname you've set) or you could use &amp;quot;xhost +&amp;quot; which is insecure. Now you can test your X11 using xclock within your Chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ export DISPLAY=”:0.0″&lt;br /&gt;
wdp@linux32 ~ $ xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
You see the Clock? Fine it worked :)&lt;br /&gt;
&lt;br /&gt;
===3D Acceleration===&lt;br /&gt;
&lt;br /&gt;
If you want to run 32 Bit Games or Emulators like wine which don't work in native 64 Bit you might want to have 3D Acceleration.  The important thing about this is that you have to use exactly the same driver version within your chroot as the driver version in your host, otherwise it will simply not work. Thats why you should try to keep both installations as up to date as possible.&lt;br /&gt;
&lt;br /&gt;
==== nVidia ====&lt;br /&gt;
&lt;br /&gt;
It is really important that you got your kernel files and kernel header from the host, also within the chroot. you can do that by copy (cp) from the host to the chrooted environment or you simply copy over the current kernel configuration to the chroot and compile the kernel within the chroot again. (i will explain this step better when i got more time) - Keep also in mind, by default the kernel is on hold within the lunar installation. you might want to &amp;quot;unhold&amp;quot; it using lvu.&lt;br /&gt;
&lt;br /&gt;
On the Host check which NVIDIA drivers you got installed and what version it is:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lvu installed NVIDIA&lt;br /&gt;
NVIDIA is not installed&lt;br /&gt;
wdp@yulivee ~ $ lvu installed NVIDIA-beta&lt;br /&gt;
185.18.14&lt;br /&gt;
wdp@yulivee ~ $&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, i have NVIDIA-beta installed on the host. Within the Chroot i check now whats the current version of NVIDIA-beta within the moonbase using:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@yulivee /usr/src # lvu version NVIDIA-beta&lt;br /&gt;
185.18.14&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, it's the same version, so everything is fine, issue:&lt;br /&gt;
&amp;lt;pre&amp;gt;lget NVIDIA-beta&amp;lt;/pre&amp;gt;&lt;br /&gt;
and copy the .run from /var/spool/lunar to /usr/src. Make it executable using chmod a+x file.run and run it finally using ./file.run. Of course you have to replace &amp;quot;file&amp;quot; with the real filename.&lt;br /&gt;
&lt;br /&gt;
It will tell you that you run an X-Server and you have to stop this one first. Thats np, close X11, chroot into your chroot on the console and install NVIDIA. Exit the Chroot, start X11 again and everything is fine and should be done. You have to try around a bit with the NVIDIA Installer.&lt;br /&gt;
&lt;br /&gt;
==== ATI (r600/kms enabled) ====&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
===Home directory===&lt;br /&gt;
This is the easiest Task. We just need to mount the home directory with bind:&lt;br /&gt;
&amp;lt;pre&amp;gt;mount -o bind /home $OC/home&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the Chroot you can “su - username” and you’re in your home directory, without any problems or any flaws.&lt;br /&gt;
&lt;br /&gt;
===Init Script===&lt;br /&gt;
These are only examples.. you’ll probably find nicer variants. Anyway, for both scripts you will need a configfile containing at least the variable CHROOTDIR - which should point to your Chroot Directory. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Config&amp;lt;/strong&amp;gt;&lt;br /&gt;
This config will be used by the initscripts below and our “chroot-enter script”.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/lunar32chroot.conf&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
CHROOTDIR=&amp;quot;/usr/local/32bit&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;SysVinit:&amp;lt;/strong&amp;gt;&lt;br /&gt;
This Init Script will mount with --bind some needed directories for the chroot and copy some files which you will most likely want to keep up to date, to have permissions and networking working correctly.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/init.d/lunar32chroot&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# lunar32chroot Initializes the 32 Bit lunar chroot&lt;br /&gt;
#&lt;br /&gt;
# chkconfig: 2345 80 10&lt;br /&gt;
# description: Initializes 32 Bit chroot&lt;br /&gt;
&lt;br /&gt;
CONFIGFILE=&amp;quot;/etc/lunar32chroot.conf&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Starting 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	if [ -e &amp;quot;$CONFIGFILE&amp;quot; ]; then&lt;br /&gt;
    		source /etc/lunar32chroot.conf&lt;br /&gt;
	else&lt;br /&gt;
	    # we need a config...&lt;br /&gt;
    	echo &amp;quot;No config file found!&amp;quot;&lt;br /&gt;
    	echo -e $RESULT_FAIL&lt;br /&gt;
    	exit 0&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Mounting chroot directories...&amp;quot;&lt;br /&gt;
        mount -o bind /dev $CHROOTDIR/dev &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /proc $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /sys $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /tmp $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /home $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /media/lain $CHROOTDIR/media/lain &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /media/maelstrom $CHROOTDIR/media/maelstrom &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /media/vortex $CHROOTDIR/media/vortex &amp;gt;/dev/null &lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
        # optional mounts //TODO: add check&lt;br /&gt;
        [ -d /dev/pts ] &amp;amp;&amp;amp; mount -o bind /dev/pts $CHROOTDIR/dev/pts &amp;gt;/dev/null&lt;br /&gt;
        [ -d /dev/shm ] &amp;amp;&amp;amp; mount -o bind /dev/shm $CHROOTDIR/dev/shm &amp;gt;/dev/null&lt;br /&gt;
        [ -d /proc/bus/usb ] &amp;amp;&amp;amp; mount -o bind /proc/bus/usb $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Copying essential files...&amp;quot;&lt;br /&gt;
        cp -afr /etc/resolv.conf $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/passwd $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/shadow $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/group $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/hosts $CHROOTDIR/etc &amp;gt; /dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/localtime $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/nsswitch.conf $CHROOTDIR/etc &amp;gt;/dev/null &lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stop() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Stopping 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Unmounting 32bit chroot directories...&amp;quot;&lt;br /&gt;
        umount -fl $CHROOTDIR/media/vortex &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/media/maelstrom &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/media/lain &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -f $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/dev &amp;gt;/dev/null&lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
        # optional unmounts //TODO: add check&lt;br /&gt;
        [ -d $CHROOTDIR/proc/bus/usb ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null&lt;br /&gt;
        [ -d $CHROOTDIR/dev/shm ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/dev/shm &amp;gt;/dev/null&lt;br /&gt;
        [ -d $CHROOTDIR/dev/pts ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/dev/pts &amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
. /lib/lsb/init-functions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run “chkconfig –add lunar32chroot” to create the essential init scripts/symlinks for the different runlevels and you’re done.&lt;br /&gt;
&lt;br /&gt;
===Entering Chroot - Script===&lt;br /&gt;
With this Script you just need to type “lunar32″ to enter the chroot environment. Keep in mind the &amp;quot;linux32&amp;quot; command should be available on all boxes, you dont need to install additional software. However its part of &amp;quot;util-linux&amp;quot;.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /usr/bin/lunar32&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# little script to reduce some things to just one command&lt;br /&gt;
# especially for lazy people like me.&lt;br /&gt;
&lt;br /&gt;
source /etc/lunar32chroot.conf&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Entering chroot...&amp;quot;&lt;br /&gt;
linux32 chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Hint from Beko&amp;lt;/strong&amp;gt;&lt;br /&gt;
Beko has shown me a dirty way (as he said) of doing the same using sudo, thus you can enter the environment without beeing root:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
linux32 sudo chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash -c &amp;quot;su $WHOAMI&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Negative Sideeffects: you're landing in / at the start and sudo has to run with NOPASS. Thats why this solution is dirty and might be a security risk. However.. :-) &amp;lt;b&amp;gt;By the way&amp;lt;/b&amp;gt; Of course you want to replace $WHOAMI with your username - or a variable containing the current username.&lt;br /&gt;
&lt;br /&gt;
==Applications==&lt;br /&gt;
===Fonts===&lt;br /&gt;
For most applications you will need some X11 Fonts installed within the Chroot. Its enough if you install these:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr mkfontdir mkfontscale bdftopcf font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-75dpi font-adobe-utopia-100dpi font-adobe-utopia-type1 font-bitstream-100dpi font-bitstream-75dpi font-bh-lucidatypewriter-100dpi font-bh-lucidatypewriter-75dpi&amp;lt;/pre&amp;gt;&lt;br /&gt;
some of them might not be needed, but well doesnt hurt to install them.&lt;br /&gt;
&lt;br /&gt;
===Skype===&lt;br /&gt;
If you want to use Skype you will have to install some more libraries and tools:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd /var/lib/lunar/moonbase&lt;br /&gt;
cp -rva qt4-apps/qt4 zlocal/&lt;br /&gt;
cd zlocal/qt4&lt;br /&gt;
vim DEPENDS&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remove this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;depends  %X&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally install needed stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr dbus alsa-utils videoproto libXv scrnsaverproto libXScrnSaver qt4&amp;lt;/pre&amp;gt;&lt;br /&gt;
It might be needed to install dbus-qt3 (not sure) if so, you have to copy the module to zlocal and edit the DEPENDS file (of qt3 and of dbus-qt3) to remove the X Dependecy.&lt;br /&gt;
&lt;br /&gt;
Skype should now work. You might want to look at the &amp;quot;fonts&amp;quot; Section because skype will display broken fonts :)&lt;br /&gt;
&lt;br /&gt;
==Useful Documentation:==&lt;br /&gt;
* http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&amp;amp;amp;chap=2 [English]&lt;br /&gt;
* http://ubuntuforums.org/showthread.php?t=24575 [English]&lt;br /&gt;
* http://wiki.ubuntuusers.de/32-Bit_chroot [German]&lt;br /&gt;
* http://www.debian-administration.org/article/Installing_apps_in_a_32-bit_chroot_in_AMD64_Debian_system [English]&lt;/div&gt;</summary>
		<author><name>Keitekk</name></author>	</entry>

	<entry>
		<id>http://doc.lunar-linux.org/Miscellaneous:32BitChroot</id>
		<title>Miscellaneous:32BitChroot</title>
		<link rel="alternate" type="text/html" href="http://doc.lunar-linux.org/Miscellaneous:32BitChroot"/>
				<updated>2012-02-23T00:11:00Z</updated>
		
		<summary type="html">&lt;p&gt;Keitekk: /* Init Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an Article about running a 32bit Chroot of Lunar Linux within 64bit Lunar Linux. It's getting updated sometimes and should work on different Distributions, too.&lt;br /&gt;
&lt;br /&gt;
==Lunar Linux 32 Bit Chroot within native 64 Bit Environment==&lt;br /&gt;
&lt;br /&gt;
===Changelog:===&lt;br /&gt;
* (20.02.12) Added 32bit-kernel configuration and prompt customization tidbits (keios) &lt;br /&gt;
* (22.02.11) Paths of qt4 changed, changed howto accordingly (for skype), fonts needs mkfontscale and mkfontdir (added), added section about ATI graphiccards (3d acceleration), some smaller adjustments.&lt;br /&gt;
* (29.10.10) Added bdftopcf to list of fonts, without that, fonts won't compile (thx to cavalier for helping to find out)  &lt;br /&gt;
* (29.10.10) Added instructions regarding the kernel&lt;br /&gt;
* (29.10.10) Added new (with current applications installed) image (lunarlinuxchroot.tar.bz2)&lt;br /&gt;
* (29.10.10) Added some information at the Test-Stage&lt;br /&gt;
* (29.10.10) Added little side note about lunar optimize in chrooted-environments&lt;br /&gt;
* (29.10.10) Added little notice about the &amp;quot;unofficial image&amp;quot;&lt;br /&gt;
* (11.08.09) Added some Information (Thanks to beko)&lt;br /&gt;
* (10.07.09) 3D Acceleration howto was wrong, corrected thx to Raedwulf for pointing out :)&lt;br /&gt;
* (10.07.09) I rewrote some parts to a hopefully nicer english.&lt;br /&gt;
&lt;br /&gt;
===Todo:===&lt;br /&gt;
* Bash Script which performs the actions below automatically&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
===Why===&lt;br /&gt;
Because. As Lunar Linux is 32bit or 64bit and not multilib, you have to use a chroot for 32bit. I really dislike this but nobody wanted to put time into multilib yet just because of a few guys which would like that and as every day some more apps work using 64bit, multilib will probably not be that useful at all. Anyway, for those of you who want to use 32bit apps within the 64bit environment, this little howto should help a lot.&lt;br /&gt;
&lt;br /&gt;
===Requirements===&lt;br /&gt;
Having an image of a running system could help a lot and reduce the needed time amount. If you like you can use an Image i created originally for use as OpenSolaris Zone. You could also create your own 32bit image (just install 32bit linux using a vm or something and tar cjvf the whole system, without proc, sys, dev..). Anyway, i will explain here how to do it using my image.&lt;br /&gt;
&lt;br /&gt;
== Images ==&lt;br /&gt;
&lt;br /&gt;
These are '''unofficial''' images made by me (wdp).&lt;br /&gt;
&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2 [current]  483M (unpacked 1,8G) - 29.10.2010&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/osol_lunar_zone.tar.gz [outdated!] 570M&lt;br /&gt;
&lt;br /&gt;
These images are quite outdated, so you're far better off making your own 32bit image. If you don't, you could have difficulties during the lunar update process below.&lt;br /&gt;
&lt;br /&gt;
===Switch to root (For the Dummies)===&lt;br /&gt;
Of course you need to be root to run most of the following commands. If you don't know how to switch to the super user (root) in a Linux System you don't want to deal with this Howto. First learn some Basics. However. You can switch to the super user using the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ su -&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setup Environment===&lt;br /&gt;
'''Important: The Image listed below''': The image was created to be used as solaris zone, however its quite fine for chrooted environments, too. Please notice that this image is &amp;quot;unofficial&amp;quot; so you won't get official support for it.&lt;br /&gt;
&lt;br /&gt;
I installed my Chroot within /usr/local/32bit you might want to change that, just replace the &amp;quot;export&amp;quot; line to do so and don't forget to replace the path in the config files i'm later showing. The following lines will create the directory for your chroot, download my image and unpack it within that directory, copy over some files from the host to the chroot (like users, passwords, etc) and finally mount some directories from the host within the chroot (like dev, proc, sys, tmp).&lt;br /&gt;
&amp;lt;pre&amp;gt;export OC=&amp;quot;/usr/local/32bit&amp;quot;&lt;br /&gt;
mkdir -p $OC&lt;br /&gt;
cd $OC&lt;br /&gt;
wget http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2&lt;br /&gt;
tar -xjvf lunarlinuxchroot.tar.bz2&lt;br /&gt;
cp /etc/hosts $OC/etc/hosts&lt;br /&gt;
cp /etc/nsswitch.conf $OC/etc/nsswitch.conf&lt;br /&gt;
cp /etc/passwd $OC/etc/passwd&lt;br /&gt;
cp /etc/shadow $OC/etc/shadow&lt;br /&gt;
cp /etc/resolv.conf $OC/etc/resolv.conf&lt;br /&gt;
mount -o bind /dev $OC/dev&lt;br /&gt;
mount -o bind /dev/pts $OC/dev/pts&lt;br /&gt;
mount -o bind /proc $OC/proc&lt;br /&gt;
mount -o bind /sys $OC/sys&lt;br /&gt;
mount -o bind /tmp $OC/tmp&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Don't copy your current kernel stuff over to the chroot except for your .config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -rva /usr/src/linux/.config $OC/usr/src/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
&lt;br /&gt;
To enter this chrooted environment, simply type in linux32 chroot $OC&lt;br /&gt;
&lt;br /&gt;
===Test #1===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: i686-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=i686-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: x86_64-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=x86_64-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared –disable-multilib&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test #2===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
i686&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
x86_64&amp;lt;/pre&amp;gt;&lt;br /&gt;
as you can see - the chroot picks a not-64bit-gcc and uname -m returns not 64bit within the chroot - It's working ;-)&lt;br /&gt;
&lt;br /&gt;
===Setting up the shell prompt===&lt;br /&gt;
You might want to ensure you don't accidently mistake the chroot environment for your host or vice-versa. Even if you don't think this could ever happen to you, it almost inevitably will if you keep a lot of terminals open at the same time like me (keios). &lt;br /&gt;
&lt;br /&gt;
So to change your default prompt automatically on entering the chroot, add something like this to your .bashrc:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ $(uname -m) = &amp;quot;i686&amp;quot; ]; then&lt;br /&gt;
   # insert whatever works for you between @ and :&lt;br /&gt;
   export PS1=&amp;quot;\u@lunar32:\W&amp;gt; &amp;quot; &lt;br /&gt;
else&lt;br /&gt;
    export PS1=&amp;quot;\u@\h:\W&amp;gt; &amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your default prompt might look different, in that case customize the snippet as you see fit. If you use a colored prompt, changing the color usually should be enough to remind you.&lt;br /&gt;
&lt;br /&gt;
===Updating the Chroot-System===&lt;br /&gt;
My Image might be quite old and it's usually good to have the chroot environment as up to date as the host is. Run the following commands to get new packages/modules:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lin moonbase; lin theedge&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now you can run &amp;quot;lunar&amp;quot; and set some settings. The most important Settings might be the Optimizations. You can either go through: Option -&amp;amp;gt; Optimize Architecture or you run &amp;quot;lunar optimize&amp;quot; at the console.&lt;br /&gt;
&lt;br /&gt;
Modules might need working 32bit kernel headers, so make sure your gcc versions in- and outside the chroot are the same (see Test 1 above). If you need a specific gcc version that's not in the moonbase, use the --want $VERSION option of lin. Then build the kernel - you need the exact same version as you have on your host so you won't run into any trouble when e.g. installing video drivers for 3d acceleration later on:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@mari-chan:/$ lin -cr linux-stable&amp;lt;/pre&amp;gt;&lt;br /&gt;
When it asks you if you want to configure the kernel, say yes. In the menuconfig, use the &amp;quot;Load alternative config&amp;quot; option to load the kernel .config file you've copied to /usr/src earlier. Just enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;../.config&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you've done configuring your lunar installation run:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lunar renew&amp;lt;/pre&amp;gt;&lt;br /&gt;
to update your whole installation. Get a cup of tea or coffee, this might take a while depending on your box and resources. At this state you should have a running 32 Bit Chroot. However we will still need to enhance this a bit. You want for sure X11 within the Chroot.&lt;br /&gt;
&lt;br /&gt;
'''Important Note about lunar optimize''':&lt;br /&gt;
If you select optimizations for your chrooted environment, never ever use &amp;quot;native&amp;quot; as cpu optimization, this will break things. Always go with something safe, like i686 for example.&lt;br /&gt;
&lt;br /&gt;
==Enhancing your Chroot Installation==&lt;br /&gt;
===X11===&lt;br /&gt;
We mounted /tmp from the host to /tmp inside the chroot already. This way we can use the X11 Socket to connect applications within the chroot to our running x11-server within the host. You could also, if this isn’t possible, use TCP Connections. But they come usually with overhead and thus performance of x11 stuff will be bad. Anyway. You don’t need a whole X11-Server within the chroot, just a few x11 libs. Let’s go:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ lin -cr libX11 fixesproto libXxf86vm libXt libXmu libXi mesa-lib xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will install some X11 staff and libraries which are needed. You need now to allow X11-Unix-Socket Connections. Within the Chroot Environment edit your /etc/hostname and set &amp;quot;linux32&amp;quot; or something similar, remember this hostname. On the host type in: xhost +local:linux32 (Replace linux32 with the hostname you've set) or you could use &amp;quot;xhost +&amp;quot; which is insecure. Now you can test your X11 using xclock within your Chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ export DISPLAY=”:0.0″&lt;br /&gt;
wdp@linux32 ~ $ xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
You see the Clock? Fine it worked :)&lt;br /&gt;
&lt;br /&gt;
===3D Acceleration===&lt;br /&gt;
&lt;br /&gt;
If you want to run 32 Bit Games or Emulators like wine which don't work in native 64 Bit you might want to have 3D Acceleration.  The important thing about this is that you have to use exactly the same driver version within your chroot as the driver version in your host, otherwise it will simply not work. Thats why you should try to keep both installations as up to date as possible.&lt;br /&gt;
&lt;br /&gt;
==== nVidia ====&lt;br /&gt;
&lt;br /&gt;
It is really important that you got your kernel files and kernel header from the host, also within the chroot. you can do that by copy (cp) from the host to the chrooted environment or you simply copy over the current kernel configuration to the chroot and compile the kernel within the chroot again. (i will explain this step better when i got more time) - Keep also in mind, by default the kernel is on hold within the lunar installation. you might want to &amp;quot;unhold&amp;quot; it using lvu.&lt;br /&gt;
&lt;br /&gt;
On the Host check which NVIDIA drivers you got installed and what version it is:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lvu installed NVIDIA&lt;br /&gt;
NVIDIA is not installed&lt;br /&gt;
wdp@yulivee ~ $ lvu installed NVIDIA-beta&lt;br /&gt;
185.18.14&lt;br /&gt;
wdp@yulivee ~ $&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, i have NVIDIA-beta installed on the host. Within the Chroot i check now whats the current version of NVIDIA-beta within the moonbase using:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@yulivee /usr/src # lvu version NVIDIA-beta&lt;br /&gt;
185.18.14&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, it's the same version, so everything is fine, issue:&lt;br /&gt;
&amp;lt;pre&amp;gt;lget NVIDIA-beta&amp;lt;/pre&amp;gt;&lt;br /&gt;
and copy the .run from /var/spool/lunar to /usr/src. Make it executable using chmod a+x file.run and run it finally using ./file.run. Of course you have to replace &amp;quot;file&amp;quot; with the real filename.&lt;br /&gt;
&lt;br /&gt;
It will tell you that you run an X-Server and you have to stop this one first. Thats np, close X11, chroot into your chroot on the console and install NVIDIA. Exit the Chroot, start X11 again and everything is fine and should be done. You have to try around a bit with the NVIDIA Installer.&lt;br /&gt;
&lt;br /&gt;
==== ATI (r600/kms enabled) ====&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
===Home directory===&lt;br /&gt;
This is the easiest Task. We just need to mount the home directory with bind:&lt;br /&gt;
&amp;lt;pre&amp;gt;mount -o bind /home $OC/home&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the Chroot you can “su - username” and you’re in your home directory, without any problems or any flaws.&lt;br /&gt;
&lt;br /&gt;
===Init Script===&lt;br /&gt;
These are only examples.. you’ll probably find nicer variants. Anyway, for both scripts you will need a configfile containing at least the variable CHROOTDIR - which should point to your Chroot Directory. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Config&amp;lt;/strong&amp;gt;&lt;br /&gt;
This config will be used by the initscripts below and our “chroot-enter script”.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/lunar32chroot.conf&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
CHROOTDIR=&amp;quot;/usr/local/32bit&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;SysVinit:&amp;lt;/strong&amp;gt;&lt;br /&gt;
This Init Script will mount with --bind some needed directories for the chroot and copy some files which you will most likely want to keep up to date, to have permissions and networking working correctly.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/init.d/lunar32chroot&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# lunar32chroot Initializes the 32 Bit lunar chroot&lt;br /&gt;
#&lt;br /&gt;
# chkconfig: 2345 80 10&lt;br /&gt;
# description: Initializes 32 Bit chroot&lt;br /&gt;
&lt;br /&gt;
CONFIGFILE=&amp;quot;/etc/lunar32chroot.conf&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Starting 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	if [ -e &amp;quot;$CONFIGFILE&amp;quot; ]; then&lt;br /&gt;
    		source /etc/lunar32chroot.conf&lt;br /&gt;
	else&lt;br /&gt;
	    # we need a config...&lt;br /&gt;
    	echo &amp;quot;No config file found!&amp;quot;&lt;br /&gt;
    	echo -e $RESULT_FAIL&lt;br /&gt;
    	exit 0&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Mounting chroot directories...&amp;quot;&lt;br /&gt;
        mount -o bind /dev $CHROOTDIR/dev &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /proc $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /sys $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /tmp $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /home $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /media/lain $CHROOTDIR/media/lain &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /media/maelstrom $CHROOTDIR/media/maelstrom &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /media/vortex $CHROOTDIR/media/vortex &amp;gt;/dev/null &lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
        # optional mounts //TODO: add check&lt;br /&gt;
        $SHELL -c &amp;quot;[ -d /dev/pts ] &amp;amp;&amp;amp; mount -o bind /dev/pts $CHROOTDIR/dev/pts &amp;gt;/dev/null&amp;quot; &amp;amp;&amp;amp;&lt;br /&gt;
        $SHELL -c &amp;quot;[ -d /dev/shm ] &amp;amp;&amp;amp; mount -o bind /dev/shm $CHROOTDIR/dev/shm &amp;gt;/dev/null&amp;quot; &amp;amp;&amp;amp;&lt;br /&gt;
        $SHELL -c &amp;quot;[ -d /proc/bus/usb ] &amp;amp;&amp;amp; mount -o bind /proc/bus/usb $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Copying essential files...&amp;quot;&lt;br /&gt;
        cp -afr /etc/resolv.conf $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/passwd $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/shadow $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/group $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/hosts $CHROOTDIR/etc &amp;gt; /dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/localtime $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/nsswitch.conf $CHROOTDIR/etc &amp;gt;/dev/null &lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stop() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Stopping 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Unmounting 32bit chroot directories...&amp;quot;&lt;br /&gt;
        umount -fl $CHROOTDIR/media/vortex &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/media/maelstrom &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/media/lain &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -f $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/dev &amp;gt;/dev/null&lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
        # optional unmounts //TODO: add check&lt;br /&gt;
        $SHELL -c &amp;quot;[ -d $CHROOTDIR/proc/bus/usb ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null&amp;quot; &amp;amp;&amp;amp;&lt;br /&gt;
        $SHELL -c &amp;quot;[ -d $CHROOTDIR/dev/shm ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/dev/shm &amp;gt;/dev/null&amp;quot; &amp;amp;&amp;amp;&lt;br /&gt;
        $SHELL -c &amp;quot;[ -d $CHROOTDIR/dev/pts ] &amp;amp;&amp;amp; umount -fl $CHROOTDIR/dev/pts &amp;gt;/dev/null&amp;quot; &lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
. /lib/lsb/init-functions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run “chkconfig –add lunar32chroot” to create the essential init scripts/symlinks for the different runlevels and you’re done.&lt;br /&gt;
&lt;br /&gt;
===Entering Chroot - Script===&lt;br /&gt;
With this Script you just need to type “lunar32″ to enter the chroot environment. Keep in mind the &amp;quot;linux32&amp;quot; command should be available on all boxes, you dont need to install additional software. However its part of &amp;quot;util-linux&amp;quot;.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /usr/bin/lunar32&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# little script to reduce some things to just one command&lt;br /&gt;
# especially for lazy people like me.&lt;br /&gt;
&lt;br /&gt;
source /etc/lunar32chroot.conf&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Entering chroot...&amp;quot;&lt;br /&gt;
linux32 chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Hint from Beko&amp;lt;/strong&amp;gt;&lt;br /&gt;
Beko has shown me a dirty way (as he said) of doing the same using sudo, thus you can enter the environment without beeing root:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
linux32 sudo chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash -c &amp;quot;su $WHOAMI&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Negative Sideeffects: you're landing in / at the start and sudo has to run with NOPASS. Thats why this solution is dirty and might be a security risk. However.. :-) &amp;lt;b&amp;gt;By the way&amp;lt;/b&amp;gt; Of course you want to replace $WHOAMI with your username - or a variable containing the current username.&lt;br /&gt;
&lt;br /&gt;
==Applications==&lt;br /&gt;
===Fonts===&lt;br /&gt;
For most applications you will need some X11 Fonts installed within the Chroot. Its enough if you install these:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr mkfontdir mkfontscale bdftopcf font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-75dpi font-adobe-utopia-100dpi font-adobe-utopia-type1 font-bitstream-100dpi font-bitstream-75dpi font-bh-lucidatypewriter-100dpi font-bh-lucidatypewriter-75dpi&amp;lt;/pre&amp;gt;&lt;br /&gt;
some of them might not be needed, but well doesnt hurt to install them.&lt;br /&gt;
&lt;br /&gt;
===Skype===&lt;br /&gt;
If you want to use Skype you will have to install some more libraries and tools:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd /var/lib/lunar/moonbase&lt;br /&gt;
cp -rva qt4-apps/qt4 zlocal/&lt;br /&gt;
cd zlocal/qt4&lt;br /&gt;
vim DEPENDS&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remove this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;depends  %X&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally install needed stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr dbus alsa-utils videoproto libXv scrnsaverproto libXScrnSaver qt4&amp;lt;/pre&amp;gt;&lt;br /&gt;
It might be needed to install dbus-qt3 (not sure) if so, you have to copy the module to zlocal and edit the DEPENDS file (of qt3 and of dbus-qt3) to remove the X Dependecy.&lt;br /&gt;
&lt;br /&gt;
Skype should now work. You might want to look at the &amp;quot;fonts&amp;quot; Section because skype will display broken fonts :)&lt;br /&gt;
&lt;br /&gt;
==Useful Documentation:==&lt;br /&gt;
* http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&amp;amp;amp;chap=2 [English]&lt;br /&gt;
* http://ubuntuforums.org/showthread.php?t=24575 [English]&lt;br /&gt;
* http://wiki.ubuntuusers.de/32-Bit_chroot [German]&lt;br /&gt;
* http://www.debian-administration.org/article/Installing_apps_in_a_32-bit_chroot_in_AMD64_Debian_system [English]&lt;/div&gt;</summary>
		<author><name>Keitekk</name></author>	</entry>

	<entry>
		<id>http://doc.lunar-linux.org/Miscellaneous:32BitChroot</id>
		<title>Miscellaneous:32BitChroot</title>
		<link rel="alternate" type="text/html" href="http://doc.lunar-linux.org/Miscellaneous:32BitChroot"/>
				<updated>2012-02-22T22:16:14Z</updated>
		
		<summary type="html">&lt;p&gt;Keitekk: /* Init Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an Article about running a 32bit Chroot of Lunar Linux within 64bit Lunar Linux. It's getting updated sometimes and should work on different Distributions, too.&lt;br /&gt;
&lt;br /&gt;
==Lunar Linux 32 Bit Chroot within native 64 Bit Environment==&lt;br /&gt;
&lt;br /&gt;
===Changelog:===&lt;br /&gt;
* (20.02.12) Added 32bit-kernel configuration and prompt customization tidbits (keios) &lt;br /&gt;
* (22.02.11) Paths of qt4 changed, changed howto accordingly (for skype), fonts needs mkfontscale and mkfontdir (added), added section about ATI graphiccards (3d acceleration), some smaller adjustments.&lt;br /&gt;
* (29.10.10) Added bdftopcf to list of fonts, without that, fonts won't compile (thx to cavalier for helping to find out)  &lt;br /&gt;
* (29.10.10) Added instructions regarding the kernel&lt;br /&gt;
* (29.10.10) Added new (with current applications installed) image (lunarlinuxchroot.tar.bz2)&lt;br /&gt;
* (29.10.10) Added some information at the Test-Stage&lt;br /&gt;
* (29.10.10) Added little side note about lunar optimize in chrooted-environments&lt;br /&gt;
* (29.10.10) Added little notice about the &amp;quot;unofficial image&amp;quot;&lt;br /&gt;
* (11.08.09) Added some Information (Thanks to beko)&lt;br /&gt;
* (10.07.09) 3D Acceleration howto was wrong, corrected thx to Raedwulf for pointing out :)&lt;br /&gt;
* (10.07.09) I rewrote some parts to a hopefully nicer english.&lt;br /&gt;
&lt;br /&gt;
===Todo:===&lt;br /&gt;
* Bash Script which performs the actions below automatically&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
===Why===&lt;br /&gt;
Because. As Lunar Linux is 32bit or 64bit and not multilib, you have to use a chroot for 32bit. I really dislike this but nobody wanted to put time into multilib yet just because of a few guys which would like that and as every day some more apps work using 64bit, multilib will probably not be that useful at all. Anyway, for those of you who want to use 32bit apps within the 64bit environment, this little howto should help a lot.&lt;br /&gt;
&lt;br /&gt;
===Requirements===&lt;br /&gt;
Having an image of a running system could help a lot and reduce the needed time amount. If you like you can use an Image i created originally for use as OpenSolaris Zone. You could also create your own 32bit image (just install 32bit linux using a vm or something and tar cjvf the whole system, without proc, sys, dev..). Anyway, i will explain here how to do it using my image.&lt;br /&gt;
&lt;br /&gt;
== Images ==&lt;br /&gt;
&lt;br /&gt;
These are '''unofficial''' images made by me (wdp).&lt;br /&gt;
&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2 [current]  483M (unpacked 1,8G) - 29.10.2010&lt;br /&gt;
* http://www.jeanbruenn.info/downloads/osol_lunar_zone.tar.gz [outdated!] 570M&lt;br /&gt;
&lt;br /&gt;
These images are quite outdated, so you're far better off making your own 32bit image. If you don't, you could have difficulties during the lunar update process below.&lt;br /&gt;
&lt;br /&gt;
===Switch to root (For the Dummies)===&lt;br /&gt;
Of course you need to be root to run most of the following commands. If you don't know how to switch to the super user (root) in a Linux System you don't want to deal with this Howto. First learn some Basics. However. You can switch to the super user using the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ su -&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Setup Environment===&lt;br /&gt;
'''Important: The Image listed below''': The image was created to be used as solaris zone, however its quite fine for chrooted environments, too. Please notice that this image is &amp;quot;unofficial&amp;quot; so you won't get official support for it.&lt;br /&gt;
&lt;br /&gt;
I installed my Chroot within /usr/local/32bit you might want to change that, just replace the &amp;quot;export&amp;quot; line to do so and don't forget to replace the path in the config files i'm later showing. The following lines will create the directory for your chroot, download my image and unpack it within that directory, copy over some files from the host to the chroot (like users, passwords, etc) and finally mount some directories from the host within the chroot (like dev, proc, sys, tmp).&lt;br /&gt;
&amp;lt;pre&amp;gt;export OC=&amp;quot;/usr/local/32bit&amp;quot;&lt;br /&gt;
mkdir -p $OC&lt;br /&gt;
cd $OC&lt;br /&gt;
wget http://www.jeanbruenn.info/downloads/lunarlinuxchroot.tar.bz2&lt;br /&gt;
tar -xjvf lunarlinuxchroot.tar.bz2&lt;br /&gt;
cp /etc/hosts $OC/etc/hosts&lt;br /&gt;
cp /etc/nsswitch.conf $OC/etc/nsswitch.conf&lt;br /&gt;
cp /etc/passwd $OC/etc/passwd&lt;br /&gt;
cp /etc/shadow $OC/etc/shadow&lt;br /&gt;
cp /etc/resolv.conf $OC/etc/resolv.conf&lt;br /&gt;
mount -o bind /dev $OC/dev&lt;br /&gt;
mount -o bind /dev/pts $OC/dev/pts&lt;br /&gt;
mount -o bind /proc $OC/proc&lt;br /&gt;
mount -o bind /sys $OC/sys&lt;br /&gt;
mount -o bind /tmp $OC/tmp&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Don't copy your current kernel stuff over to the chroot except for your .config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -rva /usr/src/linux/.config $OC/usr/src/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
&lt;br /&gt;
To enter this chrooted environment, simply type in linux32 chroot $OC&lt;br /&gt;
&lt;br /&gt;
===Test #1===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: i686-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=i686-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ gcc -v&lt;br /&gt;
Using built-in specs.&lt;br /&gt;
Target: x86_64-pc-linux-gnu&lt;br /&gt;
Configured with: ../configure –host=x86_64-pc-linux-gnu –enable-languages=c++,fortran –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-__cxa_atexit –enable-threads –disable-nls –enable-target-optspace –with-gnu-ld –with-system-zlib –enable-shared –disable-multilib&lt;br /&gt;
Thread model: posix&lt;br /&gt;
gcc version 4.2.4&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test #2===&lt;br /&gt;
Within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
i686&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the host:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ uname -m&lt;br /&gt;
x86_64&amp;lt;/pre&amp;gt;&lt;br /&gt;
as you can see - the chroot picks a not-64bit-gcc and uname -m returns not 64bit within the chroot - It's working ;-)&lt;br /&gt;
&lt;br /&gt;
===Setting up the shell prompt===&lt;br /&gt;
You might want to ensure you don't accidently mistake the chroot environment for your host or vice-versa. Even if you don't think this could ever happen to you, it almost inevitably will if you keep a lot of terminals open at the same time like me (keios). &lt;br /&gt;
&lt;br /&gt;
So to change your default prompt automatically on entering the chroot, add something like this to your .bashrc:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ $(uname -m) = &amp;quot;i686&amp;quot; ]; then&lt;br /&gt;
   # insert whatever works for you between @ and :&lt;br /&gt;
   export PS1=&amp;quot;\u@lunar32:\W&amp;gt; &amp;quot; &lt;br /&gt;
else&lt;br /&gt;
    export PS1=&amp;quot;\u@\h:\W&amp;gt; &amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your default prompt might look different, in that case customize the snippet as you see fit. If you use a colored prompt, changing the color usually should be enough to remind you.&lt;br /&gt;
&lt;br /&gt;
===Updating the Chroot-System===&lt;br /&gt;
My Image might be quite old and it's usually good to have the chroot environment as up to date as the host is. Run the following commands to get new packages/modules:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lin moonbase; lin theedge&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now you can run &amp;quot;lunar&amp;quot; and set some settings. The most important Settings might be the Optimizations. You can either go through: Option -&amp;amp;gt; Optimize Architecture or you run &amp;quot;lunar optimize&amp;quot; at the console.&lt;br /&gt;
&lt;br /&gt;
Modules might need working 32bit kernel headers, so make sure your gcc versions in- and outside the chroot are the same (see Test 1 above). If you need a specific gcc version that's not in the moonbase, use the --want $VERSION option of lin. Then build the kernel - you need the exact same version as you have on your host so you won't run into any trouble when e.g. installing video drivers for 3d acceleration later on:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@mari-chan:/$ lin -cr linux-stable&amp;lt;/pre&amp;gt;&lt;br /&gt;
When it asks you if you want to configure the kernel, say yes. In the menuconfig, use the &amp;quot;Load alternative config&amp;quot; option to load the kernel .config file you've copied to /usr/src earlier. Just enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;../.config&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you've done configuring your lunar installation run:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lunar renew&amp;lt;/pre&amp;gt;&lt;br /&gt;
to update your whole installation. Get a cup of tea or coffee, this might take a while depending on your box and resources. At this state you should have a running 32 Bit Chroot. However we will still need to enhance this a bit. You want for sure X11 within the Chroot.&lt;br /&gt;
&lt;br /&gt;
'''Important Note about lunar optimize''':&lt;br /&gt;
If you select optimizations for your chrooted environment, never ever use &amp;quot;native&amp;quot; as cpu optimization, this will break things. Always go with something safe, like i686 for example.&lt;br /&gt;
&lt;br /&gt;
==Enhancing your Chroot Installation==&lt;br /&gt;
===X11===&lt;br /&gt;
We mounted /tmp from the host to /tmp inside the chroot already. This way we can use the X11 Socket to connect applications within the chroot to our running x11-server within the host. You could also, if this isn’t possible, use TCP Connections. But they come usually with overhead and thus performance of x11 stuff will be bad. Anyway. You don’t need a whole X11-Server within the chroot, just a few x11 libs. Let’s go:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ lin -cr libX11 fixesproto libXxf86vm libXt libXmu libXi mesa-lib xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will install some X11 staff and libraries which are needed. You need now to allow X11-Unix-Socket Connections. Within the Chroot Environment edit your /etc/hostname and set &amp;quot;linux32&amp;quot; or something similar, remember this hostname. On the host type in: xhost +local:linux32 (Replace linux32 with the hostname you've set) or you could use &amp;quot;xhost +&amp;quot; which is insecure. Now you can test your X11 using xclock within your Chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@linux32 ~ $ export DISPLAY=”:0.0″&lt;br /&gt;
wdp@linux32 ~ $ xclock&amp;lt;/pre&amp;gt;&lt;br /&gt;
You see the Clock? Fine it worked :)&lt;br /&gt;
&lt;br /&gt;
===3D Acceleration===&lt;br /&gt;
&lt;br /&gt;
If you want to run 32 Bit Games or Emulators like wine which don't work in native 64 Bit you might want to have 3D Acceleration.  The important thing about this is that you have to use exactly the same driver version within your chroot as the driver version in your host, otherwise it will simply not work. Thats why you should try to keep both installations as up to date as possible.&lt;br /&gt;
&lt;br /&gt;
==== nVidia ====&lt;br /&gt;
&lt;br /&gt;
It is really important that you got your kernel files and kernel header from the host, also within the chroot. you can do that by copy (cp) from the host to the chrooted environment or you simply copy over the current kernel configuration to the chroot and compile the kernel within the chroot again. (i will explain this step better when i got more time) - Keep also in mind, by default the kernel is on hold within the lunar installation. you might want to &amp;quot;unhold&amp;quot; it using lvu.&lt;br /&gt;
&lt;br /&gt;
On the Host check which NVIDIA drivers you got installed and what version it is:&lt;br /&gt;
&amp;lt;pre&amp;gt;wdp@yulivee ~ $ lvu installed NVIDIA&lt;br /&gt;
NVIDIA is not installed&lt;br /&gt;
wdp@yulivee ~ $ lvu installed NVIDIA-beta&lt;br /&gt;
185.18.14&lt;br /&gt;
wdp@yulivee ~ $&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, i have NVIDIA-beta installed on the host. Within the Chroot i check now whats the current version of NVIDIA-beta within the moonbase using:&lt;br /&gt;
&amp;lt;pre&amp;gt;root@yulivee /usr/src # lvu version NVIDIA-beta&lt;br /&gt;
185.18.14&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see, it's the same version, so everything is fine, issue:&lt;br /&gt;
&amp;lt;pre&amp;gt;lget NVIDIA-beta&amp;lt;/pre&amp;gt;&lt;br /&gt;
and copy the .run from /var/spool/lunar to /usr/src. Make it executable using chmod a+x file.run and run it finally using ./file.run. Of course you have to replace &amp;quot;file&amp;quot; with the real filename.&lt;br /&gt;
&lt;br /&gt;
It will tell you that you run an X-Server and you have to stop this one first. Thats np, close X11, chroot into your chroot on the console and install NVIDIA. Exit the Chroot, start X11 again and everything is fine and should be done. You have to try around a bit with the NVIDIA Installer.&lt;br /&gt;
&lt;br /&gt;
==== ATI (r600/kms enabled) ====&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
===Home directory===&lt;br /&gt;
This is the easiest Task. We just need to mount the home directory with bind:&lt;br /&gt;
&amp;lt;pre&amp;gt;mount -o bind /home $OC/home&amp;lt;/pre&amp;gt;&lt;br /&gt;
Within the Chroot you can “su - username” and you’re in your home directory, without any problems or any flaws.&lt;br /&gt;
&lt;br /&gt;
===Init Script===&lt;br /&gt;
These are only examples.. you’ll probably find nicer variants. Anyway, for both scripts you will need a configfile containing at least the variable CHROOTDIR - which should point to your Chroot Directory. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Config&amp;lt;/strong&amp;gt;&lt;br /&gt;
This config will be used by the initscripts below and our “chroot-enter script”.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/lunar32chroot.conf&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# ^.^&lt;br /&gt;
OK=&amp;quot;\033[00;29;1m[ \033[00;32;1mDONE\033[00;29;1m ]\033[0m&amp;quot;&lt;br /&gt;
FAIL=&amp;quot;\033[00;29;1m[ \033[00;32;1mFAIL\033[00;29;1m ]\033[0m&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CHROOTDIR=&amp;quot;/usr/local/32bit&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;SysVinit:&amp;lt;/strong&amp;gt;&lt;br /&gt;
This Init Script will mount with --bind some needed directories for the chroot and copy some files which you will most likely want to keep up to date, to have permissions and networking working correctly.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /etc/init.d/lunar32chroot&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# lunar32chroot Initializes the 32 Bit lunar chroot&lt;br /&gt;
#&lt;br /&gt;
# chkconfig: 2345 80 10&lt;br /&gt;
# description: Initializes 32 Bit chroot&lt;br /&gt;
&lt;br /&gt;
if [ -e &amp;quot;/etc/lunar32chroot.conf&amp;quot; ]; then&lt;br /&gt;
&lt;br /&gt;
    source /etc/lunar32chroot.conf&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
    # we need a config...&lt;br /&gt;
    echo &amp;quot;No config file found&amp;quot;&lt;br /&gt;
    echo -e $RESULT_FAIL&lt;br /&gt;
    exit 0&lt;br /&gt;
&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
start() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Starting 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Mounting chroot directories...&amp;quot;&lt;br /&gt;
        mount -o bind /dev $CHROOTDIR/dev &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        if [ -d /dev/pts ]; then&lt;br /&gt;
            mount -o bind /dev/pts $CHROOTDIR/dev/pts &amp;gt;/dev/null &lt;br /&gt;
        fi &amp;amp;&amp;amp;&lt;br /&gt;
        if [ -d /dev/shm ]; then&lt;br /&gt;
            mount -o bind /dev/shm $CHROOTDIR/dev/shm &amp;gt;/dev/null &lt;br /&gt;
        fi &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /proc $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        if [ -d /proc/bus/usb ]; then&lt;br /&gt;
            mount -o bind /proc/bus/usb $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null &lt;br /&gt;
        fi &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /sys $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /tmp $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /home $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /media/lain $CHROOTDIR/media/lain &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /media/maelstrom $CHROOTDIR/media/maelstrom &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        mount -o bind /media/vortex $CHROOTDIR/media/vortex &amp;gt;/dev/null &lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Copying essential files...&amp;quot;&lt;br /&gt;
        cp -afr /etc/resolv.conf $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/passwd $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/shadow $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/group $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/hosts $CHROOTDIR/etc &amp;gt; /dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/localtime $CHROOTDIR/etc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        cp -afr /etc/nsswitch.conf $CHROOTDIR/etc &amp;gt;/dev/null &lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stop() {&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Stopping 32bit chroot...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;    Unmounting 32bit chroot directories...&amp;quot;&lt;br /&gt;
        umount -fl $CHROOTDIR/media/vortex &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/media/maelstrom &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/media/lain &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/home &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/tmp &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/sys &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        if [ -d $CHROOTDIR/proc/bus/usb ]; then&lt;br /&gt;
            umount -fl $CHROOTDIR/proc/bus/usb &amp;gt;/dev/null &lt;br /&gt;
        fi &amp;amp;&amp;amp;&lt;br /&gt;
        umount -f $CHROOTDIR/proc &amp;gt;/dev/null &amp;amp;&amp;amp;&lt;br /&gt;
        if [ -d $CHROOTDIR/dev/shm ]; then&lt;br /&gt;
            umount -fl $CHROOTDIR/dev/shm &amp;gt;/dev/null &lt;br /&gt;
        fi &amp;amp;&amp;amp;&lt;br /&gt;
        if [ -d $CHROOTDIR/dev/pts ]; then&lt;br /&gt;
            umount -fl $CHROOTDIR/dev/pts &amp;gt;/dev/null &lt;br /&gt;
        fi &amp;amp;&amp;amp;&lt;br /&gt;
        umount -fl $CHROOTDIR/dev &amp;gt;/dev/null&lt;br /&gt;
        exitcode=$?&lt;br /&gt;
        [ ${exitcode} -eq 0 ] &amp;amp;&amp;amp; echo -e $RESULT_OK&lt;br /&gt;
        [ ${exitcode} -ne 0 ] &amp;amp;&amp;amp; echo -e $RESULT_FAIL&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
. /lib/lsb/init-functions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now run “chkconfig –add lunar32chroot” to create the essential init scripts/symlinks for the different runlevels and you’re done.&lt;br /&gt;
&lt;br /&gt;
===Entering Chroot - Script===&lt;br /&gt;
With this Script you just need to type “lunar32″ to enter the chroot environment. Keep in mind the &amp;quot;linux32&amp;quot; command should be available on all boxes, you dont need to install additional software. However its part of &amp;quot;util-linux&amp;quot;.&lt;br /&gt;
&amp;lt;pre&amp;gt;$ cat /usr/bin/lunar32&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# little script to reduce some things to just one command&lt;br /&gt;
# especially for lazy people like me.&lt;br /&gt;
&lt;br /&gt;
source /etc/lunar32chroot.conf&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Entering chroot...&amp;quot;&lt;br /&gt;
linux32 chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Hint from Beko&amp;lt;/strong&amp;gt;&lt;br /&gt;
Beko has shown me a dirty way (as he said) of doing the same using sudo, thus you can enter the environment without beeing root:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
linux32 sudo chroot &amp;quot;$CHROOTDIR&amp;quot; /bin/bash -c &amp;quot;su $WHOAMI&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Negative Sideeffects: you're landing in / at the start and sudo has to run with NOPASS. Thats why this solution is dirty and might be a security risk. However.. :-) &amp;lt;b&amp;gt;By the way&amp;lt;/b&amp;gt; Of course you want to replace $WHOAMI with your username - or a variable containing the current username.&lt;br /&gt;
&lt;br /&gt;
==Applications==&lt;br /&gt;
===Fonts===&lt;br /&gt;
For most applications you will need some X11 Fonts installed within the Chroot. Its enough if you install these:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr mkfontdir mkfontscale bdftopcf font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-75dpi font-adobe-utopia-100dpi font-adobe-utopia-type1 font-bitstream-100dpi font-bitstream-75dpi font-bh-lucidatypewriter-100dpi font-bh-lucidatypewriter-75dpi&amp;lt;/pre&amp;gt;&lt;br /&gt;
some of them might not be needed, but well doesnt hurt to install them.&lt;br /&gt;
&lt;br /&gt;
===Skype===&lt;br /&gt;
If you want to use Skype you will have to install some more libraries and tools:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd /var/lib/lunar/moonbase&lt;br /&gt;
cp -rva qt4-apps/qt4 zlocal/&lt;br /&gt;
cd zlocal/qt4&lt;br /&gt;
vim DEPENDS&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remove this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;depends  %X&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally install needed stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;lin -cr dbus alsa-utils videoproto libXv scrnsaverproto libXScrnSaver qt4&amp;lt;/pre&amp;gt;&lt;br /&gt;
It might be needed to install dbus-qt3 (not sure) if so, you have to copy the module to zlocal and edit the DEPENDS file (of qt3 and of dbus-qt3) to remove the X Dependecy.&lt;br /&gt;
&lt;br /&gt;
Skype should now work. You might want to look at the &amp;quot;fonts&amp;quot; Section because skype will display broken fonts :)&lt;br /&gt;
&lt;br /&gt;
==Useful Documentation:==&lt;br /&gt;
* http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&amp;amp;amp;chap=2 [English]&lt;br /&gt;
* http://ubuntuforums.org/showthread.php?t=24575 [English]&lt;br /&gt;
* http://wiki.ubuntuusers.de/32-Bit_chroot [German]&lt;br /&gt;
* http://www.debian-administration.org/article/Installing_apps_in_a_32-bit_chroot_in_AMD64_Debian_system [English]&lt;/div&gt;</summary>
		<author><name>Keitekk</name></author>	</entry>

	<entry>
		<id>http://doc.lunar-linux.org/Module_Basics</id>
		<title>Module Basics</title>
		<link rel="alternate" type="text/html" href="http://doc.lunar-linux.org/Module_Basics"/>
				<updated>2007-09-03T11:12:35Z</updated>
		
		<summary type="html">&lt;p&gt;Keitekk: /* The CONFIGURE script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
In ''Lunar'' parlance, software packages are called [[modules]]. The collection of all modules is the [[moonbase]], which is simply a directory (usually &amp;lt;code&amp;gt;/var/lib/lunar/moonbase/&amp;lt;/code&amp;gt;) containing ''sections'' (i.e. directories) which in turn contain the [[module]] directories.&lt;br /&gt;
&lt;br /&gt;
A module is simply a directory containing the scripts necessary to build a software package, and optionally configuration files which may be needed in &amp;lt;code&amp;gt;/etc&amp;lt;/code&amp;gt;. Some modules require only a [[DETAILS]] file, however this is only the case for a few of the modules in the entire moonbase. In each case, after [[DETAILS]], [[DEPENDS]], and [[CONFIGURE]], where a module can use lunar's default internal function(s), there is no need for a module-specific script.&lt;br /&gt;
&lt;br /&gt;
* [[DETAILS]] sets version, source URL(s) and other critical data&lt;br /&gt;
* [[CONFLICTS]] specifies modules which must (will) be removed by module&lt;br /&gt;
* [[CONFIGURE]] interactive script where build options can be set&lt;br /&gt;
* [[DEPENDS]] specifies required and optional packages&lt;br /&gt;
* [[PRE_REMOVE]] used by [[lrm]]; actions which must preceed removal&lt;br /&gt;
* [[PRE_BUILD]] most often used for patching, unpacking addional source tarballs&lt;br /&gt;
* [[BUILD]] runs necessary variations on: configure; make; make install&lt;br /&gt;
* [[POST_BUILD]] install configuration scripts and data.&lt;br /&gt;
* [[POST_INSTALL]] messages, notes more cleanups, configuration fixes&lt;br /&gt;
* [[POST_REMOVE]] used by [[lrm]]; actions which must follow removal&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== Package Build and Install Scripts ==&lt;br /&gt;
&lt;br /&gt;
The following scripts are used by [[lin]] or indirectly by [[lunar]] when building modules.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The DETAILS script ===&lt;br /&gt;
&lt;br /&gt;
Every module is required to have at least a [[DETAILS]] file. A minimal [[DETAILS]] may appear as follows: (&amp;lt;code&amp;gt;/var/lib/lunar/moonbase/editors/emacs/DETAILS&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
           MODULE=emacs&lt;br /&gt;
          VERSION=21.3&lt;br /&gt;
           SOURCE=$MODULE-$VERSION.tar.gz&lt;br /&gt;
       SOURCE_URL=$GNU_URL/$MODULE&lt;br /&gt;
       SOURCE_URL=&amp;lt;nowiki&amp;gt;ftp://ftp.gnu.org/pub/gnu/$MODULE&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
       SOURCE_VFY=sha1:94d7ae9cb3aef05159cfff148265fc9ce0973980&lt;br /&gt;
         WEB_SITE=&amp;lt;nowiki&amp;gt;http://www.gnu.org/software/emacs&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
          ENTERED=20010922&lt;br /&gt;
          UPDATED=20020529&lt;br /&gt;
            SHORT=&amp;quot;the extensible, self-documenting real-time display editor&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF&lt;br /&gt;
 Emacs is the extensible, customizable, self-documenting real-time&lt;br /&gt;
 display editor. &lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
Other SOURCE_URLS in lunar : &lt;br /&gt;
* $GNOME_URL : GNOME mirrors&lt;br /&gt;
* $GNU_URL : GNU mirrors&lt;br /&gt;
* $KDE_URL : KDE mirrors&lt;br /&gt;
* $SFORGE_URL : SourceForge mirrors&lt;br /&gt;
* $LRESORT_URL : lunar-linux mirrors&lt;br /&gt;
* $XFREE86_URL : XFree86 mirrors&lt;br /&gt;
&lt;br /&gt;
Other optional fields :&lt;br /&gt;
* If the application does not compile on more than one thread, add: PSAFE=&amp;quot;no&amp;quot; or PSAFE=no&lt;br /&gt;
* If the tarball is not extracting into the default $MODULE-$VERSION (e.g. emacs-21.7), add: SOURCE_DIRECTORY=$BUILD_DIRECTORY/&amp;quot;$MODULE&amp;quot;_&amp;quot;$VERSION&amp;quot;_src&lt;br /&gt;
* If you want your name in the module and be listed as maintainer and like to be notified when somebody modifies the module, add : MAINTAINER=youremailadress&lt;br /&gt;
* If you have more than one SOURCE_URL, list them as: SOURCE_URL=, SOURCE_URL[1]=, SOURCE_URL[2]=, ...&lt;br /&gt;
* If you have more than one SOURCE, list them as: SOURCE ,SOURCE2, SOURCE3, ... (don't forget to tell the BUILD script what to do with it...) and add a SOURCE1_URL as well...&lt;br /&gt;
* If you want to force lunar to use the gcc4 compiler for this module, add: LUNAR_COMPILER=GCC_4_0 or GCC_3_4 for gcc3&lt;br /&gt;
&lt;br /&gt;
Update the UPDATED field only when you have added something that will change the compile behaviour, updated the version or you added configure options... don't change it just for outlining the DETAILS or BUILD or... file, so in general don't force ppl to recompile if all you did what tweaking around a bit...&lt;br /&gt;
&lt;br /&gt;
sha1 checksums are preferred, md5sums can be listed as SOURCE_VFY=md5: &lt;br /&gt;
&lt;br /&gt;
If you find a MAINTAINER field please respect this and notify the person listed there that you will or have updated his module.&lt;br /&gt;
&lt;br /&gt;
With comments, default values:&lt;br /&gt;
&lt;br /&gt;
           MODULE=emacs                                       # Module name, yes it's redundant&lt;br /&gt;
          VERSION=21.3                                        # Version, changes *often*&lt;br /&gt;
           SOURCE=$MODULE-$VERSION.tar.gz                     # Source filename&lt;br /&gt;
 SOURCE_DIRECTORY=$BUILD_DIRECTORY/$MODULE-$VERSION           # Where source unpacks&lt;br /&gt;
                                                              # ($BUILD_DIRECTORY=/usr/src)&lt;br /&gt;
    SOURCE_URL[0]=$GNU_URL/$MODULE                            # Download URL&lt;br /&gt;
    SOURCE_URL[1]=&amp;lt;nowiki&amp;gt;ftp://ftp.gnu.org/pub/gnu/$MODULE&amp;lt;/nowiki&amp;gt;   # Alternate URL(s)&lt;br /&gt;
       SOURCE_VFY=sha1:94d7ae9cb3aef05159cfff148265fc9ce0973980 # Sets sha1 hash or pgp/gpg sig url&lt;br /&gt;
         WEB_SITE=&amp;lt;nowiki&amp;gt;http://www.gnu.org/software/emacs&amp;lt;/nowiki&amp;gt;           # where to learn more&lt;br /&gt;
          ENTERED=20010922                                    # First appearance in moonbase&lt;br /&gt;
          UPDATED=20020529                                    # Date of latest change.&lt;br /&gt;
                                                              # Force update by setting this&lt;br /&gt;
 &lt;br /&gt;
 # The remaining lines are used for input to the 'lvu what' command&lt;br /&gt;
 # and are best copied from the source-maintainer's own description.&lt;br /&gt;
 &lt;br /&gt;
            SHORT=&amp;quot;the extensible, self-documenting real-time display editor&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF&lt;br /&gt;
 Emacs is the extensible, customizable, self-documenting real-time&lt;br /&gt;
 display editor. &lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
=== The DEPENDS script ===&lt;br /&gt;
&lt;br /&gt;
The [[DEPENDS]] script is essential to configuration management, and is the key to the overall operation of lunar. Dependencies should be exactly specified, preferably not assuming the presence of any other modules, while knowing the sub-dependencies of the modules which are added and not adding those explictly where not needed.&lt;br /&gt;
&lt;br /&gt;
'''Warning''' - Getting this right is difficult. Because the state of installed packages may vary widely, it's important to have a good understanding of what might be or not be installed on a target system.&lt;br /&gt;
&lt;br /&gt;
'''Note''' - By convention Lunar does not include the X Window System, xfree86 or XOrg, in any dependency. There are two reasons for this choice. First we expect that users must understand that to use a graphical application locally, the X Window System must be installed. Second, due to the sligtly unusual definition of client and server used by X11, it is often in fact possible to build graphical applications and tools for remote display, without the server components locally installed. At some future date we may elect to provide a client-only installation of xfree86.&lt;br /&gt;
&lt;br /&gt;
[[DEPENDS]] may include both required and optional dependencies. The '''depends()''' function statement simply determines one required package. The optional_depends function is a little more complex. It consists of the required package, necessary --options to give to &amp;lt;code&amp;gt;./configure&amp;lt;/code&amp;gt; for yes and no respectively, and an explanatory comment telling the user the purpose of the option being presented. A typical [[DEPENDS]] file might appear as follows: (&amp;lt;code&amp;gt;/var/lib/lunar/moonbase/devel/subversion/DEPENDS&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 depends zlib    &amp;amp;&amp;amp;&lt;br /&gt;
 depends openssl &amp;amp;&amp;amp;&lt;br /&gt;
 optional_depends &amp;quot;db4&amp;quot; &amp;quot;--with-berkeley-db&amp;quot;  &amp;quot;&amp;quot;   &amp;quot;for creating local repositories&amp;quot;&lt;br /&gt;
 #                  ^            ^            ^                  ^&lt;br /&gt;
 #                  |            |            |                  |&lt;br /&gt;
 #     optional package       if &amp;quot;Y&amp;quot;       if &amp;quot;N&amp;quot;       explanatory comment&lt;br /&gt;
 #                        { ./configure strings }&lt;br /&gt;
&lt;br /&gt;
Many old modules use '&amp;amp;&amp;amp;' in [[DEPENDS]] to be consistent with [[BUILD]] files, but the '&amp;amp;&amp;amp;' delimiter is not required and new [[DEPENDS]] files should not use it.&lt;br /&gt;
&lt;br /&gt;
'''Aliases'''&lt;br /&gt;
&lt;br /&gt;
Aliases are a mean to select a generic module. When you need a functionnality that can be provided by two or more softwares, you can select one of them to provide a correct dependency.&lt;br /&gt;
&lt;br /&gt;
Example /var/lib/lunar/moonbase/aliases:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 %APACHE:apache apache2 apache-mod_ssl&lt;br /&gt;
 %FAM:fam gamin&lt;br /&gt;
 %GECKO_RENDERER: firefox thunderbird mozilla&lt;br /&gt;
 %GHOSTSCRIPT:espgs ghostscript&lt;br /&gt;
 %MTA:postfix exim sendmail esmtp&lt;br /&gt;
 %SLANG:slang slang2&lt;br /&gt;
 %X:XOrg XOrg-test xfree86 xfree86-beta&lt;br /&gt;
 %XMLRENDERER: libxml2 expat&lt;br /&gt;
 %XSCREENSAVER:xscreensaver xscreensaver-gtk1 xscreensaver-kde&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example you can choose %X instead of XOrg in a module that would depends on any X server:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 depends %X&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The CONFLICTS script ===&lt;br /&gt;
&lt;br /&gt;
This script is simply used to specify modules which will be removed when a given module is installed. An example would be: (&amp;lt;code&amp;gt;/var/lib/lunar/moonbase/editors/elvis/CONFLICTS&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 conflicts vim&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The CONFIGURE script ===&lt;br /&gt;
&lt;br /&gt;
The [[CONFIGURE]] script is used to collect interactive input from the user on optional parameters for the software build. use the '''query''' function and provide a default answer to each question. The results of the answers are then used to store configuration variables needed in configuration state files. An a simple example might be: (&amp;lt;code&amp;gt;/var/lib/lunar/moonbase/crypto/gnupg/CONFIGURE&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 if ! grep -q CONFIGURED $MODULE_CONFIG ; then&lt;br /&gt;
   if query &amp;quot;Enable experimental external HKP keyserver interface? &amp;quot; n ; then&lt;br /&gt;
     OPTS=&amp;quot;$OPTS --enable-external-hkp&amp;quot;&lt;br /&gt;
   fi&lt;br /&gt;
   echo 'CONFIGURED=&amp;quot;y&amp;quot;' &amp;gt;&amp;gt; $MODULE_CONFIG&lt;br /&gt;
   echo 'OPTS='\&amp;quot;$OPTS\&amp;quot; &amp;gt;&amp;gt; $MODULE_CONFIG&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
Another way is using '''mquery''' like the lilo module does:&lt;br /&gt;
&lt;br /&gt;
 mquery RUN_LILO &amp;quot;Run LILO automatically upon LILO upgrades?&amp;quot; y&lt;br /&gt;
&lt;br /&gt;
 mquery ENABLE_FOO &amp;quot;Enable foo?&amp;quot; n &amp;quot;--enable-foo --enable-foo2&amp;quot; &amp;quot;--disable-foo --disable-foo2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Where &amp;quot;No&amp;quot; would be the default answer for the user. When he chooses to enable-foo, then answer &amp;quot;yes&amp;quot; would be stored in the ENABLE_FOO variable and --enable-foo and --enable-foo2 will get added to the ./configure command in the BUILD script.&lt;br /&gt;
&lt;br /&gt;
=== The PRE_BUILD script ===&lt;br /&gt;
&lt;br /&gt;
[[PRE_BUILD]] is used where special processing is needed before undertaking the actual build steps. Typical requirements include unpacking multiple sources, creating necessary system or source-tree direcotries and applying source patches. And example would be: (&amp;lt;code&amp;gt;/var/lib/lunar/moonbase/doc-tools/html2db/PRE_BUILD&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 mk_source_dir $SOURCE_DIRECTORY  &amp;amp;&amp;amp;&lt;br /&gt;
 unpack $SOURCE                   &amp;amp;&amp;amp;&lt;br /&gt;
 cd $MODULE&lt;br /&gt;
 unpack $SOURCE2&lt;br /&gt;
 cd tidy&lt;br /&gt;
 patch_it $SOURCE_CACHE/$SOURCE3 0&lt;br /&gt;
 cd /usr/src/$MODULE&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The BUILD script ===&lt;br /&gt;
&lt;br /&gt;
[[BUILD]] is used where the '''default_build()''' function does not work for a given software package. For reference the commands run by default are:&lt;br /&gt;
&lt;br /&gt;
Function '''default_build()''' calls '''default_config''' which executes:&lt;br /&gt;
&lt;br /&gt;
   ./configure  --build=$BUILD            \&lt;br /&gt;
                --prefix=/usr             \&lt;br /&gt;
                --sysconfdir=/etc         \&lt;br /&gt;
                --localstatedir=/var      \&lt;br /&gt;
                --infodir=/usr/share/info \&lt;br /&gt;
                --mandir=/usr/share/man   \&lt;br /&gt;
                $OPTS&lt;br /&gt;
&lt;br /&gt;
Next, '''default_build()''' calls '''default_make''' which executes:&lt;br /&gt;
&lt;br /&gt;
   make &amp;amp;&amp;amp;&lt;br /&gt;
   prepare_install &amp;amp;&amp;amp;&lt;br /&gt;
   make install&lt;br /&gt;
&lt;br /&gt;
If you have modules from git,svn or cvs, the ''configure'' script is missing most of the time. You can then use the ''default_cvs_build()'' function. The commands run are:&lt;br /&gt;
&lt;br /&gt;
    ./autogen.sh --prefix=/usr  &lt;br /&gt;
    &lt;br /&gt;
it will then call ''default_make()''            &lt;br /&gt;
&lt;br /&gt;
Where this build configuration does not work, the [[BUILD]] script is used to provide the needed steps. About 75% of modules need a [[BUILD]] script. Two examples include: (&amp;lt;code&amp;gt;/var/lib/lunar/moonbase/archive/gzip/BUILD&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 (&lt;br /&gt;
  ./configure --build=$BUILD            \&lt;br /&gt;
              --prefix=/usr             \&lt;br /&gt;
              --bindir=/bin             \&lt;br /&gt;
              --infodir=/usr/share/info \&lt;br /&gt;
              --mandir=/usr/share/man   &amp;amp;&amp;amp;&lt;br /&gt;
  make &amp;amp;&amp;amp;&lt;br /&gt;
  prepare_install &amp;amp;&amp;amp;&lt;br /&gt;
  make bindir=/bin install&lt;br /&gt;
 ) &amp;gt; $C_FIFO 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
and: (&amp;lt;code&amp;gt;/var/lib/lunar/moonbase/editors/ex/BUILD&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 (&lt;br /&gt;
   cd $SOURCE_DIRECTORY                    &amp;amp;&amp;amp;&lt;br /&gt;
   sedit 's/usr.local/usr/' Makefile       &amp;amp;&amp;amp;&lt;br /&gt;
   sedit 's/= man/= share\/man/' Makefile  &amp;amp;&amp;amp;&lt;br /&gt;
   sedit 's/ucb/bin/' Makefile             &amp;amp;&amp;amp;&lt;br /&gt;
   sedit 's/= termlib/= ncurses/' Makefile &amp;amp;&amp;amp;&lt;br /&gt;
   make                                    &amp;amp;&amp;amp;&lt;br /&gt;
   prepare_install                         &amp;amp;&amp;amp;&lt;br /&gt;
   make install&lt;br /&gt;
 ) &amp;gt; $C_FIFO 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
The first example is a build which needs non-standard 'configure' and 'make install' commands. The second is a build which does not use gnu auto-tools' 'configure' script.&lt;br /&gt;
&lt;br /&gt;
In the examples above, the [[BUILD]] scripts contain multiple commands separated by '&amp;amp;&amp;amp;' to ensure that execution stops as soon as any command fails. The '&amp;amp;&amp;amp;' are 'and' operations: the command after the '&amp;amp;&amp;amp;' will only be run if the one before the '&amp;amp;&amp;amp;' completed successfully. The use of '&amp;amp;&amp;amp;' is '''required''' in multi-command [[BUILD]] scripts.&lt;br /&gt;
&lt;br /&gt;
'''Note''' - [[BUILD]] scripts must execute inside a (), called a subshell invocation, construct and output is always directed to a named pipe (aka FIFO). Therefor all [[BUILD]] files take the follwing form:&lt;br /&gt;
&lt;br /&gt;
 (&lt;br /&gt;
   # commands are put here&lt;br /&gt;
 ) &amp;gt; $C_FIFO 2&amp;gt;&amp;amp;1     # $C_FIFO holds the name of a fifo in /tmp used for 'voyeur'&lt;br /&gt;
&lt;br /&gt;
=== The POST_BUILD script ===&lt;br /&gt;
&lt;br /&gt;
[[POST_BUILD]] runs in place of the '''default_post_build''' routine which is used to install minor documentation and transfer/enable initialization scripts and similar system data, mostly into &amp;lt;code&amp;gt;/etc&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
[[POST_BUILD]] script usage is '''deprecated'''. You should install your config files in [[BUILD]] (remember not to overwrite previous config files!) or install defaults from [[POST_INSTALL]] (again, do not overwrite present files!). The ability to use a [[POST_BUILD]] script is purely for certain internal functions.&lt;br /&gt;
&lt;br /&gt;
=== The POST_INSTALL script ===&lt;br /&gt;
&lt;br /&gt;
[[POST_INSTALL]] has no equivalent functions, and is run to handle post-installation work in a general manner. An example is: (&amp;lt;code&amp;gt;/var/lib/lunar/moonbase/compilers/gcc/POST_INSTALL&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 cd /usr/lib/gcc-lib/$BUILD/$VERSION                      &amp;amp;&amp;amp;&lt;br /&gt;
 ln    -sf /usr/bin/cpp cpp                               &amp;amp;&amp;amp;&lt;br /&gt;
 cd /lib/                                                 &amp;amp;&amp;amp;&lt;br /&gt;
 ln    -sf /usr/bin/cpp cpp                               &amp;amp;&amp;amp; &lt;br /&gt;
 if [ ! -e /usr/bin/cc ] ; then&lt;br /&gt;
   ln -s gcc /usr/bin/cc&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
As in the [[BUILD]] scripts, the '&amp;amp;&amp;amp;' represent 'and' operations, but their use in [[POST_INSTALL]] scripts is '''preferred''' rather than '''required'''.&lt;br /&gt;
&lt;br /&gt;
== Package Removal Scripts ==&lt;br /&gt;
&lt;br /&gt;
Module removal is handled by [[lrm]]. Because installation is monitored and backup tarballs are created using installwatch, most of package removal is handled automatically using the logs created by installwatch. However we provide for additional actions to be taken through the [[PRE_REMOVE]] and [[POST_REMOVE]] scripts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The PRE_REMOVE script ===&lt;br /&gt;
&lt;br /&gt;
[[PRE_REMOVE]] is needed to execute any tasks needed prior to the main task of removing all files installed by the module. An example would be: (&amp;lt;code&amp;gt;/var/lib/lunar/moonbase/mail/docbook-3.1/PRE_REMOVE&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 CENTRALIZED=/etc/sgml/catalog&lt;br /&gt;
 DOCBOOK_INSTALL_DIR=/usr/share/sgml/docbook/$VERSION&lt;br /&gt;
 install-catalog -r $CENTRALIZED $DOCBOOK_INSTALL_DIR/catalog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The POST_REMOVE Script ===&lt;br /&gt;
&lt;br /&gt;
[[POST_REMOVE]] may be used to remove data not tracked by installwatch and to correctly adjust remaining configuration files and data. Examples would include: (&amp;lt;code&amp;gt;/var/lib/lunar/moonbase/devel/binutils/POST_REMOVE&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 install-info  --delete as         --info-dir /usr/info&lt;br /&gt;
 install-info  --delete bfd        --info-dir /usr/info&lt;br /&gt;
 install-info  --delete binutils   --info-dir /usr/info&lt;br /&gt;
 install-info  --delete configure  --info-dir /usr/info&lt;br /&gt;
 install-info  --delete gasp       --info-dir /usr/info&lt;br /&gt;
 install-info  --delete gprof      --info-dir /usr/info&lt;br /&gt;
 install-info  --delete ld         --info-dir /usr/info&lt;br /&gt;
&lt;br /&gt;
or: (&amp;lt;code&amp;gt;/var/lib/lunar/moonbase/compilers/php/POST_REMOVE&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
 if    module_installed  apache;  then&lt;br /&gt;
   cp        /etc/httpd/httpd.conf       /tmp/httpd.conf&lt;br /&gt;
   grep  -v  &amp;quot;LoadModule php4_module&amp;quot;    /tmp/httpd.conf  |&lt;br /&gt;
   grep  -v  &amp;quot;AddModule mod_php4.c&amp;quot;   &amp;gt;  /etc/httpd/httpd.conf&lt;br /&gt;
   rm    -f  /tmp/httpd.conf&lt;br /&gt;
 elif  module_installed  apache_mod_ssl;  then&lt;br /&gt;
   cp        /etc/httpsd/httpd.conf      /tmp/httpd.conf&lt;br /&gt;
   grep  -v  &amp;quot;LoadModule php4_module&amp;quot;    /tmp/httpd.conf  |&lt;br /&gt;
   grep  -v  &amp;quot;AddModule mod_php4.c&amp;quot;   &amp;gt;  /etc/httpsd/httpd.conf&lt;br /&gt;
   rm    -f  /tmp/httpd.conf&lt;br /&gt;
 fi&lt;/div&gt;</summary>
		<author><name>Keitekk</name></author>	</entry>

	<entry>
		<id>http://doc.lunar-linux.org/User:Keitekk</id>
		<title>User:Keitekk</title>
		<link rel="alternate" type="text/html" href="http://doc.lunar-linux.org/User:Keitekk"/>
				<updated>2007-09-03T11:10:24Z</updated>
		
		<summary type="html">&lt;p&gt;Keitekk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''stuff test area'''&lt;br /&gt;
''wikis are interesting''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[http://www.sikkk.info weblog]&lt;br /&gt;
&lt;br /&gt;
--[[User:Keitekk|_ktx]] 13:10, 3 Sep 2007 (CEST)&lt;/div&gt;</summary>
		<author><name>Keitekk</name></author>	</entry>

	</feed>