How to run Debian from USB independently of the host operating system with out virtualbox
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What do you want, USB stick, or USB hard drive? If former, it will not save anything without persistence enabled, if you create live image on it. If later, you can install debian on it and choose during boot process to boot into it. Also, for installing debian 9, do not use live images, those are flaky in this version. Use regular installer.
I think I've figured out what the goal is. The goal is to run Whonix, which is a privacy oriented distribution similar in spirit to Tails - but using a couple VMs instead of a LiveCD/LiveUSB.
But in order to run those VMs, there must be a host OS running VirtualBox (or one of the other supported VM hosts). The original poster wants to run VirtualBox on Debian.
Now that I understand the goals, I can explain the steps required:
1) Get a second USB drive. It's good that you have the Debian installer working on a USB drive. You need a second one to install Debian onto. Bear in mind that performance will be sluggish, so keep your expectations realistic. (Performance can be better if it's a fast USB drive using USB 3.0 and plugged into a USB 3.0 port.)
2) Boot up with the Debian installer, and do the Debian install onto the second USB drive. As I previously noted, take care during the partitioning and GRUB install steps to do this onto the second USB drive (and not the internal hard drive). I recommend making a single large ext4 partition for the OS - as big as will fit on the USB drive.
Previously, I recommended a size of only 4GB would be enough. However, your intent is to eventually run VirtualBox and host a couple VMs on it. This will take up a good deal of space. The system requirements say 10GB of free space is needed for Whonix. Debian and VirtualBox itself will take up perhaps 5GB. So, I'd go with at least 15GB and preferably more than 20GB USB drive.
When you do this install, I recommend selecting the XFCE4 Desktop Environment. This is a lot less taxing on resources than GNOME3, which is important since you'll be splitting up resources three ways (for the host OS as well as two VMs).
3) Use apt-get to install VirtualBox. You'll have to add a third party software repository for this, as detailed here:
1. Install system to USB (stick or drive, both are suitable) as regular installation
2. Install bootloader, (GRUB).
3. Make sure your system uses initrd, it's important.
4. You system will not boot due to missed usb drivers, so, you have to boot into any other linux system, mount your USB stick and chroot into the system that installed to USB.
5. Decompress initrd, add required USB drivers to initrd and compress it again. You need two or three drivers: usb_xhci usb_ehci usb_storage or something similar, do not remember for sure. Kernel uses this drivers for mounting root partition.
6. Bootloader should point to the root partition by UUID or by Label, not as /dev/sda or /dev/sdb.
7. If you have enough RAM, pack /usr /home /lib into squashfs images, your system will boot faster and apps will start faster as well.
8. If you want to save changes you can rebuild squashfs "on-the-fly" so your changes would be reflected on next boot.
Did it few times with Slackware and with Gentoo. One of the USB Gentoo installations I using every day as a rescue system.
Unfortunately there is no ready to use "step-by-step" instruction how to install system to USB. At least I didn't find such an instruction.
But all the thing can be found on web, including this forum.
Tails is very different from a normal linux distribution. It is designed specifically to be a LiveCD distribution. It is purposefully designed in a way to NOT install anything or even leave any data on the computer.
But looking up Whonix, I think I misunderstand what, precisely, you want to do. What is your goal?
I thought you were intending to convert the Debian install into a VM, but after looking up Whonix I'm guessing that you actually want to run Virtualbox within the Debian install.
Okay, but first a word of warning - the performance of this will be BAD unless you're doing this with a very fast USB 3.0 drive (on a USB 3.0 port).
It is very much not obvious what these arrows are supposed to mean. Please word what exactly you mean. I had assumed the arrows meant some sort of conversion, but now I am guessing that it actually means something about running some software on something else.
What I whant is a safe internet connection avoiding VPN providers and the risk of being the end nod in tor network (I dont want Tor if not necessary any way).
I have bin reading a bit and concluded that first installing Debian then running virtualbox in debian and running whonix in the virtualbox (whonix always runs in a VB by the way)is a god solution. Or at least its seams that way to me for various reasons. I know Tails is so posed to protect the content on the computer or some thing I presume this goes for the content on a usb drive as well. but I dont relay need to worry about that. and Im not sure I know that means ether. after all there are all sorts of ways to encrypt hard drives and so on so I dont see the advantage.
As to The problem at hand:
Im some what familiar with partition magic because I watched a fiend use it on my computer once. however I just fetched a DVD at from my kind neighbor and Im going to use that unless I rely need a usb for the iso file in order to make this work. so I start up de DVD and hoping to be able to select where I want to install the iso file. but all it say is: "begin install on this computer". Why is that? What dose it take to make the usb the destination?
Now im starting to wounder if there is some kind of iso for portable drives or some thing?
1. Install system to USB (stick or drive, both are suitable) as regular installation
2. Install bootloader, (GRUB).
3. Make sure your system uses initrd, it's important.
4. You system will not boot due to missed usb drivers, so, you have to boot into any other linux system, mount your USB stick and chroot into the system that installed to USB.
5. Decompress initrd, add required USB drivers to initrd and compress it again. You need two or three drivers: usb_xhci usb_ehci usb_storage or something similar, do not remember for sure. Kernel uses this drivers for mounting root partition.
6. Bootloader should point to the root partition by UUID or by Label, not as /dev/sda or /dev/sdb.
7. If you have enough RAM, pack /usr /home /lib into squashfs images, your system will boot faster and apps will start faster as well.
8. If you want to save changes you can rebuild squashfs "on-the-fly" so your changes would be reflected on next boot.
Did it few times with Slackware and with Gentoo. One of the USB Gentoo installations I using every day as a rescue system.
Unfortunately there is no ready to use "step-by-step" instruction how to install system to USB. At least I didn't find such an instruction.
But all the thing can be found on web, including this forum.
I have installed Debian onto USB many times, and never had this problem. The default Debian initrd must be sufficiently loaded with usb storage drivers that no such customization is required. I just install Debian onto a USB drive just as I would any hard drive, and it works exactly the same.
Still, the tip about using squashfs sounds like it can be useful for someone who knows what they're doing (like myself). For a novice, though, it may be more trouble than it's worth. The original poster is trying something pretty complex involving virtualbox and VMs already, so...probably not worth the trouble.
I think I've figured out what the goal is. The goal is to run Whonix, which is a privacy oriented distribution similar in spirit to Tails - but using a couple VMs instead of a LiveCD/LiveUSB.
But in order to run those VMs, there must be a host OS running VirtualBox (or one of the other supported VM hosts). The original poster wants to run VirtualBox on Debian.
Now that I understand the goals, I can explain the steps required:
1) Get a second USB drive. It's good that you have the Debian installer working on a USB drive. You need a second one to install Debian onto. Bear in mind that performance will be sluggish, so keep your expectations realistic. (Performance can be better if it's a fast USB drive using USB 3.0 and plugged into a USB 3.0 port.)
2) Boot up with the Debian installer, and do the Debian install onto the second USB drive. As I previously noted, take care during the partitioning and GRUB install steps to do this onto the second USB drive (and not the internal hard drive). I recommend making a single large ext4 partition for the OS - as big as will fit on the USB drive.
Previously, I recommended a size of only 4GB would be enough. However, your intent is to eventually run VirtualBox and host a couple VMs on it. This will take up a good deal of space. The system requirements say 10GB of free space is needed for Whonix. Debian and VirtualBox itself will take up perhaps 5GB. So, I'd go with at least 15GB and preferably more than 20GB USB drive.
When you do this install, I recommend selecting the XFCE4 Desktop Environment. This is a lot less taxing on resources than GNOME3, which is important since you'll be splitting up resources three ways (for the host OS as well as two VMs).
3) Use apt-get to install VirtualBox. You'll have to add a third party software repository for this, as detailed here:
4) Install Whonix ... left as exercise for the reader ...
The first problem seams to be to even get the installer to install on the usb. it say: "begin install on this computer" Im using a DVD now not a second USB. However im willing to get partition magi right now and divide the USB if i have to if necessary. I Have a 32 gigabyte USB by the way.
I did not realized that the virtual box would be difficult to install. Seams to be an other challenge thanks for sharing.
I used to make usb installs from virtualbox. Just don't add in a virtual hard drive and use usb drive attached.
A safe way to make a real install to a usb could be this way.
Use a windows live to usb installer program. (pendrivelinux.com)
Power down system and remove either power or data from internal hard drive.
Boot to the usb you created.
Install a new usb 16G or so. Best if it is fast usb 3.
Install your OS to this last usb drive following the installer.
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
Quote:
Originally Posted by Eliijah
The first problem seams to be to even get the installer to install on the usb. it say: "begin install on this computer" ...
The USB stick is in "...this computer" so that's the option you want. The USB stick is just another hard drive in that computer as far as operating systems are concerned.
Now I understand what you are trying to achieve a 32GB USB stick may be a little small (you should probably use it as just one partition and be careful not to install too much). A USB stick also sounds far too slow for what you want to do -- I know when I used a USB3 stick it was a little slow and I didn't run a virtual machine from that.
The first problem seams to be to even get the installer to install on the usb. it say: "begin install on this computer" Im using a DVD now not a second USB. However im willing to get partition magi right now and divide the USB if i have to if necessary. I Have a 32 gigabyte USB by the way.
I did not realized that the virtual box would be difficult to install. Seams to be an other challenge thanks for sharing.
When you say you have a DVD, what do you mean? Do you mean a DVD disc of the Debian installer? Or something else?
If you have a DVD disc of the Debian installer, then just use that. You will wipe out everything that is currently on the 32GB USB drive (which should easily be big enough for your application).
Choose manual partitioning and create just one ext4 primary partition on the USB drive. I would recommend against creating a swap partition; note that the installer will ask to confirm that you really want this. Later on, you can create a swap file if you really want it.
The install of virtual box is not difficult, it just involves some more steps. However, looking at the Whonix web site, I think maybe their KVM option might be an easier option for you:
One annoying thing - the whonix instructions assume an Ubuntu style set up of "sudo", whereas Debian does not install sudo by default. In order to deal with this, simply use "su" to log in as root within a terminal console, and everywhere you see instructions with "sudo" ignore the "sudo".
For example, if you see:
Code:
sudo apt-get install foobar
simply do this instead:
Code:
apt-get install foobar
Optionally, you could instead set up sudo in an Ubuntu-like way. With the current Debian installer, one way to do this is to NOT provide a root password during the installation steps requesting this. This will set things up in an Ubuntu-like way. Or you can do a traditional Debian install and ignore "sudo". Either way, it's just one more annoying thing you'll have to keep in mind due to the way the whonix documentation is done.
When you say you have a DVD, what do you mean? Do you mean a DVD disc of the Debian installer? Or something else?
If you have a DVD disc of the Debian installer, then just use that. You will wipe out everything that is currently on the 32GB USB drive (which should easily be big enough for your application).
Choose manual partitioning and create just one ext4 primary partition on the USB drive. I would recommend against creating a swap partition; note that the installer will ask to confirm that you really want this. Later on, you can create a swap file if you really want it.
I have a DVD with the iso image. however when start up the cd rom intending to install on the F drive where my usb is that is not an option. It only say "being install on this computer". Its not possible to select where to install files.
How ever Im starting to wounder if its realy the iso file that sould be on the dvd (when flowing the procedure you suggested).
I actually stated out using the disk image programs (the I did not realize the need for two "hard drives" when starating up the installation files at that point) what I got om the usb when I used it was not the iso file but a lot of different files. I guess this is the installation files.
So right now I think what I should do is to run the iso fil in the disk imager have usb as my destination folder. Then simply copy paste it to my regular hard drive. And then make a dvd with the installation files not the iso file. And finally start up the installation from the dvd and select the usb drive as the destination folder.
Edit: Just did it and its exactly the same as when using the iso file. Every thing seems to work installation is starting up but I cant select what drive to install to. Is that an option that comes later in the installation process? "being install on this computer" sound kind of finale.
They dont mention any thing about installation just get the iso fil on the usb with Win32 DiskImager (i use ruffus by the way)
Then as step 6:
6. A progress bar will indicate the progress of the write. Once it has finished, simply reboot your PC and set your BIOS or Boot Menu to boot from the USB Device
I have absolutely no idea what means am I missing something fundamental in the installation process that is implicit?
You can rsync an HDD install to the stick and install grub on the stick. Just change the /etc/fstab and the bootloader to know it's new location.
Otherwise I tend to do a debootstrap install method. Be sure to install a bootable kernel in the chroot and set a root password or it's pretty useless even if you could boot it. The advantage of the debootstrap route is that you can install network drivers and firmware from a running distro before you ever boot it up. Since you can spam a key and boot from another device (usb) I almost never boot the storage device that comes with the systems I buy. Or need to do anything with that space until I've made a good backup, if ever. With usb 3 and a decent speed usb storage device, it's pretty functional. As long as you cycle through new media enough to cover paranoid trust like issues. A new stick once every 3 to 6 months keeps me calm.
They dont mention any thing about installation just get the iso fil on the usb with Win32 DiskImager (i use ruffus by the way)
Then as step 6:
6. A progress bar will indicate the progress of the write. Once it has finished, simply reboot your PC and set your BIOS or Boot Menu to boot from the USB Device
I have absolutely no idea what means am I missing something fundamental in the installation process that is implicit?
Ignore that how-to. It is about "Debian Live", not the Debian installer. The netinst Debian installer is here:
If you're not sure which architecture to get, use amd64. (If you have a 32 bit CPU, then you'd need to use i386 instead of amd64 - but this is a waste of time because you won't be able to get VMs working on a 32 bit CPU.)
"Debian Live" are Debian LiveCDs, which are different from the official Debian installer. You won't be able to set up a decent VM host with a LiveCD style install.
You can rsync an HDD install to the stick and install grub on the stick. Just change the /etc/fstab and the bootloader to know it's new location.
Otherwise I tend to do a debootstrap install method.
This won't work for the original poster because he has no working linux install whatsoever. He only has Windows on the hard drive, and is unfamiliar with how to install linux or even where to get an iso for an actual linux installer. There is no HDD install to rsync from, nor is there any working linux install to run debootstrap from.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.