install booting

This commit is contained in:
Eric Phillips
2025-12-21 14:04:07 -07:00
parent 128bedeb6a
commit 2c08321180
+116
View File
@@ -0,0 +1,116 @@
+++
date = '2025-12-19T22:51:02-07:00'
draft = true
title = 'Lenovo Slim'
tags = ['install', 'guide']
+++
## Getting rid of Windows
Windows is not my favorite and with the new push for fancy pattern matching engines that we call 'ai'I'm even less fond. My old yoga2 pro was getting long in the tooth and Sarah's is not doign well with the increased load from Windows so we got new laptops, Costco had a sale. First things first, how do we get rid of Windows on this Lenovo Ideapad Slim.
- Get into UEFI by holding F2 at poweron
- turn off secure boot, and some other windows only options
- boot into a live usb, I've had great luck with [Ventoy](https://www.ventoy.net/en/doc_start.html)
- Follow the [Arch Linux Install Guide](https://wiki.archlinux.org/title/Installation_guide)
- I deleted all partitions except the EFI and have one encrypted partition with btrfs and several subvolumes. Swap will be in a file.
` partition 1 -> EFI
partition 2 -> LUKS encryption
btrfs:
@ -> /
@home -> /home
@varlog -> /var/log
@paccache -> /var/cache/pacman
@dockerroot -> /var/docker
`
We use [dm-crypt](https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system) to encrypt the partition first, then make the filesystem and subvolumes.
`
crytpsetup -v luksFormat --label *cryptname* /dev/sda2
cryptsetup open /dev/sda2 sdacrypt
`
Create the filesystem and subvols
`
mkfs.btrfs -L realroot /dev/sda2
mount /dev/sda2 /mnt
btrfs subvol create @ # repeat for all desired subvolumes
umount /mnt
`
mount the root subvol, create the mountpoints and mount everything else
`
mount -o rw,noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=@ /dev/sda2 /mnt
mkdir /mnt/boot
mkdir /mnt/home
mkdir -p /mnt/var/log
mkdir -p /mnt/var/cache/pacman
mkdir /var/docker
mount -o rw,noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=@home /dev/sda2 /mnt/home
mount -o rw,noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=@varlog /dev/sda2 /mnt/var/log
mount -o rw,noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=@paccache /dev/sda2 /mnt/var/cache/pacman
mount -o rw,noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=@docker /dev/sda2 /mnt/var/docker
mount /dev/sda1 /mnt/boot
`
install the base system and required packages to boot
`
pacstrap -K /mnt base linux linux-firmware amd-microcode btrfs-progs iwd neovim sudo vi
`
Configure the system and chroot
`
gentfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
ln -sf /usr/share/zoneinfo/America/Denver /etc/location
hwclock --systohc
`
Edit locale.gen and uncomment the US english lines
create locale.conf and add
`
LANG="en_US.UTF-8"
LC_COLLATE="C"
`
- Run locale-gen
- Set the hosname in /etc/hostname
- enable systemd-resolved and systemd-networkd, ln -s the appropriate network example into systemd/network.
I like using a unified kernel instead of a bootloader where possible. With this in mind and the encrypted root we need to edit mkinitcpio.conf and the preset. See [Encrypting the entire filesystem](https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system) for details related to the encryption. See [Unified kernel image](https://wiki.archlinux.org/title/Unified_kernel_image) for details on booting the kernel directly.
Add to the hooks for dealing with encryption to mkinitcpio.conf:
`
HOOKS=(base systemd autodetect microcode modconf kms keyboard sd-vconsole block sd-encrypt filesystems fsck)
`
create a file called crypt.conf in /etc/cmd and add(UUID and cryptname need to match luksDump):
`
rd.luks.name=UUID=root root=/dev/mapper/cryptname
`
create a file called root.conf in /etc/cmd and add(cryptname must match cryptname in crypt.conf):
`
root=/dev/mapper/cryptname rw rootfstype=btrfs rootflags=subvol=@
`
edit /etc/mkinitcpio.d/linux.preset and comment out `PRESET_image` and uncomment `PRESET_uki`. Change the dir part of uki to match the path to the EFI directory ie `/boot/EFI/Linux`. make the Linux dir in the EFI path. Then recreate the image with:
`
mkinitcpio -p linux
`
Set the root password using `passwd` then reboot.