Linux user notes
Linux-related notes
Shell, admin, and both:
|
General
Messages/errors
perf interrupt took too long...
perf interrupt took too long (17338 > 5000), lowering kernel.perf_event_max_sample_rate to 25000
tl;dr:
- you can ignore this, it's completely benign
- it comes from the in-kernel measurement part of perf
- it's tuning down the rate it samples, down to minimal impact on this particular hardware (and current load)
Perf, samples various parts of the kernel. See e.g. http://www.brendangregg.com/perf.html on how this can be useful.
Some of the sampling is done in interrupt handlers, and when one such call takes more time than expected, this could imply interrupts might start queueing and bottlenecking. Not even necessarily, but it still takes the safer route and decides to call that interrupt less often from now on, to avoid potentially affecting host performance.
When you use perf, or might ever use it for a "why is my system currently sluggish" checks, you want to leave it on and still have it sample itself at a decent rate.
You will always see the above message, because the default rate at bootup is set higher than most CPUs can handle, so that it scales down to balance for however fast your host is. So it would be weird to not see this at bootup. You'll also probably see it the first time CPUs scale down significantly (often a little later), and sometimes under heavy load.
See also:
- Documentation/sysctl/kernel.txt, search for perf_cpu_time_max_percent
- https://stackoverflow.com/questions/48457273/how-to-change-perf-event-open-max-sample-rate
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 version to go with.
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 newish 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. Did this in various linux variants (but specifically, sprang up in Ubuntu 12, worked fine in 11).
- 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 nomodeset 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 update-grub.
Fan control
To control the fan speed, e.g. via nvidia-settings (also the CLI(verify)), you need
- to start an X server for every card you want to control
- ...with an X extension called NV-CONTROL
- have CoolBits 4 in your X configuration for each device
For added headless cards (e.g. on compute workstations):
- X server will (pretty sensibly) only launch when there is a monitor
- given that monitors are normally auto-detected, you need to configure a fake monitor for each card that doesn't actually have one.
- Note that you don't have to keep this X server running - there are tricks around that.
Example: You have two GTXes, one with a monitor, one without:
# 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, you can use nvidia-settings to write out its current configuration (which will be just the cards with monitors currently connected, but you can write the rest).
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" EndSection
The other is headless, so you need to fake a monitor, to get an X server, to get fan control, by adding something like:
Section "Device" Identifier "Device1" Driver "nvidia" VendorName "NVIDIA Corporation" BusID "PCI:3:0:0" Option "Coolbits" "4" EndSection Section "Screen" Identifier "Screen1" Device "Device1" Monitor "Monitor1" DefaultDepth 24 SubSection "Display" Depth 24 EndSubSection Option "ConnectedMonitor" "CRT" Option "TwinView" "0" Option "Stereo" "0" Option "metamodes" "nvidia-auto-select +0+0" EndSection Section "Monitor" Identifier "Monitor1" VendorName "Unknown" ModelName "CRT-N" HorizSync 28.0 - 33.0 VertRefresh 43.0 - 72.0 Option "DPMS" EndSection
(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
Adding:
Screen 1 "Screen1"
(note: don't add relative positioning, or it'll actually be part of your multimonitor layout(verify))
Now restart X (typically meaning your display manager, e.g. sudo service restart lightdm) and run nvidia-settings to see that you now have control.
See also:
- http://unix.stackexchange.com/questions/200553/multi-nvidia-gpu-overclocking-for-computations-cuda
- https://wiki.archlinux.org/index.php/NVIDIA/Tips_and_tricks#Set_fan_speed_at_login
- https://sites.google.com/site/akohlmey/random-hacks/nvidia-gpu-coolness#TOC-Faking-a-Head-for-a-Headless-X-Server
- https://hashcat.net/forum/thread-4569.html
nvidia-settings CLI
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
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 10.0 required nvidia driver 410.48
- CUDA 9.2 Update 1 required nvida driver 396.37
- CUDA 9.2 required nvidia driver 396.26
- CUDA 9.1 required nvidia driver 384.81
- CUDA 9.0 required nvidia driver 375.26
- CUDA 8.0 required nvidia driver 367.48
- CUDA 7.5 required nvidia driver 352.31
- CUDA 7.0 required nvidia driver 346.46
- CUDA 6.5 required nvidia driver 340
- CUDA 6.0 required nvidia driver 331(verify)
- 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
e.g.
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 export LD_LIBRARY_PATH=$PATH:$CUDA_HOME/lib64 `which myappname` }
GNOME / Unity 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 https://extensions.gnome.org/extension/38/windows-alt-tab/
Ctrl Alt numpad - send to corner (similar to Win-arrow on windows)
- of which Ctrl-alt-5 also works out as Maximize
In Ubuntu18 this got changed to
- Win-← - to left half of screen
- Win-→ - to right half of screen
- Win-↑ - maximize
- Win-↓ - unmaximize
- Win-Shift-← - to next screen to the let
- Win-Shift-→ - to next screen to the right
F11 fullscreen
Ctrl Win Maximize
Remove "Show desktop" from alt tab, a.k.a. "I don't randomly want all my windows minimized"
- if you have unity tweak tool or compizconfig (or can install either), look at [1]
Package manager notes
Apt notes
📃 These are primarily notes, intended to be a collection of useful fragments, that will probably never be complete in any sense. |
Install/update
Mark as automatically (not manually) installed
Sometimes you end up installing dependencies specifically, but may still want to mark it in a way so that it later becomes eligible for the "automatically installed and are no longer required" style removal
apt-mark markauto packagename
update specific package
- where just install means "if installed, update. If not installed install." (also, marks as automatically installed)
- install --only-upgrade amounts to mean "if installed, update. If not installed, complain"
(either way, extra dependencies may be auto-installed)
which versions of a package can I install?
apt-cache showpkg packagename
That is, for which are there packages - dependencies of everything you have may effectively force a minimum version.
reinstall already-installed package package (e.g. to try to force a redo of its initial config)
apt-get install --reinstall packagename
Inspect
Files belonging to a specific installed package / Where is this package installed?
dpkg -L libraw-bin dlocate libraw-bin
What package does this file belong to?
dpkg -S /usr/bin/shutter dpkg -S indicator-multiload dpkg -S `which perf`
OR
apt-file search /usr/bin/shutter apt-file search indicator-multiload
OR
dlocate /usr/bin/shutter dlocate indicator-multiload
Basic metadata/description of package (installed or not)
Installed only?
apt show libraw-bin
Details of all versions(?) (status shows installed where installed)
apt-cache show libraw-bin
List of all versions(?)
apt-cache madison apache2
What installed packages depend on this?
# e.g. "I wonder how these dummy packages work" apt-cache rdepends --installed python2.7-dev python3.8-dev
What other packages, installed or not packages, depend on that?
# e.g. looking for interesting curses-based tools apt-cache rdepends libncurses6 libncurses5
Files belonging to a downloaded-but-not-installed deb package
dpkg -c /var/cache/apt/archives/libraw-bin_0.15.4-1_amd64.deb apt-file update apt-file list libraw-bin
Files belonging to a non-installed package isn't a command, but you can get close by looking at something like:
https://packages.debian.org/buster/i386/libraw-bin/filelist
...probably ending up there with a bunch of clicks starting from a search like
https://packages.debian.org/search?searchon=sourcenames&keywords=libraw
Figure out which matching packages are installed
dpkg -l "*nvidia*" | grep ^i
Neither aptitude or apt-show-versions are installed by default, but both are useful for this:
aptitude versions libraw-bin # note that this parses the dpkg status file and the APT lists apt-show-versions python
# also allows things like # apt-show-versions -r '.*python.*'
Repositories / PPAs
There is no hard difference between a repository and a PPA (Personal Package Archive), only a practical one: basic repositories contain the distribution's package management, PPAs could be any personally-managed set of packages though are usually a specific-purpose thing (and are hosted on launchpad).
Because it could still be anything, you are still expected to explicitly say "I have decided to trust you", in the form of importing the PPA's GPG key.
https://help.ubuntu.com/community/Repositories/CommandLine
Listing repositories and PPAs
Apt managers (like Software & Updates) should list them.
From the CLI, you can do:
apt-cache policy | grep http #...close enough
Or, more manually, look through:
/etc/apt/sources.list /etc/apt/sources.list.d/*
Add PPA
Often you'll get a command from whatever you want to install, e.g.
sudo add-apt-repository ppa:kdenlive/kdenlive-stable
Remove PPA/repository
Perhaps the easiest is that it should show up Software & Updates under "Other software" (or similar in other apt managers).
Note that PPAs will typically be represented by a file (that you can remove) in:
/etc/apt/sources.list.d/
The CLI command is the most work (typing):
sudo add-apt-repository --remove ppa:PPA_Name/ppa
Any of those should be followed by an:
apt update
Messages
Stuff about Ubuntu Pro
Ubuntu Pro seems to be sold as a flavour of ubuntu focsed on enterprise/cloudy stuff.
It's a security and maintenance subscription, that goes a little beyond LTS, offering a few more security updates.
For companies this is a paid service. Individuals can get free tokens for up to 5 machines.
ESM apps (Expanded Security Maintenance) seems to be canonical's name for specific packages in universe
that get security updates longer if you use Ubuntu Pro.
It's sort of an extra opt-in channel. It seems a few applications are only updated in there, so you won't be as up-to-date without ESM and Ubuntu Pro, but the difference is not large for most home use.
While this may feel like a restriction and a corporate move to get you to pay more soon, note that the main/universe split is that main was officially supported, universe was community supported[2] - in some ways this is them doing more than before)
If you consider the login messages about this spammy, you could disable that though there's no official way to do this.
“The following packages have been kept back"
'Kept back' means a new package must be installed to be able to upgrade this one, and the command you just gave was apt upgrade and not install, so it won't do that without you telling it to.
So yes, an apt install will work -- but maybe give this an extra thought, because the difference between
apt-get install package-name
Or maybe
apt-get install package-name dependency-name
is that in the latter case, that dependency will stay installed even if nothing depends on it anymore
If it's during a large-scale (e.g. distro) upgrade and the official distro update utility isn't helpful, you can force the issue via:
sudo apt-get dist-upgrade
...though keep in mind this is the somewhat careless version of the above. It cares more about resolving the dependency tree, and may remove things to do so.
Yum notes
Yum repositories
These are mostly just individual files in /etc/yum.repos.d/.
Add
In a few cases the distro itself knows about them, e.g:
sudo yum install epel-release
In other cases it's basically just adding a .repo file in /etc/yum.repos.d/, e.g. when installing subversion
Remove
You could just remove the .repo from /etc/yum.repos.d/
Or disable, via yum-config-manager --disable reponame
List
yum repolist
Distro-specific
Ubuntu notes
Releases and their names
Releases are usually referred to as the first part of their codename, e.g. lucid, precise, trusty, xenial
Names:
- 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)
- Ubuntu 18.10 - Cosmic Cuttlefish)
- Ubuntu 19.04 - Disco Dingo
- Ubuntu 19.10 - Eoan Ermine
- Ubuntu 20.04 - Focal Fossa (LTS)
- Ubuntu 20.10 - Groovy Gorilla
- Ubuntu 21.04 - Hirsute Hippo
- Ubuntu 21.10 - Impish Indri
- Ubuntu 22.04 - Jammy Jellyfish (LTS)
- Ubuntu 22.10 - Kinetic Kudu
- Ubuntu 23.04 - Lunar Lobster
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.
Ubuntu Pro
Seems to amount to LTS but longer, and covering not only the main packages but also universe set.
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 jockey-text.
Now the GUI part is called "Additional drivers", the CLI part is ubuntu-drivers, 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.
Alternatives
To list all things registered here (most with just one option):
ls /var/lib/alternatives /etc/alternatives
Some also have:
update-alternatives --get-selections
Perhaps the best introduction is editor, i.e. /usr/bin/editor. On my system this is currently symlinked to nano:
/usr/bin/editor -> /etc/alternatives/editor -> /bin/nano
The config is:
# sudo update-alternatives --config editor There are 5 choices for the alternative editor (providing /usr/bin/editor). Selection Path Priority Status ------------------------------------------------------------ * 0 /bin/nano 40 auto mode 1 /bin/ed -100 manual mode 2 /bin/nano 40 manual mode 3 /usr/bin/emacs24 0 manual mode 4 /usr/bin/mcedit 25 manual mode 5 /usr/bin/vim.tiny 10 manual mode
The auto versus manual difference is roughly that
- in auto mode, he choice is based on the highest priority among the installed options.
- in manual mode, it's based on you selecting one.
See also:
- https://www.debian-administration.org/article/91/Using_the_Debian_alternatives_system
- http://manpages.ubuntu.com/manpages/hardy/man8/update-alternatives.8.html
In theory it's not meant to be used for versioning, largely because that's too fragile (consider e.g. ABI changes). For example, gcc is not really intended to be part of this
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
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 dconf-editor 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
https://help.ubuntu.com/community/AutomaticSecurityUpdates
See also
(need to read these myself)
http://blog.tenstral.net/2015/09/update-notifications-in-debian-jessie.html
https://www.garron.me/en/linux/turn-off-stop-ubuntu-automatic-update.html
Cleaning up space
RHEL / Fedora / Centos notes
Services
Redhat seems to have also done the path of sysv to upstart to systemd.
So see Init systems and service management
RHEL repositories
Extra ones you may care about
- EPEL (Extra Packages for Enterprise Linux) [3]
- for things like node.js, munin, ganglia, mono, mediawiki, torque
- Remi [4]
- Aims to provide a full stack of and recent PHP stuff.
- RPM Fusion [5]
See #Yum notes