From: problems on
> > OTOH, when we 'upgrade' we often loose good-old aps.

Tom N wrote:-
> Don't every 'upgrade'. Just install new apps and new libs,
> one at a time, if they are worth it.

Yes. But from where I am now, I have different apps on different
instalations/partitions, which I want to run -- ALL.

> > I've had partial success with using scripts:
> > chroot <old-proven partiton's current mount point>
> > <the old-proven-ap>

From: Shadow_7:-
> I got this from the gentoo site/forums. And adapted it for my needs.
>
> #----- START -----
> #! /bin/sh
>
> mount /dev/hd?# /mnt/chroot
> mount -t proc none /mnt/chroot/proc
> mount -o bind /lib/modules /mnt/chroot/lib/modules
> mount -o bind /sys /mnt/chroot/sys
> mount -o bind /tmp /mnt/chroot/tmp
> mount -o bind /dev /mnt/chroot/dev
> mount -o bind /dev/pts /mnt/chroot/dev/pts
>
> cp /home/user1/.Xauthority /mnt/chroot/.Xauthority
> echo "cp /etc/resolv.conf /mnt/chroot/etc/resolv.conf"
>
> echo "chroot /mnt/chroot"
> echo "su - <user>"
> echo "export DISPLAY=\":0.0\""
> #----- END -----

I tried to investigate this.
I like to understand what I'm doing ?
..Xauthority & resolv.conf seem only concerned with inet-connection.

Initially I don't even want to do X-apps -- I switch to VT-mode for
most tasks.

AFAIK many apps need libraries and perhaps config files, which are
located from 'pointers' in the executable.
Apparently the libs can be located by: ldd <newPartnPath><executable>
But his is not needed, since when the 'chroot ...' is called the executable
DOES take all 'file pointers' relative to "it's new" root-dir ?

One problem which I had, since I wanted to repeatedly call elinks,
so I wanted to use a script, which I do when calling it from its own
partition.
When I used 2 lines in the bash-script:-
chroot <newOne>
elinks <options & args>
then when the script returned, the VT was still in the 'new' root,
as seen by 'rdev'.

But if I used one line thus:
chroot <newOne> ; elinks <options & args>
it was OK.

Why would I need any of the script lines:
mount -t proc none /mnt/chroot/proc
mount -o bind /lib/modules /mnt/chroot/lib/modules
mount -o bind /sys /mnt/chroot/sys
mount -o bind /tmp /mnt/chroot/tmp
mount -o bind /dev /mnt/chroot/dev
mount -o bind /dev/pts /mnt/chroot/dev/pts
??

When it's running with <the-other-/root & /proc> I guess it
uses <the-other-/dev & /proc> ?
But these haven't been created by the boot process ?

It's interesting, but beyond my knowledge !

Thanks for any input.

== Chris Glur.


From: Olive on
problems(a)gmail wrote:
>>> OTOH, when we 'upgrade' we often loose good-old aps.
>
> Tom N wrote:-
>> Don't every 'upgrade'. Just install new apps and new libs,
>> one at a time, if they are worth it.
>
> Yes. But from where I am now, I have different apps on different
> instalations/partitions, which I want to run -- ALL.
>
>> > I've had partial success with using scripts:
>> > chroot <old-proven partiton's current mount point>
>> > <the old-proven-ap>
>
> From: Shadow_7:-
>> I got this from the gentoo site/forums. And adapted it for my needs.
>>
>> #----- START -----
>> #! /bin/sh
>>
>> mount /dev/hd?# /mnt/chroot
>> mount -t proc none /mnt/chroot/proc
>> mount -o bind /lib/modules /mnt/chroot/lib/modules
>> mount -o bind /sys /mnt/chroot/sys
>> mount -o bind /tmp /mnt/chroot/tmp
>> mount -o bind /dev /mnt/chroot/dev
>> mount -o bind /dev/pts /mnt/chroot/dev/pts
>>
>> cp /home/user1/.Xauthority /mnt/chroot/.Xauthority
>> echo "cp /etc/resolv.conf /mnt/chroot/etc/resolv.conf"
>>
>> echo "chroot /mnt/chroot"
>> echo "su - <user>"
>> echo "export DISPLAY=\":0.0\""
>> #----- END -----
>
> I tried to investigate this.
> I like to understand what I'm doing ?
> .Xauthority & resolv.conf seem only concerned with inet-connection.
>
> Initially I don't even want to do X-apps -- I switch to VT-mode for
> most tasks.
>
> AFAIK many apps need libraries and perhaps config files, which are
> located from 'pointers' in the executable.
> Apparently the libs can be located by: ldd <newPartnPath><executable>
> But his is not needed, since when the 'chroot ...' is called the executable
> DOES take all 'file pointers' relative to "it's new" root-dir ?
>
> One problem which I had, since I wanted to repeatedly call elinks,
> so I wanted to use a script, which I do when calling it from its own
> partition.
> When I used 2 lines in the bash-script:-
> chroot <newOne>
> elinks <options & args>
> then when the script returned, the VT was still in the 'new' root,
> as seen by 'rdev'.

rdev do not see you the root environment. chroot <newroot> <command>
execute a command in the chroot environment. If you do not specify a
command it executes $SHELL. If interactively you do:

chroot /mnt/chroot # line 1
ls # line 2
exit # line 3

then the first line executes a shell in the new root; the second line
executes ls within the new shell (thus in the chrooted environment); the
third line exit the chrooted shell and return to the original shell.

If you do the same in a script; the first line execute bash in a
chrooted environment that immediately exit since this new bash have no
command to execute. the second line do ls in the original shell and exit
exit the script. If you want to execute several commands from a script
in a chroot environment you have to make a script, say script.sh with
these commands and from the main script you do chroot /mnt/chroot
script.sh (you can also use redirection of stdin to specify commands to
the chrooted shell).

You can even launch X aps from the chrooted environment. To do so; you
have to ensure that X is not launched with the -nolisten tcp option (if
you use kdm, edit /etc/kde/kdm/kdmrc ) and to copy the ~/.Xauthority in
the new home of the user who will execute program. I have make a script
that put me in a Mandriva chrooted environement (with sudo mdvswitch);
assuming the correct directories are present in fstab. As I have done
this script for myself; I have not documented it; but I attach it here
in case it might be useful (I license it under MIT).

Olive