Jump to content











Photo
- - - - -

Linux from VHD How To?

linux windows boot vhd image-file howto

  • Please log in to reply
189 replies to this topic

#26 Guest_AnonVendetta_*

Guest_AnonVendetta_*
  • Guests

Posted 25 July 2016 - 08:53 PM

I was referring to a fixed VHD, not a VHDX. I'm guessing you can convert a fixed VHD to a standard raw image by simply removing the footer?

 

What do you mean by specific driver? You probably either mean the driver used by the boot loader (if any) to chainload the VHD, or the drivers used within Linux (which can't kick in until something has mounted the VHD and made it accessible (since Linux is *within* it).

 

I already know that a fixed VHD is considered as a disk, and can have any of multiple partition tables (either MBR or GPT, most likely), and can have one or more partitions/volumes within. But it seems to me that the VHD itself must be first mounted (or mapped as a disk) before any partitions/volumes within can be mounted.

 

Am I correct in assuming that:

1: Bootloader loads initrd, after which point the initial mapping/mounting is lost, but only after mounting a temp root

2. Which then transitions control to the kernel and into protected mode, which then mounts the rootfs, initializes any remaining partitions/volumes and devices/hardware, and finishes by transitioning into userspace

 

If mapping is lost when the kernel starts, then how does it know it is running within an image and not on real hardware? Does it "lose memory" of how it started, or does it not care where it is running from as long as the rootfs is available? You say the boot volume is rediscovered, but if the OS uses drivers (which is my understanding) to determine what hardware it is running on......this is getting confusing. If a script has to be run to get the OS to figure out that it is running within a loop device image and not on a real disk......I would think Linux would smarter than Windows in this regard.

 

Stop trying to compare day to night, yes, I did say that I am booting Linux within a raw IMG on Android, but we both should know (especially you) that the ways that a phone and PC boots are very different. These are images that use an ARM-based CPU and virtualized/emulated hardware.



#27 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 26 July 2016 - 08:30 AM

Just to keep on, a Fixed type VHD (not VHDX) is a RAW image with a single sector appended (Conectix descriptive sector).

 

Of course if you take a Fixed VHD and strip the last sector you get a RAW image.

 

Let's talk Windows NT first.

When booted Windows NT OS's have a built-in mechanism that:

1) scans existing hardware and loads appropriate drivers to access and mount mass storage devices

2) makes sure to "hook" the device it was booted from and its volume(s), mounting them, etc.

 

You may understand better the concept if you take some time reading about the Kansas City Shuffle:
http://www.911cd.net...showtopic=21242

 

In that case, we use a specially crafted disk image to initiate booting and when the hardware is re-scanned an actual hardware device (and volume(s) on it) are mounted.

 

The way Winvblock is used is to have grub4dos write in a specific address/place in RAM the name and path of the image we want to boot from, when the Winvblock driver is loaded, it looks for information there and if it finds valid info proceeds to access the (virtual) device and volume(s) in it, see:

http://reboot.pro/to...winvblock-work/

 

Linux is not much different.

The kernel is loaded and executed, the initrd (Initial Ram Disk) is copied to RAM and accessed.

Inside the initrd there are a number of autoexecution scripts and commands (not entirely unlike good ol' config.sys and autoexec.bat were in DOS), among them there are provisions to scan the hardware and create the device mappings (what you find in /dev/ ) and "connecting" them to the actual hardware found.

kernels normally have a parameter (or cheat code) that tells which volume is to be mounted as "root", like  root=/dev/sda1.

Of course the /dev/sda1 needs to:

1) exist

2) be a valid, recognizable, volume/filesystem

 

What is needed to boot Linux from a disk image (a RAW image or a "fixed" VHD) is to have it access and mount this virtual device during the early boot phase.

This involves modifying the initial scripts (inside the initrd) adding commands that create the mapping(s).

 

Each Linux distro might need slightly different scripts and there are a number of different tools to achieve that, I already named a few, searching for them might provide you with some examples (that will be normally however specific to a given distro, and sometimes even to a specific version of a same distro):
losetup, kpartx, kspartx-boot, mdadm, 

 

Usage of kpartx in itself is easy enough:
http://robert.penz.n...-an-image-file/

but you need to have it and find a way to execute it, and to execute it early enough in the booting phase.

Using losetup with a RAW hard disk image needs to use an offset, again it is not particularly difficult:
http://www.tldp.org/...-Root-FS-3.html

http://web2.clarkson.../ddtutorial.txt

but a lot of things depend on the modules available in the kernel or available for dynamic loading, etc.

 

 

and in the case of a VHD (not a "fixed" VHD which is just a RAW image with a single sector appended, and thus it is normally accessible by built-in proviions), you need something capable of understanding the VHD format. like:

vhd-fuse, libvhdio

 

:duff:

Wonko



#28 wean_irdeh

wean_irdeh

    Newbie

  • Members
  • 29 posts
  •  
    Vietnam

Posted 01 August 2016 - 03:39 PM

Linux is not much different.

The kernel is loaded and executed, the initrd (Initial Ram Disk) is copied to RAM and accessed.

Inside the initrd there are a number of autoexecution scripts and commands (not entirely unlike good ol' config.sys and autoexec.bat were in DOS), among them there are provisions to scan the hardware and create the device mappings (what you find in /dev/ ) and "connecting" them to the actual hardware found.

kernels normally have a parameter (or cheat code) that tells which volume is to be mounted as "root", like  root=/dev/sda1.

Of course the /dev/sda1 needs to:

1) exist

2) be a valid, recognizable, volume/filesystem

 

What is needed to boot Linux from a disk image (a RAW image or a "fixed" VHD) is to have it access and mount this virtual device during the early boot phase.

This involves modifying the initial scripts (inside the initrd) adding commands that create the mapping(s).

 

Each Linux distro might need slightly different scripts and there are a number of different tools to achieve that, I already named a few, searching for them might provide you with some examples (that will be normally however specific to a given distro, and sometimes even to a specific version of a same distro):
losetup, kpartx, kspartx-boot, mdadm,

 

and in the case of a VHD (not a "fixed" VHD which is just a RAW image with a single sector appended, and thus it is normally accessible by built-in proviions), you need something capable of understanding the VHD format. like:

vhd-fuse, libvhdio

 

:duff:

