Skip to content

Instantly share code, notes, and snippets.

@ChadBailey
Last active January 2, 2023 00:37
Show Gist options
  • Save ChadBailey/d238652f279b0ea0dff98bb88fd89ac3 to your computer and use it in GitHub Desktop.
Save ChadBailey/d238652f279b0ea0dff98bb88fd89ac3 to your computer and use it in GitHub Desktop.
Ubuntu Runbooks

Ubuntu Runbooks

These are very direct guides on dealing with specific problems within Ubuntu.

One-liners

  • Check currently running version of Ubuntu: lsb_release -a
  • Check currently running kernel: uname -r (or uname -a)
  • Remove unneeded packages: sudo apt autoremove
  • Apply configuration changes to grub (needed any time grub conf has been modified): sudo update-grub
  • Auto-refresh other installed os's to grub: sudo os-prober
  • List all graphics cards on system: lspci | grep VGA

Install NVidia Drivers

Work in progress

External resources:

  1. Open "Software & Updates" (command line: software-properties-gtk)
  2. Ensure "Proprietary drivers for devices (restricted)" is checked
  3. Click "Additional drivers" tab
  4. Select desired driver from the list... Selection process tips:
    a. If (proprietary) bothers you, don't buy an nvidia card and throw away all hope of being able to play games one day
    b. For best performance, avoid any with "server" or "Nouveau" designations
    c. Typically, the best one to use is the one with the "tested" designation

Remove Kernel

Common reasons:

  • Mewly installed kernel won't boot
  • Need to clean up space on /boot partition

External resources:

  1. Identify currently running kernel via uname -r - do not remove this under any circumstances. Sample output: 5.15.0-43-generic

    If you do want to remove it, boot into another kernel first

  2. Find installed kernel packages via dpkg -l | grep linux-image. Sample output:
    ii  linux-image-5.15.0-43-generic                 5.15.0-43.46                            amd64        Signed kernel image generic
    ii  linux-image-5.15.0-56-generic                 5.15.0-56.62                            amd64        Signed kernel image generic
    ii  linux-image-generic-hwe-22.04                 5.15.0.56.54                            amd64        Generic Linux kernel image

    If you want to clear up space in /boot it may be a good idea to capture the output of ls -al /boot to compare later

  3. Remove kernel package sudo apt remove --purge linux-image-5.15.0-56-generic. Sample output:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  amd64-microcode intel-microcode iucode-tool linux-headers-generic-hwe-22.04 thermald
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  linux-image-unsigned-5.15.0-56-generic
Suggested packages:
  fdutils linux-doc | linux-source-5.15.0 linux-tools linux-modules-extra-5.15.0-56-generic
The following packages will be REMOVED:
  linux-generic-hwe-22.04* linux-image-5.15.0-56-generic* linux-image-generic-hwe-22.04* linux-modules-extra-5.15.0-56-generic*
The following NEW packages will be installed:
  linux-image-unsigned-5.15.0-56-generic
0 upgraded, 1 newly installed, 4 to remove and 0 not upgraded.
Need to get 11.7 MB of archives.
After this operation, 353 MB disk space will be freed.
Do you want to continue? [Y/n] 
Get:1 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 linux-image-unsigned-5.15.0-56-generic amd64 5.15.0-56.62 [11.7 MB]
Fetched 11.7 MB in 1s (13.9 MB/s)                                  
(Reading database ... 359981 files and directories currently installed.)
Removing linux-generic-hwe-22.04 (5.15.0.56.54) ...
Removing linux-image-generic-hwe-22.04 (5.15.0.56.54) ...
Removing linux-modules-extra-5.15.0-56-generic (5.15.0-56.62) ...
dpkg: linux-image-5.15.0-56-generic: dependency problems, but removing anyway as you requested:
 linux-signatures-nvidia-5.15.0-56-generic depends on linux-image-5.15.0-56-generic | linux-image-unsigned-5.15.0-56-generic; however:
  Package linux-image-5.15.0-56-generic is to be removed.
  Package linux-image-unsigned-5.15.0-56-generic is not installed.
 linux-modules-nvidia-515-5.15.0-56-generic depends on linux-image-5.15.0-56-generic | linux-image-unsigned-5.15.0-56-generic; however:
  Package linux-image-5.15.0-56-generic is to be removed.
  Package linux-image-unsigned-5.15.0-56-generic is not installed.
 linux-modules-5.15.0-56-generic depends on linux-image-5.15.0-56-generic | linux-image-unsigned-5.15.0-56-generic; however:
  Package linux-image-5.15.0-56-generic is to be removed.
  Package linux-image-unsigned-5.15.0-56-generic is not installed.

Removing linux-image-5.15.0-56-generic (5.15.0-56.62) ...
I: /boot/vmlinuz is now a symlink to vmlinuz-5.15.0-43-generic
I: /boot/initrd.img is now a symlink to initrd.img-5.15.0-43-generic
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.15.0-56-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-43-generic
Found initrd image: /boot/initrd.img-5.15.0-43-generic
Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done
Selecting previously unselected package linux-image-unsigned-5.15.0-56-generic.
(Reading database ... 354049 files and directories currently installed.)
Preparing to unpack .../linux-image-unsigned-5.15.0-56-generic_5.15.0-56.62_amd64.deb ...
Unpacking linux-image-unsigned-5.15.0-56-generic (5.15.0-56.62) ...
Setting up linux-image-unsigned-5.15.0-56-generic (5.15.0-56.62) ...
I: /boot/vmlinuz is now a symlink to vmlinuz-5.15.0-56-generic
I: /boot/initrd.img is now a symlink to initrd.img-5.15.0-56-generic
(Reading database ... 354052 files and directories currently installed.)
Purging configuration files for linux-modules-extra-5.15.0-56-generic (5.15.0-56.62) ...
Purging configuration files for linux-image-5.15.0-56-generic (5.15.0-56.62) ...
I: /boot/vmlinuz is now a symlink to vmlinuz-5.15.0-43-generic
I: /boot/initrd.img is now a symlink to initrd.img-5.15.0-43-generic
/var/lib/dpkg/info/linux-image-5.15.0-56-generic.postrm ... removing pending trigger
rmdir: failed to remove '/lib/modules/5.15.0-56-generic': Directory not empty
Processing triggers for linux-image-unsigned-5.15.0-56-generic (5.15.0-56.62) ...

Optional: run sudo apt autoremove after to clean up any unneeded packages

  1. Check output of dpkg -l | grep linux-image to ensure package is no longer there. Sample output:
    ii  linux-image-5.15.0-43-generic                 5.15.0-43.46                            amd64        Signed kernel image generic
    ii  linux-image-unsigned-5.15.0-56-generic        5.15.0-56.62                            amd64        Linux kernel image for version 5.15.0 on 64 bit x86 SMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment