Creating a Bootable USB stick from Linux

How to Install FoxyRoxyLinux

Creating a Bootable USB stick from Linux

Postby jbv » Thu Aug 16, 2012 8:47 am

[edited] This thread started out as a call for help. No matter what I tried, I could not create a bootable USB stick froma Linux machine. It wasn't just the FoxyRoxy ISO, as I couldn't get a bootable stick of the original Debian-Live ISO either.

I tried anything and everything I could think of with various versions of FoxyRoxy and even a clean Debian-Live (booted from a USB made from my Windows machine). The only thing I end up with is a trashed USB stick.

I asked for some help and it came (thanks guys). There are two solutions below which will work.

I will watch this space, and give the whole process a bit of thought before deciding if FoxyRoxy really needs something internally. Right now, my first thought is that if you can just "apt-get" something, then perhaps it does not need to be included....

With thanks to saintless, and sickgut, we now present .... Creating a Bootable USB stick from Linux.
jbv
 
Posts: 600
Joined: Sat Jul 14, 2012 2:02 am
Location: Sydney, Australia

Re: Creating a Bootable USB stick from Linux

Postby saintless » Thu Aug 16, 2012 12:28 pm

At last I've decided to try to upgrade my BIOS and it worked perfect. Now I have boot from USB option. BIOS sees my USB stick as second hard drive but I guess it doesn't matter while it boots from USB.

Creating bootable USB stick in linux from FoxyRoxy_DevRel_02.iso:

I use FoxyRoxy with live-rw save file.
Download and install Unetbootin.
Code: Select all
apt-get update
apt-get install unetbootin


Start Unetbootin and choose the iso from your hard drive location and the usb where you want to copy the files. Mine USB was formatted in Fat32 in advance.
Click OK and let the program to do the job.

1.png
1.png (113.28 KiB) Viewed 13165 times

2.png
2.png (61.92 KiB) Viewed 13165 times


It will install boot loader and syslinux.
I wonder if this is the reason the dd command doesn't make the USB bootable. dd only copies isolinux and the live folder on the usb stick? There is not syslinux and I remember JBV renamed syslinux to isolinux or the opposite while he was making bootable USB from pussy linux iso.

3.png
3.png (53.04 KiB) Viewed 13165 times


The reboot button in the program doesn't work because the reboot button for FoxyRoxy does not work also for the moment. Just logout, type reboot and hit Enter.

After reboot set BIOS to boot from USB first and you will get this menu on the picture.

shutdown1.jpg
shutdown1.jpg (45.84 KiB) Viewed 13166 times


Choose the kernel you want to boot and in a few seconds you will get to login prompt.
Type root for user and roxy for password and the desktop will load.

I read some negative messages in different forums about Unetbootin and how it doesn't make bootable USB sticks from every ISO file but I guess we are lucky it does that for FoxyRoxy.

Here is the content of my bootable FoxyRoxy USB stick created wit Unetbootin:

5.jpg
5.jpg (20.18 KiB) Viewed 13164 times
User avatar
saintless
 
Posts: 246
Joined: Sat Jul 14, 2012 7:01 am
Location: Bulgaria

Re: Creating a Bootable USB stick from Linux

Postby sickgut » Thu Aug 16, 2012 5:34 pm

For the adventurous (this if for advanced users and developers):

Head over to the debian-live site and download a USB-HDD image of debian-live:

http://cdimage.debian.org/cdimage/release/current-live/i386/usb-hdd/debian-live-6.0.4-i386-standard.img

For Linux users, we use the dd command to image the USB stick or SD card or other bootable removable media, even a USB hard disk.
Boot your Linux up like normal then insert your USB stick. First we "zero it out", this is better than a format or quick format as every 0 and 1 on the USB stick is forced into a 0 position. This is somewhat precautionary as it prevents problems later on in the process. If you are lucky enough to have a Linux distro that tells you the sdb1 or other sdxx designation of the USB sticks device assignment then you may not have to enter the following command, if your distro hasnt told you yet the device designation of the USB stick in a sdb1 type format then you will need to run the following command to find out:

Open a terminal and type: fdisk -l

Note the " l " here is lowercase L not an uppercase i. The readout of this command if read carefully and thoroughly will tell you the /dev/sdb or /dev/sdb1 type designation of your USB stick. Also note here that the number after the letters sdb or sdc etc means the partiton number of the device. What we want here is only the device designation and that is /dev/sdb with no numbers at the end. We need to zero out the entire USB stick, not just partitions on the USB stick, there is a difference. Partitions dont contain the MBR (master boot record) that is responsible for booting linux. We need to zero this out to make way for the boot record that the debian live image contains.

Open a terminal and type: dd if=/dev/zero of=/dev/sdb
Note that /dev/sdb here is an example, you may find your USB stick designation has "a", "c", "d" or an "e"at the end instead of the "b".
This will take awhile. A long long time. Maybe an hour, maybe 15 minutes depending on your system and the type of kernel you are running and of cause the USB stick itself. Note here that some auto mounting OSes that automatically mount your stick in /media or other dirs can reduce the write speed by varying degrees. You may want to right click the mounted USB stick and select unmount before you zero it out. The commandline way of unmounting is to use a terminal and type: umount /media/usbstickname. If your OS mounts the USB stick automatically in multiple dirs then you may find that: umount /dev/sdb2, or eject /dev/sdb2 works better but your OS may or may not allow you to do this.

When your zeroing is finished there should be a message saying something like: Copied xxxMB, xxxxx bytes in, xxxxx bytes out.

Now you need to find the path to your downloaded debian .img file. Its something like this: /home/barry/Downloads/debian-live-image.img
Now we image your stick with the debian image by doing this:

dd if=/home/barry/Downloads/debian-live-image.img of=/dev/sdb bs=1M

The above bs=1M isnt really needed but it does make the imaging run a little faster. That command is telling the "dd" program to image with a byte size of 1 megabyte, or in simpler terms, to copy over the image in 1 megabyte chunks rather than in single byte chunks. This will probably not take all that long compared to zeroing out the USB stick because only the first 230mb or so of your stick is being imaged.

After the imaging stops, reboot your computer and remove the USB stick. Load back into your usual Linux OS and run a partition manager, if you dont have a good one then install "gparted". Insert your USB stick If you already have gparted or some other good partition editing program then load it. You should be able to find your USB stick and only the first 230mb or so of it is used. What you need to do here is resize that first partition to cover all the USB stick. If you would like to have a swap partition on your USB stick then dont cover the entire USB stick, but leave a bit of room at the end, like 300MB or whatever your heart desires. If you chose to leave some space at the end of the stick to use as swap then add the swap partition to the end of the drive. After you have done this finalize your selections, in gparted you do this by clicking "apply". You may need to reboot again to do the next step. Linux can get confused when you change partitions without rebooting, depending on your Linux then you may or may not need to reboot. I do it anyway just to be safe.

After rebooting, load back into your Linux, you may need to remove the USB stick before your Linux boots because your system may try to boot from the newly imaged USB stick instead. Once booted insert the USB stick and mount it if you need to mount things manually. Make sure you have the FoxyRoxy Linux ISO handy. You can mount the ISO manually with:

mkdir /foxyiso
mount -o loop /path-to-ISO/foxyroxy.iso /foxyiso

The file in the ISO are now accessible and mounted to the /foxyiso dir. What you need to do here is replace the main squashfs files one the USB stick with those from the FoxyRoxy Linux ISO and also copy over the menu files. You may find that deleting every file on the USB stick then copying every file from the FoxyRoxy ISO to the USB stick will work, if not then change the /isolinux dir to /syslinux and open edit all the files in the /syslinux folder and replace any reference to /isolinux with that of /syslinux.
This may take a little fiddling. Once you have it sorted and it works then you can backup your USB to an image .img file so you can use "dd" again at a later date to restore your USB stick if you hose it up or if you want to create more USB sticks with your now booting from USB image.

To backup your USB stick:

dd if=/dev/sdb of=/home/barry/FoxyRoxy-Linux.img bs=1M

And to reimage your USB stick or another USB stick with your .img file:

dd if=/home/barry/FoxyRoxy-Linux.img of=/dev/sdb bs=1M

And so there we have it, making a bootable USB FoxyRoxy from Linux. I suggest that the first person to get a booting USB stick with this method make an .img of the stick and then ask JVB for a place to upload it too so that the image can be shared with the rest of us.

This is why Pussy Linux ended getting a .iso for CDROM and an .img for USB stick download thing happening, but I did it in reverse. I started with the normal Debian Live USB-HDD image and made a USB stick with it using "dd". After i got my USB stick how i wanted it, i downloaded and edited a Debian Live ISO with ISOmaster and I simply switched the squashfs files on the ISO with the ones from the USB stick, and then edited the menu stuff so that all references to /syslinux where now changed to /isolinux in the config files and BOOM a working ISO and a working USB stick.

Note that .img files can also be imaged to your internal HDD, this will wipe everything else from your HDD so dont do it unless you can live with the choices you make. This method does not setup dual booting, it completely kills anything on your HDD just like it was reformatted blank. The only OS on your HDD will be FoxyRoxy, but how that is shaping up... it would probably the best thing you could do to your internal HDD :)
sickgut
 
Posts: 6
Joined: Sun Aug 12, 2012 1:51 pm

Re: Creating a Bootable USB stick from Linux

Postby saintless » Thu Aug 16, 2012 6:42 pm

Thanks, Sickgut,

I was thinking about something like this but now reading your instructions I don't think I could manage to do it without help.

Something to consider as disadvantage of Unetbootin is that it creates bootable USB from whole usb size, not only the size of the iso. And I don't see a way to reduce the size with Gparted.

My opinion is two images (iso and img) will make the developing process two times harder. We will have to reproduce all the changes two times and to upload two images instead of one.

I hope we will find easy and proper way to support the ISO only and to make easy bootable USB from it.
User avatar
saintless
 
Posts: 246
Joined: Sat Jul 14, 2012 7:01 am
Location: Bulgaria

Re: Creating a Bootable USB stick from Linux

