# Setting up your Thinkpad for Linux

### **Setting up your Thinkpad for Linux**

A guide for beginners to get started

### If Windows is already installed, do this first

Log into Windows with admin credentials.

* **Shrink the existing partition** that Windows is on as much as possible using the disk management tool (or leave space for Windows if you think you will use it regularly). Do not create a new drive from the unallocated space, that will be done when you install your Linux distribution.
    
* **Disable fast startup** from power settings.
    
* **Disable any Bitlocker encryption**. To save space, you may also want to disable **hibernation** by running `powercfg.exe /hibernate off` from an **Administrator Command Prompt**.
    

---

### Update the settings in your BIOS/UEFI

Boot into the BIOS/UEFI interface by pressing **F1** when the laptop is starting up (on some ThinkPad models, you may need to press **Enter** first, then F1).

* Ensure that the **Secure Boot** and encryption options are disabled (usually found under the **Security** tab).
    
* For optimal compatibility, you may also want to check the **Config** or **Restart** menu and ensure **OS Optimized Defaults** is **Disabled**.
    
* Some newer ThinkPads may require setting the **Suspend Mode** (often under the **Power** tab) to **Linux** or **"Linux S3"** for proper suspend-to-RAM functionality.
    
* Save your changes with **F10** and exit.
    

---

### Create a bootable USB

Download the **ISO image** for the distribution of your choice (e.g., Ubuntu LTS).

* Burn it onto a USB using **Rufus** or **BalenaEtcher**.
    

---

### Install Ubuntu LTS

* **Boot from the USB:** Plug the USB drive into your ThinkPad. When starting the laptop, press **F12** immediately to bring up the **Boot Menu**. Select the USB drive from the list and press Enter.
    
* **Start the Installation:** Once the USB boots, you will see a screen. Select **Try or Install Ubuntu**. It's generally recommended to select "Try Ubuntu" first to ensure everything works before committing to the installation, or simply select "Install Ubuntu" to proceed directly.
    
* **Follow the Installer Prompts:**
    
    * Choose your **language** and **keyboard layout**.
        
    * Select your installation type: choose **Normal Installation** and check the box to **Install third-party software for graphics and Wi-Fi hardware** (this is important for proprietary drivers like Nvidia graphics or some Wi-Fi cards).
        
    * When prompted for the **Installation type**, choose **"Install Ubuntu alongside Windows Boot Manager"** if you want to dual-boot, or **"Something else"** for a custom partition setup. If you created unallocated space earlier, select that space and create a new partition for Ubuntu (at minimum, one partition for the root directory `/` is needed; a separate partition for `/home` and a **swap** partition are optional but recommended).
        
    * Complete the remaining steps by setting your **time zone** and creating your **user account** and password.
        
    * Click **Install Now** and confirm the changes to the disk.
        
* **Restart:** Once the installation is complete, select **Restart Now** and remove the USB drive when prompted. The laptop should now boot into the **GRUB** bootloader, allowing you to choose between Ubuntu and Windows.
    

---

### Post-Installation Steps

After successfully logging into your new Ubuntu desktop, you should perform a few initial setup tasks:

* **Update Your System:** Open a terminal (Ctrl+Alt+T) and run the following commands to ensure all your packages are up-to-date:
    
    Bash
    
    ```
    sudo apt update
    sudo apt full-upgrade -y
    ```
    
* **Install Drivers (if needed):** If you checked the "third-party software" box, most drivers should be installed. However, if you have an **Nvidia GPU** or encounter issues with Wi-Fi, go to **Software & Updates** → **Additional Drivers** tab and check if any proprietary drivers are available and enabled.
    
* Configure TLP Battery Charge Thresholds:
    
    TLP is essential for optimizing battery life and health on ThinkPads. To protect your battery, you can set a custom charge threshold to stop charging before it reaches 100%.
    
    1. **Install TLP and TLP-RDW:**
        
        Bash
        
        ```plaintext
        sudo apt install tlp tlp-rdw
        ```
        
    2. Edit the TLP Configuration File:
        
        Open the configuration file /etc/tlp.conf using a text editor like vim:
        
        Bash
        
        ```plaintext
        sudo vim /etc/tlp.conf
        ```
        
    3. Set the Thresholds:
        
        Scroll down to the Battery Care section and find the lines for START\_CHARGE\_THRESH\_BAT0 and STOP\_CHARGE\_THRESH\_BAT0. Uncomment these lines (remove the # symbol) and set them to your desired values:
        
        * **Start Charging Below 60%:** Set `START_CHARGE_THRESH_BAT0=60`
            
        * **Stop Charging at 75%:** Set `STOP_CHARGE_THRESH_BAT0=75`
            
        
        Your edited lines should look like this (for a single battery):
        
        ```plaintext
        # Main / Internal battery (values in %)
        START_CHARGE_THRESH_BAT0=60
        STOP_CHARGE_THRESH_BAT0=75
        ```
        
        *Save and exit Vim with* `:wq`
        
    4. Apply and Verify the Settings:
        
        Apply the new configuration and start TLP:
        
        Bash
        
        ```plaintext
        sudo tlp start
        ```
        
        You can verify the settings were applied successfully by checking the battery status:
        
        Bash
        
        ```plaintext
        sudo tlp-stat -b
        ```
        
        Look for the output showing the configured `charge_start_threshold` and `charge_stop_threshold` values.
        
* **Final Check:** Test closing the laptop lid to ensure the system correctly enters and resumes from a low-power state (**suspend-to-RAM** or **S3 state**).
    

### Configuring Fingerprint Authentication

Configuring fingerprint authentication using **fprintd** and **pam-auth-update** on a Linux system (like Ubuntu) typically involves three main steps: installing the necessary packages, enrolling your fingerprint, and enabling the authentication module.

---

### 1\. Install Required Packages

First, ensure your system recognizes your fingerprint reader. You can often check this with the command `lsusb`. If your device is supported by `libfprint`, install the required packages:

Bash

```plaintext
sudo apt update
sudo apt install fprintd libpam-fprintd
```

* `fprintd`: This is the fingerprint matching daemon that communicates with your reader and manages fingerprints.
    
* `libpam-fprintd`: This is the Pluggable Authentication Module (PAM) component that allows system services to use `fprintd` for authentication.
    

---

### 2\. Enroll Your Fingerprint

Once the packages are installed, you need to enroll your fingerprint so the system can recognize it.

Bash

```plaintext
fprintd-enroll
```

Follow the on-screen prompts, which will typically ask you to swipe or tap your finger on the sensor multiple times until the enrollment is complete. It will usually specify which finger it is enrolling (e.g., "right-index-finger").

You can also use your desktop environment's **User Settings** (e.g., in GNOME or KDE) to enroll your fingerprint, which often provides a graphical interface.

---

### 3\. Enable Fingerprint Authentication via PAM

The `pam-auth-update` tool configures the system's authentication stack (PAM) to use the new fingerprint module.

Bash

```plaintext
sudo pam-auth-update
```

This command will open a text-based configuration menu.

1. Use the **Up/Down arrow keys** to navigate to **"Fingerprint authentication"**.
    
2. Press the **Spacebar** to place an asterisk (`*`) next to it, indicating it is selected/enabled.
    
3. Use the **Tab** key to highlight `<Ok>`.
    
4. Press **Enter** to save the configuration and exit.
    

This step integrates the `pam_`[`fprintd.so`](http://fprintd.so) module into the common authentication stack (usually by modifying files like `/etc/pam.d/common-auth`), allowing it to be used for things like graphical login, screen unlock, and `sudo` elevation.

---

### 4\. Test the Configuration

After completing these steps, you should be able to test the fingerprint authentication:

* **Sudo:** Open a terminal and run a `sudo` command. You should be prompted to either scan your finger or enter your password.
    
* **Login/Screen Unlock:** Lock your screen or log out. The login prompt should offer a fingerprint option.
    

Now you can proceed to install all the other packages and utilities you might need, like `homebrew` for package management.
