Linux user notes

From Helpful
Jump to: navigation, search
Linux-related notes
Linux user notes

Shell, admin, and both:

Shell - command line and bash notes · shell login - profiles and scripts · Shells and execution ·· find and xargs and parallel · screen and tmux
Linux admin - disk and filesystem · users and permissions · Debugging · security enhanced linux · health and statistics · kernel modules · YP notes · unsorted and muck
Logging and graphing - Logging · RRDtool and munin notes
Network admin - Firewalling and other packet stuff ·

Remote desktops
VNC notes
XDMCP notes



If you want more recent drivers (and sometimes the more stable ones), you may wish to use the graphics-drivers PPA by doing:

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update

The newer versions and dependencies will show up alongside.

Failed to initialize NVML: Driver/library version mismatch

dmesg will probably have a little more detail, like:

NVRM: API mismatch: the client has the version 384.130, but
NVRM: this kernel module has the version 384.111.  Please
NVRM: make sure that this kernel module and all NVIDIA driver
NVRM: components have the same version.

If you just ran a package update, then rebooting will typically solve this.

If not, it's probably because you had previously installed some part manually, and a later installed/update conflicts with it. That mix can easily conflict/break on some libraries/symlinks, so (to be sure remove all before...) decide which way to go.

Your system is not currently configured to drive a VGA console
Your system is not currently configured to drive a VGA console on the primary VGA device.
The NVIDIA Linux graphics driver requires the use of a text-mode VGA console.
Use of other console drivers including, but not limited to, vesafb, may result in
corruption and stability problems, and is not supported.

Basically, it has an issue with framebuffer (non-VGA) consoles.

It just seems to be a newer message, for an issue very similar to the one in the next section.

Freeze with GeForce GTX
The problem:

Once X starts up / the GPU gets used, the graphics and/or mouse would be extremely slow (or in some cases not work at all).

The context

Geforce GTX graphics card (a 580 in our case), X windows. Ubuntu 12 (worked fine in 11), also a few other linux variants we tried.

The diagnosis:

Some bad interaction between the the modeset used for the graphical pre-X boot splash, and the graphics driver used for X.

This is a problem that seems unique to the GTX family (and maybe some relations, and maybe only early models / now-old driver versions).

Not Ubuntu-specific, just a bad combination at bootup (that various ubuntu versions and other linux variants have).

The simple workaround:
Use the
boot option, implying a text mode boot.

You probably want to make this default. On Ubuntu, that means

  • editing /etc/default/grub (look for the "add to all entries" bit, which probably says quiet splash)
  • and running

Fan control

nvidia-settings works via an X extension (called NV-CONTROL), meaning there needs to be an X server for the card.

Fan control only works when you have CootBits 4

basic fix

  • edit your xorg.conf to have
    Option "CoolBits" "4"
    in the Device section(s) for your GPU(s)
  • restart X (typically meaning your display manager, e.g.
    sudo service restart lightdm
  • use
    (CLI or GUI)

For headless cards (typical for compute, even on workstations)

  • X server will (pretty sensibly) only launch when there is a monitor,
  • monitors are auto-detected
  • you have to fake a monitor, for each card that doesn't actually have one.
Note that you don't have to keep X running - there are tricks around that.

See also:

Example: You have

# lspci  | grep VGA
02:00.0 VGA compatible controller: NVIDIA Corporation Device 1b06 (rev a1)
03:00.0 VGA compatible controller: NVIDIA Corporation Device 1b06 (rev a1)

And you stuck a monitor only on the first.

Find /etc/X11/xorg.conf. If it doesn't exist, e.g. use nvidia-setting to write one, from what it's got already (which will be the ones with monitors).

nvidia-settings will also list the thing you need to put in BusID for new Device sections (if you use lspci for that, note that it shows hex whereas xorg.conf wants decimal

The first gets an X server because you have a monitor, so you only need to add the CoolBits 4 line

Section "Device"
   Identifier     "Device0"
   Driver         "nvidia"
   VendorName     "NVIDIA Corporation"
   BoardName      "GeForce GTX 1080 Ti"
   BusID          "PCI:2:0:0"
   Option         "Coolbits" "4"

The other is headless, so you need to fake a monitor, to get an X server, to get fan control, roughly with:

Section "Device"
   Identifier     "Device1"
   Driver         "nvidia"
   VendorName     "NVIDIA Corporation"
   BusID          "PCI:3:0:0"
   Option         "Coolbits" "4"
Section "Screen"
   Identifier     "Screen1"
   Device         "Device1"
   Monitor        "Monitor1"
   DefaultDepth    24
   SubSection     "Display"
       Depth       24
   Option         "ConnectedMonitor" "CRT"
   Option         "TwinView" "0"
   Option         "Stereo" "0"
   Option         "metamodes" "nvidia-auto-select +0+0"
Section "Monitor"
   Identifier     "Monitor1"
   VendorName     "Unknown"
   ModelName      "CRT-N"
   HorizSync       28.0 - 33.0
   VertRefresh     43.0 - 72.0
   Option         "DPMS"

(I'm fairly sure there are lines in there that are not required and/or do nothing, this is copy-paste from elsewhere)

Also make it relevant by, in Section ServerLayout, where you already had a

Screen      0  "Screen0" 0 0


Screen      1  "Screen1" 

nvidia-settings CLI
This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

For example, to force the fan to highish speed (90%)

DISPLAY=:0 nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUTargetFanSpeed=90"

DISPLAY=:0 is useful when SSHing in, and possible in scripts. Without that, it'll complain it "Failed to connect to Mir"

CUDA versions

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

When you can, use the metapackages (cuda-6-5, cuda-7-0, cuda-7-5, etc.).

Less headache in the long run, also because all the parts (cuda-*-version packages) are pulled in as dependencies and removable when you remove the metapackage.

Keep in mind that recent CUDA versions will depend on recent nvidia drivers, and possibly opencl wrapper, which have to be installed relatively manually or at least specifically named.

TODO: verify the following list:

  • CUDA 9.0
  • CUDA 8.0 required nvidia driver ~367
  • CUDA 7.5 required nvidia driver ~352
  • CUDA 7.0 required nvidia driver ~346
  • CUDA 6.5 required nvidia driver ~340
  • CUDA 5.5 required nvidia driver ~319
  • CUDA 5.0 required nvidia driver ~304

The currently installed/active CUDA is essentially what's there in PATH and LD_LIBRARY_PATH. The easiest way to see is probably:

nvcc -V    #from nvidia-cuda-toolkit


nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2013 NVIDIA Corporation
Built on Wed_Jul_17_18:36:13_PDT_2013
Cuda compilation tools, release 5.5, V5.5.0

means 5.5

CUDA is designed to be backwards compatible, so a newer system CUDA in your system should support applications that use older CUDA libraries.

Some applications still manage to break this, though.

You can install multiple CUDA versions. Keep in mind that you would need to separate their environments. You would probably have one of them active by default.

I wanted cuda7.5 for just one program, which (after install did not tie it into the system) ended up working something like:

function myappname() {
  export CUDA_HOME=/usr/local/cuda-7.5
  export PATH=$PATH:$CUDA_HOME/bin
  `which myappname`

GNOME notes

Check out shortcuts in system Settings → Keyboard → Shortcuts tab

I didn't know about opening a terminal via CtrlAltT

AltTab switches between apps

and hold for windows of that app

Alt` (backtick) switches between windows of the same application

actually just initially fixed on the same app, you can shift to

You may also like

Ctrl Alt numpad - send to corner (similar to Win-arrow on windows)

of which Ctrl-alt-5 also works out as Maximize

F11 fullscreen Ctrl Win Maximize

Ubuntu notes

Releases and their names

Releases are usually referred to as the first part of their codename, e.g. lucid, precise, trusty, xenial


  • Ubuntu 10.04 - Lucid Lynx (LTS)
  • Ubuntu 10.10 - Maverick Meerkat
  • Ubuntu 11.04 - Natty Narwhal
  • Ubuntu 11.10 - Oneiric Ocelot
  • Ubuntu 12.04 - Precise Pangolin (LTS)
  • Ubuntu 12.10 - Quantal Quetzal
  • Ubuntu 13.04 - Raring Ringtail
  • Ubuntu 13.10 - Saucy Salamander
  • Ubuntu 14.04 - Trusty Tahr (LTS)
  • Ubuntu 14.10 - Utopic Unicorn
  • Ubuntu 15.04 - Vivid Vervet
  • Ubuntu 15.10 - Wily Werewolf
  • Ubuntu 16.04 - Xenial Xerus (LTS)
  • Ubuntu 16.10 - Yakkety Yak
  • Ubuntu 17.04 - Zesty Zapus
  • Ubuntu 17.10 - Artful Aardvark
  • Ubuntu 18.04 - Bionic Beaver (LTS)

You can figure out which you are using using:

cat /etc/issue

LTS refers to Long Time Support releases, meaning that they will be supported three (for desktops) or five (for servers) years instead of two.

See also

Window manager behaviour

You can send windows to a specific part of the screen with CtrlAltkeypad

Additional (proprietary) drivers

Used to be called jockey up to Ubuntu 12, with a CLI variant called

Now the GUI part is called "Additional drivers", the CLI part is
, but note that it does not itself install specific drivers.

It does mention their package names, though, so it's mostly an apt-get install away.


To list all things registered here (most with just one option):

ls /var/lib/alternatives /etc/alternatives

Some also have:

update-alternatives --get-selections

See also:

On updates

Automatic updates can be thought of as two parts:

  • update knowledge of packages from the repositories
  • notice what to do with these changes (automatic install, notifications, etc. There may be more than one piece of software doing this)

Disable updates / notifications

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

Things relating to the update system include:

  • automatic background
    apt-get update
  • the sources that update pulls from
  • checks whether the current state has any packages that can be updated
  • the various notifiers and updater utilities that exist
  • "new version of ubuntu" check

You may wish to tackle the update notification rather than the repository update, because chances are something (or you) will run apt-get update anyway, after which you'll get notifications again.

There is more than one utility that can be saying this, and they can be hooked in in different ways (mostly changes over time).

update-notifier is apparently the thing that launches update-manager according to the settings mentioned above.

The most certain, but also overkill way is to remove these (
apt-get remove update-notifier update-manager

but this removes more features than you probably want.

your options seem to be
  • avoid update-notifier from being started
look at /etc/xdg/autostart - chances are there's a update-notifier.desktop in there.
  • ask update-notifier to be silent (verify)
Under GNOME (and as of this writing), you can use
and in dconf under com, ubuntu, update-notifier
Check no-show-notifications (
gsettings set com.ubuntu.update-notifier no-show-notifications true
and/or uncheck auto-launch, if present (
gsettings set com.ubuntu.update-notifier auto-launch false
auto_launch may be outdated, though?(verify)
These things may have been in different places before

TODO: complete this

Unattended upgrades

See also

(need to read these myself)

Cleaning up space

RHEL / Fedora / Centos notes


Redhat seems to have also done the path of sysv to upstart to systemd.

So see Init systems and service management


Extra ones you may care about

  • EPEL (Extra Packages for Enterprise Linux) [1]
for things like node.js, munin, ganglia, mono, mediawiki, torque
Aims to provide a full stack of and recent PHP stuff.
  • RPM Fusion [3]

Add, remove


yum repolist


yum-config-manager --disable name

Yum command cheat sheet


perf interrupt took too long...

perf interrupt took too long (17338 > 5000), lowering kernel.perf_event_max_sample_rate to 25000

This is the kernel part of the perf tool, which samples the kernel itself.

When sampling itself seems to take too much time, it decides to sample less often, because it assumes it might be affecting performance.

You would expect to see at bootup, when CPUs scale down significantly, and sometimes under heavy load. because this is effectively an auto-tuning process, and completely benign.

See also: