Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
32-bit Ubuntu system, 64-bit Gentoo chroot
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
j0m
n00b
n00b


Joined: 17 Mar 2006
Posts: 12

PostPosted: Tue May 22, 2007 9:59 pm    Post subject: 32-bit Ubuntu system, 64-bit Gentoo chroot Reply with quote

Maybe this is not the right place to ask this question, but I'm not sure where it belongs, so I'll try nevertheless...

Despite the title of the topic, my Gentoo installation has not been carried out in a chroot, so until now I've always restarted the PC to boot either Ubuntu32 or Gentoo64, but I've thought about emerging/upgrading Gentoo packages from right inside Ubuntu, to avoid downtime when I screw something in Gentoo and still get to work under Ubuntu.

I've already done all the "mount -o bind"s for /proc /sys /dev /tmp etc.etc. But when I try to

Code:
sudo chroot /mnt/gentoo /bin/bash


I get

Code:
cannot run command `/bin/bash': Exec format error


The obvious suspect is 32/64-bit environment mismatch, but I know I can chroot inside a 32-bit one from a 64-bit, using linux32: does a sort of linux64 exist to make the opposite (64-bit chroot from 32-bit system as per my topic) ? If this kind of tool really exists, is the 32-bit Ubuntu kernel ok for the job ? Or should I use a 64-bit kernel inside Ubuntu to enable proper chrooting ? Would a special tool be needed anymore in this second case ?

And what about launching GNOME/KDE apps installed under Gentoo64 from inside Ubuntu32 ?
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Tue May 22, 2007 10:16 pm    Post subject: Re: 32-bit Ubuntu system, 64-bit Gentoo chroot Reply with quote

j0m wrote:
Maybe this is not the right place to ask this question, but I'm not sure where it belongs, so I'll try nevertheless...

Despite the title of the topic, my Gentoo installation has not been carried out in a chroot, so until now I've always restarted the PC to boot either Ubuntu32 or Gentoo64, but I've thought about emerging/upgrading Gentoo packages from right inside Ubuntu, to avoid downtime when I screw something in Gentoo and still get to work under Ubuntu.

I've already done all the "mount -o bind"s for /proc /sys /dev /tmp etc.etc. But when I try to

Code:
sudo chroot /mnt/gentoo /bin/bash


I get

Code:
cannot run command `/bin/bash': Exec format error


The obvious suspect is 32/64-bit environment mismatch,


That is, indeed, your problem.

Quote:
but I know I can chroot inside a 32-bit one from a 64-bit, using linux32: does a sort of linux64 exist to make the opposite (64-bit chroot from 32-bit system as per my topic) ? If this kind of tool really exists, is the 32-bit Ubuntu kernel ok for the job ? Or should I use a 64-bit kernel inside Ubuntu to enable proper chrooting ? Would a special tool be needed anymore in this second case ?


You can chroot into 32 from 64 because x86_64 cpus can natively run 32 bits even when working in 64 bits mode. The opposite is not true. So, that is not achievable on a simple manner. I am by no means and expert in this kind of weird situations. But -at least theoretically- you should be able to run a 64 bits kernel and a 32 bits userland. In other words, you should be able to run a 64 bits kernel into your current ubuntu installation, though that might depends on many factors and I know nothing about ubuntu at all.

If that turns out to be true, then you could chroot into gentoo without any problem. So, the real problem is whether your ubuntu install will work flawlessly under a 64 bits kernel or not. To make a quick test, you could use the same gentoo kernel, just change its root= clause in grub.conf to point to the ubuntu partition and try to boot it, but before that, make sure you have IA32 emulation turned on into that kernel.
Back to top
View user's profile Send private message
torne
n00b
n00b


Joined: 22 Jan 2004
Posts: 65
Location: Cambridge, UK

PostPosted: Thu May 24, 2007 11:42 am    Post subject: Reply with quote

Yup, you need a 64-bit kernel. Generally this will work fine, but a few programs that talk to kernel interfaces might break - at one point, 32-bit iptables couldn't operate on a 64-bit kernel (I don't know if this is still true).
Back to top
View user's profile Send private message
j0m
n00b
n00b


Joined: 17 Mar 2006
Posts: 12

PostPosted: Sat Jun 02, 2007 3:48 pm    Post subject: Re: 32-bit Ubuntu system, 64-bit Gentoo chroot Reply with quote

6thpink wrote:
To make a quick test, you could use the same gentoo kernel, just change its root= clause in grub.conf to point to the ubuntu partition and try to boot it, but before that, make sure you have IA32 emulation turned on into that kernel.


I've tried the Gentoo64 kernel, to no avail, as it gets stuck very early and don't know where to start troubleshooting.

But, on the positive side of things, I also tried the Ubuntu64 kernel (in more detail: I dpkg'ed linux-image and linux-restricted-modules packages with the --force-architecture switch), and both the 32-bit native Ubuntu userland and 64-bit chrooting into Gentoo work, at least from the command-line.

The remaining issue is Xorg-related; for details, please have a look here (I hope I'm not breaking forum rules: I know I'm not linking to a Gentoo forum, but I'm not really cross-posting, just trying to see where troubleshooting leads us to, as it doesn't seem a distro-specific issue at this point).
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Sat Jun 02, 2007 4:21 pm    Post subject: Re: 32-bit Ubuntu system, 64-bit Gentoo chroot Reply with quote

[quote="j0m"]
6thpink wrote:

But, on the positive side of things, I also tried the Ubuntu64 kernel (in more detail: I dpkg'ed linux-image and linux-restricted-modules packages with the --force-architecture switch), and both the 32-bit native Ubuntu userland and 64-bit chrooting into Gentoo work, at least from the command-line.


Well, since this works, I don't see a reason to bother about the Gentoo 64 kernel part.

Quote:

The remaining issue is Xorg-related; for details, please have a look here (I hope I'm not breaking forum rules: I know I'm not linking to a Gentoo forum, but I'm not really cross-posting, just trying to see where troubleshooting leads us to, as it doesn't seem a distro-specific issue at this point).


Those are the issues I was waiting for hehe. And I don't have a clue if there would be any easy workaround. I am not familiar with the Xorg ABI at such level. One thing is clear, though. The kernel and the modules must match. That is for sure.

Anyway, in fact that this leads nowhere, have you considered virtualization? A machine emulator that can emulate a 64 bits cpu should be able to load Gentoo 64 on a nice window into your ubuntu desktop. Bosch, VMWare or Qemu should be able to do that, I think.

EDIT, By the way, maybe (only maybe), installing a multilib capable toolchain could help in anything, I am not sure. And I don't have a clue on how ubuntu manages that, if at all. In gentoo, multilib is the default way to go on amd64.
Back to top
View user's profile Send private message
j0m
n00b
n00b


Joined: 17 Mar 2006
Posts: 12

PostPosted: Sat Jun 02, 2007 5:21 pm    Post subject: Re: 32-bit Ubuntu system, 64-bit Gentoo chroot Reply with quote

6thpink wrote:
Anyway, in fact that this leads nowhere, have you considered virtualization? A machine emulator that can emulate a 64 bits cpu should be able to load Gentoo 64 on a nice window into your ubuntu desktop. Bosch, VMWare or Qemu should be able to do that, I think.


I thought about that, taking into account also solutions like VirtualBox (which is easy to use, and quite a polished Qemu clone/fork). But there's one gotcha: don't know how to employ _real_ partitions (LVM volumes to be precise) inside a guest. VirtualBox doesn't support it, at least I think, as there's no way to specify a LV, and no way to force it.

Still, I'm not Qemu-savvy, so maybe Qemu could do... Do you know anything about Qemu or VMWare supporting this "feature" ?

6thpink wrote:
By the way, maybe (only maybe), installing a multilib capable toolchain could help in anything, I am not sure. And I don't have a clue on how ubuntu manages that, if at all. In gentoo, multilib is the default way to go on amd64.


Do you mean Gentoo on amd64 is _always_ multilib ? Does it imply I can always emerge/compile 32-bit things without crossdev ? How ?
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Sat Jun 02, 2007 5:44 pm    Post subject: Re: 32-bit Ubuntu system, 64-bit Gentoo chroot Reply with quote

No idea about LVM, I always tried to flee away from it. It causes for me more trouble than it is worth (for me).

j0m wrote:

6thpink wrote:
By the way, maybe (only maybe), installing a multilib capable toolchain could help in anything, I am not sure. And I don't have a clue on how ubuntu manages that, if at all. In gentoo, multilib is the default way to go on amd64.


Do you mean Gentoo on amd64 is _always_ multilib ? Does it imply I can always emerge/compile 32-bit things without crossdev ? How ?


No.

Gentoo on amd64 is multilib by default. That is controled via profile. The default 2007.0 profile, is multilib enabled, 2007.0/desktop is as well. You can disable it by choosing a 2007.0/no-multilib profile.

But this profile is only a run-time solution. There is no support, currently, to build 32 bits applications on a Gentoo 64 installation (other than a proper chroot to 32 bits). That is, mainly, due to the fact that all the libraries are installed precompiled, to serve as runtime deps for some packages.

I think this will improve in the future, I hope so. But currently, in gentoo, multilib means "runtime support for 32 bits applications". No support at all to build them, without a chroot or crossdev stuff.

I don't know how this support is in ubuntu at all. So I can't tell you anything about that.
Back to top
View user's profile Send private message
j0m
n00b
n00b


Joined: 17 Mar 2006
Posts: 12

PostPosted: Sat Jun 02, 2007 10:05 pm    Post subject: Re: 32-bit Ubuntu system, 64-bit Gentoo chroot Reply with quote

6thpink wrote:
currently, in gentoo, multilib means "runtime support for 32 bits applications". No support at all to build them, without a chroot or crossdev stuff


Absolutely clear, thanks :)

6thpink wrote:
No idea about LVM


Ok, but what about a normal partition ? Is it usable "as is" inside Qemu/VMWare ?
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Sat Jun 02, 2007 10:30 pm    Post subject: Reply with quote

You can use real or virtual partitions under vmware, I suppose that the same is applicable to Qemu. If those partitions can be used or not, would depend on the guest OS. If the OS has support for a given fs, then there should be no problem.
Back to top
View user's profile Send private message
Enverex
Guru
Guru


Joined: 02 Jul 2003
Posts: 501
Location: Worcester, UK

PostPosted: Sun Jun 17, 2007 9:23 am    Post subject: Re: 32-bit Ubuntu system, 64-bit Gentoo chroot Reply with quote

6thpink wrote:
No idea about LVM, I always tried to flee away from it. It causes for me more trouble than it is worth (for me).

j0m wrote:

6thpink wrote:
By the way, maybe (only maybe), installing a multilib capable toolchain could help in anything, I am not sure. And I don't have a clue on how ubuntu manages that, if at all. In gentoo, multilib is the default way to go on amd64.


Do you mean Gentoo on amd64 is _always_ multilib ? Does it imply I can always emerge/compile 32-bit things without crossdev ? How ?


No.

Gentoo on amd64 is multilib by default. That is controled via profile. The default 2007.0 profile, is multilib enabled, 2007.0/desktop is as well. You can disable it by choosing a 2007.0/no-multilib profile.

But this profile is only a run-time solution. There is no support, currently, to build 32 bits applications on a Gentoo 64 installation (other than a proper chroot to 32 bits). That is, mainly, due to the fact that all the libraries are installed precompiled, to serve as runtime deps for some packages.

I think this will improve in the future, I hope so. But currently, in gentoo, multilib means "runtime support for 32 bits applications". No support at all to build them, without a chroot or crossdev stuff.

I don't know how this support is in ubuntu at all. So I can't tell you anything about that.


This isn't true else Wine wouldn't build (needs a multilib GCC for it to work). Also if this was true then the need for a multilib and non-multilib profiles wouldn't exist because the only difference would be the "emul" packages (which if what you're saying was true, to not have a multilib system they'd just not install them).
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Sun Jun 17, 2007 12:41 pm    Post subject: Re: 32-bit Ubuntu system, 64-bit Gentoo chroot Reply with quote

Enverex wrote:
6thpink wrote:
No idea about LVM, I always tried to flee away from it. It causes for me more trouble than it is worth (for me).

j0m wrote:

6thpink wrote:
By the way, maybe (only maybe), installing a multilib capable toolchain could help in anything, I am not sure. And I don't have a clue on how ubuntu manages that, if at all. In gentoo, multilib is the default way to go on amd64.


Do you mean Gentoo on amd64 is _always_ multilib ? Does it imply I can always emerge/compile 32-bit things without crossdev ? How ?


No.

Gentoo on amd64 is multilib by default. That is controled via profile. The default 2007.0 profile, is multilib enabled, 2007.0/desktop is as well. You can disable it by choosing a 2007.0/no-multilib profile.

But this profile is only a run-time solution. There is no support, currently, to build 32 bits applications on a Gentoo 64 installation (other than a proper chroot to 32 bits). That is, mainly, due to the fact that all the libraries are installed precompiled, to serve as runtime deps for some packages.

I think this will improve in the future, I hope so. But currently, in gentoo, multilib means "runtime support for 32 bits applications". No support at all to build them, without a chroot or crossdev stuff.

I don't know how this support is in ubuntu at all. So I can't tell you anything about that.


This isn't true else Wine wouldn't build (needs a multilib GCC for it to work). Also if this was true then the need for a multilib and non-multilib profiles wouldn't exist because the only difference would be the "emul" packages (which if what you're saying was true, to not have a multilib system they'd just not install them).


I was talking about Gentoo itself, and it IS TRUE that gentoo offers no support to build 32 bits apps with a multilib profile. When you choose 64 bits multilib, all apps will be built with 64 bits word size. Except those hard-Makefiled to do other thing. Which lets the user no choice, and that was my point.

No one stops you from using -march=whatever86 and -m32 to build a 32 bits thing, like wine or grub, but that is entirely app-side, and not OS dependant. Makefiles forever. And there is a difference besides emul* between multilib and no-multilib: glibc is compiled twice, as 32 and as 64. Otherwise, all the emul-* stuff would fail as well.
Back to top
View user's profile Send private message
molot
Apprentice
Apprentice


Joined: 26 Feb 2005
Posts: 214
Location: Warsaw, Poland

PostPosted: Mon Aug 27, 2007 8:13 am    Post subject: Reply with quote

i92guboj wrote:
You can use real or virtual partitions under vmware, I suppose that the same is applicable to Qemu. If those partitions can be used or not, would depend on the guest OS. If the OS has support for a given fs, then there should be no problem.
AFAIR Qemu can use real disks and partitions as well as vmware... NOTE that wmvare warns about using physical partitions, says it might be dangerous. I've ignored it for months preparing two gentoos for labs and all was perfectly ok, but it's better to know than not to know about possible danger. And always check, if you are not double-mounting! It is (sometimes) possible and leads to effects hardly weaker than shred's ones ;)
_________________
"I just have to run faster than the slowest party member"
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