Wednesday, July 13, 2011

Installing Peppermint OS without a CD

In this post, I will describe how I installed Peppermint Linux onto my harddrive without burning a CD and the issues I ran into.  First I should warn you that this method is not for the light-hearted. It involves manually editing GRUB configurations, chrooting, loop mounting, etc.

The first step is to prepare the partition.  In my case I formated an existing partition as ext4 using the mkfs command. I won't go into the details of how to do this, because I assume that you either already know how to do it, or are intelligent enough to find a howto somewhere else. 

The next step is to get the installation ISO of the desired distro and make the filesystem accessible. In my case I just downloaded the 64-bit ISO from the Peppermint OS website.  Then I mounted the ISO image using a command of the form "mount -o loop path/to/isofile.iso /mnt/mountpoint" which needs to be run as root. While you are at it you also need to make sure that the partition you want to install to is mounted (from now on I will refer to that mount point as /mnt/new).  Finally, you will also need to find the squashfs filesystem on the ISO, I believe for PeppermintOS it was in the Casper folder, but it could vary from distro to distro. You will either need to extract it or mount it.  I mounted it because I didn't have the squashfs tools installed, but you could probably extract it directly into the desired partition. In my case I mounted the squashfs with the command "mount -o loop -t squashfs filesystem.squashfs /mnt/squash." Then once I had it mounted I copied the entire contents into the new partitions with "cp -R ./* /mnt/new". 

I had a slight problem in that the squashfs only appeared to have a broken symlink instead of a kernel, so make sure that you have a kernel (vmlinuz26) and an initram disk (prabably initrd.img or something like that). It may be in the root directory or in the boot directory depending on the distro.

Now you need to modify grub so you can actually log into your new OS.  In my case (I am using grub 2) I added a new menu item with the following lines:

set root="(hd0,5)"
linux /vmlinuz root=/dev/sda5 ro quiet splash
initrd /initrd.img
The last part is the trickiest, and most likely to change from OS to OS.  I was unable to log in because there wasn't any account created, so I went back to my original OS and chrooted into the partitions (note you will need to mount with the exec option). Then I created a new user account, and granted it sudo priveledges. While in the chroot I also ran dpkg-reconfigure on several packages, such as the locale packages, and edited /etc/fstab and a couple other /etc files to behave properly, and for some reason I also needed to give the /tmp folder world writeable access (don't know why it didn't have it before). Unfortunately I am still having some kind of trouble with dbus, and I am not sure what is causing it.  I've tried reinstalling it, recnfiguring it, etc.  But since my Arch Linux works fine, and this was more of an experiment than anything else, I haven't worried too much about it. 

So, installing Linux this way is a lot of effort, but if, like me, you like to do things the hard way and are too cheap to buy a CD :), or if you don't have a CD drive on the computer you want to put it on, this is definetely an option.

No comments:

Post a Comment