This is the build script and notes for my Lenovo T490 laptop.
Laptop will start from factory with preinstalled Windows 10 Pro + bloatware. Reimage then setup dual booting.
Download a copy of Windows 10 Pro from Microsoft
Create bootable USB stick using instructions on Microsoft website.
Disable fast boot in preinstalled windows.
Go to Settings -> System -> Power & Sleep -> Additional Power Settings -> Choose What Power Buttons Do -> Change settings that are currently unavailable
Uncheck “Turn on Fast Startup”. This prevents skipping the BIOS screen.
Verify BIOS is set to allow booting from USB sticks. Also verify that BIOS is only set to UEFI mode
Make sure laptop does not have an internet connection. This allows for the creation of a local user account without a Microsoft account.
Insert USB stick and boot. Hit enter to interrupt startup, then select USB stick as boot drive.
Start windows install process. Select Language, Time and Keyboard options then press next.
Click Install Now.
Accept Terms and Conditions
Select Custom: Install Windows Only.
Wipe out all existing partitions on the main SSD, then create the following:
Leave the remaining space unpartitioned. This will be partitioned during the linux install.
These will both be NTFS. Windowe will create additional partitions at the beginning of the partition list for recovery ETC.
Select the 120GB partiton to install windows on.
Wait for several reboots
Select Customize Settings option on Express Settings Prompt.
Turn off all Privacy and tracking options
When prompted to create an account, click join a Domain and follow prompts to create a local account.
After setup is finished, uninstall all apps that can be uninstalled, and clean up the start menu.
Install Lenovo Vantage from Lenovo’s website and make sure BIOS and drivers are installed and up to date. (Especially important for Thunderbolt devices)
Install rEFInd boot manager. These steps are shamelessly reappropriated and modified from https://rodsbooks.com/refind/installing.html#windows
Download rEFInd as a binary ZIP file from reputable sources, currently: https://rodsbooks.com/refind/getting.html
Unzip the file in a place you can find it. Usually Desktop or Downloads is best.
Open an Administrator Command Prompt.
Type mountvol S: /S
in the Administrator Command Prompt window. This makes the ESP accessible as drive S: from that window. (You can use a drive identifier other than S: if you like.)
Use CD
command to change into the main rEFInd package directory, so that the refind subdirectory is visible when you type dir.
Type xcopy /E refind S:\EFI\refind\
to copy the refind directory tree to the ESP’s EFI directory. If you omit the trailing backslash from this command, xcopy will ask if you want to create the refind directory. Tell it to do so.
Type S:
to change to the ESP. (This changes which drive is active in Command Prompt)
Type cd EFI\refind
to change into the refind subdirectory.
Delete the drivers_ia32
, refind_ia32.efi
, tools_ia32
, drivers_aa64
, refind_aa64.efi
and tools_aa64
files and directories using the DEL
command. Unnecessary drivers will slow the rEFInd start process.
Type rename refind.conf-sample refind.conf
to rename rEFInd’s configuration file.
Type bcdedit /set "{bootmgr}" path \EFI\refind\refind_x64.efi
to set rEFInd as the default EFI boot program. Note that “{bootmgr}” is entered as such, including both the quotes and braces ({}).
Type bcdedit /set "{bootmgr}" description "rEFInd description"
to set a description (change rEFInd description as you see fit).
Now, when the laptop is rebooted, rEFInd should present itself with an option to boot into windows 10.
Download a copy of void-live-x86_64-date.iso
from reputable sources, currently: https://alpha.de.repo.voidlinux.org/live/current/.
Create bootable USB stick using dd
or whatever windows tool is the popular thing and preferably doesn’t use electron.
Login to live environment as root
with password voidlinux
.
Verify system is booted in UEFI mode by verifying the presence of the /sys/firmware/efi/
directory.
run void-installer
to start the installation wizard.
Specify the us
keymap.
Select DHCP.
Select install from network.
Set hostname to the-machine
.
Set Locale to en_US.UTF-8
.
Set timezone to local timezone.
Set root password to the one stored in password database.
Set up normal user account based on password database.
Select none
for bootloader since rEFInd was installed earlier.
Create an Linux filesystem
partition out of the remaining space on disk and write the partition map to disk. Make note of the partition names and filesystems for the next step.
Proceed through all partitions and set mount points as follows:
Do not set mount points for the Windows recovery partion
, or the Microsoft reserved
partition.
Set the EFI System
partition filesystem to vfat
and the mount point to /boot/efi
.
Set the 500GB Microsoft basic data
partition to filesystem ntfs
and mountpoint /mnt/passthrough
.
Set the ~1.3TB Linux filesystem
partition to filesystem ext4
and mountpoint /
.
Review settings and install. This will take a while.
Reboot and select Void Linux at rEFInd prompt.
Login to newly installed Void Linux using root account and password found in password database. This is due to the fact that we haven’t configured sudo yet.
Configure sudo
to allow full access to members of wheel
group. Run visudo
and uncomment the line
#%wheel ALL=(ALL) ALL
Enable NTP and DHCP services
ln -s /etc/sv/ntpd /var/service
ln -s /etc/sv/dhcpcd /var/service
Create passthrough
folder under /mnt/
to allow passthrough partition to mount correctly.
Update system by running command xbps-install -Svu
until it shows no updates.
Install ntfs driver.
xbps-install ntfs-3g
Reboot system and login as normal user.
Enable trim on SSD by editing /etc/fstab
and adding ,discard
after the defaults line on the /
and /mnt/passthrough
mountpoints.
Install and remove the following packages. Want to use simpler NTP implementation.
sudo xbps-install nano openntpd rng-tools thefuck vim htop socklog
sudo xbps-remove chrony
Install commonly used applications.
sudo xbps-install firefox freecad git glow kicad lynx netcat p7zip powertop
rsync tmux unzip wget zip
Setup system logging using socklog
sudo xbps-install socklog-void
# enable services
sudo ln -s /etc/sv/socklog-unix/ /var/service
sudo ln -s /etc/sv/nanoklogd/ /var/service
# add user to log group
sudo usermod -a -G socklog $USER
# log out and log back in
Create projects directory tree in ~
as follows:
mkdir -p ~/projects/src/github.com/sww1235
This mirrors the structure of how golang wants to set things up.
Clone dotfiles repo from GitHub and install vim and bash files using install.sh
script.
Set up ssh-agent using user specific services. Instructions taken from https://www.daveeddy.com/2018/09/15/using-void-linux-as-my-daily-driver/
Create user specific service directory:
sudo mkdir /etc/sv/runit-user-toxicsauce
Create run script for user specific service by adding the following into /etc/sv/runit-user-toxicsauce/run
#!/bin/sh
exec 2>&1
exec chpst -u toxicsauce:toxicsauce runsvdir /home/toxicsauce/runit/service
Mark it as executable:
sudo chmod +x /etc/sv/runit-user-toxicsauce/run
Create necessary user specific service directories:
mkdir ~/runit
mkdir ~/runit/sv
mkdir ~/runit/service
Start this service of services with:
sudo ln -s /etc/sv/runit-user-toxicsauce /var/service
Now set up ssh-agent
service:
mkdir ~/runit/sv/ssh-agent
Create run script for ssh-agent
service by adding the following into ~/runit/sv/ssh-agent/run
.
#!/usr/bin/env bash
#
# Start ssh-agent from runit
file=~/.ssh/ssh-agent-env
exec > "$file"
echo "# started $(date)"
# For some reason, this line doesn't get emitted by ssh-agent when it is run
# with -d or -D. Since we are starting the program with exec we already know
# the pid ahead of time though so we can create this line manually
echo "SSH_AGENT_PID=$$; export SSH_AGENT_PID"
exec ssh-agent -D
Mark run file as executable with:
chmod +x ~/runit/sv/ssh-agent/run
Now start the service with:
ln -s ~/runit/sv/ssh-agent ~/runit/service
Clone projects from github into Projects tree as desired.
Set up void-packages per the instructions in this wiki.
Make sure build-branch-the-machine
in my fork of void-packages
is checked out, and up to date with desired patches. See the suckless page for more info.
Build binary packages of dwm
, dmenu
, st
and slstatus
as follows:
cd ~/Projects/src/github.com/sww1235/void-packages
./xbps-src pkg dwm
./xbps-src pkg dmenu
./xbps-src pkg st
./xbps-src pkg slstatus
Install dwm
, dmenu
, st
and slstatus
with the command:
sudo xbps-install --repository=hostdir/binpkgs/build-branch-the-machine \
dwm dmenu st slstatus
Modify ~/.xinitrc to contain the following:
slstatus &
exec dwm
Install tlp
for power management:
sudo xbps-install tlp
sudo ln -s /etc/sv/tlp /var/service
Setup CUPS for printing:
Install and enable the service:
sudo xbps-install cups
sudo ln -s /etc/sv/cupsd/ /var/service
Edit /etc/cups/cupsd.conf, find line that starts with <Limit CUPS-Add-Modify-Printer
and add toxicsauce
after @SYSTEM
Restart cupsd
service
go to http://localhost:631/ to configure
Need to set up bumblebee/optimus for graphics, set up dropbox and 1password cli client.
install alsa-utils to get audio working
build-script, void-linux,laptop, lenovo, notes