[Jodavaho.io]

Stuff by Josh Vander Hook

Debugging Slow Ubuntu Boot

A living page, mostly for my own reference of how to debug slow Ubuntu boot times view full post

Created with chatgpt + my own notes.

System Analysis

  1. Check Boot Time:

    • Use systemd-analyze to see the total boot time.
    • Use systemd-analyze blame to see which services take the longest to start.
    • Use systemd-analyze critical-chain to understand the critical path.
  2. Check Boot Logs:

    • Review the logs with journalctl -b to identify errors and warnings.

Hardware and BIOS/UEFI

  1. Update BIOS/UEFI:

    • Ensure your BIOS/UEFI is up to date.
    • Check BIOS/UEFI settings for any boot-related options (e.g., Fast Boot).
  2. Check Hardware:

    • Ensure all hardware components (RAM, SSD/HDD) are functioning correctly.

Services and Applications

  1. Disable Unnecessary Services:

    • Use systemctl disable <service> to disable unneeded services.
    • Use systemctl mask <service> to prevent services from starting.
  2. Remove Unnecessary Applications:

    • Use sudo apt-get remove <application> to uninstall unneeded applications.
    • Use sudo apt-get purge <application> for a thorough cleanup.

File System and Storage

  1. Check Disk Usage:

    • Use df -h to check for any partitions that are almost full.
    • Use du -sh /path/to/directory to find large files and directories.
  2. Optimize File System:

    • Use sudo e4defrag / for ext4 file system defragmentation.
    • Use sudo tune2fs -O fast_commit /dev/sdX for ext4 optimizations.
  3. Check for Disk Errors:

    • Use sudo fsck /dev/sdX to check and repair filesystem errors.

Kernel and Drivers

  1. Update Kernel and Drivers:
    • Use sudo apt-get update and sudo apt-get upgrade to ensure you have the latest updates.
    • Use ubuntu-drivers autoinstall to install the recommended drivers.

Startup and Grub

  1. Optimize GRUB:

    • Edit /etc/default/grub and set GRUB_TIMEOUT to a lower value (e.g., 2 seconds).
    • Run sudo update-grub after making changes.
  2. Reduce Kernel Load:

    • In /etc/default/grub, add quiet splash to GRUB_CMDLINE_LINUX_DEFAULT for a quieter boot.

Swap and Memory

  1. Optimize Swap Usage:

    • Adjust vm.swappiness in /etc/sysctl.conf to a lower value (e.g., 10).
  2. Check Memory Usage:

    • Use free -h to check RAM usage.
    • Use top or htop to monitor active processes and their memory consumption.

Network and Connectivity

  1. Disable Unused Network Services:

    • Disable services like NetworkManager-wait-online.service if not needed.
    • Use systemctl disable NetworkManager-wait-online.service.
  2. Optimize Network Settings:

    • Edit /etc/network/interfaces to configure network interfaces for faster boot.

Miscellaneous

  1. Disable Unused TTYs:

    • Edit /etc/systemd/logind.conf and set NAutoVTs=1.
  2. Use a Lightweight Desktop Environment:

    • Consider switching to a lighter desktop environment like Xfce or LXDE.
  3. Profile Your Boot:

    • Use systemd-analyze plot > bootchart.svg to create a visual representation of the boot process.

Regular Maintenance

  1. Clean Package Cache:

    • Use sudo apt-get clean to clear the package cache.
  2. Remove Old Kernels:

    • Use sudo apt-get autoremove to remove old kernel versions.

Comments

I have not configured comments for this site yet as there doesn't seem to be any good, free solutions. Please feel free to email, or reach out on social media if you have any thoughts or questions. I'd love to hear from you!