Difference between revisions of "Linux user notes"
m (→Repositories) |
m (→Repositories) |
||
Line 400: | Line 400: | ||
− | ===Repositories=== | + | ===Repositories / PPAs=== |
{{stub}} | {{stub}} | ||
Revision as of 12:54, 15 May 2019
Linux-related notes
Shell, admin, and both:
|
Contents
- 1 General
- 2 Package manager notes
- 3 Distro-specific
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 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. 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:
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
- for each, have CoolBits 4 in your X configuration
For headless cards (typical for compute):
- 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 X 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.
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))
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
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 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
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) |
shorter forms
Many of us are used to:
apt-cache search openmpi apt-get install openmpi-bin
There is also a shorter form:
apt search openmpi apt install openmpi-bin
specific-package stuff
update specific package
...and dependencies (only?(verify) when versions say it must.
apt-get install --only-upgrade packagename
which versions of a package can I install?
sudo 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
apt-get install --reinstall packagename
Repositories / PPAs
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) |
There is no technical difference between a repository or PPA (Personal Package Archive), only a practical one: basic repositories define the distribution's package management, PPAs could be any personally-managed collection of packages -- but 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
“The following packages have been kept back"
'Kept back' means a new package must be installed to be able to upgrade this one, and it won't do so fully automatically.
If it's just one or two cases, then you can probably figure out the dependency, decide it's okay, and install it explicitly:
apt-get install package-name depdency-name
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.
Inspection
Files in a package
Files belonging to an installed package: -L / --listfiles
dpkg -L libraw-bin dlocate libraw-bin
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 you'll need a browser for (and a choice of version, here wheezy)
http://packages.debian.org/wheezy/all/libraw-bin/filelist
Tell me more about a package
apt-cache show libraw-bin apt show libraw-bin
What package does this file belong to?
dpkg -S /usr/bin/shutter dpkg -S indicator-multiload apt-file search /usr/bin/shutter apt-file search indicator-multiload dlocate /usr/bin/shutter dlocate indicator-multiload
Version information
Figure out which matching packages are installed
dpkg -l *nvidia* | grep ^i
apt-show-versions python
aptitude versions python-matplotlib
List of manually installed packages
No direct way, but a few decent approximations.
Apt logs its command history, so the following is a start (half of this is just formatting one package name per line)
(zcat /var/log/apt/history.log.*.gz ; cat /var/log/apt/history.log) | sed 's/apt-get install //p' | tr ' ' '\n' | sort -u
Note that this does not reflect the current state of the system, when any package led to uninstall of another, or you manually removed things. Also it doesn't mention what wildcards resolved to.
All packages, minus those in the initial install, minus things installed as dependencies. This still leaves in some updates.
zcat /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u > initial # Installed things apt-mark showmanual | sort -u > manualmostly apt-mark showauto | sort -u > auto cat initial auto | sort -u > boring # Print entries unique to the first file: comm -23 manualmostly boring
Props to / based on http://unix.stackexchange.com/questions/3595/list-explicitly-installed-packages/3624 and http://askubuntu.com/questions/32007/how-to-find-manually-installed-packages
You may also care about residual-config, roughtly stuff that gets left over after a distribution upgrade.
dpkg -l | grep '^rc' | awk '{print $2}' > residual
Yum notes
Repositories
These are mostly just individual files in
Add
In a few cases the distro itself knows about them, e.g:
sudo yum install epel-releaseIn other cases it's basically just adding a .repo file in
e.g. when installing subversion
Remove
You could just remove the .repo from /etc/yum.repos.d/
Or disable, via
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)
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
- http://en.wikipedia.org/wiki/Ubuntu_(Linux_distribution)#Release_History
- http://en.wikipedia.org/wiki/List_of_Ubuntu_releases#Version_timeline
http://www.techotopia.com/index.php/Ubuntu_Linux_Essentials
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
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
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.
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-editorand 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)
- Check no-show-notifications (
- 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
Repositories
Extra ones you may care about
- EPEL (Extra Packages for Enterprise Linux) [2]
- for things like node.js, munin, ganglia, mono, mediawiki, torque
- Remi [3]
- Aims to provide a full stack of and recent PHP stuff.
- RPM Fusion [4]
See #Yum notes