Debian Linux in Chroot

I have two Linux installations in my hard drive, and I want to modify
Linux-2 from Linux-1, using Chroot. Basically "dpkg-reconfigure" and similar
stuff. How do I tell DPKG of Linux-2 to not disturb the daemons that are
running in Linux-1?

--
Masatran, R. Deepak

No votes yet

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Debian Linux in Chroot

Masatran, R. Deepak wrote:
> I have two Linux installations in my hard drive, and I want to modify
> Linux-2 from Linux-1, using Chroot. Basically "dpkg-reconfigure" and similar
> stuff. How do I tell DPKG of Linux-2 to not disturb the daemons that are
> running in Linux-1?
>

Say you are booted into Linux1, and linux 2 is mounted at /linux2, you
need to do this (assuming they are both recent distrobutions):

mount -t proc proc /linux2/proc
chroot /linux2

then inside the chroot, whatever you do should not disturb what's
cooking in Linux-1

Remember to unmount proc from Linux-2 after leaving the chroot.

--

Debian Linux in Chroot

I have also thought heavily about doing this sort of thing, for developing and
testing and such. My understanding is that there would be very close to
having two differant GNU/Linux operating systems running at once, but using
only one kernel. Once inside the chroot, BASH would be using tools
from /linux2/usr/bin, is that correct?

My understanding of chroot is extremely limited, right now. I have searched
around, but can anyone point me to anything specific that they know to be a
good tutorial/explanation or how chroot works and what its capabilities are?

On Tuesday 31 July 2007 7:15 am, koffiejunkie wrote:
> Masatran, R. Deepak wrote:
> > I have two Linux installations in my hard drive, and I want to modify
> > Linux-2 from Linux-1, using Chroot. Basically "dpkg-reconfigure" and
> > similar stuff. How do I tell DPKG of Linux-2 to not disturb the daemons
> > that are running in Linux-1?
>
> Say you are booted into Linux1, and linux 2 is mounted at /linux2, you
> need to do this (assuming they are both recent distrobutions):
>
> mount -t proc proc /linux2/proc
> chroot /linux2
>
> then inside the chroot, whatever you do should not disturb what's
> cooking in Linux-1
>
> Remember to unmount proc from Linux-2 after leaving the chroot.

--
Matthew K Poer
Location: GA, USA Web: http://matthewpoer.freehostia.com
GnuPG Public Key: 4DD0A9A6 Keyserver: subkeys.pgp.net

Debian Linux in Chroot

On Tue, 31 Jul 2007 08:04:10 -0400, Matthew K Poer wrote:

> My understanding of chroot is extremely limited, right now. I have searched
> around, but can anyone point me to anything specific that they know to be a
> good tutorial/explanation or how chroot works and what its capabilities are?

Check this out:

System Chroot And Debootstrap
http://xpt.sourceforge.net/techdocs/nix/chroot/

HTH

--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/

--

Debian Linux in Chroot

- Tong - wrote:
> Matthew K Poer wrote:
>
> > My understanding of chroot is extremely limited, right now. I have
> > searched around, but can anyone point me to anything specific that
> > they know to be a good tutorial/explanation or how chroot works
> > and what its capabilities are?
>
> Check this out:
>
> System Chroot And Debootstrap
> http://xpt.sourceforge.net/techdocs/nix/chroot/

Also see:

http://www.debian.org/doc/manuals/reference/ch-tips.en.html#s-chroot

Bob

--

Debian Linux in Chroot

On 7/31/07, Matthew K Poer wrote:
> My understanding of chroot is extremely limited, right now. I have searched
> around, but can anyone point me to anything specific that they know to be a
> good tutorial/explanation or how chroot works and what its capabilities are?

chroot is a system call that causes all descended processes to treat a
directory in the filesystem as the root directory (/). When you do
this to an interactive Bash shell, you then have the ability to launch
programs and do development work, etc. from this chroot.

Debian has good tools for doing this sort of thing--debootstrap and
friends can install a new system (etch, lenny, sid, and more) in a
folder for you, and you can even install an entire 32-bit userland on
a 64-bit system, which is useful for running 32-bit Firefox with stuff
like the non-free Adobe Flash plugin (FYI-if you're going to point out
nspluginwrapper, please also tell me how to make sound with PulseAudio
work in that setup). Then there are tools like schroot (apt-get
install schroot) which can be configured to launch programs from
inside the chroot in one command line, complete with 32-bit uname()
emulation if so desired.

--
Andrew Barr

We matter more than pounds and pence,
your economic theory makes no sense...

--

Debian Linux in Chroot

Wow, you seem to be really singing the praises of chroot.

I have a spare 10gig partition on my hard drive. I originally considered
simply dual-booting Etch and Lenny, or Etch and Feisty, or something similar.
Perhaps instead I will make it a chroot jail for Lenny.

Big question answered: you can run X clients (applications) on your local,
non-chroot Xserver (display).

So, again, it is a completely separate operating system installation, running
on the same kernel as the active, base OS?

So how do you handle the /boot partition? Do you have to redirect to the
active kernel, or is this sort of automatically taken care of by debootstrap?
(I have never used debootstrap).

On Tuesday 31 July 2007 7:25 pm, Andrew J. Barr wrote:
> On 7/31/07, Matthew K Poer wrote:
> > My understanding of chroot is extremely limited, right now. I have
> > searched around, but can anyone point me to anything specific that they
> > know to be a good tutorial/explanation or how chroot works and what its
> > capabilities are?
>
> chroot is a system call that causes all descended processes to treat a
> directory in the filesystem as the root directory (/). When you do
> this to an interactive Bash shell, you then have the ability to launch
> programs and do development work, etc. from this chroot.
>
> Debian has good tools for doing this sort of thing--debootstrap and
> friends can install a new system (etch, lenny, sid, and more) in a
> folder for you, and you can even install an entire 32-bit userland on
> a 64-bit system, which is useful for running 32-bit Firefox with stuff
> like the non-free Adobe Flash plugin (FYI-if you're going to point out
> nspluginwrapper, please also tell me how to make sound with PulseAudio
> work in that setup). Then there are tools like schroot (apt-get
> install schroot) which can be configured to launch programs from
> inside the chroot in one command line, complete with 32-bit uname()
> emulation if so desired.

--
Matthew K Poer
Location: GA, USA Web: http://matthewpoer.freehostia.com
GnuPG Public Key: 4DD0A9A6 Keyserver: subkeys.pgp.net

Debian Linux in Chroot

On 7/31/07, Matthew K Poer wrote:
> Wow, you seem to be really singing the praises of chroot.
>
> I have a spare 10gig partition on my hard drive. I originally considered
> simply dual-booting Etch and Lenny, or Etch and Feisty, or something similar.
> Perhaps instead I will make it a chroot jail for Lenny.

You don't need partitions for chroots, you can just make them in a
folder on your root filesystem, say /var/chroot. This is more flexible
than a partition, so you might consider merging that 10gb partition
into your root file system--you can use gparted on a LiveCD for easy
point-and-click partition editing (I've found Ubuntu LiveCDs
particularly useful for this).

> Big question answered: you can run X clients (applications) on your local,
> non-chroot Xserver (display).

Yes, remember--X is a network protocol and you can run clients on any
network-connected computer, regardless of architecture or operating
system.

> So, again, it is a completely separate operating system installation, running
> on the same kernel as the active, base OS?

Yes.

> So how do you handle the /boot partition? Do you have to redirect to the
> active kernel, or is this sort of automatically taken care of by debootstrap?
> (I have never used debootstrap).

The system is already booted when you enter into your chroot. There is
no need for /boot, as the kernel is already loaded into memory.
However, if you want to have folders from your main system available
in your chroot, 'mount --bind' is your friend.

--
Andrew Barr

We matter more than pounds and pence,
your economic theory makes no sense...

--

Debian Linux in Chroot

Am 2007-07-31 12:15:33, schrieb koffiejunkie:
> Say you are booted into Linux1, and linux 2 is mounted at /linux2, you
> need to do this (assuming they are both recent distrobutions):
>
> mount -t proc proc /linux2/proc

This should be

mount -t none /proc /linux2/proc -o bind

Thanks, Greetings and nice Day
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant

--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSN LinuxMichi
0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)

Debian Linux in Chroot

On Tue, Jul 31, 2007 at 02:31:07PM +0530, Masatran, R. Deepak wrote:
> I have two Linux installations in my hard drive, and I want to modify
> Linux-2 from Linux-1, using Chroot. Basically "dpkg-reconfigure" and similar
> stuff. How do I tell DPKG of Linux-2 to not disturb the daemons that are
> running in Linux-1?

The easiest way is to, on Linux-1, install schroot. Then tell schroot
how to access the chroot. It then takes care of mounting anything
required. For example, on my amd64, I have an i386 chroot installed
under /srv/chroot, and here's my schroot.conf:

[etch-ia32]
type=directory
description=Debian Etch ia32
groups=ssh
run-setup-scripts=true
run-exec-scripts=true
personality=linux32
location=/srv/chroot/etch-ia32

The groups=ssh is a security feature; only people who I trust to run ssh
can run schroot. I generally schroot into the chroot and then run the
command. To do so its just:

$ schroot -pc etch-ia32

The -p means to bring in my environment: usefull if I want to run an X
app.

The -c is telling schroot which chroot to use.

I understand that your chroot in this case is also a fully bootable
instalation on its own, with its own kernel. However, that kernel and
its daemons will not run under a chroot, only when it is booted.

Doug.

--

Syndicate content