Skip to content

Instantly share code, notes, and snippets.

@codyzu
Last active December 6, 2019 15:08
Show Gist options
  • Save codyzu/0d45a91c33173cb57118840869dc5591 to your computer and use it in GitHub Desktop.
Save codyzu/0d45a91c33173cb57118840869dc5591 to your computer and use it in GitHub Desktop.
Dell XPS 9560 Ubuntu 18.04+ Changes

Installation

Sometimes the installer crashes. With 19.10, this happened when trying to connect to the wifi. The solution is to set the kernel parameters when starting the installer or live environment.

  1. Press e when the grub boot menu is displayed (the menu that lets you "Try Ubuntu" or "Install Ubuntu")
  2. On the line containing the kernel parameters, add the following (to the same line) after quiet splash:
    acpi_rev_override i915.modeset=1 nouveau.modeset=0
    
    Note: I'm not sure if they are all needed, but it fixed the installer from crashing when connecting to the wifi. These are the same params that I add after disabling the nvidia graphics driver.

Hardware

Disable nvidia graphics adapter

I don't game and find the extra heat, fan noise, and reduced battery are reason enough to completely disable the nvidia graphics adapter. You can measure power consumption (and compare after making the below changes) with powerstat or powertop.

  1. Uninstall the nvidia drivers. This will force Ubuntu to use the nouveau driver (not better, but the first step) (reference):
    sudo apt-get purge "nvidia-*"
    Note: with 19.10, the computer wouldn't boot after this, until fixing the kernel params in the next step. You can push e in the grub menu to manually add the params if the computer is not booting.
  2. Ensure the kernel is well behaved (not loading the nouveau drivers, but instead the intel drives) with the graphics adapter by adding the following kernel paramters to /etc/default/grub (these can be tested by pressing e en the grub boot menu and adding them manually for a single boot) (reference):
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_rev_override i915.modeset=1 nouveau.modeset=0"
    
  3. Disable the graphics adapter on boot (reference)
    1. Check that it is "on" by running cat /sys/bus/pci/devices/0000\:01\:00.0/power/control
    2. Test we can turn it off with sudo sh -c 'echo auto > /sys/bus/pci/devices/0000\:01\:00.0/power/control'
    3. Make the change permanent at boot by adding the following startup script /lib/systemd/system/gpuoff.service:
      [Unit]
      Description=Power-off gpu
      
      [Service]
      Type=oneshot
      ExecStart=/bin/bash -c "if [[ `prime-select query` == 'intel' ]]; then echo auto > /sys/bus/pci/devices/0000\:01\:00.0/power/control; fi"
      
      
      
      [Install]
      WantedBy=default.target
      
    4. Test the script sudo systemctl start gpuoff
    5. Enable the script at boot sudo systemctl enable gpuoff

Classic network adapter names

Add the following kernel paramters to GRUB_CMDLINE_LINUX_DEFAULT (as described above). They can be tested during a single boot by pressing e during the grub boot menu. (reference)

  • net.ifnames=0
  • biosdevname=0
  • ipv6.disable=1

Intel graphics enhancements

I have not yet test this, but I would like to try the tips noted here.

Wireless

I physically replaced the wifi card with an intel card and all of my long lived wireless problems (like "random" disconnects) disappeared. I highly recommend this. There are youtube videos showing how it is done (easy after buying the correct screw driver).

Desktop

Gnome Extensions

Install the big extension pack with sudo apt install gnome-shell-extensions then Logout and Login. This also installs the Gnome Tweaks application.

The system monitor gnome shell extension from the Ubuntu repositories did not work with Ubuntu 19.04. To make it work:

  • install the (broken) version from the repo to have the necessary dependencies: sudo apt install gnome-shell-extension-system-monitor
  • install the gnome shell chrome integration if using chrome: sudo apt install chrome-gnome-shell
  • update the extension from the gnome extensions web page
  • Logout/Login or restart the shell with Alt+F2, r

Gnome Theme

Enable the User Themes Gnome extension Gnome Tweaks (installed above). This allows setting the Gnome theme.

I'm a big fan of the pop theme. Plus it comes with icons and recommends fonts to make the theme look greate. Note: as of Unbuntu 19.04, I had to sudo apt install hidpi-daemon go get the settings app to open after enabling the theme (reference).

Fonts

Nerd Fonts are the best for the terminal and programming.

My prefered way to install various nerd fonts:

  1. Clone the repo locally (it's big, but I can delete it later)
  2. Run their install script, with the system setting (:warning: I found the system setting necessary to allow some snap apps to pick up the fonts, specifically Visual Studio Code). sudo ./install.sh -S {FONT_FAMILY}

My favorite Nerd fonts for Visual Studio Code:

  • Iosevka
  • FuraCode (installed with sudo ./install.sh -S FiraCodeuse 'FuraCode Nerd Font' in the Visual Studio Code settings)

The above fonts look great for the terminal also. For Gnome Terminal (the default terminal in Ubuntu), I was forced to set the system wide MonoSpace Font with Gnome Tweaks and set Gnome Terminal to use the default system font. I have not found any other way for Gnome Terminal to pick up installed fonts.

Securty + Yubikey

TODO

Disk Encryption

Resizing encrypted partition

My lvm pv was not full and I successfully resized the encrypted pv to gain some space to create additional unencrypted boot partitions for new distros. I followed the steps here and here.

Notes:

  • I had to move a lv because it was at the end of the pv.
  • I had to do some manual sector calculations when resizing the pv, the partition, and the luks volume.
  • TODO

Installing new distro into already encrypted system

  1. Paritions:
    • add new boot partition (700 MB seems to be a the standard) in uncrypted space
    • add root lvm logical (~30GB) volume for new distro
  2. Boot from live cd
  3. Decrypt encrypted parition: sudo cryptsetup luksOpen nvme0n1p3_crypt
    • ⚠️ this might need to be the same volume name (nvme0n1p3_crypt) they we put in crypttab when fixing initramfs. i.e., don't use a temporary name here since it might crash update-initramfs.
  4. Install and use the above partitions and install the bootloader to the physical disk that holds the partitions
  5. FIX NEW INSTALL before rebooting! (reference)
    • I had troubles after the install, these steps worked when booting from a previous install on the same encrypted drive:
      1. setup and activate the chroot env:
        sudo mount /dev/mapper/vgroot-lvroot /mnt
        sudo mount </dev/DEV_BOOT> /mnt/boot
        sudo mount --bind /dev /mnt/dev
        sudo chroot /mnt
        mount -t proc proc /proc
        mount -t sysfs sys /sys
        mount -t devpts devpts /dev/pts
      2. Configure grub to unlock and boot using the encrypted root partition sudo nano /etc/crypttab:
        nvme0n1p3_crypt UUID=THE_ROOT_UUID none luks,discard
        
      3. Update grub: update-initramfs -k all -c
    • ⚠️ The above steps did not work for me from the livecd after the install was finished (although they should work!). I had to reboot from an existing install. Maybe because when I installed Ubuntu I didn't name the luks volume the same name that I used in the crypttab file and that caused problems with update-initramfs (not including the necessary encryption stuff). Or it could have been something was missing allow the install of grub/initramfs that is comptable with luks.
    • For reference I also followed this guide, but I had problems with the post install steps (maybe because I unlocked luks with a different name than I used in crypttab).

Yubikey

For sudo + Login

Step by step guide

Login with yubikey requires no password for the gnome keyring for now. I can't find a way to unlock the keyring via pam.

For disk encryption key

guide

zsh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment