Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Trying to chroot to 32bit....
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on AMD64
View previous topic :: View next topic  
Author Message
spoofy
n00b
n00b


Joined: 28 Mar 2005
Posts: 58

PostPosted: Tue Jun 07, 2005 3:00 am    Post subject: Trying to chroot to 32bit.... Reply with quote

Quote:
bash-2.05b# linux32 chroot /mnt/gentoo32 /bin/bash
chroot: cannot run command `/bin/bash': No such file or directory
bash-2.05b#



the guide at
http://www.gentoo.org/proj/en/base/amd64/technotes/index.xml?part=1&chap=4

doesnt say thing about this.. i do have bash installed so i'm not quite sure what is going on ..anyone?
Back to top
View user's profile Send private message
whig
l33t
l33t


Joined: 27 Nov 2004
Posts: 973
Location: New Zealand

PostPosted: Tue Jun 07, 2005 4:31 am    Post subject: Reply with quote

Dumb question, but do you have a (complete?) 32 bit system under /mnt/gentoo32?
Back to top
View user's profile Send private message
kabage
Guru
Guru


Joined: 31 Jan 2005
Posts: 340

PostPosted: Tue Jun 07, 2005 5:59 am    Post subject: Maybe Reply with quote

I think whig is trying to say you need to make
sure you unzipped your stage1 2 or 3 before you chroot in otherwise there will be no bash
to login to
_________________
The solutions are easy. Its finding them that is hard.


Last edited by kabage on Thu Jun 09, 2005 4:30 am; edited 1 time in total
Back to top
View user's profile Send private message
wnreynolds
n00b
n00b


Joined: 22 Nov 2004
Posts: 5

PostPosted: Tue Jun 07, 2005 6:32 am    Post subject: Reply with quote

I think you need to be root. To do this as a normal user, you have to make linux32 setuid (WARNING! BIG SECURITY HOLE)

Code:
 
  $ chmod 4755 /bin/linux32


Following http://gentoo-wiki.com/HOWTO_AMD_64, I've set up a 32 bit chroot. I've also written a little script that allows you to launch 32 bit apps from
the kde/gnome desktop. This script assumes you have 2 home dirs - one 32 bit, one 64 bit, and that the 64 bit home is accessible (via mount -o bind) from the 32 bit chroot. The syntax is:

Code:

  $ exec32  <unix socket display> <path to 64 bit home dir from 32 bit env or "false" if shared with 32 bit env>  <32 bit dir to run in> <app and args to execute>


For example, to launch 32 bit firefox from my kde desktop, I create an application shortcut and use the following for the command:

Code:

  /bin/linux32 /bin/chroot /old /usr/local/bin/exec32 myHostName/unix:0 /home64/my64BitHome /home/my32BitHome firefox


To launch a shell in the 32 bit env, create an application shortcut with the following:

Code:

  konsole -e linux32 /bin/chroot /old /usr/local/bin/exec32 myHostName/unix:0 /home64/my64BitHome /home/my32BitHome bash -login


You can now launch all your 32 bit apps from this console, and they should open fine on your desktop. The script uses xauth, so you shouldn't be compromising your X server security (although this trick definitely needs a setuid linux32).


Here is the script, exec32, put it somewhere in your 32 bit env (I use /usr/local/bin/exec32).

Code:

#!/bin/sh
# This script is run from the 32 bit environment with 4 args:
# 1) The display in the 64 bit environment
# 2) The path in 32 bit environment to the dir containing the .Xauthority
#   from the 64 bit environment
# 3) The directory to execute the program in in the 32 bit environment
# 4) The name of the file to be executed in the 32 bit environment

DISPLAY=$1
shift
HOME_64=$1
shift
NEWDIR=$1
shift
EXE=$*

if [ ! "$HOME_64" = "false" ]; then
        HOST_AUTH=$(xauth -f ${HOME_64}/.Xauthority list  | grep ${DISPLAY})
        xauth add ${HOST_AUTH}
        export DISPLAY=$DISPLAY
fi
cd ${NEWDIR}
exec $EXE
Back to top
View user's profile Send private message
spoofy
n00b
n00b


Joined: 28 Mar 2005
Posts: 58

PostPosted: Tue Jun 07, 2005 7:54 pm    Post subject: Reply with quote

whig wrote:
Dumb question, but do you have a (complete?) 32 bit system under /mnt/gentoo32?


the directions in the guide simply stated to emerge various packages ..which i did
Back to top
View user's profile Send private message
spoofy
n00b
n00b


Joined: 28 Mar 2005
Posts: 58

PostPosted: Tue Jun 07, 2005 8:00 pm    Post subject: Reply with quote

wnreynolds wrote:
I think you need to be root. To do this as a normal user, you have to make linux32 setuid (WARNING! BIG SECURITY HOLE)

Code:
 
  $ chmod 4755 /bin/linux32


Following http://gentoo-wiki.com/HOWTO_AMD_64, I've set up a 32 bit chroot. I've also written a little script that allows you to launch 32 bit apps from
the kde/gnome desktop. This script assumes you have 2 home dirs - one 32 bit, one 64 bit, and that the 64 bit home is accessible (via mount -o bind) from the 32 bit chroot. The syntax is:

Code:

  $ exec32  <unix socket display> <path to 64 bit home dir from 32 bit env or "false" if shared with 32 bit env>  <32 bit dir to run in> <app and args to execute>


For example, to launch 32 bit firefox from my kde desktop, I create an application shortcut and use the following for the command:

Code:

  /bin/linux32 /bin/chroot /old /usr/local/bin/exec32 myHostName/unix:0 /home64/my64BitHome /home/my32BitHome firefox


To launch a shell in the 32 bit env, create an application shortcut with the following:

Code:

  konsole -e linux32 /bin/chroot /old /usr/local/bin/exec32 myHostName/unix:0 /home64/my64BitHome /home/my32BitHome bash -login


You can now launch all your 32 bit apps from this console, and they should open fine on your desktop. The script uses xauth, so you shouldn't be compromising your X server security (although this trick definitely needs a setuid linux32).


Here is the script, exec32, put it somewhere in your 32 bit env (I use /usr/local/bin/exec32).

Code:

#!/bin/sh
# This script is run from the 32 bit environment with 4 args:
# 1) The display in the 64 bit environment
# 2) The path in 32 bit environment to the dir containing the .Xauthority
#   from the 64 bit environment
# 3) The directory to execute the program in in the 32 bit environment
# 4) The name of the file to be executed in the 32 bit environment

DISPLAY=$1
shift
HOME_64=$1
shift
NEWDIR=$1
shift
EXE=$*

if [ ! "$HOME_64" = "false" ]; then
        HOST_AUTH=$(xauth -f ${HOME_64}/.Xauthority list  | grep ${DISPLAY})
        xauth add ${HOST_AUTH}
        export DISPLAY=$DISPLAY
fi
cd ${NEWDIR}
exec $EXE


thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on AMD64 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