Author Topic: Chrooted Debian The Other Easier? Way  (Read 9808 times)

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Chrooted Debian The Other Easier? Way
« on: December 13, 2005, 07:54:18 am »
A different way to access debian:

Notes:

* in the following, it assumes that your card is formatted using a unix friendly filesystem (ie ext2).

* /mnt/card is used because I  install debian on a SD card, you need to change this if you install elsewhere.



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:
Download the attach files, remove the .txt (it's just added  so that I can upload the files there) and copy these in /usr/bin/

make them executable:

Code: [Select]
chmod +x /usr/bin/startdebian.sh
chmod +x /usr/bin/stopdebian.sh
chmod +x /usr/bin/Crd


(Press ENTER once after each line.)

edit this files to change /mnt/card to whatever you use

STEP 5:

in a terminal run
Code: [Select]
startdebian.sh

This needs to be done only once, (ie everytime you reboot)

Optionnaly If you want to be able  to access more than the sd card in debian copy the last 2 lines of
startdebian.sh and modify accordingly (ie replace /mnt/card by the path to the directory you want to be accessible in the debian chroot).

for instance if you want to access the cf cards add
Quote
mkdir -p ${DEBROOT}/mnt/cf
mount --rbind /mnt/cf ${DEBROOT}/mnt/cf

and in stopdebian.sh
Quote
umount ${DEBROOT}/mnt/cf


STEP 6:

in a terminal:

Code: [Select]
Crd aterm

STEP 7:

f you  need to umount your card run stopdebian.sh
Don't run startdebian.sh stopdebian.sh everytime you want to launch an application.

(Yes I stole a part from Zdevil's post)

tell me if this works for you
SLC-860 cacko / senao wifi

ZDevil

  • Hero Member
  • *****
  • Posts: 1998
    • View Profile
    • http://
Chrooted Debian The Other Easier? Way
« Reply #1 on: December 13, 2005, 03:12:52 pm »
Hey, this truly dummy guide should've appeared right from the beginning, so as to save the trouble of writing and making others read my still-not-so-easy post.    
Thank you, pgas!
(Well, in a way i'm also 'stealing' from the original debian post ... )
« Last Edit: December 13, 2005, 03:41: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]

smuelas

  • Full Member
  • ***
  • Posts: 110
    • View Profile
Chrooted Debian The Other Easier? Way
« Reply #2 on: December 18, 2005, 04:25:44 pm »
Quote from: pgas,Dec 13 2005, 12:54 PM
A different way to access debian:

Notes:

* in the following, it assumes that your card is formatted using a unix friendly filesystem (ie ext2).

* /mnt/card is used because I  install debian on a SD card, you need to change this if you install elsewhere.



STEP 6:

in a terminal:

Code: [Select]
Crd aterm

STEP 7:

f you  need to umount your card run stopdebian.sh
Don't run startdebian.sh stopdebian.sh everytime you want to launch an application.

(Yes I stole a part from Zdevil's post)

tell me if this works for you
[div align=\"right\"][a href=\"index.php?act=findpost&pid=106964\"][{POST_SNAPBACK}][/a][/div]
[/quote]

Hi pgas,
I've just tried your method on my 6000 and it works very well. It is a lot simpler than anything else and the result is as good as the best. Great job!
Now, a couple of questions:
1) What is the reason to link /mnt/cf/debroot/mnt/cf ?
When in Debian, I look at this place and there is nothing inside. Also, when I "stopdebian" I receive a message telling me that it is not possible to umount it as it is busy.
2) I have reflash everything and now I don't remember what I did before to have the second and middle button of the mouse using Fn and/or Shift. Do you remember what should be done?

Thanks for your very good help.

smuelas
Zaurus SL-6000  --  Microdrive Hitachi 6Gb placed permanently on CF slot.

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Chrooted Debian The Other Easier? Way
« Reply #3 on: December 19, 2005, 03:09:06 am »
thanks! I was wondering if this was working so well that nobody have a problem or so bad  that nobody even bother with this.

1) you have to mount  the cards or the other filesystem  if you want to access something outside /mnt/cf/debroot/ while in debian.

I don't now for the busy message, maybe something is running in debian or your are  in the  folder. I'm also not sure if suspend/resume does not causes problem

2) It's by default on the clamshell, I'm not sure for the 6000, maybe via the inputhelper application in the settings?
SLC-860 cacko / senao wifi

smuelas

  • Full Member
  • ***
  • Posts: 110
    • View Profile
Chrooted Debian The Other Easier? Way
« Reply #4 on: December 19, 2005, 06:57:21 am »
Quote
thanks! I was wondering if this was working so well that nobody have a problem or so bad  that nobody even bother with this.

1) you have to mount  the cards or the other filesystem  if you want to access something outside /mnt/cf/debroot/ while in debian.

I don't now for the busy message, maybe something is running in debian or your are  in the  folder. I'm also not sure if suspend/resume does not causes problem

2) It's by default on the clamshell, I'm not sure for the 6000, maybe via the inputhelper application in the settings?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=107539\"][{POST_SNAPBACK}][/a][/div]

Well, it seems that Suspend, really causes problems. After it, the access to Debroot is finished and "Crd" hangs the console if writing in a console, or had no effect if clicking a button prepared for launching something with "Crd ###".
The mounting of the cards has no interest for those who use only one card with debroot ocupying the whole card, as I do.
In fact, one solution that I will find excellent would be to use pdaxrom to control the standard applications included in the ROM and launching the Xserver. Then, Debian could take the control for any other application wanted. It seems a lot of work to compile applications for pdaXrom when they are available with just apt-get. I have tested some applications in both ways and they run more or less equal: Firefox, Scite, Emacs, Gimp, Octave... It is like reinventing the wheel.
Anyway, up to now your approach seems to me the simplest, more rational and easy to implement.
We have to solve this problem with Suspend and everything would be perfect! Thanks for all.

smuelas
Zaurus SL-6000  --  Microdrive Hitachi 6Gb placed permanently on CF slot.

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Chrooted Debian The Other Easier? Way
« Reply #5 on: December 19, 2005, 07:09:27 am »
Quote
Well, it seems that Suspend, really causes problems. After it, the access to Debroot is finished and "Crd" hangs the console if writing in a console, or had no effect if clicking a button prepared for launching something with "Crd ###".
hmm It does not happen to me.
Maybe the problem is linked to the usage of the cf, I remember a post about squashfs stating that the cf card was causing problem because if I remember well it is mounted and unmounted during suspend.

Quote
hen, Debian could take the control for any other application wanted. It seems a lot of work to compile applications for pdaXrom when they are available with just apt-get. I have tested some applications in both ways and they run more or less equal: Firefox, Scite, Emacs, Gimp, Octave... It is like reinventing the wheel.
Anyway, up to now your approach seems to me the simplest, more rational and easy to implement.
We have to solve this problem with Suspend and everything would be perfect! Thanks for all.

This is the original goal of pocketworkstation.
If you use the installation describe on the site, it stops qtopia and starts an xserver over a virtual  frame buffer. the "daemon" installed forwarded commands from the chrooted environement to the default qtopia environnement.

There is some info out there explaining how someone runs debian only on his c3000.
« Last Edit: December 19, 2005, 07:10:18 am by pgas »
SLC-860 cacko / senao wifi

smuelas

  • Full Member
  • ***
  • Posts: 110
    • View Profile
Chrooted Debian The Other Easier? Way
« Reply #6 on: December 19, 2005, 11:26:55 am »
Quote
This is the original goal of pocketworkstation.
If you use the installation describe on the site, it stops qtopia and starts an xserver over a virtual  frame buffer. the "daemon" installed forwarded commands from the chrooted environement to the default qtopia environnement.

There is some info out there explaining how someone runs debian only on his c3000.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=107574\"][{POST_SNAPBACK}][/a][/div]

I have used the original pocketworkstation sometime. It is not the same...

When you say "out there" do you mean in the pocketworkstation site?

smuelas
Zaurus SL-6000  --  Microdrive Hitachi 6Gb placed permanently on CF slot.

Chero

  • Hero Member
  • *****
  • Posts: 1140
    • View Profile
    • http://users.telenet.be/zaurususer/Chero
Chrooted Debian The Other Easier? Way
« Reply #7 on: December 19, 2005, 02:09:37 pm »
Quote
It is like reinventing the wheel.

I don't agree here. Porting apps to pdaXrom makes them available for users that don't want to install the whole debian chroot or that just don't have the disk-space to install the chroot.
A second advantage of this "reinventing the wheel" is that most pdaX packages are a lot smaller compared to their debian brothers and sisters.

Quote
This is the original goal of pocketworkstation.

It is, but the way debian packages can work on pdaXrom, using the pdaXrom window manager, has a few advantages. I have the feeling they are faster than in the original pocketworkstation setup (it's been quite a long time since I've used it, but still...). When using debian this way, you can run debian apps and pdaX-apps at the same time.

just my 2 cents.

About the subject :
I had this resume thing when I had debian on my c860 (both on CF and SD). It was installed "the old way". My debian apps use to crash after long suspends. But I could still use Crd and if I was running a bash, it wouldn't hang. It were apps with open files on SD or CF that crashed.
It wasn't only like this with debian apps , pdaX-apps had the same behaviour. When running KDE from SD, it sometimes hung after a resume.
I didn't have this behaviour on my C3100, where everything runs from ide. I didn't do some real tests to "challenge" my Z. Just once I started KDE in the evening, suspended, resumed in the morning. The kde-panel crashed and restarted and I could continue. I just thought :"If it can do this, it can do anything".

Next week is holiday-time for me. If I have some time left, I might do some testing on the subject.

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 The Other Easier? Way
« Reply #8 on: December 21, 2005, 01:41:30 am »
Quote
When you say "out there" do you mean in the pocketworkstation site?
I meant this:
http://www.eleves.ens.fr/home/leurent/zaurus.html
SLC-860 cacko / senao wifi

apink

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Chrooted Debian The Other Easier? Way
« Reply #9 on: December 21, 2005, 01:54:54 am »
Bonjour,

I am looking forward to getting debian going and have tried installing via these instructions twice.  It seems that things have gone nicely for others so I was a little perplexed when it didn't work for me.  The first time through I tried to erase the debroot contents so I could start over but ended up erasing pretty much everything on the Z along with the debroot stuff.  Silly newb mistake but I am back up and running for the most part.

After following the instructions at the beginning of this thread I get to the command "startdebian.sh" and get the error:

mount: mount point /mnt/card/debroot/etc/resolve.conf does not exist.

Then I pretend that this is not important and try the "Crd aterm".  This aborts witha message of

aterm:  can't open pseudo-tty
aterm:  aborting

Any help is appreciated.

george
--current use--
linux chroot on top of lineage  on cell phone

--past handhelds--
pandora
ben nanonote
zaurus sl-c1000

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Chrooted Debian The Other Easier? Way
« Reply #10 on: December 21, 2005, 02:10:35 am »
Quote
mount: mount point /mnt/card/debroot/etc/resolve.conf does not exist.

hmm, maybe you need do do "touch /mnt/card/debroot/etc/resolve.conf"
This is used to have the right dns set in debian

Quote
aterm: can't open pseudo-tty
aterm: aborting
I was getting this when /dev was not mounted.
Where did you have your debroot?
Can you post the result of mount after startdebian?
Do you use a unix filesystem on your card?
SLC-860 cacko / senao wifi

Chero

  • Hero Member
  • *****
  • Posts: 1140
    • View Profile
    • http://users.telenet.be/zaurususer/Chero
Chrooted Debian The Other Easier? Way
« Reply #11 on: December 21, 2005, 12:40:10 pm »
Quote
Quote
mount: mount point /mnt/card/debroot/etc/resolve.conf does not exist.

hmm, maybe you need do do "touch /mnt/card/debroot/etc/resolve.conf"
This is used to have the right dns set in debian

I think there is a typo in this, it should be "/etc/resolv.conf"
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.

apink

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Chrooted Debian The Other Easier? Way
« Reply #12 on: December 21, 2005, 05:33:42 pm »
Quote
Quote
mount: mount point /mnt/card/debroot/etc/resolve.conf does not exist.

hmm, maybe you need do do "touch /mnt/card/debroot/etc/resolve.conf"
This is used to have the right dns set in debian

Quote
aterm: can't open pseudo-tty
aterm: aborting
I was getting this when /dev was not mounted.
Where did you have your debroot?
Can you post the result of mount after startdebian?
Do you use a unix filesystem on your card?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=107875\"][{POST_SNAPBACK}][/a][/div]

I tried touch /mnt/card/debroot/etc/resolve.conf but got the same results.  I tried it several times.  It seems that resolve.conf was not in there at first.  

Here is the output from mount:

rootfs on / type rootfs (rw)
/dev/root on / type jffs2 (rw)
/proc on /proc type proc (rw)
none on /dev type tmpfs (rw)
/dev/mtdblock3 on /home type jffs2 (rw,noatime)
none on /dev/pts type devpts (rw)
/dev/mtdblock3 on /mnt/user type jffs2 (rw,noatime)
/dev/mmcda1 on /mnt/card type ext2 (rw)
none on /mnt/card/debroot/proc type proc (rw)
none on /mnt/card/debroot/dev type tmpfs (rw)
/dev/mtdblock3 on /mnt/card/debroot/home/root type jffs2 (rw,noatime)
none on /mnt/card/debroot/tmp type tmpfs (rw)
/dev/mmcda1 on /mnt/card/debroot/mnt/card type ext2 (rw)
none on /mnt/card/debroot/mnt/card/debroot/tmp type tmpfs (rw)
/dev/mtdblock3 on /mnt/card/debroot/mnt/card/debroot/home/root type jffs2 (rw,noatime)
none on /mnt/card/debroot/mnt/card/debroot/dev type tmpfs (rw)
none on /mnt/card/debroot/mnt/card/debroot/proc type proc (rw)
--current use--
linux chroot on top of lineage  on cell phone

