Skip to content

Instantly share code, notes, and snippets.

@absolutejam
Last active June 13, 2018 22:01
Show Gist options
  • Save absolutejam/5cbbef05975de588cd8954eea8e52985 to your computer and use it in GitHub Desktop.
Save absolutejam/5cbbef05975de588cd8954eea8e52985 to your computer and use it in GitHub Desktop.
disk partitions

Next step, Arch

WiFi

  • Unblock WiFi permanently systemctl enable rfkill-unblock@all && systemctl start rfkill-unblock@all
  • Connect to WiFi using wifi-menu as it creates a persistent profile - wifi-menu
    • I always rename them from wlp1s0-<ssid> to wifi-<ssid> (And replace spaces with _)
  • Then start your profile netctl start <profile>
    • netctl list if you've forgotten it already
    • netctl enable <profile> for it to autostart
  • Update pacman databases pacman -Sy
  • Install the essentials pacman -S vim sudo

User, etc.

  • Create user useradd -m james
  • Set password passwd james
  • Add user to sudoers
export EDitor=vim
visudo
  • Uncomment the line
%wheel ALL=(ALL) ALL
  • Add user to wheel group usermod -aG wheel james
  • logout and log in as new user. Test sudo.
  • Time to begin the fun stuff.

Installing packer (AUR helper)

Taken directly from here

  • Install dependencies
sudo pacman -S base-devel fakeroot jshon expac git wget
# just hit enter to accept 'all'
  • Do these steps in a temp folder mkdir /tmp/packer && cd /tmp/packer
  • Get the PKGBUILD wget https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=packer
  • Rename the file to PKGBUILD mv PKGBUILD\?h\=packer PKGBUILD
  • Build it! makepkg
  • Install it! sudo pacman -U packer-*.pkg.tar.xz
  • Time to install dangerous software from the AUR! 😉

Installing the WM

Okay, now I'm going to install openbox. This could easily be , but this example is using openbox.

  • Install xorg-server xinit-xinit xorg-xrandr xorg-xinput
  • Install python python2 python-oip python2-pip
  • Install openbox pacman -S openbox
  • Install xdg packages sudo pacman -S xdg-utils xdg-user-dirs

Plan

476.94GiB SSD

LVL   USAGE           MOUNT             SIZE         FMT               INFO
=================================================================================================================================
      EFI partition   /boot/efi         1GiB         FAT32 (EFI)       From all other partitions
      GRUB2           /boot             1GiB         EXT4  (BIOSGRUB)  Bootloader (Is this correct?)
      Free space      Free space        4GiB 
      LUKS volume                       470.934GiB   LUKS
.     LVM Physical Volume                            LVM FEATURE
..    LVM Volume Group: luksvg                       LVM FEATURE
...   root            /                 100GiB       EXT4              Kubuntu - My workhorse & fallback 
 ...   root            /                 100GiB       EXT4              Arch - Ricing/toy distro
...   root            /                 70GiB        EXT4              Misc - Testing other distros, etc.
...   data            /home/user/data   200GiB       EXT4              Shared data - For all distros to use

Steps

  • Nuke partition table and create new with GPT scheme
  • Create EFI partition, GRUB partition and LUKS partition (as any old filesystem), remembering to leave space before it
  • Run cryptsetup luksFormat /dev/sda3 to convert the LUKS partition to a... LUKS partition
  • Open the luks volume cryptsetup open --type luks /dev/sda3 luks
    • The last luks being the name it will be referred to while open
  • Create the physical volume pvcreate /dev/mapper/luks
  • Create the volume group vgcreate luksvg /dev/mapper/luks
  • Run vgdisplay because to check
  • Create the volumes
    • Kubuntu - lvcreate -L 100G luksvg -n kubuntu-root
    • Arch - lvcreate -L 100G luksvg -n arch-root
    • Misc - lvcreate -L 70G luksvg -n misc-root
    • Data - lvcreate -L 200G luksvg -n data
      • Note: If you view the LVs, you may notice that they've not in the order created. They seem to be ordered alphabetically.
  • Install operating systems! (More to come)

Install Kubuntu (Live CD)

  • Connect WiFi, fix date/time
  • Mount the LUKS volume cryptsetup luksOpen /dev/sda3 luks (Where luks is just what we'll refer to it as)
  • Run the installer, and when choosing drives:
    • Choose /dev/sda1 as the EFI System Partition (aka. ESP)
    • Choose the boot loader location as /dev/sda2 (This aint no MBR disk)
      • This will do the needful and make /dev/sda2 the /boot partition, and /dev/sda1 /boot/efi
    • Choose the correct LV (kubuntu-root) and format as EXT4, mapped to /
  • Now, rebooting will not work! This is because we manually set up LUKS. So don't bother.

Grub and LUKS

So I had a bit of a fun time figuring this one out. And by that, I mean finding the right forum posts - https://askubuntu.com/questions/733488/lvm-luks-manual-partitioned-but-issues-with-loader-init-grub/893906#893906 & https://askubuntu.com/questions/733488/lvm-luks-manual-partitioned-but-issues-with-loader-init-grub/893906#893906

First of all, while still in the Kubuntu live boot environment, we want mount all of the appropriate partitions to chroot into.

  • The LUKS volume should still be open (cryptsetup luksOpen /dev/sda3 luks)
  • Mount the Kubuntu volume mount /dev/mapper/luksvg-kubuntu--root /mnt
  • Mount the boot volume mount /dev/sda2 /mnt/boot
  • Mount the efi volume mount /dev/sda1 /mnt/boot/efi
  • Now, mount parts of the live system into this for a chroot
    • sudo mount --bind /dev /mnt/dev
    • sudo mount --bind /run/lvm /mnt/run/lvm
  • Chroot into the system chroot /mnt
  • Mount some more from the live boot environment
    • mount -t proc proc /proc
    • mount -t sysfs sys /sys
    • mount -t devpts devpts /
  • Now we create the /etc/crypttab file. Like fstab only for cryptsetup!
  • Get the LUKS volume UUID (/dev/sda3) - lsblk
  • Create the crypttab with the following contents, replacing the UUID= value,
luks UUID=000-000-000-000 none luks,discard
  • Edit /etc/default/grub and add the line
GRUB_ENABLE_CRYPTODISK=y
  • Rebuild boot files update-initramfs -k all -c
  • Update grub grub-mkconfig -o /boot/grub/grub.cfg
  • Install updated grub configs onto /dev/sda2 - grub-install /dev/sda1
  • Reboot and cross your fingers

Arch

For highdpi: First off, when the boot menu appears, hit e and add in video=1600x900 (Or whatever is appropriate)

I'm going to do this over WiFi because I don't like to have an easy life.

  • Unblock the WiFi adapter
    • rfkill list
    • rfkill unblock x where x is each entry required for the adapter
  • Get the wifi adapter ip addr
  • Mine is simply wlp1s0. Let's get it up 😉
ip link set wlp1s0 up
wpa_supplicant -B -D wext -i wlp1s0 -c <(wpa_passphrase "SSID" "pre-shared key"))
dhcpd wlp1s0
  • And we should be connected and have an IP address!

Now, follow the arch install guide but do not format any disks, and read until Mount the filesystems.

Okay, now we mount the filesystems.

  • cryptsetup luksOpen /dev/sda3 luks

  • Mount the (blank) Arch volume mount /dev/mapper/luksvg-arch--root /mnt

  • mkdir /mnt/boot

  • Mount the boot volume mount /dev/sda2 /mnt/boot

  • Mount the efi volume mount /dev/sda1 /mnt/boot/efi

  • Now, back to the Arch guide! Set it all up, do the chrooting and get to the end. Don't reboot yet!

  • Also, we need to install wpa_supplicant (and optionally dialog for netctl's wifi-menu) to the 'real' partition since we're already connected on the live image.

  • pacman --root /mnt -S wpa_supplicant dialog

Getting Arch to boot (This bit is gross)

  • So, to allow Arch to boot, we need to add some mkinitcpio hooks
  • Edit /etc/mkinitcpio.conf
  • Go to HOOKS and replace the line with HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt lvm2 filesystems fsck)
  • Then generate the initramfs images with mkinitcpio -p linux
    • Don't worry, the initram/linuz images are named differently from Ubuntu images so there's no clash

Next is getting Arch onto the Grub menu. At this point I rebooted into Kubuntu and went about adding Arch by using update-grub to auto-detect it. This is where it all went badly for me.

For some reason, Grub change my default Kubuntu linuz/initramfs images to the Arch one and my automatically added Arch entries...using the Kubuntu partition 🤷

At this point, I manually edited /boot/grub/grub.cfg and backed it up. This is not advised as it will be overwritten upon kernel upgrades, etc. but I'm going to revisit this later and look at editing the Grub scripts.

NOTE: I have chosen to manage Grub purely from Kubuntu to avoid any config clashes.

TODO: Add info about these

  • Change resolution in Grub & in Grub command line (For Linux TTY)
  • Try wifi-menu
  • wifi-menu is a curses interface which saves the config to /etc/netctl
  • Couldn't get it to start after that using netctl :sad:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment