mikey93898
June 2nd, 2016, 03:10 AM
Hi all,
I may be grossly over complicating things. Very simply put: I would like to make a multiboot USB stick, but with full installations, not the readonly "live" iso's.
What I've done in the past, and have going right now:
One operating system (Ubuntu, full install) installed directly to my thumb stick, fully encrypted OS using luks. I didn't do this by hand but basically just used the Ubuntu installer and customized the install layout. This is fine and useful for me to bring my customized OS everywhere, but I'd like to take it a step further.
What I'd love to be able to do:
Take multiple IMG files for multiple installs (created from dd'ing an existing os install partition, or grab an IMG from a KVM vm), copy them each into their own partitions on my usb stick (sda2, sda3, etc), install grub2 to the first partition (sda1), then somehow be able to boot to that USB stick, see grub's little menu, and select the OS/partition of my choice.
I'd like for each OS partition to be fully encrypted inside a luks container.
If possible, I'd like to be able to do this inside KVM from start to finish, until the very last write of a final IMG file to my thumb drive. This way I can reduce the risk of borking my desktop system due to my extreme noobery
What I've tried:
First, I created a KVM vm, gave it a 20G hard disk image, and installed Centos 6 (it worked, and would boot)
Second, I created a second KVM vm, and installed Ubuntu to another 20G disk image (also worked and booted)
Next, I created a third KVM vm (yes, I am ridiculous) running yet another copy of Ubuntu (so I could work), and also gave it a 60G disk image (my thumb drive is 64G), and access to the first and second 20G images that I had just installed Centos/Ubuntu to
Then I created (on the 60G image, which I *think* ended up being sdb at the time) three partitions: First an empty 1G partition with boot flag (to hold grub) on sdb1, then two more (sdb2, sdb3) to hold the Centos/Ubuntu installs I'd just done.
Next, I used dd to copy both 20G images of my installs into the 60G partitions sdb2 and sdb3. Or rather, indirectly using crypt-setup's mapper as I had just mounted them as encrypted containers... but still
Finally, inside that third VM, I attempted to run "grub-install" on the 60G image's drive (to sdb)
It's at that point where I realize... I may have no idea what I'm doing. Sorry for being a n00b. On one attempt, Grub booted to recovery mode after complaining about a missing device. On another, Grub booted to a normal prompt, but with no menu. I feel like I should be somehow generating a grub configuration file, as it seems to be missing from the boot partition I created.
Any advice on how to proceed? I would love love love an automated tool to do this, if one exists. If not, I would love to be able to do this myself. The main things still puzzling me are:
Is KVM the death of me? It would be so great to be able to do these things without worrying about screwing up my normal OS/bootloader... but maybe this is not possible
Am I actually allowed to simply take an IMG of any existing OS partition, and copy it wherever I feel like, and somehow expect grub to be able to see it and go "Oh look, an OS! I can boot into that for you bro!" ... I mean - is that even the function of grub?
Does putting an OS partition inside a luks container screw everything up? I was under the impression grub would just see it, and realize it needed to ask for a passphrase before continuing (I'm ashamed to admit - I just now realized I haven't actually tried doing this entire process without luks ... maybe I should while I'm waiting for replies)
Thank you for reading, and I appreciate your suggestions!
~Mike
I may be grossly over complicating things. Very simply put: I would like to make a multiboot USB stick, but with full installations, not the readonly "live" iso's.
What I've done in the past, and have going right now:
One operating system (Ubuntu, full install) installed directly to my thumb stick, fully encrypted OS using luks. I didn't do this by hand but basically just used the Ubuntu installer and customized the install layout. This is fine and useful for me to bring my customized OS everywhere, but I'd like to take it a step further.
What I'd love to be able to do:
Take multiple IMG files for multiple installs (created from dd'ing an existing os install partition, or grab an IMG from a KVM vm), copy them each into their own partitions on my usb stick (sda2, sda3, etc), install grub2 to the first partition (sda1), then somehow be able to boot to that USB stick, see grub's little menu, and select the OS/partition of my choice.
I'd like for each OS partition to be fully encrypted inside a luks container.
If possible, I'd like to be able to do this inside KVM from start to finish, until the very last write of a final IMG file to my thumb drive. This way I can reduce the risk of borking my desktop system due to my extreme noobery
What I've tried:
First, I created a KVM vm, gave it a 20G hard disk image, and installed Centos 6 (it worked, and would boot)
Second, I created a second KVM vm, and installed Ubuntu to another 20G disk image (also worked and booted)
Next, I created a third KVM vm (yes, I am ridiculous) running yet another copy of Ubuntu (so I could work), and also gave it a 60G disk image (my thumb drive is 64G), and access to the first and second 20G images that I had just installed Centos/Ubuntu to
Then I created (on the 60G image, which I *think* ended up being sdb at the time) three partitions: First an empty 1G partition with boot flag (to hold grub) on sdb1, then two more (sdb2, sdb3) to hold the Centos/Ubuntu installs I'd just done.
Next, I used dd to copy both 20G images of my installs into the 60G partitions sdb2 and sdb3. Or rather, indirectly using crypt-setup's mapper as I had just mounted them as encrypted containers... but still
Finally, inside that third VM, I attempted to run "grub-install" on the 60G image's drive (to sdb)
It's at that point where I realize... I may have no idea what I'm doing. Sorry for being a n00b. On one attempt, Grub booted to recovery mode after complaining about a missing device. On another, Grub booted to a normal prompt, but with no menu. I feel like I should be somehow generating a grub configuration file, as it seems to be missing from the boot partition I created.
Any advice on how to proceed? I would love love love an automated tool to do this, if one exists. If not, I would love to be able to do this myself. The main things still puzzling me are:
Is KVM the death of me? It would be so great to be able to do these things without worrying about screwing up my normal OS/bootloader... but maybe this is not possible
Am I actually allowed to simply take an IMG of any existing OS partition, and copy it wherever I feel like, and somehow expect grub to be able to see it and go "Oh look, an OS! I can boot into that for you bro!" ... I mean - is that even the function of grub?
Does putting an OS partition inside a luks container screw everything up? I was under the impression grub would just see it, and realize it needed to ask for a passphrase before continuing (I'm ashamed to admit - I just now realized I haven't actually tried doing this entire process without luks ... maybe I should while I'm waiting for replies)
Thank you for reading, and I appreciate your suggestions!
~Mike