--past handhelds--
pandora
ben nanonote
zaurus sl-c1000

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Chrooted Debian The Other Easier? Way
« Reply #13 on: December 21, 2005, 08:59:17 pm »
something is wrong ,
Quote
none on /mnt/card/debroot/dev type tmpfs
is mounted with the wrong type, it should be
Quote
none on /mnt/card/debroot/dev type devfs

 perhaps change the script to add -t devfs ie
Quote
mount --bind /dev ${DEBROOT}/dev -t devfs

Did you copy the script by hand? maybe you made a typo and have
mount --bind /tmp ${DEBROOT}/dev  in your script?

there is also a set of duplicate wrong entries:
it should be mnt/card/debroot/dev   and not /mnt/card/debroot/mnt/card/debroot/dev (accordingly for the rest)

you should umount every /mnt/card/debroot, before remounting

and Chero is right it's resolv.conf not resolve.conf
« Last Edit: December 21, 2005, 09:05:02 pm by pgas »
SLC-860 cacko / senao wifi

apink

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Chrooted Debian The Other Easier? Way
« Reply #14 on: December 22, 2005, 01:33:25 am »
1)  resolv.conf fixed the first error.  (In the downloaded script there is a resolv.cong where there should be a resolv.conf.)

2)  I tried
Quote
mount --bind /dev ${DEBROOT}/dev -t devfs
It didn't change the type to devfs.  

3)  The issue with
Quote
/mnt/card/debroot/mnt/card/debroot/dev (accordingly for the rest)
is caused, I think, by the last line in the script:
Quote
mount --rbind /mnt/card ${DEBROOT}/mnt/card

I entered the script in manually and even had the shell expand the last line before executing it.  ${DEBROOT} expanded appropriately.  I don't know where the extra /mnt/card/debroots are coming from but they all show up only after the last line in the script is executed.

Here is my revised startdebian.sh script:

Quote
#!/bin/ash
DEBROOT=/mnt/card/debroot
#test
mount none ${DEBROOT}/proc -t proc
mount --bind /dev ${DEBROOT}/dev -t devfs
mkdir -p  ${DEBROOT}/home/root
mount --bind /home/root ${DEBROOT}/home/root
mount --bind /tmp ${DEBROOT}/tmp
mount --bind /etc/resolv.conf ${DEBROOT}/etc/resolv.conf
mkdir -p ${DEBROOT}/mnt/card
mount --rbind /mnt/card ${DEBROOT}/mnt/card


Here is the output of mount after this script.

Quote
rootfs on / type rootfs (rw)
/dev/root on / type jffs2 (rw)
/proc on /proc type proc (rw)
none on /dev type tmpfs (rw)
/dev/mtdblock3 on /home type jffs2 (rw,noatime)
none on /dev/pts type devpts (rw)
/dev/mtdblock3 on /mnt/user type jffs2 (rw,noatime)
/dev/mmcda1 on /mnt/card type ext2 (rw)
none on /mnt/card/debroot/proc type proc (rw)
none on /mnt/card/debroot/dev type tmpfs (rw)
/dev/mtdblock3 on /mnt/card/debroot/home/root type jffs2 (rw,noatime)
none on /mnt/card/debroot/tmp type tmpfs (rw)
/dev/root on /mnt/card/debroot/etc/resolv.conf type jffs2 (rw)
/dev/mmcda1 on /mnt/card/debroot/mnt/card type ext2 (rw)
/dev/root on /mnt/card/debroot/mnt/card/debroot/etc/resolv.conf type jffs2 (rw)
none on /mnt/card/debroot/mnt/card/debroot/tmp type tmpfs (rw)
/dev/mtdblock3 on /mnt/card/debroot/mnt/card/debroot/home/root type jffs2 (rw,noatime)
none on /mnt/card/debroot/mnt/card/debroot/dev type tmpfs (rw)
none on /mnt/card/debroot/mnt/card/debroot/proc type proc (rw)

I don't know if this will help.

Thanks
« Last Edit: December 22, 2005, 01:36:40 am by apink »
--current use--
linux chroot on top of lineage  on cell phone

--past handhelds--
pandora
ben nanonote
zaurus sl-c1000