Welcome
Welcome to refracta

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

chroot

Tips and Instructional topics. Not for support questions.

chroot

Postby nadir » Sat Nov 23, 2013 11:32 am

for what purpose ever.
I think it should work
(i run it here, but not long enough to say if it really works)

mkdir /media/chroot

debootstrap sid /media/chroot

cd /media/

bash mount_chroot.sh

Code: Select all
#!/usr/bin/env bash

mount -o bind /dev build_chroot/dev/

mount -o bind /dev/pts build_chroot/dev/pts

mount -o bind /sys build_chroot/sys

mount -t proc /proc build_chroot/proc

LANG=C chroot build_chroot

umount build_chroot/proc

umount build_chroot/sys

umount build_chroot/dev/pts

umount build_chroot/dev/

exit 0
So i herd u liek mudkip?
User avatar
nadir
 
Posts: 1160
Joined: Wed Mar 09, 2011 4:18 am
Location: here

Re: chroot

Postby dzz » Sat Nov 23, 2013 12:50 pm

Code: Select all
# e.g us,de,uk,fr
LOCALE=uk

CHROOT=/media/chroot

#possible opts:--variant=minbase exclude=aptitude,tasksel,tasksel-data --include=mc
BOOTSTRAPOPTS="--exclude=tasksel,tasksel-data"

debootstrap $BOOTSTRAPOPTS sid $CHROOT http://ftp.$LOCALE.debian.org/debian


My preferred method to build a clean Debian system, for live image or real partition..

If you want to get networking up, use apt, install a kenel there's a bit more work to do.

What do you actually want to do?
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: chroot

Postby nadir » Sat Nov 23, 2013 1:58 pm

Oh, i just need an environment where to do stuff which i don't want to do on my regular installation
(third party stuff, not yet in the repositories, partly with bugs)
so i don't break it.
It's just a test environment.
Create it, use it for a while, delete it.

One might ask: Why not dualboot or use Virtualbox?
- I can use my regular installation while doing some other things in the chroot
- I don't need to boot a VirtualBox session.
- It is (slightly) more easy to copy files from-and-to.

-
A bit more detailed:
It is for packaging ruby gems.
a) ruby uses bundler and rubygems to install gems (which will install further gems from rubygems.org).
That is not the debian way to do it, but i want to look at it now and then, to check it
b) Some gems got other gems at dependencies, which are not yet in the repos. I need to install them to test the gems i package.
In the long run that means that i got a lot of ruby stuff which is not really proper (and which i don't need at all, as i don't do ruby).

Hence the most important part, for me, is to mount dev, sys, dev/pts and proc (and using LANG=C), so i can use the chroot without running into error messages. And to umount them after i exit the chroot.

I am not that happy to run:
chroot /media/chroot
and then do
su - username
but don't know a better solution yet.

Did that make sense?
So i herd u liek mudkip?
User avatar
nadir
 
Posts: 1160
Joined: Wed Mar 09, 2011 4:18 am
Location: here

Re: chroot

Postby nadir » Sat Nov 23, 2013 1:59 pm

A throw-away environment for anything which might break your system.
^^ That sums it up.
So i herd u liek mudkip?
User avatar
nadir
 
Posts: 1160
Joined: Wed Mar 09, 2011 4:18 am
Location: here

Re: chroot

Postby dzz » Sat Nov 23, 2013 3:10 pm

Ready to go then.. installing "locales" in the chroot should get rid of locale errors. You might get trouble running a sid chroot from wheezy..
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: chroot

Postby nadir » Sat Nov 23, 2013 7:38 pm

I think to go for a real installation one would need the following:

instead of mkdir /media/chroot a mounted partition
run debootstrap and chroot to it
passwd
touch etc/mtab
adapt etc/fstab via copy and paste from host(and comparing with blkid)
edit etc/hosts via copy and paste from host (one line only)
edit etc/network/interfaces via copy and paste from host
apt-get install linux-image-***
adduser

Then either:
install grub and run grub-install /dev/sda
exit the chroot
Or:
exit the chroot and run
update-grub

Then reboot

http://www.debian.org/releases/stable/i ... n#id602068
http://wiki.debian.org/Debootstrap
http://www.debian-administration.org/articles/426
I did that only a few times, and it's been a while. I don't think much should be missing.
So i herd u liek mudkip?
User avatar
nadir
 
Posts: 1160
Joined: Wed Mar 09, 2011 4:18 am
Location: here

Re: chroot

Postby nadir » Mon Nov 25, 2013 2:35 am

Code: Select all
apt-get install xnest
Xnest -ac :2 -geometry 1024x768+0+0 &
cd /media
bash mount_chroot.sh
su - username
env DISPLAY=":2" startfluxbox &

tada.
So i herd u liek mudkip?
User avatar
nadir
 
Posts: 1160
Joined: Wed Mar 09, 2011 4:18 am
Location: here

Re: chroot

Postby Richard » Thu Nov 28, 2013 12:56 pm

@nadir,

Check out User Mode LInux. Might do what you wish.
http://user-mode-linux.sourceforge.net/
MX16x32: NetBook, 1GB, w/3.16.0-4-686-pae
refracta8.3_xfce_i386-20170304_2347.iso
User avatar
Richard
 
Posts: 19
Joined: Thu Mar 01, 2012 4:39 pm

Re: chroot

Postby nadir » Thu Nov 28, 2013 7:26 pm

Interesting. I found this (which basically says that it is available via repos):
http://eggdrop.ch/texts/uml/

In general chroot does what i want.
I use it as it is more easy than pbuilder - at least for me.
I didn't check closely, but it also seems to be very easy on resources
(sure more light than Virtualbox and it is there immediatly, no need to boot the Vbox guest, and it is more easy to copy files from-to).
So i herd u liek mudkip?
User avatar
nadir
 
Posts: 1160
Joined: Wed Mar 09, 2011 4:18 am
Location: here


Return to How-to

Who is online

Users browsing this forum: No registered users and 0 guests

suspicion-preferred