1

I'm planning to host a web application on a 64-bit Dell server with 32 GB RAM. I'm planning to put Ubuntu 10.04 LTS there. The problem is, our web app uses a simulator, which could be compiled and run only in 32-bit mode. So, right now I'm thinking of two possible solutions:

  1. Install 32-bit Ubuntu -- the simulator would run happily, but resource utilization might not be optimal
  2. Install 64-bit OS; install another 32-bit Ubuntu virtual machine. Have Apache redirect from the main server to the "virtual" server.

I'd like to know about the pros and cons of these two techniques. In case there is some better alternative, I'd be glad to hear that.

I've already searched for the similar threads here, and found this to be closely related: Should I run 32 bit and 64 bit production applications on a 64 bit Debian server?

However, the solutions provided there couldn't satisfy me fully.

Finally, I must confess I don't have any knowledge on virtualization. Option #2 provided above is based on what I know about a system. However, I'm more than eager to learn about virtualization.

Barun
  • 289
  • 1
  • 3
  • 13
  • 1
    Why does solutions provided couldn't satisfy you? Have you tried just to run your simulator on 64-bit machine? Most of the time you only need to install some 32-bit libraries in order to get 32-bit binary working on 64-bit os. – rvs Nov 27 '11 at 14:54
  • I've tried installing the necessary 32-bit libraries, and compiling with -m32 flag to g++. Compilation, installation went through fine. However, the software failed while trying to run it. Besides, the server is going to be public. The post here http://serverfault.com/q/97109/58453 somehow suggests chroot may not be a good option. – Barun Nov 27 '11 at 16:13
  • What if you try to run the software that was compiled on a 32 bit machine? What kind of errors did you have? Having a VM would ease some of the management problems, but you will probably have at least a performance penality if you go that way. – Jure1873 Nov 27 '11 at 17:40
  • If I try to compile without the -m32 flag and then install, an error comes notifying architecture incompatibility. Then I tried to compile with -m32 flag. A major problem is that this simulator needs to have five other software installed. So, it becomes difficult to identify which particular software should cause the problem. – Barun Nov 27 '11 at 17:52
  • @Barun This is a fine use case for a chroot. As the post you cite says: “When the answer isn't 'for security purposes.'” – Gilles 'SO- stop being evil' Nov 27 '11 at 18:40

2 Answers2

3

The ia32-libs package contains a large collection of x86_32 libraries. If your program can run with only those libraries, you're set. There are also 32-bit development tools in the gcc-multilib and binutils-multiarch packages.

If you need to go beyond that, run a 32-bit system in a chroot. Debian and Ubuntu come with tools that make this easy, primarily schroot, and debootstrap for installation. Set up a schroot and install your 32-bit system inside it. Calling schroot takes care of calling setpersonality(), which in particular makes uname() return i686 and not x86_64. Having uname return an unexpected value is probably what confused your application when you tried running it directly on the 64-bit system. Remember to turn off services in the chroot (the guide I linked to explains how), and do security upgrades in the chroot (you're not going to run any services there, but there could be bugs in libraries).

A virtual machine is no use here. You'd have all the maintenance issues of a chroot, plus those of the VM, plus those of the separation (memory usage, disk usage, …), plus the separate Apache instance in the VM, plus the redirection on the host, plus possibly performance issues.

  • Thanks! I had already tried `ia32-libs` and `gcc-multilib`, I'd still give another try. I'll go through your tutorial on `schroot`. – Barun Nov 27 '11 at 18:54
  • Just a question -- I came across this software, `Jail` (http://www.jmcresearch.com/projects/jail/), which seems to provide `chroot` environment. Is it advisable to use this, or the manual `schroot` configuration as in the tutorial? – Barun Nov 27 '11 at 18:58
  • @Barun I didn't know about Jail. I don't see the point given your use case. It seems to mainly do the job of debootstrap, which debootstrap does just fine (on the platforms that have it). – Gilles 'SO- stop being evil' Nov 27 '11 at 19:17
1

If I were you I would run a PV xen (thus minimizing the "penalty" for the VM) with the 32-bit version (which is easier than fiddling with 32-bit libraries on a 64-bit-system). And I would use an AMD-Opteron-based machine for this purpose (Intel emulates 32 bit, AMD does execute it natively).

Nils
  • 7,657
  • 3
  • 31
  • 71