Lenovo Ideapad 5 Install Woes

So update/new information with this systemd-nspawn. I got my laptop on Friday and I have yet to get a successful Fedora boot ūüôĀ There are 2 hurdles that I’ve imposed upon¬†myself that I think are making it worse.

1) I want to use XBOOTLDR so that means the .iso installer is not gonna work
2) I want to have most of my partitions on an LVM filesystem

The XBOOTLDR¬†is having a minor issue that when I click the power button and just let the laptop boot, it will only see entries on the esp. But if I spam F12 and select the “Linux Boot Manager” It works just fine. I am suspecting it is some sort of fast boot mechanism¬†that only reads the esp on bootup, but I have found no setting that lets me disable this fast boot in my bios or the crazy lenovo tool. I am interested in writing a github issue and see what kind of answers I could get, but I fear it’s more hardware specific.

I can’t get the system to boot because of LVM. When I boot Fedora it actually seems to work fine initiating the kernel and starting things up, but it hangs on mounting the root filesystem. Any time I use systemd-nspawn -bD /fedora I cannot see the LVM volumes. If i just use chroot /fedora it works fine but I think that’s¬†because it’s simply¬†changing the root and my USB can read the LVM fine, not booting a whole containerized¬†environment. If I do some funny bind mounts it works, but that seems like cheating and only fixes it for that usb instance.

I think the issue is the initramfs. It’s only goal is to mount the root filesystem. The kernel and initramfs are loaded into memory by the boot loader and the kernel uses initramfs to mount the file systemd and run the program /init. So with this knowledge it makes sense why nothing is working, my initramfs is not reading the LVM volume thus never mounting /root. So I’ve been spending time reading about the different ways this little¬†compressed file is created. Red Hat and SUSE use a program called dracut, Arch, the only other one I’m really¬†familiar with, is actually just a shell script from the Arch community. I’ve tried running the basic google commands for dracut but realised I have to point to a kernel to actually¬†make it work, after stopping my last attempt >.>

I just think this is all quite fun to think about. I think about how Linus Torvalds once said he doesn’t use debian because he found it hard to install. Or how Richard Stallmen doesn’t¬†typically install his operating systems because that’s not his expertise. He will just go to a local users group meeting and have someone install it for him there. I think it’s quite a good skill to be able¬†to masterfully install a linux box. Linux is all about choice, so it’s funny that we are all ok with these automated installers doing things you may not want to do on your system.

It’s really blurring¬†the lines of what a distro is to me, It’s just a social construct of what packages you get and from where. I’m coming to love the idea of Fedora. It’s basically 99% free software, with the 1% being proprietary¬†blobs. It’s based on what the enterprise uses, not to mention it’s what Linus and Poettering use. It’s also very bleeding edge even though it¬†uses a 6 month version release.

Here’s hoping I can actually start using Linux on this machine soon. It’s kinda half the reason I bought the damn thing.

Linux Multi Boot with Systemd-boot

I’ve been working on a new project with my newfound systemd knowledge.I want to have as many distro’s installed at once while using systemd boot.Ubuntu, Debian, and Fedora use grub by default but it’s linux right? It’s all about choice.

So I have a EFI enabled Hyper-V to play with and it’s¬†a 64 HDD cut up like this:

sda1 100M EFI
sda2 1G Linux Extended Boot
sda3 4G Linux Swap
sda4 15G Linux root(x86-64)
sda5 15G Linux File System
sda6 15G Linux File System
sda7 13.9G Linux Home

I install arch linux with systemd-boot per usual and get a booting system off sda4
I then mount /dev/sda5 to /var/lib/machines/ubuntuand install:

pacman -S debootstrap ubuntu-keyring

this lets me run:

debootstrap --include=systemd-container --components=main,multiverse,universe focal /var/lib/machines/ubuntu http://archive.ubuntu.com/ubuntu

Which will install a base Ubuntu 20.04 filesystem to the other partition. I can actually run a whole container instance with systemd and this partition.

systemd-nspawn -b -D /var/lib/machines/ubuntu

Systemd has a whole management suite with machinectl

machinectl status ubuntu

The problem I’ve run into is when I make a container like this I cannot mount the file system. Or at least not as easily. What I¬†end up doing is copying any files from /dev/sda5 to the other partition¬†while the container is not running.

But! when I am in the ubuntu container I can run:

apt install linux-image grub-pc-

That will give me the ubuntu kernel and initramfs without installing grub.
I copy the kernel related files to the systemd XBOOTLDR partition and write a boot config file and BOOM it actually lets me boot both arch and ubuntu from the bootloader and it will use the right HDD partition.

I have more to do to actually get it working nice, and fedora will probably be its own undertaking but I’m really excited about it! Learning a lot about how linux actually boots, it’s no longer really “Black Magic” anymore. Basically any package manager has an “install root” function so it’s really knowing how to use each of them.

XBOOTLDR systemd-boot 242

The following is a copy/paste of a Reddit post I made to r/archlinux a month ago. I was doing an install of arch and upon reviewing of the systemd-boot wiki page I saw that it stated that it was out of date. I was doing a bunch of reading on the topic and decided to try and reach out to the community to see what input they had.

Replies were next to none (except the 1 guy that said the wiki was correct as if he didn’t even read my post/look at the page for himself) but I had found the solution to my problem.

So below is an even shorter version of the Reddit thread that gives the step by step notes I would use to install arch with XBOOTLDR.

More reading about this can be found on Systemd’s website

**Using XBOOTLDR:**

create a separate partition of at least 250Mib labeled "Linux extended boot" (guid of bc13c2ff-59e6-4262-a352-b275fd6f7172) now referred to as $BOOT

Format $BOOT to fat32:
mkfs.vfat -F 32 $BOOT

mount the ESP to /mnt/efi and the $BOOT to /mnt/boot

install with pacstrap per usual

in chroot use the command: (not sure it is needed as bootctl looks for this by default but good to specify)

bootctl --esp-path=/efi --boot-path=/boot install

edit /efi/loader/loader.conf to say:

"default arch
timeout 3"

edit /boot/loader/entries/arch.conf to:

"title Arch_Linux_extendedboot
linux /vmlinuz-linux
initrd /initramfs-linux.img
initrd /initramfs-linux-fallback.img
options root=/dev/sdX"

reboot and enjoy

See the next page for the original Reddit post: