Duel boot Debian and Windows

Debian ,FLOSS
July 17, 2021

Installing a new laptop

‘New’ is a 2nd hand Thinkpad T470p laptop that I intend to duel boot with windows.
I have been a Debian user for over 20 years, I use windows at work for the proprietary EDA ‘Altium’, but I have never had a windows installation on my laptop. This machine will to be different – it is the first laptop that I have owned that has sufficient GPU to realistically run Altium.. I will try it in a VM later (if that works it will be my preferred choice), but for now I want to try a duel boot system.

So where to start?

Step one Debian wiki…

https://wiki.debian.org/DimentionedDualBoot/Windows

My laptop was purchased from a dealer / refurbisher. This means that they had confirmed that the hardware was functional, wiped it down and then installed a ‘clean’ copy of Windows on the whole system. What it doesn’t mean is that the system was set for UEFI boot and that the EFI partition is set correctly….

I turned on UEFI and made sure that Legacy BIOS mode was disabled.

Next I re-installed Windows, making sure to leave enough disk space for may later Debian install. (if you already have UEFI / secure boot enabled then you could skip the reinstall and instead re-size your disk)

Eeew! Windows now wants to show me adverts, it doesn’t give me the option to never show me ads, but at least I could insist that it doesn’t display tailored ads based on the obvious snooping of my web browsing habits – just another reason to use Debian.

Now to install Debian…

I want an encrypted file system, and because I want to dual boot I can’t just follow the guided installation in the Debian installer. So I shall detail what I did here. Indeed I took several attempts at this and eventually asked for help as I had still messed up (I thought I was doing it correctly but had missed out a step)

First the boiler plate DI

  • Download your prefered Debian installation media (I am using Bullseye AMD64 netinst beta), and drop this directly onto a USB memory stick (dd)
  • Put the USB stick in the laptop and select this as the boot device (on my thinkpad the boot device menu is F12)
  • I chose the graphical installation option, but only because it was less key strokes to select
  • Select your prefered Locale
    • UI language (English)
    • Enter your location (United Kingdom)
    • …and keyboard layout (British English)
  • Next DI comes up with a whole host of missing firmware for the detected WiFi – I can safely ignore this as I have a network cable plugged in (select No). If I want to enable WiFi I could choose to add media with the firmware at this stage or add it later.
    • I have a network cable plugged in and DI finds and configures my network setup (IPv6 and v4 with DHCP)
  • I enter a hostname (I chose to name my machines after lizards – this will be called skink)
  • I am asked for a domain name (I have koipond.org.uk configured)
  • You are then asked for some account details
    • I do not enter a root password as I want the root account login disabled
    • But I do provide my details for a user account

Now for the interesting bit – Partitioning the disk(s)

Select MANUAL disk partitioning…

I have the following partitions:

/dev/nvmen0p1
1.0MB FREE SPACE
#1 536.9 MB B K ESP
400.0 GB FREE SPACE
#3 16.8 MB Microsoft reserved partition
#4 111.6 GB ntfs Basic data partition
335.4 kB FREE SPACE

  • Create an partition for /boot
    • Select the 400GB free space
    • Create a new partition
    • Enter enough space of /boot (>100MB I select 500 MB)
    • place this at the beginning of the disk
    • Name it (boot)
    • Use as ext2 – we don’t want journaling here
    • Mount point – /boot
  • Set up encrypted volumes
    • We need to write the new partition table to disk before we can continue
    • Create encrypted volumes
      • select the large remaining area of free space
      • name it (skink)
      • write disk configuration
      • finish
      • let the system overwrite the partition with random
      • enter a passphrase for the disk
  • Set up LVM (inside the encrypted volume)
    • Select Configure Logical Volume Manager
    • Write changes to disk (we do this a lot)
    • Create volume group
      • Give it a name (VG-Skink)
      • Select the encrypted partition
    • Create logical volume (swap)
      • Select the volume group to use (VG-Skink)
      • Enter a name (LV-Swap)
      • Enter size of swap (32G)
    • Create logical volume (system)
      • Select the volume group to use (VG-Skink)
      • Enter a name (LV-System)
      • Enter size of swap (remaining space)
    • Finish

Set use

  • Select your LVM VG for swap
    • Use as: Swap area
    • Done Setting up partition
  • Select your LVM VG for system
    • Use as: Ext4 journaling file system
    • Mount point: / – the root filing system
    • Mount options: I select ‘discard’ (trim function as this makes a considerable improvement to the disk performance and life)

I now have the following partitions:

LVM VG VG-Skink
#1 32 GB f swap swap
LVM VG VG-System
#1 367.5 GB f ext4 /
Encrypted volume
#1 399.5 GB K lvm
/dev/nvmen0p1
1.0MB FREE SPACE
#1 536.9 MB B K ESP
#2 500.2 MB F ext2 /boot
#5 399.2 GB K crypto skink
#3 16.8 MB Microsoft reserved partition
#4 111.6 GB ntfs Basic data partition
335.4 kB FREE SPACE

  • Finish partitioning and write changes to disk
    • Write the changes to disk

Boiler plate debian install continues

The system will install a base system

  • Configure package manager – Select nearest mirror (I run a local mirror so select enter information manually)
  • Yes I do want to take part in “popcon” (Debian uses this as a guide to how many instances of each package are installed – I select this for anything other than test installs)
  • Software Selection
    • I will have a desktop environment and I currently use KDE
    • I would like an ssh server to be installed
    • I want the standard system utilities

Sit back and wait a for the system to install…

Well that didn’t take very long – Damn this new laptop is quick. I suspect that is nvme solid state storage, no longer limited to SATA bus speeds (and even that wasn’t slow)