site  news  contact

How to install EasyOS on your hard drive

December 11, 2018 — BarryK

This is part-2 of a tutorial series written about 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:

https://easyos.org/install/easy-frugal-installation.html  

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

image1

Author's note:
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.

Author's note:
This is "take 2" writing this tutorial. The first time, I created 640MB fat32 and 8GB ext4 partitions, reducing the Windows ntfs partition down to 20GB. However, Microsoft advises that this is too small for applying upgrades. The second time, I created just a 644MB fat32 partition, and used an 8GB SD-card for the ext4 partition.
The second method is recommended for any PC with only 32GB internal drive. Note, though, there are workarounds to upgrade Win10 in only 20GB, but it is not simple.

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 EasyOS, 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:

image2

...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:

image3

...we only want a size of 640MB, fat32 filesystem, and give it a suitable label, in this case "easy1".

And here it is:

image4

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:

image5

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 the Author recommends it. Maybe don't bother for now, but if you are going to run Easy on the partition for the "long haul", then it is worth considering. Exit from GParted, then, you have to do it from a terminal, as shown here:

image6

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.

...given that this may be difficult for newbies, don't bother with it. Just record it in your mind as something that can be done in a future install. Actually, SSDS have improved considerably, and this measure to prolong the life might not really be needed.

Take-2
As stated earlier in this page, the "second go" installing to the Mele was done differently, creating just a small 644MB "gap" in the internal drive, for a fat32 partition, and use an external SD-card for the 8GB ext4 partition. Here is a snapshot back at the Win10 Disk Manager:
 

image13

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":

image7

...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.

Author's note:
You may sometimes see the initrd file named as initrd.q in tutorials. No difference, the name was changed to initrd in EasyOS 0.9.10 and later. Also, q.sfs was renamed to easy.sfs, to make it's meaning clearer.

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

Fixing initrd

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

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

Which is quite easy to do. initrd is a binary file, however, it can be opened up just by clicking on it, and this window will appear:

image18

...click "Yes" and this appears...

image15

...if this is correct, then just click "Yes" button. This snapshot was taken for the "take-2" install, and the working-partition entries are wrong (at the time of writing, automatic fixing of BOOT_SPECS is a work-in-progress). No problem, click the "No" button, and you will then be able to manually edit file BOOT_SPECS, just open it in a text editor...

image16

The entries in the BOOT_SPECS file are pretty self-explanatory. The disk-id for the working-partition would be correct if it was in the internal drive, but you would have to set "WKG_PARTNUM" to the partition that the ext4 filesystem was created -- in "take-1" install, that was "6".

For "take-2", the disk-id for the plugged-in SD card is obtained by doing the following. Open a terminal, and run "fdisk -l /dev/mmcblk1" (that is a lower-case letter "l", not a number one!), where "mmcblk0" is the internal SSD in the Mele, and "mmcblk1" is the plugged-in SD-card: 

# fdisk -l /dev/mmcblk1
Disk /dev/mmcblk1: 7.4 GiB, 7948206080 bytes, 15523840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x69522b3b

Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 2048 15521791 15519744 7.4G 83 Linux

...disk-id is "0x69522b3b" and it is partition "1", So, edit BOOT_SPECS appropriately:

BOOT_DISKID='5D7ACA74-4E2C-4584-B8AE-60AFE5C6C0DA'
BOOT_PARTNUM=5
BOOT_FS='vfat'
BOOT_DIR=''
WKG_DISKID='0x69522b3b'
WKG_PARTNUM=1
WKG_FS='ext4'
WKG_DIR=''
INIT_DISTRO_VERSION=0.9.12
INIT_DISTRO_BINARY_COMPAT='oe'
INIT_DISTRO_COMPAT_VERSION='pyro'
INIT_DISTRO_TARGETARCH='amd64'

It's pretty simple, you follow the prompts to close up initrd with updated BOOT_SPECS, and you are good-to-go.

image17

Copy-paste from terminal:
This needs a bit of explanation if you are a Linux newbie. Some terminals do not understand clipboard copy-paste with ctrl-c and ctrl-v. Instead, the middle-mouse button is used to paste any highlighted text. remember this, it works in all Linux apps, and is often more convenient that the clipboard method.
Remember: highlight some text, anywhere, by dragging over it, place the text insertion point, then click middle-button on mouse -- hey presto, pasted!
The specific situation in this tutorial is if you want to copy-paste the disk-id from terminal into the text-editor, to avoid having to type it in.

Do not be afraid, all of the steps of opening up initd, editing BOOT_SPECS, closing up initrd, are straightforward, with prompts at every step.

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

Booting Easy

The installation 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 640MB + 8GB gap that was previously created. Take-2: only a 644MB gap to remove.

Anyway, it is most likely 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:

image11

...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:

image18

...this snapshot is for "take-2", and you can see the orange-dot on mmcblk1p1, which is the working-partition, the plugged-in SD-card. Note, there are a couple of downsides to using an SD-card -- you will have to leave it plugged in, and it is likely to be slower than the internal SSD. Oh, also, SD-cards are less tolerant of power-failure than SSDs.

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:

image13

...this example is for the Author's Mele PCG35 Apo mini-PC. If there were other OSs, they would also be picked up and offered in the menu.

Post-amble

Probably most of the install describe above could be further automated with a nice GUI. The Author might do it one day. There is a certain personal satisfaction though, doing it manually.

The Mele PCG35 Apo has an interface for 2.5inch SATA hard drive or SSD, which would be another really nice way to install Easy. You would follow the instructions as above, no need to create that "gap" in the on-motherboard 32GB SSD, you would just create the fat32 640MB and the ext4 partitions on the SATA drive. 


(c) Copyright Barry Kauler, December 2018, all reproduction rights reserved.
A disclaimer: Barry Kauler has 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, it is recommended that you find a Linux-knowledgeable guy to help.


Tags: install