Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Architectures & Platforms Gentoo on AMD64
  • Search

32-bit Ubuntu system, 64-bit Gentoo chroot

Have an x86-64 problem? Post here.
Locked
Advanced search
12 posts • Page 1 of 1
Author
Message
j0m
n00b
n00b
Posts: 12
Joined: Fri Mar 17, 2006 8:24 pm

32-bit Ubuntu system, 64-bit Gentoo chroot

  • Quote

Post by j0m » Tue May 22, 2007 9:59 pm

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: Select all

sudo chroot /mnt/gentoo /bin/bash
I get

Code: Select all

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 ?
Top
i92guboj
Bodhisattva
Bodhisattva
User avatar
Posts: 10315
Joined: Tue Nov 30, 2004 8:17 pm
Location: Córdoba (Spain)

Re: 32-bit Ubuntu system, 64-bit Gentoo chroot

  • Quote

Post by i92guboj » Tue May 22, 2007 10:16 pm

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: Select all

sudo chroot /mnt/gentoo /bin/bash
I get

Code: Select all

cannot run command `/bin/bash': Exec format error
The obvious suspect is 32/64-bit environment mismatch,
That is, indeed, your problem.
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.
Top
torne
n00b
n00b
Posts: 65
Joined: Thu Jan 22, 2004 4:24 pm
Location: Cambridge, UK

  • Quote

Post by torne » Thu May 24, 2007 11:42 am

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).
Top
j0m
n00b
n00b
Posts: 12
Joined: Fri Mar 17, 2006 8:24 pm

Re: 32-bit Ubuntu system, 64-bit Gentoo chroot

  • Quote

Post by j0m » Sat Jun 02, 2007 3:48 pm

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).
Top
i92guboj
Bodhisattva
Bodhisattva
User avatar
Posts: 10315
Joined: Tue Nov 30, 2004 8:17 pm
Location: Córdoba (Spain)

Re: 32-bit Ubuntu system, 64-bit Gentoo chroot

  • Quote

Post by i92guboj » Sat Jun 02, 2007 4:21 pm

j0m wrote:
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.
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.
Top
j0m
n00b
n00b
Posts: 12
Joined: Fri Mar 17, 2006 8:24 pm

Re: 32-bit Ubuntu system, 64-bit Gentoo chroot

  • Quote

Post by j0m » Sat Jun 02, 2007 5:21 pm

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 ?
Top
i92guboj
Bodhisattva
Bodhisattva
User avatar
Posts: 10315
Joined: Tue Nov 30, 2004 8:17 pm
Location: Córdoba (Spain)

Re: 32-bit Ubuntu system, 64-bit Gentoo chroot

  • Quote

Post by i92guboj » Sat Jun 02, 2007 5:44 pm

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.
Top
j0m
n00b
n00b
Posts: 12
Joined: Fri Mar 17, 2006 8:24 pm

Re: 32-bit Ubuntu system, 64-bit Gentoo chroot

  • Quote

Post by j0m » Sat Jun 02, 2007 10:05 pm

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 ?
Top
i92guboj
Bodhisattva
Bodhisattva
User avatar
Posts: 10315
Joined: Tue Nov 30, 2004 8:17 pm
Location: Córdoba (Spain)

  • Quote

Post by i92guboj » Sat Jun 02, 2007 10:30 pm

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.
Top
Enverex
Guru
Guru
Posts: 501
Joined: Wed Jul 02, 2003 12:25 pm
Location: Worcester, UK
Contact:
Contact Enverex
Website

Re: 32-bit Ubuntu system, 64-bit Gentoo chroot

  • Quote

Post by Enverex » Sun Jun 17, 2007 9:23 am

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).
Top
i92guboj
Bodhisattva
Bodhisattva
User avatar
Posts: 10315
Joined: Tue Nov 30, 2004 8:17 pm
Location: Córdoba (Spain)

Re: 32-bit Ubuntu system, 64-bit Gentoo chroot

  • Quote

Post by i92guboj » Sun Jun 17, 2007 12:41 pm

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.
Top
molot
Apprentice
Apprentice
User avatar
Posts: 214
Joined: Sat Feb 26, 2005 6:29 pm
Location: Warsaw, Poland
Contact:
Contact molot
Website

  • Quote

Post by molot » Mon Aug 27, 2007 8:13 am

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"
Top
Locked

12 posts • Page 1 of 1

Return to “Gentoo on AMD64”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic