Debian within SuSE
From wiki.network-crawler.de
Contents |
Why should I do this?
In my case I need a Debian croos toolchain and my normal notebook system is SuSE 10.1. It was tiresome to reboot my system just to build a little pity program for my embedded SLIND RT Linux. Therefor I desided to install Debian right into my SuSE filesystem and chroot in there.
How to do this
Bootstrapping
Ok first you should know what bootstrapping is. Then you should also know that there is the debootstrap command in Debian. But regrettably SuSE does not have this nice command but - never mind SuSE knows alien!
Download and alien
Download debootstrap i386 or what architecture you have. Then:
alien --to-rpm debootstrap*.deb
Now you have an rpm SuSE understands. Just install it with:
rpm -i debootstrap*.rpm
Install Debian
Now you can install the prefered Debian into your filesystem. In my case I created the directory /debian and install sarge for my 32 bit system in there.
mkdir /debian debootstrap --arch i386 sarge /debian
or s.th. like this:
debootstrap --arch i386 sarge /chroot/sarge/ http://ftp.uni-koeln.de/debian
Prepare the chroot environment
In order to resolve domain names do this:
cp /etc/resolv.conf /debian/etc/
Then chroot in your brand new Debian
chroot /debian
Now you should add some installation sources to your Debian:
echo "deb http://ftp.uni-koeln.de/debian/ sarge main contrib non-free" > /etc/apt/sources.list
To test my Internet connection and because I dislike the original vi:
apt-get update apt-get install vim
Oh before I forget do:
cd /dev mount /proc /sbin/MAKEDEV generic
To keep your Debian /proc file system you should
exit echo "proc-debian /debian/proc proc none 0 0" >> /etc/fstab
Get rid of locale errors
chroot /debian cat > ~/.bashrc << "EOF" set +h umask 022 LC_ALL=POSIX export LC_ALL EOF
How to go on?
What I did you can see here
Bind chroot shell
It is also possible to bin chroot to a tty. For example tty3 and tty4 (switch with Control+Alt+F3 Control+Alt+F4): First install in your chroot environment
apt-get install mingetty
Then edit /etc/inittab and replace the tty3 and tty4 entries with s.th. like this:
3:2345:respawn:/usr/bin/chroot /mnt/chroot /sbin/mingetty tty3 4:2345:respawn:/usr/bin/chroot /mnt/chroot /sbin/mingetty tty4
Be sure, that the path to chroot and to mingetty is correct (differs from distrie to distrie)! Reload inittab with
telinit Q
Or
init 3 ; init 5
Connect to open X server
Example: Start a X server (not in chroot)
X -- :1
Then chroot with this script (user is your user):
#/bin/bash
mount --bind /home/user /debian/home/user mount --bind /tmp /debian/tmp mount /debian/sys mount /debian/proc export DISPLAY=:1 chroot /debian su user
On exit unmount
umount /debian/home/user umount /debian/tmp umount /debian/sys umount /debian/proc
Now you can start X applications like xeyes
xeyes
