Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Oct 2003 13:20:09 -0700
From:      Andrew Barnert <barnert@myrealbox.com>
To:        freebsd-questions@freebsd.org
Subject:   Linux ABI using existing linux setup?
Message-ID:  <1066767608.2167.206.camel@verdammt.falcotronic.net>

next in thread | raw e-mail | index | archive | help
Hi there. After years of not using BSD, I've recently installed FreeBSD
5.1, and I have some questions about the linux ABI (plus a few other BSD
questions).

The short version is: Can I use an existing linux installation instead
of linux_base (and if so, what do I need to do to set it up), and can I
use a Mandrake setup instead of Redhat or Debian?

If you can already answer me, just skip the rest of my email; if you
need more information, read on:

This box dual-boots between FreeBSD 5.1 and Mandrake Cooker (9.2-ish).
The Lilo setup was easy, mounting my ext3 partitions was easy, and after
configuring my system and installing the emulation/linux_base port, I
can now run most of the software I've installed for Mandrake--including
commercial software like SMACX and utilities like fdisk.

But there are a few problems. For the most part, they're the same
problems you'd get running Mandrake 9.x software on a real Redhat 7.x
installation, although there are a few that may be BSD-specific. Either
way, I'd like to find a solution.

First, is there more information available than the chapter in the
Handbook?

Next, is it possible to just use my existing linux install in place of
the libraries from linux_base? I tried just mounting my linux
filesystems on /compat/linux, and almost everything dumps core. That's
not surprising, but I wanted to try that before asking. 

But if I mount my linux system in /mnt/linux, executables can't find any
of the solibs. I tried running things under a chroot jail, but then
everything coredumps. Is the dynamic rerooting thing configurable? Is
there anything tricky I need to do here? And if I do need to chroot
nearly everything under /mnt/linux, does that mean only root can run
linux apps, or can I allow other people to chroot successfully (and
how)?

Do I need to brandelf all of my linux executables? (And will this affect
using them under linux?)

Do I need to run an extra ldconfig, passing /mnt/linux/lib, etc.? And do
I use /sbin/ldconfig, /compat/linux/sbin/ldconfig, or
/mnt/linux/sbin/ldconfig? (Since I don't know the inner workings of the
BSD loader as I do linux, I don't want to mess things up and have to
reinstall... I was a bit surprised to see that ldconfig runs so quickly,
and the only file it seems to keep around, /var/run/ld-elf.so.hints, is
only 239 bytes rather than the 100K+ for /etc/ld.so.cache under linux.)

Once I get shared library support working, is there any reason I can't
use Mandrake's RPM (a modified 4.2) and urpmi and related tools to
update my Mandrake installation from within BSD (by repointing the
config files and/or chrooting them)? 

It may be a larger problem with the dynamic rerooting than just so
loading. For example, /usr/local/bin/rpm -qa fails because /var/lib/rpm
is empty. But /compat/linux/bin/rpm -qa also fails for the same reason,
even though /compat/linux/var/lib/rpm is not empty.

Meanwhile, in a separate issue, Linux SDL games have no sound. When I
run smacx (with sound enabled), after about 10 seconds it prints "SDL:
Audio timeout - buggy audio driver? (disabled)" to stderr. If I don't
disable sound, I get a long delay every time it tries to play a movie.
Otherwise the game works fine, but no sound. The same thing happens with
/mnt/linux/usr/bin/playsound (from the SDL audio package), but
/usr/local/bin/playsound works fine. (This is all true whether I'm
running esd or not--and esddsp doesn't help. Even after I've set sysctl
hw.snd.pcm0.vchans=4, nothing changes.) Do I just need to symlink
something to [/compat/linux?]/dev/pcm, etc.?

If the system crashes without unmounting cleanly (playing with svgalib
stuff...), I can run fsck.ext2 under BSD until the penguins come home,
and it finds and even fixes problems just fine, but it never marks the
filesystems as clean. So, until I reboot into linux once, I can only
mount my ext2 filesystems readonly. Is there something I'm missing?
Should I run /mnt/linux/sbin/fsck, or is this a dangerously stupid idea?
Or is this by design?

And speaking of crashes, I assume there's nothing like linux's "magic
SysRq hack" in FreeBSD? (Being able to SysRq-SUB to unmount cleanly even
after the system is totally hosed is quite nice for
kernel/driver/svga/X/etc. hacking.)

Finally, I can lilo -R (to change the default boot target (so I can
"lilo -r /mnt/linux -R FreeBSD-5.1 && reboot" or "lilo -r /mnt/linux -R
linux24229mm && reboot" and walk away), but lilo -q (to see the list of
targets, and verify that they can be found) doesn't work. And, needless
to say, installing a new boot map doesn't work. I've spoken to the main
lilo developer, and looked at the code, and this is pretty much
unfixable (unless you want to add a bunch of new IOCTL's into the
various fs drivers, or rewrite lilo to do things a different way), but I
thought it was worth mentioning. (I can just 
strings /mnt/linux/boot/map to get all I really need....)

Anyway, any help anyone can offer would be greatly appreciated.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1066767608.2167.206.camel>