site  contact  subhomenews

Frugal install to mid-tower PC with shared ESP

March 15, 2019 — BarryK

I have just now installed Easy 1.0.14 on my mid-tower PC. The previous owner built this with various parts. A HP motherboard with UEFI-firmware, i5 CPU, 16GB RAM, 1TB hard drive, and I have since added a 4TB hard drive and a 500GB SSD. No Windows.

sda has these partitions:

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
sda10 unused

sda1 has reFind, which was accomplished simply by copying the "EFI" folder from one of the EasyOS USB-sticks, and edit 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.

The kernels for all of these installations has to be 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

That is OK for full installations, but Easy requires a frugal install, and the three files vmlinuz, easy.sfs and initrd must all be in the boot-partition.

I could create another ESP partition, however, to share the existing one, it will have to be big enough to hold all three of those files. Well, I had anticipated this, so sda1 is 640MB.

If your PC has a smaller ESP, then you won't be able to do this. If anyone knows a clever way around this, let me know. Probably the init script in the initrd could be hacked to find easy.sfs somewhere else.

I installed the three files, got them off the USB-stick:

img2

The usual next step: click on initrd to fix BOOT_SPECS. In this case, it could not be auto-fixed, as Easy did not know where the working-partition is, so BOOT_SPECS had to be edited manually:

BOOT_UUID='698C-C460'
BOOT_DIR='easy/'
WKG_UUID='dfe45104-fbb1-4216-81f8-847ad601f9a1'
WKG_DIR='easy/'

I found out the UUID like this:

# blkid /dev/sda9
/dev/sda9: LABEL="intern9" UUID="dfe45104-fbb1-4216-81f8-847ad601f9a1" TYPE="ext4"

The WKG_UUID is sda9, which I chose because currently not being used for anything. There is one extra thing to do, if want the security of encrypted folders:

# tune2fs -O encrypt /dev/sda9

The only thing left to do is insert an entry into EFI/BOOT/refind.conf:

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

That's it, done. Rebooted, and running it now. Notice that I did not put the version number into "menuentry" title. This is because I intend to upgrade this installation, and keep history of past versions. So, really, it will be multi-version. 

I want to use this installation as a test-bed, that upgrade/downgrade, rollback/roll-forward works over many versions. 

EDIT 20190315:

Well, well, I didn't know that this can be done:

https://bbs.archlinux.org/viewtopic.php?id=171994

That changes everything! OK, I will redo the installation, with those three files not in the ESP. This is great news! 

EDIT 20190316:

Aaaaargh! Last night I spent hours trying to figure out why rEFind wasn't working. As per the above link, "volume <label>" can be used to specify another partition where vmlinuz and initrd are located. So, I did a frugal install to sda9, boot-partition and working-partition both sda9, and it didn't work.

Yes, a refind ext4 driver is required, had that. Eventually discovered that rEFind does not recognize ext4 partitions in which the "encrypt" flag is set. I had run this:

# tune2fs -O encrypt /dev/sda9

...this does not encrypt anything, just enables the capability of per-folder encryption, and the partition is mountable and usable as before. Except that rEFind no longer sees it.

Took a few hours before the penny dropped. The solution is to have any other partition for the boot-partition. I created a fat32 640MB partition for that purpose -- not an ESP, just a normal partition. Yep, success.

I plan to write a tutorial on this. 

Tags: easy