Author Topic: Chrooted Debian Made Easy  (Read 10387 times)

ZDevil

  • Hero Member
  • *****
  • Posts: 1998
    • View Profile
    • http://
Chrooted Debian Made Easy
« on: November 01, 2005, 04:42:11 pm »
So here is an absolute dummy guide to setting up the fantastic chrooted Debian in 14 steps (and a few more -- just read on).  
Well, it's NOT my work at all.  The whole thing is nothing new but a summary and collection of the main information stretched out in this thread: https://www.oesf.org/forums/index.php?showtopic=9654 , after getting some good advice from Chero and rehorrericha in particular.  
Then why do I post this and in a new thread?  Because I guess dummies may find it easier to read a separate summary than to wade through the dozens of pages and >100 posts of discussions.
Most, if not all, of the content of this summary is already included in CyberWolf's excellent guide in the very first post of thread above, plus the gems of thoughts of many others there.  I hope I didn't miss anything, despite the fact that I still consider myself a dummy.  Please correct me if I'm wrong in any place.  Thank you!    


 How to set up chrooted Debian environment in pdaXrom: an absolute dummy guide  


STEP 1:
Download either the "base" or the "big" Debian package from http://pocketworkstation.org/files/ .  The latest version is 0.18.  


STEP 2:
Since this is real big stuff, we can't put it in the main memory but must let a memory card take it instead.

Make sure that your card is of 256MB at least.
Let's get started.

Start a terminal session.  

Switch to /mnt/card, and

create a new directory called "debroot" by
Code: [Select]
cd /mnt/card    
mkdir debroot
(Press ENTER once after each line.)


STEP 3:
Switch to this newly created debroot dir.  

Put the debian package in this dir, and

extract it by:
Code: [Select]
tar -xvzpf zaurus-debian-*.tgz
This will take a few minutes.  Just let it do its job.  After this you'll see a whole bunch of files and dir created in /mnt/card/debroot.


STEP 4:
Now you have to configure Debian and install a few important files to the main memory.  The files are going to be very small so no need to worry about the space in the main memory.

Stay put in /mnt/card/debroot and do this

Code: [Select]
./INSTALL.d/postinst.sh
And ...


STEP 5:
Phew!   What?  A questionnaire?  Don't panic. It's just a few "Yes/No" questions. There may be some actions going on between the questions, as the setup will respond and take actions immediately after each of your answers.

The "model answers" are simply: "Yes" (press y and ENTER) to all questions, BUT say "No" (press n and ENTER) to the last two questions asking you whether you want to start vncserver and fbvnc.

After the last question, the installation process finishes and returns you to the command prompt (the "#" sign).


STEP 6:
Now it's time to go to do something about the files in the main memory.  Go to your root directory by
Code: [Select]
cd ~

STEP 7:
Now go check and see whether you've got these three files in the main memory (use a file manager to help you find them):

/etc/debroot.conf
/usr/local/bin/Crd
/etc/rc.d/init.d/zdebian

If any of them is missing, then something may have gone wrong     and you'll have to repeat steps 3, 4 and 5.


STEP 8:
Now we are going to make some important changes in the first two files mentioned in STEP 7 by editing them with an editor (am I being too dummy here?)  

Don't worry too much.  What we mean by "editing" here simply means adding one symbol or some words or a line somewhere in the files.

Being a dummy myself, I prefer using nano (hey guys, c'mon don't fire at me please ~    ).  

First, open /etc/debroot.conf with nano by
Code: [Select]
nano /etc/debroot.confDon't freak out when you see the mysterious codes and messages.  Just do three simple things:


1. Locate the statement "#The chroot directory for the Debian installation", make sure that it gets the correct path as
Code: [Select]
DEBROOT=/mnt/card/debroot
2. Comment out (i.e. put a "#" symbol in front of) all these lines:
DEB_RUN_VNCSERVER,
DEB_RUN_FBVNC,
DEB_RUN_ZAPM_PROXY,
DEB_RUN_ZAPMD.
(In my case I also have to comment out DEB_RUN_SERVICES="ssh", although it's not mentioned in the CyberWolf's original guide.  Still dunno why coz I'm just a dummy.)

3. Go to the bottom of the file, start a line afresh and type the following:
Code: [Select]
DEB_DISPLAY=127.0.0.1:0
After these three things are done, press Ctrl and o together to save the file (you'll be asked for a filename; just ENTER to  confirm to use the existing one), followed by Ctrl and x together to exit nano.


STEP 9:
Now we head to the second file.  Again use nano to open it:
Code: [Select]
/usr/local/bin/CrdGo to the bottom and look for the line that begins with "PATH=...".  
Add the string DISPLAY=$DEB_DISPLAY at the end of the line,
followed by Ctrl-o (save) and Ctrl-x (exit nano)


STEP 10:
Now we need to edit one more file.  Use nano again to open /usr/X11R6/bin/startx
Code: [Select]
nano /usr/X11R6/bin/startx
Locate the line(s) beginning with "defaultserverargs=...".
Comment out the line(s) if you see "-nolisten tcp"
Code: [Select]
#defaultserverargs=" -nolisten tcp"
#defaultserverargs=" -nolisten tcp -kb"

Next, add a new line right above or below these lines (use your cursor key to move around, ENTER to add a new line) and type this down:
Code: [Select]
defaultserverargs=" -kb"
When it's done, Ctrl-o and then Ctrl-x.

[A NOTE for users of more than one window manager (wm):
The default window manager is called Matchbox, and the initial script (i.e. the file that brings it up and tells it to do and display things in the way you want) is called "startx" and its path is /etc/X11R6/bin/startx.  
Oh, yes, that's the one you have just edited.  
And...
If you also use other window managers, you'll have to do the same change to their initial scripts.  For example, the initial script of Xfce4 is called "startxfce4" and has a different path /usr/local/bin/startxfce4.  If you forget to edit this you will only get chrooted Debian to work in Matchbox but not in Xfce4.]


STEP 11:
Quit the terminal session.
Exit the current window manager and restart it.  (If you don't know how then you won't be reading  this!)


STEP 12:
Start a terminal session again.  
Copy a file called .Xauthority to the root directory of debroot by running this command:
Code: [Select]
cp .Xauthority /mnt/card/debroot/home/root
(In case you don't have the root dir under /mnt/card/debroot/home, (just like in my case), you must create it first before copying .Xauthority to there.  Or just run mkdir -p /mnt/card/debroot/home/root to fix that.)


STEP 13:
Start the chrooted Debian enviroment with
Code: [Select]
/etc/rc.d/init.d/zdebian start
If you get back to the usual prompt in 1 or 2 seconds, that is a good sign, meaning your chrooted Debian environment is (almost) ready to roll out.


STEP 14:
Finally, give your chrooted Debian environment a test drive.  Try
Code: [Select]
Crd aterm
Then you'll see a different terminal window pop up, with a slightly different prompt as "/#".

And as CyberWolf says, "If it works, congratulations, you've done it...  "


Plus...

You can go three more steps further (by Chero):
STEP 15:
Go connected!
Copy /etc/resolv.conf to /mnt/card/debroot/etc/resolv.conf to enable networking


STEP 16:
Eat a lot without getting overweight?
Use the debshrink command (a real space-saver !!)


(STEP 17: to be clarified ...
Find the way to your /mnt/cf and or /mnt/card: (I think I described them in the Xqt/debian forum - in a thread related to xfce4) -- Chero said he's come up with an easy mounting script but it takes some time to recover it from the X/Qt page...)


Corrections, clarifications and reminders are always welcome.  Thank you all!  
« Last Edit: November 01, 2005, 04:57:56 pm by ZDevil »

Life is too precious for hacking *too much*
Visit my Z screencap gallery[/color]
My EeePC 701 Black = Debian (Lenny) on IceRocks + Transcend SDHC Class6 8GB + 2GB RAM
My Zaurus SL-C3200 = Debian EABI (kernel 2.6.24.3-yonggun) on a swapped internal Sandisk Extreme III CF 16gb
My Debian EABI feed: http://matrixmen.free.fr/zaurus/debian/
My OpenBSD/Zaurus feeds:  Link1, Link2
[/i][/font][/color][/size]

Chero

  • Hero Member
  • *****
  • Posts: 1140
    • View Profile
    • http://users.telenet.be/zaurususer/Chero
Chrooted Debian Made Easy
« Reply #1 on: November 02, 2005, 07:37:05 am »
Quote
(STEP 17: to be clarified ...
Find the way to your /mnt/cf and or /mnt/card: (I think I described them in the Xqt/debian forum - in a thread related to xfce4) -- Chero said he's come up with an easy mounting script but it takes some time to recover it from the X/Qt page...)


Corrections, clarifications and reminders are always welcome.  Thank you all!   
[div align=\"right\"][a href=\"index.php?act=findpost&pid=101741\"][{POST_SNAPBACK}][/a][/div]

The syntax is :
Code: [Select]
mount -o bind olddir newdir
In case you are running on SD, this is :
Code: [Select]
mount -o bind /mnt/cf /mnt/card/debroot/mnt/cf
mount -o bind /mnt/card /mnt/card/debroot/mnt/card
mount -o bind /home/root /mnt/card/debroot/mnt/home

At least, if you want to access your cf, sd and home-dir.
Just make sure the dirs (mountpoints) exist.

Have fun,
Chero.
HP-95LX -> HP Jornada 680 -> SL-C860 -> SL-C3100 -> Fuji u810 -> SL-C1000 -> HTC uni -> SL-C860 -> SL-C760.
March 12 2009 : Back because the Zaurus is one of a kind.
SL-C760 : pdaXrom
Pandora pre-ordered -> received and tested : great device but not my cup of tea -> sold.

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Chrooted Debian Made Easy
« Reply #2 on: November 02, 2005, 08:49:11 am »
I think that if you have your debroot on /mnt/card you should use

Code: [Select]
mount  --rbind  /mnt/card /mnt/card/debroot/mnt/card
(to avoid recursion in the filesystem)

Note that if you mount the /tmp and the home directory this way, you can run directly X without the xhost, exporting the display etc...
I will post instructions for this when I have time....

Also the posintall script starts a small loop that forward command to the "native" environement, I think that this is not needed when we use pocketworkstation this way as it is easy to open a "native" terminal.
So this could be disable.
SLC-860 cacko / senao wifi

ShiroiKuma

  • Hero Member
  • *****
  • Posts: 900
    • View Profile
Chrooted Debian Made Easy
« Reply #3 on: November 02, 2005, 09:11:44 am »
Quote
Note that if you mount the /tmp and the home directory this way, you can run directly X without the xhost, exporting the display etc...
I will post instructions for this when I have time....

Also the posintall script starts a small loop that forward command to the "native" environement, I think that this is not needed when we use pocketworkstation this way as it is easy to open a "native" terminal.
So this could be disable.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=101873\"][{POST_SNAPBACK}][/a][/div]
Yes, please do... I'm experimenting with this... I'd like to see your instructions.
[span style=\'font-size:8pt;line-height:100%\']Das ganze tschechische Volk ist eine Simulantenbande.[/font][/span]
Militäroberarzt Bautze

stac

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • http://
Chrooted Debian Made Easy
« Reply #4 on: November 02, 2005, 10:30:38 am »
Can we get this pinned? Nice job - looking forward to going through this today...

Stac
Sporting...

CacKo 1.23

Sl-C1000, PDAir Leather Case, 1GB ATP 60X SD, Socket 10/100 CF, NetGear MA701, Memorex 64MB (for flashing), 1GB Microdrive (for storing ipkgs and data)


Visit my new package feed and feel free to donate to show your support!

GadgetGuy

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://
Chrooted Debian Made Easy
« Reply #5 on: November 03, 2005, 01:10:18 pm »
I have followed the instructions step by step.

When I get to the point

cp .Xauthority /mnt/card/debroot/home/root

my Z tells me, that there is no .Xautority file...

If I still continue, and start
" /etc/rc.d/init.d/zdebian start "

Then when I try

" Crd aterm "

I get:

" bad option "DISPLAY=127.0.0.1:0"

What is going on?
Zaurus C-3100 from PriceJapan with OZ 3.5.4.1. Opie and GPE
Ambicom CF WL1100C Wifi Card and Symbol Wireless Networker CF Wifi Card
1 GB Sandisk Ultra II SD
PdAir leather case - Nintendo DS metal case
various smaller CF and SD cards
all kinds of USB cables and accessories
-------------------------------------------------------------
Previous computers: TI 99/4A, ZX81, C64, Amiga 500, Apple Powerbook 100
Previous PDA's: Palm 1000, Palm III, Palm V, Palm Vx, Audiovox Maestro Pocket PC, Psion 5mx
Current PDA: Palm Tungsten E2
Current favourite: Zaurus C3100 - my "micro laptop"

Chero

  • Hero Member
  • *****
  • Posts: 1140
    • View Profile
    • http://users.telenet.be/zaurususer/Chero
Chrooted Debian Made Easy
« Reply #6 on: November 03, 2005, 02:08:46 pm »
Quote
I have followed the instructions step by step.

When I get to the point

cp .Xauthority /mnt/card/debroot/home/root

my Z tells me, that there is no .Xautority file...

If I still continue, and start
" /etc/rc.d/init.d/zdebian start "

Then when I try

" Crd aterm "

I get:

" bad option "DISPLAY=127.0.0.1:0"

What is going on?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=102110\"][{POST_SNAPBACK}][/a][/div]

Try :
cp /home/root/.Xauthority /mnt/card/debroot/home/root/
HP-95LX -> HP Jornada 680 -> SL-C860 -> SL-C3100 -> Fuji u810 -> SL-C1000 -> HTC uni -> SL-C860 -> SL-C760.
March 12 2009 : Back because the Zaurus is one of a kind.
SL-C760 : pdaXrom
Pandora pre-ordered -> received and tested : great device but not my cup of tea -> sold.

GadgetGuy

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://
Chrooted Debian Made Easy
« Reply #7 on: November 03, 2005, 02:29:23 pm »
Quote
Try :
cp /home/root/.Xauthority /mnt/card/debroot/home/root/
[div align=\"right\"][a href=\"index.php?act=findpost&pid=102117\"][{POST_SNAPBACK}][/a][/div]

Still no luck. If I do a file search starting on root, no such file is found anywhere on my Z...

I am just thinking: is this maybe a pdaXrom related file - as I am running Cacko?
« Last Edit: November 03, 2005, 02:33:51 pm by GadgetGuy »
Zaurus C-3100 from PriceJapan with OZ 3.5.4.1. Opie and GPE
Ambicom CF WL1100C Wifi Card and Symbol Wireless Networker CF Wifi Card
1 GB Sandisk Ultra II SD
PdAir leather case - Nintendo DS metal case
various smaller CF and SD cards
all kinds of USB cables and accessories
-------------------------------------------------------------
Previous computers: TI 99/4A, ZX81, C64, Amiga 500, Apple Powerbook 100
Previous PDA's: Palm 1000, Palm III, Palm V, Palm Vx, Audiovox Maestro Pocket PC, Psion 5mx
Current PDA: Palm Tungsten E2
Current favourite: Zaurus C3100 - my "micro laptop"

ZDevil

  • Hero Member
  • *****
  • Posts: 1998
    • View Profile
    • http://
Chrooted Debian Made Easy
« Reply #8 on: November 03, 2005, 02:39:08 pm »
Quote
Quote
Try :
cp /home/root/.Xauthority /mnt/card/debroot/home/root/
[div align=\"right\"][a href=\"index.php?act=findpost&pid=102117\"][{POST_SNAPBACK}][/a][/div]

Still no luck. If I do a file search starting on root, no such file is found anywhere on my Z...

I am just thinking: is this maybe a pdaXrom related file - as I am running Cacko?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=102119\"][{POST_SNAPBACK}][/a][/div]

Oh sorry forgot to mention that this summary is for chrooted debian on pdaXrom.  Not sure if it works on Sharp/Cacko  (probably not).   Maybe X/Qt is still the way for you.
« Last Edit: November 03, 2005, 02:39:39 pm by ZDevil »

Life is too precious for hacking *too much*
Visit my Z screencap gallery[/color]
My EeePC 701 Black = Debian (Lenny) on IceRocks + Transcend SDHC Class6 8GB + 2GB RAM
My Zaurus SL-C3200 = Debian EABI (kernel 2.6.24.3-yonggun) on a swapped internal Sandisk Extreme III CF 16gb
My Debian EABI feed: http://matrixmen.free.fr/zaurus/debian/
My OpenBSD/Zaurus feeds:  Link1, Link2
[/i][/font][/color][/size]

Chero

  • Hero Member
  • *****
  • Posts: 1140
    • View Profile
    • http://users.telenet.be/zaurususer/Chero
Chrooted Debian Made Easy
« Reply #9 on: November 03, 2005, 02:40:14 pm »
Quote
Quote
Try :
cp /home/root/.Xauthority /mnt/card/debroot/home/root/
[div align=\"right\"][{POST_SNAPBACK}][/a][/div]

Still no luck. If I do a file search starting on root, no such file is found anywhere on my Z...

I am just thinking: is this maybe a pdaXrom related file - as I am running Cacko?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=102119\"][{POST_SNAPBACK}][/a][/div]

Yes, it is.

To get it going on cacko or sharp-rom :
www.pocketworkstation.org
or
[a href=\"http://zaurusfun.4t.com/index.html]http://zaurusfun.4t.com/index.html[/url]
or
Meanie's website

but it won't be as fast  
HP-95LX -> HP Jornada 680 -> SL-C860 -> SL-C3100 -> Fuji u810 -> SL-C1000 -> HTC uni -> SL-C860 -> SL-C760.
March 12 2009 : Back because the Zaurus is one of a kind.
SL-C760 : pdaXrom
Pandora pre-ordered -> received and tested : great device but not my cup of tea -> sold.

takuan

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Chrooted Debian Made Easy
« Reply #10 on: November 04, 2005, 11:12:21 pm »
I'm having trouble upgrading to the latest "testing" packages with apt-get upgrade. I have to run apt-get upgrade -o APT::Force-LoopBreak=1 to force it to upgrade some things. Everything still runs after that but some tools just stop working right. Particularly i would like nmap 2.93 to work but with the latest version from testing it runs but doesn't work right. It can't even ping another host..it says its always down.

Has anybody gotten this to work for them?

scoutme

  • Hero Member
  • *****
  • Posts: 579
    • View Profile
Chrooted Debian Made Easy
« Reply #11 on: November 08, 2005, 10:15:05 am »
Quote
Quote
I have followed the instructions step by step.

When I get to the point

cp .Xauthority /mnt/card/debroot/home/root

my Z tells me, that there is no .Xautority file...

If I still continue, and start
" /etc/rc.d/init.d/zdebian start "

Then when I try

" Crd aterm "

I get:

" bad option "DISPLAY=127.0.0.1:0"

What is going on?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=102110\"][{POST_SNAPBACK}][/a][/div]

Try :
cp /home/root/.Xauthority /mnt/card/debroot/home/root/
[div align=\"right\"][a href=\"index.php?act=findpost&pid=102117\"][{POST_SNAPBACK}][/a][/div]


I'm having the very same problem with RC12
cannot get it properly running  

Chero

  • Hero Member
  • *****
  • Posts: 1140
    • View Profile
    • http://users.telenet.be/zaurususer/Chero
Chrooted Debian Made Easy
« Reply #12 on: November 08, 2005, 11:30:34 am »
Quote
Quote
Quote
I have followed the instructions step by step.

When I get to the point

cp .Xauthority /mnt/card/debroot/home/root

my Z tells me, that there is no .Xautority file...

If I still continue, and start
" /etc/rc.d/init.d/zdebian start "

Then when I try

" Crd aterm "

I get:

" bad option "DISPLAY=127.0.0.1:0"

What is going on?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=102110\"][{POST_SNAPBACK}][/a][/div]

Try :
cp /home/root/.Xauthority /mnt/card/debroot/home/root/
[div align=\"right\"][a href=\"index.php?act=findpost&pid=102117\"][{POST_SNAPBACK}][/a][/div]


I'm having the very same problem with RC12
cannot get it properly running  
[div align=\"right\"][a href=\"index.php?act=findpost&pid=102846\"][{POST_SNAPBACK}][/a][/div]

I'll have to give it a try on rc12.
I could always solve the display problem by removing the "nolisten" thing and copying the .Xauthority to  /mnt/card/debroot/home/root/ and /mnt/card/debroot/root/, then leave X, start again and off you go.
HP-95LX -> HP Jornada 680 -> SL-C860 -> SL-C3100 -> Fuji u810 -> SL-C1000 -> HTC uni -> SL-C860 -> SL-C760.
March 12 2009 : Back because the Zaurus is one of a kind.
SL-C760 : pdaXrom
Pandora pre-ordered -> received and tested : great device but not my cup of tea -> sold.

smuelas

  • Full Member
  • ***
  • Posts: 110
    • View Profile
Chrooted Debian Made Easy
« Reply #13 on: November 15, 2005, 08:30:25 am »
Quote from: Chero,Nov 8 2005, 04:30 PM
Quote from: scoutme,Nov 8 2005, 04:15 PM
Quote from: Chero,Nov 3 2005, 11:08 AM
Quote from: GadgetGuy,Nov 3 2005, 07:10 PM
I have followed the instructions step by step.

When I get to the point

I get:

" bad option "DISPLAY=127.0.0.1:0"

What is going on?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=102110\"][{POST_SNAPBACK}][/a][/div]

Yesterday I installed pdaXrom. Before I used the original Qtopia plus Debian+Xqt.
I didn't modify anything on my "debroot" on the microdrive.
Then, from one of this "not-so-nice" console from openbox, that I have already changed, I simply tiped:
chroot /mnt/cf/debroot
and I was in Debian. When I try to launch any application, I had my "ERROR display 0:0 not available" or something similar.
I looked at "startx" and see this "-nolisten" story. Then I run out of the X's and on once more, but this time I didn't write "startx" but "xinit".
This is all the story. After that, everything (with the Java exception) was working perfectly and, I think, quicker.
smuelas
Zaurus SL-6000  --  Microdrive Hitachi 6Gb placed permanently on CF slot.

whit

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Chrooted Debian Made Easy
« Reply #14 on: December 11, 2005, 11:47:26 pm »
Quote
STEP 14:
Finally, give your chrooted Debian environment a test drive.  Try
Code: [Select]
Crd aterm
Then you'll see a different terminal window pop up, with a slightly different prompt as "/#".

Nice guide.  Yet ...

When I get to this point on a 3100 running rc12 I get

aterm: bad option "DISPLAY=127.0.0.1:0"
« Last Edit: December 12, 2005, 12:02:16 am by whit »