loader
Loading...
I am Nick Lang

I'm up for a laptop refresh at work, and as usual I got a Lenovo laptop and I'm going to install Arch Linux on it. this time around I'm getting an X1 Extreme. Previously I had the X1 Yoga and before that I had the X1 Carbon. I've run arch on all of these, and I've found the experience to be quite pleasant.

Let's get down to the details shall we?

First off I used this gist, as a great help for how to get this process going. But I'd still write up my experience.

Update your computer

Next I ran a full Lenovo system upgrade. Download all firmware updates all windows updates etc. This will take a while.

Update Bios settings

After your computer is fully updated and firmwares are updated, lets update the bios so that we can boot from USB. * Set the Security -> Secure Boot -> Secure Boot setting to "Disabled". * Set the Configs -> Display -> Graphics Device setting to "Discrete".

Resize Your Partitions

I have a 1TB disk in my computer and I want to Dual boot, so I opted to shrink my drive, and leave some un-formatted room on my HD. This can be done through the windows explorer. Right click "Windows" on the bottom left screen and select "Disk Management". Then you can choose the drive you want and select "Shrink Volume". Read this for more info.

I opted to go with 2 partitions: * / => root partition * /home => home partition

You can create as many partitions as you want or need. Also note, I explicitly didn't create a swap volume. Cause I have 64g of ram I don't want to consume 128g of disk space for a swap!

Download Arch

First get yourself a USB drive and download the latest Arch release. Next you'll want to install this iso on your usb drive. There's a lot of different ways to do this. But since I just opened a brand new computer with Windows installed I figured I'd do the windows instructions.

After your disk is ready, let's leave it in the computer.

Install a Boot Manager

I found that installing rEFInd to be easy to install. Since the docs are kinda on the website I'll write up the instructions here:

  1. Download the zip file
  2. Unzip the zipfile to your Downloads directory. Keep note, we'll have to copy these files in a second.
  3. Start a CMD shell as Administrator.
  4. Click Start
  5. type "cmd"
  6. right click and choose Run as Administrator
  7. Type mountvol S: /S. This will mount your EFI volume.
  8. cd into the directory where you unzipped the file from step 1, then cd into the unzipped directory. You should see a directory named refind when you type the command dir
  9. Type xcopy /E refind S:\EFI\refind\
  10. type s: to change to the EFI volume
  11. type cd EFI/refind.
  12. In this step I deleted all the drivers I didn't need. Since my system is x64 I kept those file and deleted the rest.
  13. type rename refind.conf-sample refind.conf
  14. type bcdedit /set "{bootmgr}" path \EFI\refind\refind_x64.efi. Please do this it is displayed. the " and the {} are both required.

Now lets reboot.

Boot from USB

If the EFI update worked, we'll be at a rEFInd screen and you can choose what to boot from. Lets boot from USB. I can't remember which option it was, but it should be obvious. Something like x64 Archiso USB UEFI.

Quick Sanity Check

  1. Are we booted into UEFI mode? If you can type:
ls /sys/firmware/efi/efivars

And you get a bunch of files, then yes we are booted in UEFI mode. If not, reboot and make sure you select the right option at the boot menu this time.

  1. Are we connected to the network? If you're plugged into a LAN, then type ping -c 3 google.com if that works then yay. If you're on wifi, we'll have to run wifi-menu to start the connection to a wifi network. After you get connected, try the ping command again. If you're having trouble getting connected to the network, I can't help you here. I'd say take a look at the Network Debugging page on the Arch Wiki.

  2. Sync your clock:

timedatectl set-ntp true

Format the partitions

Lets run fdisk -l to see our partitions. Now this step is extremely important. We want to identify the partitions that are empty and are NOT Windows.

For me, they were named: * nvme0n1p4 -> for root * nvme0n1p5 -> for home

Now we want to format our partitions.

# mkfs.ext4 /dev/nvme0n1p4
# mkfs.ext4 /dev/nvme0n1p5

If you were creating a swap partition you would want to run the command:

mkswap /dev/nvme0n1p#

where # is the number of the partition you created specifically for swap.

Mounting the Partitions

Now we need to mount the partitions.

mount /dev/nvme0n1p4 /mnt

Now that we've mounted that one we need to create a home directory in /mnt as well as an efi directory.

mkdir /mnt/home
mkdir /mnt/efi

This will be the directory we want to mount the home partition.

mount /dev/nvme0n1p5 /mnt/home

Next we need to mount the efi partition. If you don't know which one this is, run the fdisk -l command and look for one that says EFI.

mount /dev/nvme0n1p1 /mnt/efi

Here what we are doing is just re-using the windows EFI partition, along with the bootloader we added to it using rEFInd.

Pacman Mirrors (optional)

Next you can use nano or vi or whatever to edit your /etc/pacman.d/mirrorlist. You can leave this alone if you want. Basically what happens is if a mirror fails, Arch will try the next one in the list. If your list is long, it can take a long time for a pacman command to quit. So trim that down to stuff near by.

Base Install

I would recommend installing base and base-devel. Only install just base if you're not ever going to build software.

pacstrap /mnt base base-devel

Make sure you install both base and base-devel. My first time going through this I forgot to install base and my computer wouldn't boot into Linux.

Auto Mounting

Now that we have our drives mounted linux installed, we want to make sure these drives mount every time we boot, automagically.

genfstab -U /mnt >> /mnt/etc/fstab

Arch-Chroot

Now that linux is installed, lets use it!

arch-chroot /mnt

This will create a chroot on the /mnt, and lets us run as root on our fresh Arch install.

Initial Setup

A few things we wanna do here, install any packages you might know you need. For me, I really needed wifi-menu cause it was part of the USB ISO, it's not installed from the pacstrap. So when I booted into linux for the first time I couldn't get online. I had to reboot into the USB, re mount my drives, re-run arch-chroot install wifi-menu then reboot again. UGH

pacman -S wifi-menu

Lets set the timezone:

ln -sf /usr/share/zoneinfo/<Region>/<City> /etc/localtime

Now lets set the hardware clock:

hwclock --systohc

Localization

Open the file /etc/locale.gen using your editor, then un-comment out the locals you want. for me en_US.UTF8 Now run locale-gen

Next run echo "LANG=en_US.UTF8" > /etc/locale.conf

Create a Hostname and setup Localhost

Type echo "computername" > /etc/hostname to create a name for your computer. Where computername is something you like.

Now lets edit /etc/hosts

127.0.0.1     localhost
::1           localhost
127.0.1.1       <hostname>.localdomain  <hostname>

hostname here should match the computername you created before.

Root password

Lets run passwd to create a password for the root user.

And we're done.

Type exit and then type reboot. After the computer has turned off, and before it turns back on, unplug your USB drive. And you should be back at the rEFInd menu where you can choose Arch as the OS to boot into.

You'll be dropped at a terminal asking for a username and a password. Your username is root and your password is what ever you set in the last step.

Post Install Steps

Here it's really up to you. There's the General Recomendations from the Arch Wiki, you could also continue to follow the Gist I linked above. The author goes into details on all the next steps.

One thing I still have to do is enable bumblebee so that I can use hybrid graphics, which the author of the gist goes into detail about. My battery life is SHIT using only the onboard NVIDIA card.

I hope you find this useful and helpful.

I'm up for a laptop refresh at work, and as usual I got a Lenovo laptop and I'm going to install Arch Linux on it. this time around I'm getting an X1 Extreme. Previously I had the X1 Yoga and before that I had the X1 Carbon. I've run arch on all of these, and I've found the experience to be quite pleasant.

Let's get down to the details shall we?

First off I used this gist, as a great help for how to get this process going. But I'd still write up my experience.

Update your computer

Next I ran a full Lenovo system upgrade. Download all firmware updates all windows updates etc. This will take a while.

Update Bios settings

After your computer is fully updated and firmwares are updated, lets update the bios so that we can boot from USB. * Set the Security -> Secure Boot -> Secure Boot setting to "Disabled". * Set the Configs -> Display -> Graphics Device setting to "Discrete".

Resize Your Partitions

I have a 1TB disk in my computer and I want to Dual boot, so I opted to shrink my drive, and leave some un-formatted room on my HD. This can be done through the windows explorer. Right click "Windows" on the bottom left screen and select "Disk Management". Then you can choose the drive you want and select "Shrink Volume". Read this for more info.

I opted to go with 2 partitions: * / => root partition * /home => home partition

You can create as many partitions as you want or need. Also note, I explicitly didn't create a swap volume. Cause I have 64g of ram I don't want to consume 128g of disk space for a swap!

Download Arch

First get yourself a USB drive and download the latest Arch release. Next you'll want to install this iso on your usb drive. There's a lot of different ways to do this. But since I just opened a brand new computer with Windows installed I figured I'd do the windows instructions.

After your disk is ready, let's leave it in the computer.

Install a Boot Manager

I found that installing rEFInd to be easy to install. Since the docs are kinda on the website I'll write up the instructions here:

  1. Download the zip file
  2. Unzip the zipfile to your Downloads directory. Keep note, we'll have to copy these files in a second.
  3. Start a CMD shell as Administrator.
  4. Click Start
  5. type "cmd"
  6. right click and choose Run as Administrator
  7. Type mountvol S: /S. This will mount your EFI volume.
  8. cd into the directory where you unzipped the file from step 1, then cd into the unzipped directory. You should see a directory named refind when you type the command dir
  9. Type xcopy /E refind S:\EFI\refind\
  10. type s: to change to the EFI volume
  11. type cd EFI/refind.
  12. In this step I deleted all the drivers I didn't need. Since my system is x64 I kept those file and deleted the rest.
  13. type rename refind.conf-sample refind.conf
  14. type bcdedit /set "{bootmgr}" path \EFI\refind\refind_x64.efi. Please do this it is displayed. the " and the {} are both required.

Now lets reboot.

Boot from USB

If the EFI update worked, we'll be at a rEFInd screen and you can choose what to boot from. Lets boot from USB. I can't remember which option it was, but it should be obvious. Something like x64 Archiso USB UEFI.

Quick Sanity Check

  1. Are we booted into UEFI mode? If you can type:
ls /sys/firmware/efi/efivars

And you get a bunch of files, then yes we are booted in UEFI mode. If not, reboot and make sure you select the right option at the boot menu this time.

  1. Are we connected to the network? If you're plugged into a LAN, then type ping -c 3 google.com if that works then yay. If you're on wifi, we'll have to run wifi-menu to start the connection to a wifi network. After you get connected, try the ping command again. If you're having trouble getting connected to the network, I can't help you here. I'd say take a look at the Network Debugging page on the Arch Wiki.

  2. Sync your clock:

timedatectl set-ntp true

Format the partitions

Lets run fdisk -l to see our partitions. Now this step is extremely important. We want to identify the partitions that are empty and are NOT Windows.

For me, they were named: * nvme0n1p4 -> for root * nvme0n1p5 -> for home

Now we want to format our partitions.

# mkfs.ext4 /dev/nvme0n1p4
# mkfs.ext4 /dev/nvme0n1p5

If you were creating a swap partition you would want to run the command:

mkswap /dev/nvme0n1p#

where # is the number of the partition you created specifically for swap.

Mounting the Partitions

Now we need to mount the partitions.

mount /dev/nvme0n1p4 /mnt

Now that we've mounted that one we need to create a home directory in /mnt as well as an efi directory.

mkdir /mnt/home
mkdir /mnt/efi

This will be the directory we want to mount the home partition.

mount /dev/nvme0n1p5 /mnt/home

Next we need to mount the efi partition. If you don't know which one this is, run the fdisk -l command and look for one that says EFI.

mount /dev/nvme0n1p1 /mnt/efi

Here what we are doing is just re-using the windows EFI partition, along with the bootloader we added to it using rEFInd.

Pacman Mirrors (optional)

Next you can use nano or vi or whatever to edit your /etc/pacman.d/mirrorlist. You can leave this alone if you want. Basically what happens is if a mirror fails, Arch will try the next one in the list. If your list is long, it can take a long time for a pacman command to quit. So trim that down to stuff near by.

Base Install

I would recommend installing base and base-devel. Only install just base if you're not ever going to build software.

pacstrap /mnt base base-devel

Make sure you install both base and base-devel. My first time going through this I forgot to install base and my computer wouldn't boot into Linux.

Auto Mounting

Now that we have our drives mounted linux installed, we want to make sure these drives mount every time we boot, automagically.

genfstab -U /mnt >> /mnt/etc/fstab

Arch-Chroot

Now that linux is installed, lets use it!

arch-chroot /mnt

This will create a chroot on the /mnt, and lets us run as root on our fresh Arch install.

Initial Setup

A few things we wanna do here, install any packages you might know you need. For me, I really needed wifi-menu cause it was part of the USB ISO, it's not installed from the pacstrap. So when I booted into linux for the first time I couldn't get online. I had to reboot into the USB, re mount my drives, re-run arch-chroot install wifi-menu then reboot again. UGH

pacman -S wifi-menu

Lets set the timezone:

ln -sf /usr/share/zoneinfo/<Region>/<City> /etc/localtime

Now lets set the hardware clock:

hwclock --systohc

Localization

Open the file /etc/locale.gen using your editor, then un-comment out the locals you want. for me en_US.UTF8 Now run locale-gen

Next run echo "LANG=en_US.UTF8" > /etc/locale.conf

Create a Hostname and setup Localhost

Type echo "computername" > /etc/hostname to create a name for your computer. Where computername is something you like.

Now lets edit /etc/hosts

127.0.0.1     localhost
::1           localhost
127.0.1.1       <hostname>.localdomain  <hostname>

hostname here should match the computername you created before.

Root password

Lets run passwd to create a password for the root user.

And we're done.

Type exit and then type reboot. After the computer has turned off, and before it turns back on, unplug your USB drive. And you should be back at the rEFInd menu where you can choose Arch as the OS to boot into.

You'll be dropped at a terminal asking for a username and a password. Your username is root and your password is what ever you set in the last step.

Post Install Steps

Here it's really up to you. There's the General Recomendations from the Arch Wiki, you could also continue to follow the Gist I linked above. The author goes into details on all the next steps.

One thing I still have to do is enable bumblebee so that I can use hybrid graphics, which the author of the gist goes into detail about. My battery life is SHIT using only the onboard NVIDIA card.

I hope you find this useful and helpful.