Friday, August 22, 2008

Howto: Install Mint from a USB Pendrive/SD

Hi, new to the forum. Hi everyone.
This guide is for people who want to install Linux Mint FROM a pendrive, not ON, on computers that boots from USB.

// Silver got it to work with a card-read with a 1 gb SD-card! Props to him! =) //

Today, I thought I should give Mint a try, so I brought forth my old laptop, which hasn't a cd-rom. It can boot from USB (Been meddeling with Ubuntu there.) so I though I should give it a try, but there was no guide here on this forum. Since Mint is related to Ubuntu, I crawled the wiki's and all that on the ubuntu-pages, but the guides there didn't work at all with Mint.
There are some threads here on how to use a pendrive as the main drive for Mint with persistence, but that's not what I want at all, although it's great.

I just wanted to install Mint on my craptop which doesn't have a cd-rom, and I was too lazy to boot up a linux on my regular pc to make the pendrive bootable, so everthing was to be done in Windows. I later edited this guide to include instructions on how to do the same from linux. I used Linux Mint 3.0/3.1-beta.

Anyway, here's what I did and what worked for me. I used a Creative MuVo Tx 1gB for this. The computer must be able to boot from USB.

Step 1: Make the Pendrive bootable.

Format the pen-drive to FAT32. This is done by right-clicking on it in 'My computer' and pressing 'Format'.
Then grab syslinux: ...
Unzip somewhere, then use the windows command-line. Navigate to the directory where you unzipped Syslinux (I called the folder syslinux), then to the win32-folder inside that folder. Then use the command syslinux -s X: (Whereas X is the drive-letter for the pendrive.)
In my example, since the pendrive had the drive-letter I:
Code: Select all
C:\syslinux\win32\syslinux -s I:

I used the console for this, but you could probably use Gparted aswell.
//Edit by husse/
Gparted is more secure in this case as you can easily see the partitons, their size and so, thus avoiding any mistake
For this just right click the pendrive and that gives you the options to create and format a FAT16 partition//

Anyway, in console, first find the pendrive. sudo fdisk -l will list every mounted thing, see if you can find it. For me, the pendrive was mounted as /dev/sdb1
Then I used sudo fdisk /dev/sdb1
This will start the fdisk-program. A command-prompt will start. First, we must delete any existing partition. Use the letter 'd'. Follow the instructions. Then use the letter 'n', for add a new partision. Make it a primary. Partition number should be 1.
Then use the command 't' to make it a FAT16. Other filesystems should work, but fat16 is a garantee. It's very stable and supported. The hex-code for fat16 is 6, so use that.
Then write it with 'w'.

Now, format the stick. You probably have to unmount it first.
Code: Select all
sudo umount /dev/sdb1
sudo mkfs.vfat -F 16 /dev/sdb1

Now mount it again. It should be clean and stuff.

Install Syslinux and Mtools (sudo apt-get install syslinux mtools) and run the console command:
Code: Select all
sudo syslinux /dev/sdb1

Note: The syslinux apt-get will download is severly outdated!! It took me some time to discover this. >_>
Anyway, download a fresh syslinux here: ... .51.tar.gz
Extract it somewhere. I used the desktop, since I only need syslinux for this small operation. Then go console:
Code: Select all
sudo Desktop/syslinux-3.51/unix/syslinux /dev/sdb1

Step 2: Copy the files from the Mint live-cd.

Download the ISO, then open it/mount it. It can be opened and extracted with WinRar or mounted with daemon-tools. Whatever you chose, make sure you copy _every_ file to the pendrive. _Every_ file.
To be 100% sure, mount it, then do the windows-command: xcopy /e /h /k X:\*.* XX: (Whereas the X is the mounted cd-drive and XX is the pendrive. In my case below;
Code: Select all
xcopy /e /h /k h:\*.* i:

This will copy everything. Everything. Yay.

Mount the ISO to a folder. This part is easiest done if you have the iso in your home-folder. It should then suffice do to this:
Code: Select all
mkdir mint
sudo mount LinuxMint-version.iso mint -o loop

Then copy everything to the pendrive using cp.
Code: Select all
sudo cp -r mint/.* /media/cdrom0

I had mounted the pendrive to /media/cdrom0. If you have mounted it somewhere else, use that directory instead. During this process, there will be no progress-bar or something like that, just wait. It takes some time to copy 700mB. It's important to use /.* or it won't copy the hidden files.

Step 3: Edit some files!

[Windows and Linux]
On the pendrive, rename the folder isolinux to syslinux. Very important.
Open that folder, and rename the isolinux.cfg to syslinux.cfg.
In linux you could use the console-command;
Code: Select all
sudo mv /media/cdrom0/isolinux /media/cdrom0/syslinux
sudo mv /media/cdrom0/syslinux/isolinux.cfg /media/cdrom0/syslinux/syslinux.cfg

And that's it! You should now have a bootable Linux Mint on the pendrive you can install from!

The parts here that confused me from the ubuntu-guide was that here, you were supposed to edit the syslinux.cfg and remove every instance of /casper/ and /install/. For somewhat reason, you should NOT edit it at all, just rename. And it works. Actually, me myself used some hours while ripping out my hair trying to figure this out, and in the end I just gave my pc the finger, then just tried with a clean unedited syslinux.cfg since it was the only thing I hadn't tried.

And yeah, this works 100% the same way as the Live CD, so if you just want to test Mint without burning any cd's, this is a good option.

// Updates /
6. September - Added 3.1-beta and colorized Husse's comments.
26. September - Tested with 3.1 final.
3. November - Works with 4.0 beta. Changed the title. Guide is so good it works for every release. :3
13. January - No, this guide is not outdated. It works with Mint 4.0 final too. I removed a part and fixed the syslinux-link. Thanks to those who posted here that the link was dead.//

No comments: