Ubuntu tricks

From CECS wiki
Jump to navigation Jump to search

This is a list of notes on tweaking and repairing ubuntu

See also:

video issues[edit]

  • edit /etc/default/grub and comment out both the HIDDEN entries so you see the grub menu before the video driver loads (and run update-grub )
  • try editing the boot and add to the linux line nomodeset and see if the video works
  • see nvidia
  • try disabling the nvidia driver currently installed by editing the kernel command line
    • remove everything after quiet
    • add: text modprobe.blacklist=nvidia_346 modprobe.blacklist=nvidia_361

network[edit]

For desktops[edit]

Edit /etc/network/interfaces and change (for example)

iface eth0 inet manual

to

iface eth0 inet dhcp

Optionally change auto to allow-hotplug to remove boot delay, especially if you have multiple integrated network ports and will only use one.

For laptops[edit]

Edit /etc/network/interfaces and remove eth0 and eth1 references


updated drivers[edit]

Try installing proprietary drivers:

ubuntu-drivers autoinstall

Install a HWE kernel for newer hardware that is missing drivers in the default kernel.

apt-get install linux-generic-hwe-18.04

There may be multiple options, check

apt-cache search linux-generic-hwe

Use the highest non-edge version. "edge" is an experimental version if you want to test even newer drivers.

disable dnsmasq[edit]

Problem
ubuntu system can ping ip addresses but either internal or external addresses fail to work and/or apt-get update fails due to host not found
Solution
disable dnsmasq (which is malfunctioning and not using the dns servers advertised in dhcp)
  1. edit /etc/NetworkManager/NetworkManager.conf
  2. comment out dns=dnsmasq
  3. service networking restart

Also, if the interface is being managed with NetworkManager, edit the interface and delete any DNS entries.

In a home environment where external DNS servers may be far away and overloaded, dnsmasq makes sense. In an enterprise environment with internal DNS servers, dnsmasq interferes with normal operation and does not help significantly even when it does work.

disable google dns[edit]

Try one of:

  • adjust dhclient
  1. Edit /etc/dhcp/dhclient.conf
  2. comment out supercede ... 8.8.8.8
  3. restart network or dhclient
  • disable dnsmasq
  1. Edit network settings for your network card
  2. remove hardcoded DNS ips from IPv4 settings
  3. restart networking

DNS configuration[edit]

Legacy
/etc/resolv.conf
dnsmasq
NetworkManager, ?
systemd-resolved
(Ubuntu 20, Fedora 33+?) resolvectl

systemd check dns resolve status[edit]

systemd-resolve --status

Also look in /var/run/systemd/resolve/resolv.conf for the real resolv.conf

systemd[edit]

systemd output can't be surpressed but all of the below is suppose to do it.

rd.systemd.show_status=false  (auto)
rd.udev.log.priority=3 (0=less)
quiet loglevel=3 vga=current
systemd.log_target=syslog
systemd.log_level=0
udev.log-priority=0
rd.log-priority=0
modprobe.blacklist=nvidia_346 modprobe.blacklist=nvidia_361
udev.exec-delay=10
udev.event-timeout=10

disable system sleep[edit]

This seems to be randomly enabled?

Disable with

systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

servers[edit]

By default, grub will pause in the boot menu after a power failure. To prevent this:

Add to /etc/default/grub

GRUB_RECORDFAIL_TIMEOUT=30

and run update-grub

timezone conflict with windows[edit]

Windows likes your hardware clock in localtime. Linux by default wants it in UTC. This makes dual boot a mess.

To tell ubuntu (15+) to use the clock in localtime:

timedatectl set-local-rtc 1

For more information, see [1]

Upgrading to a new release[edit]

Edit /etc/update-manager/release-upgrades

Disable the proxy briefly when starting the upgrade.

See also https://linuxhint.com/prevent_fix_package_dependency_errors_ubuntu/

Cisco AnyConnect in Ubuntu[edit]

apt-get install libpangox-1.0-0

See also help:vpn

sysreq[edit]

sysrq_always_enabled=1

list installed packages[edit]

  • apt list --installed
  • dpkg --get-selections | awk '$2=="install" {print $1}'

CUDA conflicts with itself[edit]

nVidia's cuda packages tend to have overlapping files withotu the necsesary internal dependencies to force the old package to be removed before the new one is installed. Soemetimes this can be mitigated by uninstalling the conflicting old package before installing the new one, but frequently this just leads to unresolvable dependency loops, especially if you already half way upgraded CUDA before it crashed..

This is partuclarly problematic if you install CUDA-11 in Ubuntu 16 and then upgrade to Ubuntu 18 with the nVidia repos because the nvidia-450 driver for Ubuntu 16 conflicts in an unresolveable way with nvidia-450 for Ubuntu 18. Here are 3 potential mitigations:

Note: for the first two methods, it is best to install the Ubuntu 18 repos and new cuda before rebooting.

  • (best, untested) Do not install cuda-11 for ubuntu 16. Remove the nvidia repos and upgrade to Ubuntu 18. Reinstall the repos for Ubuntu 18 and upgrade cuda. (If you don't remove the cuda repos, ubuntu refuses to upgrade until you install cuda 11, which is to be avoided.)
  • If you've already installed nvidia-450, uninstall it. This will also remove the top level cuda packages, but not the bulk of cuda. Upgrade to Ubuntu 18 if you haven't already BUT DO NOT ALLOW IT TO AUTOREMOVE, and reinstall the top level cuda packages (e.g., cuda-10-0 cuda-10-2 cuda). Then run the autoremove. Note that you will lose cuda-9-2 (and earlier) as it is no longer available.


  • If you have already tried and failed to install the Ubuntu 18 nvidia-450, force it to replace itself with the following command
apt --fix-broken -o Dpkg::Options::="--force-overwrite"  install nvidia-450
  • cuda 11.4 to 11.6
 apt install cuda cuda-drivers-470- nvidia-kernel-common-470- libnvidia-compute-470- libnvidia-fbc1-470- nvidia-kernel-common-470- nvidia-kernel-source-470-  libnvidia-cfg1-470- 
 apt install cuda cuda-drivers-470- libnvidia-cfg1-470- libnvidia-compute-470- libnvidia-decode-470- libnvidia-encode-470- libnvidia-extra-470- libnvidia-fbc1-470- libnvidia-gl-470- libnvidia-ifr1-470- nvidia-compute-utils-470- nvidia-dkms-470- nvidia-driver-470- nvidia-kernel-common-470- nvidia-kernel-source-470- nvidia-utils-470- xserver-xorg-video-nvidia-470-