site  news  contact

How to install Easy OS on your hard drive

October 17, 2017 — BarryK

This is part-2 of a tutorial series that I am writing on installing Linux, especially but not exclusively Easy Linux, on your PC. Part-1 must be read first. It "prepares the way":

http://bkhome.org/linux/prepare-your-computer-for-booting-linux.html

The starting-point for the tutorial that you are now reading, is that you have read part-1 and configured your PC to be able to boot Linux from a USB-stick, and you did that final step of creating an "unallocated" gap in the internal hard drive.

However, there is one more thing, you need a USB-stick with Easy Linux on it. Please go here to find the latest version, download, and follow the instructions to write it to a USB-stick:

http://bkhome.org/easy

Then, boot-up your computer from the USB-stick and you are good-to-go for this tutorial...

Notice:
This tutorial is for modern (manufactured in 2012 or later) Windows desktop PCs and laptops, with UEFI firmware. For older PCs with BIOS firmware, the installation steps are somewhat different, and require a separate tutorial, here:
http://bkhome.org/easy/easy-frugal-installation.html 

The case study for this tutorial is my new Mele PCG35 Apo mini-PC, that I introduced in part-1. Here it is, booted-up from the USB-stick:

image

Ha ha, that reminds me. I received an email recently, from a chap lamenting that I was not supplying Easy OS as an ISO file -- his complaint was that there is lots of room on a CD to write stuff, but no space on a USB Flash stick. Not so! I have a simple solution -- masking tape, as you can see above. Whenever I change what is in the drive, I apply a new piece of tape. The thing about masking tape is that it is cheap, sold everywhere, and you can write on it.

Creating Linux partitions on the internal hard drive

Part-1 explained how to use the Windows Disk Manager utility to shrink the C: partition, to make space for creating a Linux partition. This is the safe way to do it, that will keep Windows happy.

Now that you are running Easy OS, you can use the GParted partition management utility, to create one or more partitions in that "unallocated" gap.

Start GParted from the menu (look under "Filesystem"), and first-up there is a wrapper-window, which asks which drive you want to work on:

Menu "Filesystem"
choose "GParted partition manager"
choose "mmcblk0"

In the Mele, the internal drive is named "mmcblk0", and partitions are named "mmcblk0p1", "mmcblk0p2", "mmcblkop3" and "mmcblk0p4". This is Linux naming, and the Windows C: partition is actually "mmcblk0p3".

After GParted starts, this is what you will see, for the Mele case-study:

image

...you can see the "unallocated" gap created in part-1.

Now, what we need to do is create two partitions. The first will be a small 640MB partition with a fat32 filesystem -- this is required for booting, and we will know it as the "boot partition". OK, let's do it...

Creating a fat32 boot partition

A computer with UEFI-firmware will recognise a boot-partition, and add it to the list of bootable operating systems. In the GParted window:

Right-click on "unallocated"
choose "New"

Then you will see this window, and fill in the parameters appropriately:

image

...we only want a size of 640MB, fat32 filesystem, and give it a suitable label, in this case "easy1" (see also, note near bottom of this page).

And here it is:

image

There is one more thing to do, to make "mmcblk0p5" bootable:

Right-click on "/dev/mmcblk0p5"
choose "Manage flags"
tick "esp" and "boot"

Bootable partition created!

That's for booting-up. However, the actual partition used when Easy OS is running, is going to be another one, and we will know this as the "working partition".

Creating a ext4 working partition

Basically the same procedure as before:

Right-click on "unallocated"
choose "New"

And fill in as appropriate. In this case, leave the size as-is, which will fill all available space, choose "ext4" filesystem, and type in a label, for example "easy2". Afterward, they have both been created:

image

However, there is one little hiccup. GParted does not support fine-tuning some ext4 settings. On Flash drives, which includes SSDs, it will prolong the life of the drive if writes are avoided as much as possible. One thing that can be done in this regard is to turn off "journalling".

You don't have to do this, but I recommend it. Exit from GParted, then, you have to do it from a terminal, as shown here:

image

This is for the case of the working partition being "mmcblk0p6". To avoid a typo error, here is the command, that can be copied from here and pasted into a terminal window:

mke2fs -t ext4 -O ^has_journal -L easy2 -m 0 -b 4096 /dev/mmcblk0p6

If you are familiar with Linux, you will probably know this: For newbies, the rxvt terminal does not support the usual CTRL-C, CTRL-V clipboard operations. To paste, click the middle-mouse-button.

Be careful!
Please do check this step very carefully -- you do not want to accidentally wipe the Windows C: partition! Well, in this case the C: partition is "mmcblk0p3", so all is well, but your PC may be different -- so check very carefully. To be ultra-cautious, paste the above into a text editor, modify it to suit your PC, then copy and paste it into the rxvt terminal.

Almost there! Just one little detail -- we need some files in those partitions. Actually, we don't need to do anything more to the working-partition, only the boot-partition...

Populating the boot partition

Near the bottom of the screen you can see the partitions, "sda" is the USB-stick and "mmcblk0" is the internal SSD. The partitions "mmcblk0p5" and "mmcblk0p6" are the newly-created boot- and working-partitions. To populate the boot-partition, all that you have to do is drag some files from "sda1" to "mmcblk0p5":

image

...it is easy, just click on "sda1" and "mmcblk0p5" to mount them, file manager windows will pop-up, and drag some files across -- as shown above.

You only need to copy the files and folder shown in /mnt/mmcblk0p5 above. The others are for the Syslinux boot manager, for booting the USB-stick on pre-2012 PCs.

Tantalizingly close now! Just a little fix required in that initrd.q file...

Fixing initrd.q

The file initrd.q is a tiny Linux filesystem, that the kernel loads into RAM and runs at power-on, prior to launching the "proper" Easy Linux. File q.sfs is the entire Easy Linux filesystem, and vmlinuz is the Linux kernel.

If I was to reboot right now, Mele would detect the "mmcblk0p5" boot-partition, and would load the vmlinuz kernel, which in turn would load initrd.q. But, bootup would fail at that point. We need to fix one little thing -- there is a text file inside initrd.q, named BOOT_SPECS, that has to be edited.

Which is quite easy to do. initrd.q is a binary file, however, it can be opened up just by clicking on it:

image

...I clicked on initrd.q in the new boot-partition, and up popped the contents, expanded at /root/initrd-expanded. Now click on BOOT_SPECS and edit it:

image

...the content of BOOT_SPECS is setup for the USB-stick. The meanings of those variables is pretty obvious, except for that BOOT_DISKID and WKG_DISKID. They are what is known as the "disk identifier", which is different for each drive.

To find the disk-ID, open a terminal, as shown above, and run "fdisk -l /dev/mmcblk0" (that is a lower-case letter "l", not a number one!), where "mmcblk0" is the internal SSD in the Mele.

To copy it into BOOT_SPECS, drag the mouse-pointer over it to highlight the disk-ID, in this case "5D7ACA74-4E2C-4584-B8AE-60AFE5C6C0DA", then paste it. Remember though, the rxvt terminal does not support CTRL-C and CRTL-V keys, so click the middle-mouse-button to paste (which is the scrollwheel on my mouse, or press left and right simultaneously if you only have a two-button mouse).

All done, this is what BOOT_SPECS now looks like:

image

...save, exit the text editor. Finally, click on initrd.q again, and it will be closed up, with your update. Note, this process of opening up initrd.q, modifying it, then closing it, is pretty intuitive. There are popup messages that prompt you what to do next.

We are now ready to bootup Easy from the internal hard drive...

Booting Easy

The installation that I have described on this page is already setup for booting Easy, no extra boot manager required. No invasive modifications to the hard drive. Later, if you decide that you don't want Easy on the hard drive, just bootup Easy from the USB-stick and run GParted, then delete those two partitions -- hey presto, you are back to the start of this web page.

You can then bootup Windows and run the Disk Manager, as described in part-1, and grow the C: drive to fill up that 8GB gap that was previously created.

Anyway, I think that you will really like Easy running on the internal drive, and will keep it!

So, how do we boot Easy, for the very first time? The answer is to run UEFI-Setup. Power-on, holding down the hot-key, then select whether to boot Windows or Easy.

Easy will then present you with a boot menu:

images

...that bottom item will run the UEFI-Setup, a handy way to run it on future occasions, without needing to press the hot-key.

A picture is needed to show Easy now running on the Mele:

image

...of course, I did remove the USB-stick beforehand!

I never mentioned anything about populating that working-partition, "mmcblk0p6". That's because Easy does that automatically at first bootup. If you want to know the details, read the in-depth "How Easy works" page:

http://bkhome.org/easy/how-easy-works.html

To round-off this page, explaining more about dual-booting...

rEFInd boot manager

The UEFI-firmware works as a rudimentary boot manager. At power-on, it scans the drives, searching for what are known as "EFI system" vfat partitions. You will see in the GParted snapshots above, that there is one for booting Windows, "mmcblk0p1".

The exercise we went through on this page is to create another, "mmcblk0p5". At power-on, the UEFI will recognise all of these EFI system partitions, and add them to the boot-list. By default, it puts the Windows one on top, that is why you have to run UEFI-Setup and change the order.

This works fine, and is a very simple and non-invasive way to dual-boot. And, especially, easily reversible.

However, if you want a nice menu at power-on, offering you a selection of operating systems, well, Easy already has it: the rEFInd boot manager.

The boot-menu snapshot shown above, is actually provided by rEFInd, and by a very simple configuration change, rEFInd can be told to scan the computer and offer other OSs in the menu. In the boot-partition, open file EFI/BOOT/refind.conf in a text editor. You will see this:

timeout 10
textonly on
textmode 0
showtools shutdown,reboot,firmware
#scan_all_linux_kernels off
#scanfor manual,internal
scanfor manual

menuentry "Easy OS" {
loader /vmlinuz
initrd /initrd.q
ostype linux
options rw
submenuentry "Filesystem check" {
add_options "qfix=fsck"
}
submenuentry "Commandline only, do not start X" {
add_options "qfix=nox"
}
submenuentry "Rollback to earlier session" {
add_options "qfix=bak"
}
}
menuentry "Windows 10" {
volume SYSTEM
loader \EFI\Microsoft\Boot\bootmgfw.efi
disabled
}

This configuration file tells rEFInd to not do any automatic scanning. Notice the entry for "Windows 10" at the bottom. If you comment-out that "disabled" line, and replace "SYSTEM" with the label of the Windows ESP partition (on my Mele it is "SYSTEM"), then you will have Windows added to the boot menu.

Alternatively, you can turn on automatic scanning, which is, quite frankly, brilliant. Just change these three lines, like so:

scan_all_linux_kernels off
scanfor manual,internal
#scanfor manual

Reboot, and hey presto, Windows is in the menu:

image

...this example is for my Mele. If there were other OSs, they would also be picked up and offered in the menu.

Post-amble

A few more scattered thoughts...

That working-partition could be on a SD-card. It is just a matter of editing BOOT_SPECS appropriately. The Mele has a SD-card slot, and if I left one plugged in permanently, it could be the working-partition.

Why would you do that? One big reason: you would only have to shrink the Windows C: partition by 0.7GB, just enough to fit the 640MB Easy boot-partition. Given how tiny the SSD is, that would leave more space for installing apps in Windows.

All of Easy on the SD-card?
If you are going to do that, then why not just have both boot-partition and working-partition on the SD-card? In that case, just write the downloaded easy-*.img.gz to the SD-card, as you did with the USB-stick. The SSD can be left in its pristine state.
However, I have tested three different laptops and my Mele mini-PC, and they refuse to boot from an SD-card. The BIOS/UEFI simply ignores the SD-card at power-on.
Note that some laptops connect the SD-card socket internally via the USB-bus, so an SD-card might be recognised at bootup, and it is probably worth trying on your computer.

A second reason: use whatever size SD-card that you want, so you will have heaps of space for Easy.

Another thought: everything described on this page could be done with a nice friendly GUI app. For Linux newbies, that would be great, and I might do it, one day.

However, doing it manually gives a certain satisfaction. You know exactly what you have done to your computer, and are well-placed to make changes in the future.

(c) Copyright Barry Kauler, September 2017, all reproduction rights reserved.
A disclaimer: I have provided these instructions in good faith, however there is a disclaimer of all responsibility if something does go wrong. It shouldn't, but if you type in something incorrectly and wipe your C: drive, that is entirely your own responsibility. if you are a Linux newbie and want to install Easy on the internal hard drive, I recommend that you find a Linux-knowledgeable guy to help.

Tags: easy