How to boot a Linux loopback file from Windows boot manager.

Posted on 2008-11-15
Last Modified: 2013-12-15
I'm trying to create a small linux filesystem(25MB) within a loopback file then boot it from the Windows boot manager(boot.ini).
I know it's possible(Ubuntu has a Windows installer that does this). Does anyone know to pull this off?
Question by:jasonzx
    LVL 43

    Expert Comment

    Windows boot manager is very unfriendly for 3rd party booting. Maybe You should consider using 3rd party bootmanager or linux's grub?
    What You mean by "within loopback"? Where is the real device for linux root filesystem?

    Author Comment

    Since this will be installed on machines that will be cloned using Zen imaging or Ghost, Grub isn't an option as both of them break Grub.
    And when I say "within a loopback file" I mean:
     create a zero file of 25MB using dd
     format the file with mkfs.ext3
     mount the file
     copy initrd, vmlinuz, etc to the mounted file
     install grub to the file

    I've got most of the procedure figured out but I'm not sure I'm installing Grub properly as when I try to do things this way and select 'Linux' from boot.ini the screen just goes blank.
    LVL 43

    Expert Comment

    I see.
    You will not boot such "file" from windows boot.ini - no such support.

    Next question, where this file is put? ext3 linux filesystem? NTFS?
    The problem is that such file has to be mounted as loop or hdd first.
    IMHO Your options are:
    virtual machine;
    bootlader which can do that(but I doubt);
    special initrd which will mount the host filesystem(where the file lives), loop it, mount it and switch root to newly created mountpoint - yet the kernel/initrd has to be placed somewhere else - not in the loop-file itself. Yet You still will not boot it from boot.ini
    LVL 23

    Expert Comment

    Image the system with an initial bootloader whose sole purpose is to run a script to properly install grub.

    Wait... you just said ubuntu does this.
    Why not just use the Ubuntu installer then, modify the results to be exactly what you need, and copy them to the target system?

    Ubuntu Wubi  does not load Linux directly from bootback, it uses a DOS-based bootloader  ala  loadlin

    From there,  custom scripts in an init ramdisk (initrd), presumably  mount the loopback file  and load the operating root file system and system services.

    Accepted Solution

    Yeah, it was the Wubi installer I was thinking of and when I looked into it, it was a little more complicated than I could figure out. It seems to create some kind of mbr file and boot.ini points to this which is the jumping off point for the whole thing. How this mbr file is create, I've no idea.
    I looked into loadlin but everything I read seems to say that it doesn't work with XP's ntldr.
    However, I did find that pointing boot.ini at grldr(from the grub4dos) package will let me either boot a loopback file or load my ramdisk and kernel.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
    SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now