Wonko

 

Thanks for the big enlightening Wonko, your mention of vhd-fuse lead me to search on google, which returning result 'vbox-fuse'. Appearantly the packages has been merged to the mainstream, but there's one thread on vbox support forum which has step by step on how to install the 'fanmade vbox' using vbox headers source and some provided files in the post. I can't follow the guide since for me, it's like written for advanced linux user, while I'm still n00b.

 

Meanwhile a quick google search for libvhdio reveals the blktap package as part of xen virtualization, but could be used as standalone package. I had a success using this package to mount VHD.

There's also qemu-utils, which use qemu's capabillity, combined with network block driver to mount vhd, \

dd if=/dev/mapper/tapdev0p1 of=/dev/null bs=1M

using the command, it shows that qemu is 2x slower than blktap.

 

Now the boot vhd thing.

After successfully attempt to mount vhd, I need to put these program to initrd.img. But I haven't tried it since I still haven't figure out how to put these program and it's dependencies (I can't even figure out if the distro I'm using, antiX 15 is using initrd or initramfs since there are different instruction), not to mention these program will only have access to busybox command interpreter.

 

Looking at your date post, Wonko, I figured out I just spent my entire week just for mounting VHD in linux, and haven't figure out how to boot linux from it. At this point it could be just better to boot into minimal linux distro iso with kvm-qemu paravirtualization installed and run linux VHD from it, if you don't want to mess up with partition.



#29 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 01 August 2016 - 03:56 PM

Well, it seems like the basic message still didn't come through.

Sometimes I wonder what is the issue in it.

As said on this thread and on the other thread:
http://reboot.pro/to...istro-antix-15/
and all over the board, there is no actual *need* of using a VHD image.

A "static" VHD image is a RAW image.

The only kind of VHD image that actually makes sense is a "static" one (i.e. a RAW image) unless there are any particular, documented, valid reasons for needing a "differencing" one or a "dynamic" one.

I will repeat, particular, documented, valid.

IF there is no such reasons (or they are not valid) do yourself a favour and use a RAW image instead.

With a RAW image (or a "static" VHD, which is the same thing) you need not an "interposition library" such as libvhdio

 

 

libvhdio.so is an interposition library which presents VHDs as block
devices. When pre-loaded with dynamically linked binaries, it
intercepts all file-level IO calls (such as open, read, write, etc.)
made against VHDs and interprets them as if they were against the VHD
virtual block device. Thus, for example, when libvhdio intercepts a
read() call at offset 0 of a VHD, it parses the VHD metadata, maps the
offset into the virtual block device address space, and returns the
data corresponding to byte 0 of the virtual block device. This
essentially makes the VHD regular file appear as a 'mounted' block
device, and it allows unmodified binaries (like dd, mkfs, etc.) to
manipulate VHDs without knowing anything about the VHD file format.

A RAW image (or a static VHD) is already seen by the Linux as a block device once mounted with kpartx or losetup.

 

Besides, grub4dos cannot deal at all with "differencing" and only very partially/in a very limited way with "dynamic".

 

So the advice is:

1) try with  a RAW image (or a static VHD, they are the same thing apart the footer)

2) manage to boot Linux from said RAW image (or static VHD)

3) once successful, experiment making things needlessly complex by adding interposition libraries, fuse mounts or whatever else (and you will also need to find a suitable bootloader)

 

:duff:

Wonko
 



#30 crashnburn

crashnburn

    Frequent Member

  • Advanced user
  • 136 posts

Posted 06 September 2016 - 06:16 AM

Well, it seems like the basic message still didn't come through.

Sometimes I wonder what is the issue in it.

As said on this thread and on the other thread:
http://reboot.pro/to...istro-antix-15/
and all over the board, there is no actual *need* of using a VHD image.

A "static" VHD image is a RAW image.

The only kind of VHD image that actually makes sense is a "static" one (i.e. a RAW image) unless there are any particular, documented, valid reasons for needing a "differencing" one or a "dynamic" one.

I will repeat, particular, documented, valid.

IF there is no such reasons (or they are not valid) do yourself a favour and use a RAW image instead.

With a RAW image (or a "static" VHD, which is the same thing) you need not an "interposition library" such as libvhdio

A RAW image (or a static VHD) is already seen by the Linux as a block device once mounted with kpartx or losetup.

 

Besides, grub4dos cannot deal at all with "differencing" and only very partially/in a very limited way with "dynamic".

 

So the advice is:

1) try with  a RAW image (or a static VHD, they are the same thing apart the footer)

2) manage to boot Linux from said RAW image (or static VHD)

3) once successful, experiment making things needlessly complex by adding interposition libraries, fuse mounts or whatever else (and you will also need to find a suitable bootloader)

 

:duff:

Wonko
 

 

The awesome Wonko :) I've been reading on this thread for a long time about RAW Image and VHD etc but I have yet to see a single step by step "experiment" that has been able to do so. 

On the other hand, I've been doing the following, repeatedly for a long time now: 
A) Creating VHDs using PowerShell/ Diskpart/ Batch scripts

B ) Applying Windows (pref 8.1, 10 etc) Images (.WIM from ISO) to the above VHDs using DISM ApplyImage

C) Apply Boot Code using BCDBoot.exe 

D) Boot via Windows Boot Manager

 

Can you outline steps, or point out articles that have the above similar steps, that I can experiment on to see if this can be made to work. 

 

A) Can I use a VHD or is there a Tutorial to make a Blank RAW image file? >

Does it have to be on a Linux partition or can it be on a NTFS/ FAT Host drive partition? 

Can it be created via Windows or do I need another temporary "venue" to run it from? 

 

B ) Apply/ Install Linux to the said Image/ VHD? How? 

Are there Linux Distros/ Live CDs/DVDs via which we can create some Image/VHD directly? 

Which distro or distros to "Choose" for this experiment? > and how?

It will be a failing task to be choosing the wrong distros and experimenting 

 

C) Apply Booting Code Linkages to get Booting from the Image/VHD to work - i.e.

Choosing various items from the Linux landscapr - A boot manager; Grub/2 , LILO, Chameleon etc etc. 

Setup the Host partition(s) and the Image with the Boot Manager and other "booting files/ components"

PS: I am not a super expert here but need some direction on what I am to try here. 

 

D) Boot successfuly first time. 

 

E) Find a way to be able to move/ copy the Image and be able to repeat the "Boot Linkage" step in Step C to repeat D

 

With the above A, B, C, D, E steps I am only covering Steps 1,2 from your outline. 

 

I'd appreciate if you / others can help detail the outline for A, B, C, D, E with some references so that I can actually have a Step by Step for the experiment. Else, I am dealing with a "possible" thing that I am unable to find a single, HOW TO that says.. this is how its done. 

 

PS: I am also thinking, maybe install a Distro under Hyper V to a VHD (almost RAW), get it to work/ boot.. and THEN, find a way to Native boot it..i.e. using some mix of C & D -

 

Again, the stumbling point is choosing the right distro with the right components and the right steps/ commands to mount and apply the boot linkages from the Hardware boot towards the Image/ VHD. 



#31 wean_irdeh

wean_irdeh

    Newbie

  • Members
  • 29 posts
  •  
    Vietnam

Posted 08 September 2016 - 01:50 AM

 

The awesome Wonko :) I've been reading on this thread for a long time about RAW Image and VHD etc but I have yet to see a single step by step "experiment" that has been able to do so. 
On the other hand, I've been doing the following, repeatedly for a long time now: 
A) Creating VHDs using PowerShell/ Diskpart/ Batch scripts
B ) Applying Windows (pref 8.1, 10 etc) Images (.WIM from ISO) to the above VHDs using DISM ApplyImage
C) Apply Boot Code using BCDBoot.exe 
D) Boot via Windows Boot Manager
 
Can you outline steps, or point out articles that have the above similar steps, that I can experiment on to see if this can be made to work. 
 
A) Can I use a VHD or is there a Tutorial to make a Blank RAW image file? >
Does it have to be on a Linux partition or can it be on a NTFS/ FAT Host drive partition? 
Can it be created via Windows or do I need another temporary "venue" to run it from? 
 
B ) Apply/ Install Linux to the said Image/ VHD? How? 
Are there Linux Distros/ Live CDs/DVDs via which we can create some Image/VHD directly? 
Which distro or distros to "Choose" for this experiment? > and how?
It will be a failing task to be choosing the wrong distros and experimenting 
 
C) Apply Booting Code Linkages to get Booting from the Image/VHD to work - i.e.
Choosing various items from the Linux landscapr - A boot manager; Grub/2 , LILO, Chameleon etc etc. 
Setup the Host partition(s) and the Image with the Boot Manager and other "booting files/ components"
PS: I am not a super expert here but need some direction on what I am to try here. 
 
D) Boot successfuly first time. 
 
E) Find a way to be able to move/ copy the Image and be able to repeat the "Boot Linkage" step in Step C to repeat D
 
With the above A, B, C, D, E steps I am only covering Steps 1,2 from your outline. 
 
I'd appreciate if you / others can help detail the outline for A, B, C, D, E with some references so that I can actually have a Step by Step for the experiment. Else, I am dealing with a "possible" thing that I am unable to find a single, HOW TO that says.. this is how its done. 
 
PS: I am also thinking, maybe install a Distro under Hyper V to a VHD (almost RAW), get it to work/ boot.. and THEN, find a way to Native boot it..i.e. using some mix of C & D -
 
Again, the stumbling point is choosing the right distro with the right components and the right steps/ commands to mount and apply the boot linkages from the Hardware boot towards the Image/ VHD. 

 

Please just use virtualbox for linux. Virtualbox emulates SATA even for non-UEFI system, and more friendly with linux graphic (I have tried booting a distro in Hyper-V and it fallback into CLI mode while in Virtualbox doesn't). If you have any problem running x86_64 distro on virtualbox, try running it under Administrator, or (maybe you don't want to do this) uninstall Hyper-V

Finally I can boot into VHD using arch linux. I just bundle two programs in the initramfs, but as a linux n00b I have to write that thing over and over in an emergency shell, I can't write bash script in the init to detect if the root is the loop file and adding another boot parameter variable
It would be awesome if I could do something like this
kernel /vmlinuz root=/dev/loop0p1 loop_file=/archlinux.vhd loop_dev=/dev/sdb1
I want to ask a question on how to accomplish this, but I fear getting bashed for my limited knowledge as with my experience asking a question in another linux forum.
Ugh. Windows community seems to be friendly towards n00b while linux community seems can't tolerate that.

I have figured out too, on how to boot into dynamic VHD in linux, if only grub4dos could map dynamic VHD without putting it into memory

#32 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 08 September 2016 - 07:46 AM

Well, 

let's divide the thing between us.

 

You explain to us what you have done exactly in the initrd, and we will try to help you.

You know like which two programs you "bundled", how exactly you "bundled" them, etc. 

 

The line you posted:

 

kernel /vmlinuz root=/dev/loop0p1 loop_file=/archlinux.vhd loop_dev=/dev/sdb1

looks a lot like setting kernel parameters, which is something you would normally do in the loader, before actually booting. :unsure:

 

If this is something instead that needs to be typed in the Linux console once booted, the issue (to me) is not much inserting that line in a bash file, but rather to find the way to have that file autoexecute at boot time.

bash scripts are not much different from DOS/Windows batches, and particularly the above is a oneliner:



#!/bin/bash
kernel /vmlinuz root=/dev/loop0p1 loop_file=/archlinux.vhd loop_dev=/dev/sdb1

the "most complex part" s to make the .sh file executable modifying permissions:
http://tldp.org/LDP/...sect_02_01.html

 

But what Archlinux executes at boot and how to modify it needs some specific research on the Archlinux documentation, AFAICR there are several ways to run a script at boot time, and each one may be supported or not in the specific distro and also execute it "too early" or "too late".

 

 

:duff:

Wonko 



#33 wean_irdeh

wean_irdeh

    Newbie

  • Members
  • 29 posts
  •  
    Vietnam

Posted 08 September 2016 - 10:39 AM

 

Well, 
let's divide the thing between us.
 
You explain to us what you have done exactly in the initrd, and we will try to help you.
You know like which two programs you "bundled", how exactly you "bundled" them, etc. 
 
The line you posted:
looks a lot like setting kernel parameters, which is something you would normally do in the loader, before actually booting. :unsure:
 

That's the problem wonko, actually I just make up the last two boot parameter (loop_file & loop_dev), these boot parameter don't exist in the actual documentation. It would be nice to have init which is flexible, if it detects the root device as loop, it detect whether the last two parameter exist.

If this is something instead that needs to be typed in the Linux console once booted, the issue (to me) is not much inserting that line in a bash file, but rather to find the way to have that file autoexecute at boot time.

bash scripts are not much different from DOS/Windows batches, and particularly the above is a oneliner:

kernel /vmlinuz root=/dev/loop0p1 loop_file=/archlinux.vhd loop_dev=/dev/sdb1

The line I posted is not a bash script, as you know the line only appends boot parameter to the kernel right? (you don't need to add '#!/bin/bash' too, as this is not a bash script)
To execute the script you just need to add the script to the initramfs hooks, add another script to tell initramfs building tool how to install the script, add the script name into initramfs building tool configuration, and finally, build the initramfs.

Have you checked the manpage of the initramfs building tool? On linux, manual page is just a command away
man program_name
If you've tried building the initramfs, you should have already known there are different phase in init, you just need to put the script at the right phase, like before the root device mounted, after the root device mounted, etc.

the "most complex part" s to make the .sh file executable modifying permissions:
http://tldp.org/LDP/...sect_02_01.html
 
But what Archlinux executes at boot and how to modify it needs some specific research on the Archlinux documentation, AFAICR there are several ways to run a script at boot time, and each one may be supported or not in the specific distro and also execute it "too early" or "too late".
 
 
:duff:
Wonko 

 

You don't need to set up the permission, Wonko, as script in initramfs is running at early boot time with PID=1 (the initramfs bulding tool also has taken care the script permission too), setting up the permission is only needed when you want to execute it directly with a simple command, as you've read the link you posted here
chmod u+x /path/to/your_script.sh
That is not the most complex part because it's a beginner problem, for security reason the script you've created can't be executed directly, you need to set up the permission first.

As a bonus of this kind of thing, I also learned how to use vim, actually is not that bad as everyone says, as my first linux distro only bundle vim and emacs is only available through emulation mode (and I find that very hard compared to vim)

#34 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 08 September 2016 - 04:21 PM

Maybe there is a misunderstanding. :unsure:

 

What I read (maybe not what you have written):

1) I found a way to boot a static VHD (or a RAW file that is the same thing ;))

2) this consists into "bundling two files" in initram <- and I won't say which files they are nor how exactly I "bundled" them

3) after having booted, I need to go to an emergency shell and type a number of commands every time <- commands which I won't list 

4) I would like to have a bash script automating the thing in #3 above but I am a n00b at Linux

5) I am also fearful of asking to the people that might know how to do the above because they are less friendly than you guys

 

What I wrote (maybe not what you have read):

1) Good :)

2) Please tell us what you did EXACTLY

3) please tell us which commands you use/need

4) writing a bash script is not particularly difficult, though what you wrote seem a lot like kernel parameters, but more generally a bash script needs to be either called from the console or autoexecuted at boot time; each Linux distro may have different ways to autoexecute something at boot time and you need to find the mechanism used by the specific distro you use. But maybe they will run "too early" in the boot process or "too late" (cannot say).

 

New addition:

5) if you want to pass kernel parameters (to the kernel and NOT to a bash script) you need to have a kernel that understands these parameters which implies that you need to modify the source and recompile a kernel, I am pretty sure that if you go to a Linux board (very often populated by real - but grumpy :ph34r: - experts and by a large number of kids pretending to be experts) proposing that you will be bashed. Particularly if - as you just did with me - after describing yourself as a Linux n00b, you start lecturing on initramfs hooks (mind you it is OK as long as you do it with me :), as I am definitely a Linux n00b).

 

Seemingly the ArchLinux accepts two parameters that may be useful:

https://wiki.archlin...rnel_parameters

init=      Run specified binary instead of /sbin/init (symlinked to systemd in Arch) as init process.

init=/bin/sh      Boot to shell.

 

So maybe you could see if you can use any of the known autoexecution methods for your specific distro:

https://wiki.archlin...hp/autostarting

 

Let's see if now we can understand each other better.

 

Can you check /proc/cmdline? (no idea if the approach is the same in recent Linux kernels and/or specifically in ArchLinux)

See here:

http://www.linuxques...87/#post2917469

https://bbs.archlinu...c.php?id=106197

 

:duff:

Wonko



#35 wean_irdeh

wean_irdeh

    Newbie

  • Members
  • 29 posts
  •  
    Vietnam

Posted 10 September 2016 - 03:11 PM

Maybe there is a misunderstanding. :unsure:


4) writing a bash script is not particularly difficult, though what you wrote seem a lot like kernel parameters, but more generally a bash script needs to be either called from the console or autoexecuted at boot time; each Linux distro may have different ways to autoexecute something at boot time and you need to find the mechanism used by the specific distro you use. But maybe they will run "too early" in the boot process or "too late" (cannot say).

Can you check /proc/cmdline? (no idea if the approach is the same in recent Linux kernels and/or specifically in ArchLinux)
See here:
http://www.linuxques...87/#post2917469
https://bbs.archlinu...c.php?id=106197


For me at least, writing bash script is very very difficult, I don't know why bash script is very sensitive with whitespaces

The same url (linux questions) also popped out too when searching for custom boot parameters in google, thanks anyway
the command
cat /proc/cmdline
indeed returns the current boot parameter

Particularly if - as you just did with me - after describing yourself as a Linux n00b, you start lecturing on initramfs hooks (mind you it is OK as long as you do it with me :), as I am definitely a Linux n00b).

LOL at lecturing, I am sorry then, probably my tone is aggressive and annoying, actually, it's just 'FYI', but I'm sorry if that makes me aggressive and annoying

