Google
 
Web www.bloodpet.tk
phreakfish.blogspot.com emans.blogspot.com

20050623

Kewl chroot tips

8.6.35 chroot

The chroot program, chroot(8), enables us to run different instances of the GNU/Linux environment on a single system simultaneously without rebooting.

One may also run a resource hungry program such as apt-get or dselect under the chroot of a fast host machine while NFS-mounting a slow satellite machine to the host as r/w and the chroot point being the mount point of the satellite machine.


8.6.35.1 Run a different Debian distribution with chroot

A chroot Debian environment can easily be created by the debootstrap command in Woody. For example, to create a Sid chroot on /sid-root while having fast Internet access:

     main # cd / ; mkdir /sid-root
main # debootstrap sid /sid-root http://ftp.debian.org/debian/
... watch it download the whole system
main # echo "proc-sid /sid-root/proc proc none 0 0" >> /etc/fstab
main # mount proc-sid /sid-root/proc -t proc
main # cp /etc/hosts /sid-root/etc/hosts
main # chroot /sid-root /bin/bash
chroot # apt-setup # set-up /etc/apt/sources.list
chroot # vi /etc/apt/sources.list # point the source to unstable
chroot # dselect # you may use aptitude, install mc and vim :-)

At this point you should have a fully working Debian system, where you can play around without fear of affecting your main Debian installation.

This debootstrap trick can also be used to install Debian to a system without using a Debian install disk, but instead one for another GNU/Linux distribution. See http://www.debian.org/releases/stable/i386/ch-preparing#s-linux-upgrade.


8.6.35.2 Setting up login for chroot

Typing chroot /sid-root /bin/bash is easy, but it retains all sorts of environment variables that you may not want, and has other issues. A much better approach is to run another login process on a separate virtual terminal where you can log in to the chroot directly.

Since on default Debian systems tty1 to tty6 run Linux consoles and tty7 runs the X Window System, let's set up tty8 for a chrooted console as an example. After creating a chroot system as described in Run a different Debian distribution with chroot, Section 8.6.35.1, type from the root shell of the main system:

     main # echo "8:23:respawn:/usr/sbin/chroot /sid-root "        "/sbin/getty 38400 tty8"  >> /etc/inittab
main # init q # reload init

8.6.35.3 Setting up X for chroot

You want to run the latest X and GNOME safely in your chroot? That's entirely possible! The following example will make GDM run on virtual terminal vt9.

First install a chroot system using the method described in Run a different Debian distribution with chroot, Section 8.6.35.1. From the root of the main system, copy key configuration files to the chroot system.

     main # cp /etc/X11/XF86Config-4 /sid-root/etc/X11/XF86Config-4
main # chroot /sid-root # or use chroot console
chroot # apt-get install gdm gnome x-window-system
chroot # vi /etc/gdm/gdm.conf # do s/vt7/vt9/ in [servers] section
chroot # /etc/init.d/gdm start

Here, /etc/gdm/gdm.conf was edited to change the first virtual console from vt7 to vt9.

Now you can easily switch back and forth between full X environments in your chroot and your main system just by switching between Linux virtual terminals; e.g. by using Ctrl-Alt-F7 and Ctrl-Alt-F9. Have fun!

[FIXME] Add a comment and link to the init script of the chrooted gdm.


8.6.35.4 Run other distributions with chroot

A chroot environment for another Linux distribution can easily be created. You install a system into separate partitions using the installer of the other distribution. If its root partition is in /dev/hda9:

     main # cd / ; mkdir /other-dist
main # mount -t ext3 /dev/hda9 /other-dist
main # chroot /other-dist /bin/bash

Then proceed as in Run a different Debian distribution with chroot, Section 8.6.35.1, Setting up login for chroot, Section 8.6.35.2, and Setting up X for chroot, Section 8.6.35.3.


8.6.35.5 Build a package with chroot

There is a more specialized chroot package, pbuilder, which constructs a chroot system and builds a package inside the chroot. It is an ideal system to use to check that a package's build-dependencies are correct, and to be sure that unnecessary and wrong build dependencies will not exist in the resulting package.



source: Debian Reference - Chapter 8 - Debian tips

1 Comments:

Anonymous Anonymous said...

If you are in the process of selecting a moving company, here are some points to consider:

§ Established Company

Check older copies of the Qwest Dex yellow pages. This will give you a good indication as to whom the established companies are.

§ Customer Service

Are you talking to an experienced representative or a girl Friday? This can make the difference between making sure the arrangements for your move are accurate. This is simple to determine, are you being asked intelligent relevant questions about your items and conditions or are you simply being quoted an hourly rate?

§ Insurance

What is the amount of the company’s general liability policy? Will the company send you documented proof? Do you have to pay extra for insurance coverage?

§ Repair/Replacement Policy

Will the company guarantee that they will repair or replace any items that their movers damage free of charge to you or will they pay you based upon $0.60 per pound?

§ Professional Full-Time Movers

Does the company use only full-time professional movers or do they utilize labor pool personnel and day laborers?

§ Written Confirmation

Will you receive a written confirmation that includes pricing via e-mail, fax or mail before the movers show up to move you?

§ Arrival Time

Will you receive a two (2) hour window of arrival for the movers or a simple: “we’ll be there sometime in the morning.”

for additional tips on moving contact ##url##

9:48 AM  

Post a Comment

<< Home