Instructions given below are for a "frugal install" using an iso image. It is much smaller than a full-on installation because the filesystem is maintained in compressed form as found on a DVD. A frugal install only requires enough space on a drive to hold the iso file and bootloader. Frugal installs can be added to an existing system with minimal cost in drive space, and updates are a simple matter of copying a new iso file. The critical step is installing the bootloader.
Create a disk partition separate from the computer's main system to hold MOFO Linux and any other Linux frugal installs. This will ensure that updates or clean-ups for one system do not damage or clutter the other one. The webmaster has accidentally erased frugal installs kept on his main system during overzealous maintenance. Take the lesson and keep the iso files on a different partition...
In this example, the computer has one hard drive, and it is divided into two partitions. The main system runs on the first partition and the second partition serves as storage for documents, backups, and a frugal installation of MOFO Linux. Be aware that the drive and partitioning scheme is peculiar: the first drive is "hd0" while the first partition is numbered "1" and so forth.
#!/bin/sh exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. # First drive, first partition set root=(hd0,1) menuentry 'MOFO Linux v9.0.0 (Debian)' { set isofile="/isofiles/mofolinux-9.0.0.iso" loopback loop linux (loop)/live/vmlinuz boot=live findiso= threadirqs mitigations=off initrd (loop)/live/initrd.img } menuentry 'MOFO Linux NEXT v9.x.x (Debian)' { set isofile="/isofiles/mofolinux-next.iso" loopback loop linux (loop)/live/vmlinuz boot=live findiso= threadirqs mitigations=off initrd (loop)/live/initrd.img }For versions earlier than 9.0
#!/bin/sh exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. # First drive, second partition menuentry 'MOFO Linux v8.4.0 (Ubuntu)' { insmod ext2 set isofile='/isofiles/mofolinux-8.4.0.iso' search --no-floppy --file --set=root loopback loop (hd0,2) linux (loop)/casper/vmlinuz boot=casper iso-scan/filename= boot=casper quiet splash threadirqs -- initrd (loop)/casper/initrd }
After editing /etc/grub.d/40_custom, open a terminal window and update grub2:
sudo update-grub
Yes, it is entirely possible to put MOFO Linux on a machine with Windows already installed! Similar to other dual boot setups, it is necessary to create a partition separate from Windows and install Grub2 as the bootloader on that partition. It is actually much like the dedicated USB installation shown below, but instead of a separate flash memory device, the files and bootloader are installed to an extra partition just above Windows. To boot windows, Grub2 is set up to chainload the Windows bootloader.
For accomplishing this sort of installation, you must correctly determine the partition to be used for holding the MOFO Linux iso file and Grub2 configuration files. This example depicts a hard drive with Windows on the first partition and MOFO Linux on the second. Expect Windows to occupy /dev/sda1; install Grub2 and MOFO Linux to /dev/sda2.
We will begin by installing Grub2 to the second partition on the hard drive. Boot the machine into Linux from a live DVD or USB stick, mount the partition, and then write the Grub2 data to the second partition as shown below:
1) Open the terminal and get root priveleges:
sudo su
2) Verify the location of the second drive partition:
fdisk -l
3) Set up a mount point to work on the partition. You may delete it later:
mkdir /mnt/CBIRDPARTITION && mount /dev/sda2 /mnt/CBIRDPARTITION
4) Install Grub2 to the drive:
grub-install --force --no-floppy --boot-directory=/mnt/CBIRDPARTITION/boot /dev/sda2
5) Create a directory to hold the one or more isofiles:
mkdir /mnt/CBIRDPARTITION/isofiles
6) Use your file manager, drag and drop the MOFO iso file into the "isofiles" directory in the partition.
7) Create a "grub.cfg" file located at /boot/grub/grub.cfg in the partition which will hold menu data and direct grub to boot using one or more isofiles. In this example we will configure for booting MOFO Linux, Skywave Linux, and Windows 7. Be aware that Grub counts drives starting at zero and partitions starting at one:
set timeout=20 set default=0 # First drive, second partition menuentry 'MOFO Linux v9.0.0 (Debian)' { set isofile="/isofiles/mofolinux-9.0.0.iso" loopback loop (hd0,2) linux (loop)/live/vmlinuz boot=live findiso= threadirqs mitigations=off initrd (loop)/live/initrd.img } menuentry 'Skywave Linux 4.4.0 (Ubuntu)' { insmod ext2 set isofile='/isofiles/skywavelinux-4.4.0.iso' loopback loop (hd0,2) linux (loop)/casper/vmlinuz boot=casper iso-scan/filename= quiet splash threadirqs -- initrd (loop)/casper/initrd } menuentry 'Windows 10' { insmod part_msdos insmod ntfs set root='(hd0,msdos1)' chainloader +1 }
To run MOFO Linux, simply boot the computer and await the appearance of Grub2's menu. It should list both the main system and also MOFO Linux. Select MOFO Linux, and observe a normal startup sequence. After a few seconds of scrolling messages, the desktop should appear. At this point, the system is ready to run.
Other systems may be added in the same manner as MOFO Linux. Kali Linux, Slitaz, SLAX, Siduction, Knoppix, or any other live CD or DVD may be installed alongside MOFO Linux. The iso files may all reside in one group, but each will need its own entry (plus startup options) written to "/etc/grub.d/40_custom."
Yet another option is putting multiple systems onto a large USB stick or SD card. In that case, you must install grub to the USB stick and then use the file "/boot/grub/grub.cfg" for the menu entries. There are computer users who actually use nothing but frugal installs on a large USB stick, with the hard drive strictly storing documents, multimedia files, and so forth.
You can even set up a multiboot hard drive, doing all of your daily computing on live Linux systems.
To install Grub2 to the boot sector of a USB stick, you will plug in the stick, mount it, and then write the Grub2 data to the stick. In the following example, we'll install to a USB flashdrive plugged into a machine running Linux on the hard drive. The hard drive is "sda" and the USB stick is "sdb". The first partition on the USB stick is "sdb1".
1) Open the terminal and get root priveleges:
sudo su
2) Verify the location of the USB stick:
fdisk -l
3) Set up a mount point to work on the USB drive. You may delete it later:
mkdir /mnt/USBDRIVE && mount /dev/sdb1 /mnt/USBDRIVE
4) Install Grub2 to the drive:
grub-install --force --no-floppy --boot-directory=/mnt/USBDRIVE/boot /dev/sdb
5) Create a directory to hold the isofiles:
mkdir /mnt/USBDRIVE/isofiles
6) Use your file manager, drag and drop the MOFO Linux iso file into the "isofiles" directory on the USB stick.
7) Create a "grub.cfg" file located at /boot/grub/grub.cfg on the USB stick which will hold menu data and direct grub to boot using one or more isofiles. In this example we will configure for booting MOFO Linux and Skywave Linux. Be aware that Grub counts drives starting at zero and partitions starting at one:
set timeout=20 set default=0 # set root location and insmod ext2 for all menu entries set root=(hd0,2) insmod ext2 menuentry 'MOFO Linux v9.0.0 (Debian)' { set isofile="/isofiles/mofolinux-9.0.0.iso" loopback loop linux (loop)/live/vmlinuz boot=live findiso= threadirqs mitigations=off initrd (loop)/live/initrd.img } menuentry 'Skywave Linux 4.4.0 (Ubuntu)' { set isofile='/isofiles/skywavelinux-4.4.0.iso' search --no-floppy --file --set=root loopback loop linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename= quiet splash threadirqs -- initrd (loop)/casper/initrd.lz } menuentry 'MOFO Linux 7.0 (Ubuntu)' { set isofile='/isofiles/mofolinux-7.0.iso' search --no-floppy --file --set=root loopback loop linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename= quiet splash threadirqs -- initrd (loop)/casper/initrd.lz }
Test the USB stick by rebooting the computer system and making sure the BIOS is set to look for the stick as either a USB flash memory or as a hard drive on the system. If necessary, use "E" to edit the Grub commands at boot time and find out what works. Most problems involve pointing Grub to the isofile, then to the vmlinuz and initrd files within the iso.
There is no need to lose files you create or changes you make while operating your system from an iso file! Configure the system to boot with persistence enabled. In the persistent mode, new data and settings are written to a dedicated partition which holds them safely between shutdown and subsequent restarts. Sure, it is possible to manually save your files before shutting down at the end of a computing session, but why bother when persistent mode does it automatically? You can even install software and retain it for future computing sessions.
Persistence requires two things: a dedicated partition of at least 128 MB and an additional boot parameter. When setting up partitions, create one in EXT2 or EXT3 format and label it "casper-rw". Persistence can be added to an existing USB stick or SD card by creating a new partition and setting the label to "casper-rw". For best results, consider making the partition 1GB to 2GB in size. Then add "persistent" to the kernel boot options in grub2. At start-up, the system will find and use the partition for any changes made.
Good luck, and enjoy the convenience and robustness of having one or more operating systems frugally installed to an inexpensive USB drive.