site  news  contact

Install to PC with existing rEFind boot manager

March 17, 2019 — BarryK

The main install-to-hard-drive page is here, with links to to alternative install scenarios:

https://easyos.org/install/how-to-install-easyos-on-your-hard-drive.html

This page is one of those scenarios...

This is a tutorial to install EasyOS on a PC with UEFI-firmware, which already has rEFind boot manager installed.

Here is the scenario for this page:

The case study is the Author's mid-tower PC, which has Intel i5 CPU, 16GB RAM, 1TB and 4TB rotating-platter hard-drives, and one 500GB SSD.
The 1TB HD has sda1 to sda9 partitions, with sda1 a fat32 ESP partition with rEFind boot manager. The PC does not have Windows, it has various Linux distributions.

There is one strong recommendation, that you bootup EasyOS from a USB-stick to perform this installation. It can be done while running some other Linux distribution, however it is more tedious. Highlighting this recommendation:

Please boot EasyOS from USB-stick to do this installation to internal hard drive 

Good, let's get going...

The situation before installing Easy

The installed Linux distributions are all conventional "full" installations. For the record, this is what is in the partitions of sda:

sda1  ESP fat32
sda2  Quirky Pyro 0.6.2
sda3  Quirky Xerus 8.3
sda5  Quirky Xerus 8.6
sda7  file storage
sda7  swap
sda8  Slackware 14.2
sda9  unused

The Author installed rEFind to sda1 simply by copying the "EFI" folder from one of the EasyOS USB-sticks, to sda1, and then editing the entries in EFI/BOOT/refind.conf appropriately.

All of those installations are full installs, and an entry in refind.conf looks like this:

menuentry "Slackware64 14.2 (sda8)" {
loader /vmlinuz-slackware-4.4.14
ostype Linux
options "root=PARTUUID=64685683-08 rootwait rw"
}

...where "64685683" is the disk-identifier of sda, and the "-08" means partition number 8. Well, as "sda8" is not going to change, could have put "root=/dev/sda8".

The kernels for all of these installations are in the ESP, that is, the fat32 partition that has its "esp" flag set, thus recognised as a boot partition by the UEFI. So, this is what is in sda1:

img1

These are full-installs, but EasyOS requires a "frugal" install, and the boot-partition is required to have three files, vmlinuz, initrd and easy.sfs. These files must be together, and they total about 410MB. Hmmm... if sda1 is big enough, which it so happens it is in this case, then could do this:

img2

The Author had created sda1 nice and big, 640MB, however, most people are not going to have such a generously-sized ESP.

So, scrub that. Fortunately, eEFind does allow vmlinuz and initrd to be in a different partition...

Installing Easy to a ext4 partition

sda9 is ext4, 64GB, currently unused, a good place to install Easy. Easy requires a "boot partition" and a "working partition", but they can be the same partition. So, let them both be sda9.

Installation is simple, just copy those three files vmlinuz, initrd and easy.sfs, from USB-stick or extracted from the downloaded *.img.gz file, to sda9.

Then, an entry can be inserted into EFI/BOOT/refind.conf in sda1, and you are good-to-go. Well, almost, there are two more things to do, and one huge caveat. Let's itemize the steps...

Step 1: edit refind.conf

Here is an entry that can be put into refind.conf:

menuentry "EasyOS (frugal install sda9)" {
volume intern1p9
loader /vmlinuz
initrd /initrd
options "rw"
}

Where "intern1p9" is the label of sda9. The "volume" command tells rEFind to look in the partition with label "intern1p9", and the path, in this case "/vmlinuz" and "/initrd" is from the root of sda9.

Step 2: ext4 driver 

Simple enough, however, eEFind requires that an ext4 driver be installed, and in a certain location that it will be auto-loaded. Here it is:

img3

You will need to acquire that driver from somewhere. If running Easy 1.0.15+ on a USB-stick right now, you will find the eEFind drivers at /usr/share/refind/drivers_x64. Or, there is a PET package here:

http://distro.ibiblio.org/easyos/amd64/packages/pet/pet_packages-pyro/refind-drivers-20171008-p20180531-amd64.pet

...if running a Linux distro that does not understand PET packages, they are just tarballs with a checksum appended, so you can run "tar -xf <name of pet>" to open it.

Step 3: "fix" initrd 

File initrd has inside it a file named BOOT_SPECS, that tells the boot-scripts where Easy is installed. If you are running easy right now, booted off a USB-stick, great, just click on initrd, and it will be automatically fixed.

If running some other Linux distro, you will have to manually open up initrd and edit BOOT_SPECS. This manual editing is explained at the bottom of this page:

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

Step 4: Step-2 is broken! 

Unfortunately, at the time of writing, rEFind has a serious bug, it cannot recognize a ext4 partition if it's "encrypt" flag is set. This flag is set on a partition by doing this:

# tune2fs -O encrypt /dev/sd9

This does not encrypt anything, what it does is turn on the ability of ext4 to support per-folder encryption. This means that you can choose any folders in the partition to be encrypted, all others are un-encrypted.

It is very highly recommended to do this, as Easy will take advantage of it to offer improved security. At first bootup, Easy will detect that the "encrypt" flag is set, and will ask for a password and create encrypted folders. This is really great per-chance that your PC is stolen.

The huge caveat is that as soon as you turn on the "encrypt" flag, eEFind can no longer see that partition. The Author has reported this to the rEFind developers:

https://sourceforge.net/p/refind/discussion/general/thread/6cfc10d3c2/

...so, hopefully it will be fixed soon.

As it is currently not fixed, and we really do want that extra security, what to do?

Installing Easy to two partitions

The solution is easy enough, just choose any non-encrypted partition as the boot-partition.

The Author decided to break sda9 into two partitions, a 640MB fat32 sda9, and 63.4GB ext4 sda10. Itemizing the steps:

Step 1: Install to boot-partition

Then, installation just requires copying vmlinuz, initrd and easy.sfs to sda9:

img4

Then, click on initrd to "fix" it...

img5

...yep, Easy automatically figured out that we will be using sda10 as the working-partition.

Step 2: Secure the working-partition

Highly recommended, run this is a terminal:

# tune2fs -O encrypt /dev/sda10

Where that "-O" is capital-letter, not a zero. This is a one-way operation, you can't turn it off. Also, it needs to be done now, before booting Easy, as encryption can only be applied to empty folders.

Step 3: Setup rEFind

As the boot-partition is fat32, no need to install a driver. The only thing to do is edit file EFI/BOOT/refind.conf in sda1:

menuentry "EasyOS (frugal install sda9, sda10)" {
volume intern1p9
loader /vmlinuz
initrd /initrd
options "rw"
submenuentry "Filesystem check" {
add_options "qfix=fsck"
}
submenuentry "Commandline only, do not start X" {
add_options "qfix=nox"
}
submenuentry "Rollback to last saved session" {
add_options "qfix=bak"
}
submenuentry "Rollback to pristine first-bootup" {
add_options "qfix=new"
}
}

That's it, fully installed, ready to boot!

Testing the installation

All that remains is to reboot, and EasyOS will be in the eEFind boot menu...

img6

And she boots to the desktop... yay!


(c) Copyright Barry Kauler, March 2019, 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