Finnaly!!! these days are gone. After heavy intense of googling, looking at stackoverflow, forcing myself reading antix live iso init script.
Thanks to star brilliant for making me able to boot into vhd, though his code is very hard coded and doesn't work for me, so I had to type the script in emergency shell every time I boot into arch linux.
and whoever made the lvm2 hook script (My script which boot into raw image suffered the same fate with lvm, the root device won't appear unless a specific script is run)
and wonko the sane for his helps

Tested on arch linux with RAW image with partition table, I don't know if it's work with RAW image without partition table
Do it at your own risk. For whatever reason there are some obscure error everytime I turn off arch linux.

Installation instruction (on arch linux):

1. If you haven't installed ntfs-3g and parted, install the package (recommended: upgrade the system and refresh the package list first)
recommended:
pacman -Syu
pacman -S ntfs-3g parted

2. This step is optional, jump to the next step if you already sure

Try to mount RAW image first (with partition table) and see if it's successful
losetup /dev/loop0 /mnt/sdb1/archlinux.vhd
if /dev/loop0 is already used, try /dev/loop1, or /dev/loop2, or so on

partprobe /dev/loop0
check whether the partition appear (usually /dev/loop0p1)
fdisk -l /dev/loop0
try to mount the partition and see the content
mkdir /mnt/loop0p1
mount /dev/loop0p1 /mnt/loop0p1
ls /mnt/loop0p1
if it's fails, it's probably the default option of the loop module by not allowing any partition and only one loop device allowed

save this file as /etc/modprobe.d/loop.conf
# Increase loop partition limit and maximum loop device allowed
options loop max_part=64 max_loop=8
restart and try again



3. Choose either a or b
a.
Download the file in https://drive.google...Qk9kaGZKTnZNb28
put the file initcpio.zip/initcpio/hooks/loopboot on /lib/initcpio/hooks/loopboot
put the file initcpio.zip/initcpio/install/loopboot on /lib/initcpio/install/loopboot

OR

b.
Save this file as /lib/initcpio/hooks/loopboot

loopboot
#!/bin/bash

run_hook ()
{
	local param cmdline=$(cat /proc/cmdline) loop_dev loop_part_num loop_file_path loop_dev_path
	#local cmdline="root=/dev/loop123p321 loop_file_path=/archlinux.vhd loop_dev_path=/dev/sda1"
	echo $cmdline
	for param in $cmdline; do
		value=${param#*=}
		case $param in
			root=*) if [[ "${value/loop}" == "$value" ]];
					then echo "Root device is not a loop device. loopboot hook will be terminated."; return 
					else local loop_dev=${value%p*} 
					local loop_part_num=${value##*p}
				fi ;;
			loop_file_path=*) local loop_file_path=$value ;;
			loop_dev_path=*) local loop_dev_path=$value ;;
		esac
	done
	#echo $loop_dev and $loop_part_num
	if [ "$loop_file_path" == "" ] || [ "$loop_dev_path" == "" ];
		then echo "Either loop_file_path or loop_dev_path parameter does not specified. loopboot hook will be terminated."; return
	fi 
	blkid
	echo "$loop_dev_path"
	local loop_dev_type=$(blkid -s TYPE -o value $loop_dev_path)
	echo "$loop_dev_type"
	mkdir /host
	if [[ "$loop_dev_type" == "ntfs" ]];
		then ntfs-3g $loop_dev_path /host; echo "mounted using ntfs-3g";
		else mount -t $loop_dev_type $loop_dev_path /host; echo "mount -t $loop_dev_type $loop_dev_path /host"; echo "mounted using mount";
	fi
	losetup $loop_dev /host$loop_file_path
	partprobe $loop_dev
			

	#echo $loop_file_path and $loop_dev_path
}

# vim: set ft=sh ts=4 sw=4 et:

Save this file as /lib/initcpio/install/loopboot

loopboot

#!/usr/bin/bash

build() {
    local mod

    for mod in loop fuse; do
        add_module "$mod"
    done

    add_binary /usr/bin/ntfs-3g
    add_binary /usr/bin/losetup
    add_binary /usr/bin/partprobe

    add_runscript
}

help() {
  cat <<HELPEOF
This hook enables loopback booting using RAW image in initramfs.

Installation: edit /etc/mkinitcpio.conf, add this hook after block hook
>HOOKS="...block loopboot filesystems..."

Usage: append this on boot parameter: loop_file_path= (file directory where the loop located) loop_dev_path= (device directory where the loop located). Change the root as loop
Example: root=/dev/loop2p1 loop_file_path=/archlinux.img loop_dev_path=/dev/sdb1
HELPEOF
}

# vim: set ft=sh ts=4 sw=4 et:

3. Edit /etc/mkinitcpio.conf (using vi, emacs, nano, etc)
Scroll down until you see HOOKS="...
edit the line, add 'loopboot' into the line
HOOKS="...block loopboot filesystems..."
4. Rebuild the initramfs
mkinitcpio -p linux --verbose >> initcpio-result
5. Verify the partprobe and ntfs-3g is already installed into initramfs (using vi, emacs, nano, etc)
(I like using vi, so I use vi as an example here)
vi initcpio-result
Tip:
On vi, type
?ntfs-3g
and press enter to search for ntfs-3g
type
?partprobe
and press enter to search for partprobe
type
:q
and press enter to quit

6. Edit the grub4dos menu.
I recommend using the latest grub4dos version possible, because grub4dos 0.4.4 cannot read ext4 formatted partition on RAW image

title Arch Linux loopback booting
find --set-root /ada.vhd
map --heads=0 --sectors-per-track=0 /ada.vhd (hd3)
map --hook
root (3,0)/boot
kernel /vmlinuz-linux root=/dev/loop0p1 rw loop_file_path=/ada.vhd loop_dev_path=/dev/sda1
initrd /initramfs-linux.img
Explanation
/ada.vhd is path where the RAW image stored, on yours it might be different like /VHD/archlinux.img

root (3,0) means the linux is on the first partition, if yours is on the second partition, then it becomes root (3,1), and so on
/dev/loop0p1 means the linux is on the first partition, if yours is on the second partition, then it becomes /dev/loop0p2, and so on

/dev/sda1 device where the RAW image is stored, if it's on different disk it might be in /dev/sdb1, /dev/sdc1, and so on
if it's on different partition then it might be in /dev/sda2, /dev/sda3, and so on

#36 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 11 September 2016 - 09:46 AM

Very good :).

 

Grub4dos (latest) is on Chenall pages:
http://grub4dos.chen...ries/downloads/

Latest 0.4.6a:
http://grub4dos.chen....6a-2016-08-06/

Latest 0.4.5c:
http://grub4dos.chen....5c-2015-12-31/

 

I believe you can use - instead of hardcoding a disk,partition for the root command, a tag file or a UUID and use again find --set-root, and use the batch capabilities of grub4dos to derive the loop0pn and /dev/sdmn :dubbio: but possibly it is not worth the time/effort.

 

Good work. :thumbsup:

 

:duff:

Wonko



#37 wean_irdeh

wean_irdeh

    Newbie

  • Members
  • 29 posts
  •  
    Vietnam

Posted 13 September 2016 - 08:16 AM

Very good :).

 

Grub4dos (latest) is on Chenall pages:
http://grub4dos.chen...ries/downloads/

Latest 0.4.6a:
http://grub4dos.chen....6a-2016-08-06/

Latest 0.4.5c:
http://grub4dos.chen....5c-2015-12-31/

 

I believe you can use - instead of hardcoding a disk,partition for the root command, a tag file or a UUID and use again find --set-root, and use the batch capabilities of grub4dos to derive the loop0pn and /dev/sdmn :dubbio: but possibly it is not worth the time/effort.

 

Good work. :thumbsup:

 

:duff:

Wonko

 

Thats a great idea, Wonko, after all, one of the point of RAW image booting is portability, so using UUID means less manual editing involved, but I encounter  a problem, so the user still had to manually change the partition in the RAW image 

 

http://reboot.pro/to...r-my-ugly-hack/

 

If this succeed, I plan to add support for LUKS drive encryption 

 

For some reason I cannot edit my post above

 

Link to download:

https://drive.google...w?usp=drive_web

 

OR

 

Save this file as /lib/initcpio/hooks/loopboot
 
loopboot
#!/bin/bash
 
run_hook ()
{
local param cmdline=$(cat /proc/cmdline) loop_dev loop_part_num loop_file_path loop_dev_path loop_dev_uuid 
#local cmdline="root=/dev/loop123p321 loop_file_path=/archlinux.vhd loop_dev_path=/dev/sda1"
echo $cmdline
for param in $cmdline; do
value=${param#*=}
case $param in
root=UUID*) ;;
root=*) if [[ "${value/loop}" == "$value" ]];
then echo ":: :: Root device is not a loop device. loopboot hook will be terminated."; return 
else local loop_dev=${value%p*} 
local loop_part_num=${value##*p}
fi ;;
loop_file_path=*) local loop_file_path=$value ;;
loop_dev_path=UUID=*) local loop_dev_uuid=${value#*=} ;;
loop_dev_path=*) local loop_dev_path=$value ;;
esac
done
#echo $loop_dev and $loop_part_num
if [ "$loop_file_path" == "" ] || ( [ "$loop_dev_path" == "" ] && [ "$loop_dev_uuid" == "" ] );
then echo ":: :: Either loop_file_path or loop_dev_path parameter does not specified. loopboot hook will be terminated."; return
fi 
blkid
mkdir /host
if [ "$loop_dev_uuid" != "" ];
then echo "$loop_dev_uuid"
local loop_dev_type=$(blkid -s TYPE -o value -t UUID=$loop_dev_uuid)
echo "$loop_dev_type"
mount -t $loop_dev_type -U $loop_dev_uuid /host
local loop_dev=$(losetup -f)
 
 
else echo "$loop_dev_path is the loop_dev_path"
echo "blkid -s TYPE -o value $loop_dev_path"
local loop_dev_type=$(blkid -s TYPE -o value $loop_dev_path)
echo "$loop_dev_type is the loop_dev_type"
mount -t $loop_dev_type $loop_dev_path /host
echo "mount -t $loop_dev_type $loop_dev_path /host"
fi
losetup $loop_dev /host$loop_file_path
partprobe $loop_dev
 
 
#echo $loop_file_path and $loop_dev_path
}
 
# vim: set ft=sh ts=4 sw=4 et:
 
 
Save this file as /lib/initcpio/install/loopboot
 
loopboot
 
#!/usr/bin/bash
 
build() {
    local mod
 
    for mod in loop fuse; do
        add_module "$mod"
    done
 
    add_binary /usr/bin/ntfs-3g
    add_binary /usr/bin/losetup
    add_binary /usr/bin/partprobe
    
    add_symlink "/usr/bin/mount.ntfs" ntfs-3g
    
    add_runscript
}
 
help() {
  cat <<HELPEOF
This hook enables loopback booting using RAW image in initramfs.
 
Installation: edit /etc/mkinitcpio.conf, add this hook after block hook
>HOOKS="...block loopboot filesystems..."
 
Usage: append this on boot parameter: loop_file_path= (file directory where the loop located) loop_dev_path= (device directory where the loop located). Change the root as loop
Example: root=/dev/loop2p1 loop_file_path=/archlinux.img loop_dev_path=/dev/sdb1
HELPEOF
}
 
# vim: set ft=sh ts=4 sw=4 et:
 
 
Grub4DOS menu
 
Choose either a or b
 
a non-UUID version
title Arch Linux loopback booting
find --set-root /ada.vhd
map --heads=0 --sectors-per-track=0 /ada.vhd (hd3)
map --hook
root (3,0)/boot
kernel /vmlinuz-linux root=/dev/loop0p1 rw loop_file_path=/ada.vhd loop_dev_path=/dev/sda1
initrd /initramfs-linux.img
 
Explanation
/ada.vhd is path where the RAW image stored, on yours it might be different like /VHD/archlinux.img
 
root (3,0) means the linux is on the first partition, if yours is on the second partition, then it becomes root (3,1), and so on
/dev/loop0p1 means the linux is on the first partition, if yours is on the second partition, then it becomes /dev/loop0p2, and so on
 
/dev/sda1 device where the RAW image is stored, if it's on different disk it might be in /dev/sdb1, /dev/sdc1, and so on
if it's on different partition then it might be in /dev/sda2, /dev/sda3, and so on
 
 
b UUID version
title Arch loopback booting with UUID
set FILEPATH=/ada.vhd
find --set-root %FILEPATH%
uuid () && call set UUIDHOST=%^?%
map --heads=0 --sectors-per-track=0 %FILEPATH% (hd3)
map --hook
root (hd3,0)
uuid () && call set UUIDLOOP=%^?%
kernel /boot/vmlinuz-linux root=UUID=%UUIDLOOP% rw loop_file_path=%FILEPATH% loop_dev_path=UUID=%UUIDHOST%
initrd /boot/initramfs-linux.img
 
/ada.vhd is path where the RAW image stored, on yours it might be different like /VHD/archlinux.img
 
root (3,0) means the linux is on the first partition, if yours is on the second partition, then it becomes root (3,1), and so on
 

Edited by wean_irdeh, 13 September 2016 - 08:20 AM.


#38 virgus

virgus

    Newbie

  • Members
  • 26 posts
  •  
    Italy

Posted 22 December 2016 - 04:20 PM

Hello everybody,

I've been following this thread for a while hoping to be able to get a working example of how to boot a Ubuntu OS from a img/vhd file.

I still didn't succeed but it would be great to have a tutorial/working example. Maybe the chinese users had it already done and it won't be too hard to be able to re-create what they did from the old english readme they wrote!

 

I managed to connect and download most of the files in BaiDu; some minor extra files are still missing but I hope to be able to get them with the help of a chinese friend.

 

Meanwhile here they are on hubic.com (the link expires in 30 days), hopefully someone more expert than me will make it work in a breeze.

 

Merry Christmas to all of you and your families.

V.


Edited by virgus, 22 December 2016 - 04:27 PM.


#39 sixcentgeorge

sixcentgeorge

    Frequent Member

  • Advanced user
  • 191 posts
  •  
    France

Posted 22 December 2016 - 07:49 PM

the vhd system is more or less existing : it is the squashfs archive . look in folder casper of ubuntu or mint for filesystem.squashfs [ 7zip  can read it ] , check for remastering and toram

linux ...or should i say : its "leader linus T" : sucks or stinks ...they make nothing for the kernel to recognize a file /  iso loaded in ram by grub4dos or syslinux-memdisc...that boot loaders being very old...



#40 tritant

tritant
  • Members
  • 2 posts
  •  
    Belgium

Posted 28 December 2016 - 07:05 PM

Hi all,

 

I have dowloaded the pack.zip from baidu is in the first post and it work fine for me, i boot from UBT-small.vhd without probleme.

it is a linux vhd created with virtualbox

it is easy to use...

 

format a usb stick(256gb with ssd controler) in ntfs(important)

install grub4dos and easy2boot on stick or other solution...

 

copy 3 files(in pack, ) to a rep called ubuntu at the root of ntfs partition

UBT-small.vhd

initrd.img

vmlinuz

 

add a .mnu file to mainmenu/mnu with content:

 

title UBT-small.vhd
kernel /ubuntu/vmlinuz  root=/dev/sdd1 kloop=/ubuntu/UBT-small.vhd  kroot=/dev/mapper/loop0p1
initrd  /ubuntu/initrd.img

 

boot your usb stick and select UBT-small in menu ! that work great !!

 

The process for create the good initrd.img and the good vmlinuz is explained...

 

Now y try this...

 

title UBT-small.vhd
find --set-root --ignore-floppies --ignore-cd  /ubuntu/UBT-small.vhd
uuid ()
kernel /ubuntu/vmlinuz  root=UUID=%?%  kloop=/ubuntu/UBT-small.vhd  kroot=/dev/mapper/loop0p1
initrd  /ubuntu/initrd.img

 

But no luck, when booting the first step is mount ntfs partition with ntfs-3g and return this error:

mount -t netfs-3g uuid=xxxxxxxxxxxxxx no such file or ....

 

Any idea ?

 

Sorry, i am francophone....



#41 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 28 December 2016 - 07:59 PM

Any idea ?

 

Sorry, i am francophone....

Not really an idea, but maybe for *whatever* reason the kernel passes the root= parameter to the ntfs-3G and this latter does not understand the uuid syntax.

 

Try using a workaround. :unsure:

 

Use this "converter" here:
http://reboot.pro/to...ts-in-grub4dos/

http://reboot.pro/to...b4dos/?p=200832

to get the "Linux device" (such as /dev/sdd1) and pass that to the kernel root= parameter:

root=/dev/%LXVOLID%

 

:duff:

Wonko



#42 tritant

tritant
  • Members
  • 2 posts
  •  
    Belgium

Posted 29 December 2016 - 04:16 PM

Thx for your reply Wonko, but I have found a other solution :sudo mount -t ntfs-3g `blkid -U 6054DA9E54DA766E` /host

#43 virgus

virgus

    Newbie

  • Members
  • 26 posts
  •  
    Italy

Posted 10 January 2017 - 01:09 PM

Hello Tritant,
many thanks for your posts! I was able to replicate your commands on an E2B usb key,
but I still did not figure out how to boot from g4dos or grub2 from the vhd file.

For those who are not skilled enough as me, I wrote down all the steps I made to change from chinese to english in the downloaded VHD file. Next steps would be to replicate the commands to make my own linux bootable vhd.

 

I didn't understand where in the sequence I should use "sudo mount -t ntfs-3g `blkid -U 6054DA9E54DA766E` /host"

A sample of your entries in grub would be really helpful.

I changed the cloud location for all the files and my "readme" and put them on Mega:
https://mega.nz/#F!2...iWYAK4XzC5lGvwA

Thanks and have a nice day,
V.
 


Edited by virgus, 10 January 2017 - 01:10 PM.


#44 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 10 January 2017 - 01:33 PM

@virgus

Tritant DID POST the relevant grub4dos/easy2boot menu entry:

add a .mnu file to mainmenu/mnu with content:


title UBT-small.vhd
kernel /ubuntu/vmlinuz root=/dev/sdd1 kloop=/ubuntu/UBT-small.vhd kroot=/dev/mapper/loop0p1
initrd /ubuntu/initrd.img

boot your usb stick and select UBT-small in menu ! that work great !!

what happens in your setup if you use EXACTLY that? :unsure:

 

FORGET (for the moment) abut using UUID, that is a variation that is not really-really *needed*.

 

Even better than using the menu entry, do type manually the lines on the grub4dos prompt (and follow them with a "boot" command) so that you can see if any error is shown.

 

Maybe you have a different set of devices or a different numbering of them numbering.

 

Get to the grub4dos prompt and issue:
find --set-root /ubuntu/vmlinuz

root <- take note of the output, if it is (hd3,0), then in the below line use root=/dev/sdd1, if it is (hd0,0) use root=/dev/sda1 if it is (hd1,0) use root=/dev/sdb1, if it is (hd1,1) use root=/dev/sdb2, etc.

kernel /ubuntu/vmlinuz root=/dev/sdd1 kloop=/ubuntu/UBT-small.vhd kroot=/dev/mapper/loop0p1
initrd /ubuntu/initrd.img

boot

 

OR, FORGET (temporarily) about the orignal source and Ubuntu and try re-doing what was explained here by wean_irdeh:
http://reboot.pro/to...e-2#entry200203

using archlinux instead.

 

:duff:

Wonko



#45 virgus

virgus

    Newbie

  • Members
  • 26 posts
  •  
    Italy

Posted 10 January 2017 - 05:40 PM

Many thanks Wonko, as usual :hyper:

 

> find --set-root /ubuntu/vmlinuz

did the job as I had to set sda2 and I was focused on the wrong partition instead :glare:

 

So now the vhd boots from grub as well and I'm continuing testing for the Live version to boot.

 

I got the UUID from "vboxmanage internalcommands dumphdinfo UBT-small.vhd and wrote my entries as niumao did in his menu.lst file that I found in the archive "grubsmall2016.7z" but I just found this thread where I discovered that windows UUIDs are different than Grub4dos ones :o  http://reboot.pro/topic/7457-uuid/

 

So I suppose the UUID posted by Tritant should be the correct one: 6054DA9E54DA766E but I don't have a clue on how to get it for future img files. I tried mounting the VHD file and running "Grub4DOS Toolbox for Windows-0.23.exe" but I couldn't make it work up to now.

 

So the entries that don't work are (I supposed that the vmlinuz and initrd.img in the casper dir are the same than the others, so I used the ubuntu dir instead):

title UBT-small.vhd
find --set-root --ignore-floppies --ignore-cd  /ubuntu/UBT-small.vhd
uuid ()
kernel /ubuntu/vmlinuz  root=UUID=283b2512-e47c-40bc-b11e-431689d648ca  kloop=/ubuntu/UBT-small.vhd  kroot=/dev/mapper/loop0p1
initrd /ubuntu/initrd.img

that gives me the following output error:

> mounting UUID= on /host failed: No such device

> failed to stat() /host/ubuntu/UBT-small.vhd
 

and

iftitle [ find --set-root --ignore-floppies --ignore-cd  /casper/UBT-small.squashfs ] LIVE-UBT-small
find --set-root --ignore-floppies --ignore-cd  /casper/UBT-small.squashfs
uuid ()
kernel /casper/vmlinuz boot=casper
initrd  /casper/initrd.img

that gives me the following output error:

> (initramfs) Unable to find a medium containing a live file system
> /scripts/panic/plymouth: line 18: /bin/plymouth: not found
 

I'm gonna try the UUID from Tritant but thanks to your hint I'm at least able to boot the vhd and use it :)

title UBT-small.vhd
find --set-root --ignore-floppies --ignore-cd  /ubuntu/UBT-small.vhd
uuid ()
kernel /ubuntu/vmlinuz  root=UUID=6054DA9E54DA766E  kloop=/ubuntu/UBT-small.vhd  kroot=/dev/mapper/loop0p1
initrd /ubuntu/initrd.img 

 

Thanks again,

V.

 

  :worship:


Edited by virgus, 10 January 2017 - 05:44 PM.


#46 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 10 January 2017 - 06:19 PM

Well, the idea of a UUID, is that of a Universal Unique ID, if your UUID was the same as the one tritant had, there would be a non-trivial issue.
 
Now, what would the uuid command in grub4dos do? :dubbio:
 
What do you think these commands do? :unsure:
 
title UBT-small.vhd
find --set-root --ignore-floppies --ignore-cd /ubuntu/UBT-small.vhd <- find the device on which UBT-small.vhd resides and set root to it
uuid () <- calculate the UUID of the current root (and store it in the temporary variable "?")
kernel /ubuntu/vmlinuz root=UUID=%?% kloop=/ubuntu/UBT-small.vhd kroot=/dev/mapper/loop0p1
initrd /ubuntu/initrd.img
 
But then you will have the SAME issue that tritant had about uuid= vs blkid U
 
Please note how anyway this UUID is not the UUID of the vhd image, but rather the UUID of the volume where the image is stored.
 
 
Now, why don't you (as was already suggested) FORGET about UUID and follow me?
It is NOT NECESSARY to use UUID.
 
Read attentively the given reference:
http://reboot.pro/to...ow-to/?p=201223
 
This way you can have the root (found by means of a normal "find --set-root") converted to the Linux syntax, and suitable to be provided to the root= parameter when calling the kernel.
 
:duff:
Wonko



#47 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 10 January 2017 - 06:30 PM

Try

title UBT-small.vhd
find --set-root --ignore-floppies --ignore-cd  /ubuntu/UBT-small.vhd
map --heads=0 --sectors-per-track=0 /ubuntu/UBT-small.vhd (hd9)
map --hook
uuid (9,0)
set UUID=%?%
map --unhook
kernel /ubuntu/vmlinuz  root=UUID=%UUID%  kloop=/ubuntu/UBT-small.vhd  kroot=/dev/mapper/loop0p1
initrd /ubuntu/initrd.img

untested...

Assumes the root value needs the UUID of the volume inside the VHD??


Edited by steve6375, 10 January 2017 - 06:51 PM.


#48 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 10 January 2017 - 06:49 PM

 

Assumes the root value needs the UUID of the volume inside the VHD??

 

 

NO, NO, NO!  :ranting2:

 

 The root=UUID needed is the volume where the .vhd is  :frusty:

 

The kloop= is the (relative) path to the .vhd starting from the root= volume.

 

That virgus might get confused .... :unsure:

but you? :w00t: :ph34r:

 

:duff:

Wonko



#49 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 10 January 2017 - 06:50 PM

sorry! :unsure:



#50 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 10 January 2017 - 06:53 PM

So try...

title UBT-small.vhd
find --set-root --ignore-floppies --ignore-cd  /ubuntu/UBT-small.vhd
uuid ()
kernel /ubuntu/vmlinuz  root=UUID=%?% kloop=/ubuntu/UBT-small.vhd  kroot=/dev/mapper/loop0p1
initrd /ubuntu/initrd.img

This is similar to what is in the hubiC download...







Also tagged with one or more of these keywords: linux, windows, boot, vhd, image-file, howto

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users