Postby sickgut » Thu Aug 16, 2012 10:16 pm

I volunteer to convert the ISO to USB as a "master" template and upload it as a zipped .img image file. It shouldnt be much bigger than the ISO because blank space zips really well. Its much easier to do your developing on a USB stick and when you are ready to upload the new version, you just dd your USB stick to a .img file, zip it and upload. Once your boot menu stuff is done as i believe it is, you simply swap out the squashfs files from the old ISO with the new ones from your USB stick.

I know that it is more confusing for end users to have an ISO and a USB .img image. It all depends on how you want people to run your OS, from a CDROM? or from a USB stick or HDD? If you dont care much for live CDROM usage, then maybe ISO isnt the most ideal format to use, also .img files do allow for reasonably simple HDD installs... and i see that Foxy is set to become a NAS server OS so this may be well suited for single boot HDD installs if people want to have their NAS box running on an oldish computer with an internal HDD. Also ISO format when used to make a bootable USB stick doesnt let you automatically setup save files, swap files and or other partitions like a .img does. The only draw back an .img image has is that it is a set size. However the initial size doesnt need to be any larger than the OS, as once the USB stick is imaged its possible to have a script that automatically formats the rest of the stick as an ext2,3,4 or fat32 and label it as live-rw and there you have it. In such setups however, a swap file cant reside in the live-rw partition so its probably best to have the first partition contain the OS and then have a small swap partition as the second partition and this will be a set size and the final partition for the .img image. So in conclusion the first partition is the OS partition, the swap partition is second and the third isnt part of the image as this would always be variable depending on the storage device Foxy is meant to be installed to. The third partition is created by the user clicking on an icon or menu entry entitled "Expand to fill the rest of the drive" or "Setup data partition" or something similar. Of cause you could always just use gparted to resize the first partition to cover the rest of the drive or create a live-rw drive that uses the rest of the space, but i was trying to explain a newbie scenario.

Telling other devs how they should be doing things is not my intention, but i am volunteering to create the initial "master" .img image if it would be of any help. Im not trying to say do this or do that, what im trying to do is "offer" a "solution" by providing the master .img all fixed up good and proper. And if need be, i can do this regularly as you guys release new versions i can refresh the .img and upload it, so there need not be any extra workload for the current devs of Foxy.

In essence the .img version will look after itself and just be there for people to download. Its no secret that i appreciate all the help that devs here gave me on my own project, and i have no problem in returning the favor. Also i am personally excited about Foxy. Its similar enough to what i was doing previously that i can reuse the same skills i learned but different enough so as not to stir up bad memories of stressful times :)
sickgut
 
Posts: 6
Joined: Sun Aug 12, 2012 1:51 pm

Re: Creating a Bootable USB stick from Linux

Postby jbv » Fri Aug 17, 2012 12:21 pm

To allow the Unetbootin thing to be experimented with, I have created an injection that will inject Unetbootin into the 02-FoxyDesktop sqf.

See <this thread> if you would like to play with it.

See <this message> if you have any comments to make on the functionality of Unetbootin and adding it to a future release.
jbv
 
Posts: 600
Joined: Sat Jul 14, 2012 2:02 am
Location: Sydney, Australia

Re: Creating a Bootable USB stick from Linux

Postby saintless » Wed Sep 12, 2012 4:06 pm

Thanks to Brenton we have one more way making bootable usb from FoxyRoxy live CD.

Lets suppose your linux does not support Unetbootin, or you don't have linux at all and you don't have any program to create bootable usb installed.

To create your bootable USB just download and burn FoxyRoxy iso to CD. Then delete the iso. You don't need it anymore.

Boot the system with FoxyRoxy CD and open the quick-console window (on the left side on the taskbar) and type mount. You will get some output like this on the next picture:

snapshot3.png
snapshot3.png (55.45 KiB) Viewed 13034 times


Look where live is mounted from. You will see /dev/sr0 or /dev/md0.
Remember this device name, insert USB stick and wait for it to auto mount and just in case see what device it mounts as. Unetbootin will detect it anyway but check this for your self.

Then select from taskbar menu -> Administration -> UNetbootin to start it.
Then select "Diskimage" button and make sure the first drop down box as an ISO.
Do not touch the selector button on the right and just type the /dev/sr0 or the device name for your CD/DVD reader. See the next picture:

snapshot1.png
snapshot1.png (24.26 KiB) Viewed 13034 times


Then select the correct USB stick device and click on the OK button.

Unetbootin will use your CD/DVD ROM as the ISO. It will slow down the writing at about 64% (see the next picture) because of the slow CD and USB writing speed:

snapshot2.png
snapshot2.png (21.04 KiB) Viewed 13034 times


But as Brenton says:
It "will not lock up" - FoxyRoxy DOES NOT lock-up
Just have some "faith" and wait a while.


When it is done reboot, remove the CD and then boot from the USB stick.

Image
User avatar
saintless
 
Posts: 246
Joined: Sat Jul 14, 2012 7:01 am
Location: Bulgaria


Return to Installing FoxyRoxyLinux



Who is online

Users browsing this forum: No registered users and 1 guest

cron