Linux ABI using existing linux setup?

From: Andrew Barnert (barnert_at_myrealbox.com)
Date: 10/21/03

  • Next message: andi payn: "Linux ABI using existing linux setup?"
    To: freebsd-questions@freebsd.org
    Date: Tue, 21 Oct 2003 13:20:09 -0700
    
    

    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.

    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"


  • Next message: andi payn: "Linux ABI using existing linux setup?"

    Relevant Pages

    • Re: Story Time
      ... The only thing Linux has that BSD ... mismash, and then there was the OSF, Unix International, etc, none ... I remember when ftp.cdrom.com ran off a modestly powered FreeBSD box. ...
      (comp.os.vms)
    • Re: Story Time
      ... The only thing Linux has that BSD ... And while the Unix vendors were fighting, VMS slid and MSFT became unstoppably dominant. ... Anyway, Linux has commercial products like Oracle and engineering CAD apps, important free packages like Sun Java (although compatibility modules might let it run on FreeBSD) and the drivers to get full usage of my NVIDIA video card. ...
      (comp.os.vms)
    • Re: Story Time
      ... The only thing Linux has that BSD ... "Why not VMS?" ... I remember when ftp.cdrom.com ran off a modestly powered FreeBSD box. ...
      (comp.os.vms)
    • Re: BSD derivatives
      ... What is your association with Open BSD? ... on the work of the FreeBSD Project, with an eye to being, maybe, more "user ... If you are familiar with Linux, search at Google with the string "BSD Linux ... Both are computer operating systems with several similarities, enough that if you can "drive" one, you can probably ...
      (freebsd-questions)
    • Re: Confessions of a Linux Wannabe
      ... wouldn't be able to tell you if it is using Linux or FreeBSD. ... As for software installation: FreeBSD has a package management system ... download/build dependencies if applicable, configure and compile the ...
      (comp.os.linux.misc)