Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
chroot jail creation from existing installation
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
compor
n00b
n00b


Joined: 23 Feb 2014
Posts: 1

PostPosted: Sun Feb 23, 2014 3:05 pm    Post subject: chroot jail creation from existing installation Reply with quote

hello,

for development and dependency control reasons, i'd like to create a minimal chroot environment out of an existing (6+ years old - 2.6.24 kernel) gentoo installation that we happened to inherit.
my goal is to offer that environment in relocatable way, so that developers can use it freely on their host systems (with varying distros from debian, ubuntu to even gentoo) and
avoid the hassle of VM's and as part of a jenkins CI configuration.

i've skimmed through the documentation on how to create a chroot jail, but nearly everything i've seen, basically starts off with getting the latest stage 3 tarballs.
my situation differs in that i already have a system up and running.

so, my question boils down on what's the best way to go at it.
should i quickpkg my way through, grabbing from bash to gcc and whatever other packages i need?

i have to admit that my familiarity with gentoo is fairly minimal, but it's growing day by day :-]
any tips and/or pointers to doc are appreciated.
Back to top
View user's profile Send private message
hielvc
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2805
Location: Oceanside, Ca

PostPosted: Mon Feb 24, 2014 8:38 pm    Post subject: Reply with quote

I build packages as I emerge so use a script like this.
Code:
#!/bin/bash
mount -t tmpfs shm /dev/shm
mount -t proc /proc /mnt/gentoo/proc
mount --rbind /dev /mnt/gentoo/dev
mount --rbind /sys /mnt/gentoo/sys
swapon /dev/sd{a,b}2
mount /dev/md3 /mnt/gentoo/
mount /dev/md5 /mnt/gentoo/usr/portage
mount /dev/md7 /mnt/gentoo/home
chroot /mnt/gentoo /bin/bash


As you can see this also mounts swap which in your case you dont need.

This one is for use on a running system.
    mount /dev/sda9 /home/hielvc/tmp
    mount -t tmpfs shm /dev/shm
    mount -t proc none /home/hielvc/tmp/proc
    mount -o bind /dev /home/hielvc/tmp/dev
    mount -o bind /sys /home/hielvc/tmp/sys
    mount -o bind /tmp /home/hielvc/tmp/tmp
    #mount -o bind /usr/portage /home/hielvc/tmp/usr/portage
    #mount -o /home/distfiles /home/hielvc/tmp/usr/portage/distfiles
    ## do not need to mount packages as I'll be coping these new packages
    ## over. Cant use the old ones so they'll dumped.
    mount -o bind /usr/src/linux /home/hielvc/tmp/usr/src/linux


I could have cleaned the above but it might some spark ideas for u or others.
_________________
An A-Z Index of the Linux BASH command line
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum