Difference between revisions of "Ubuntu notes"
Line 24: | Line 24: | ||
sudo update-alternatives --set editor /usr/bin/vim.basic | sudo update-alternatives --set editor /usr/bin/vim.basic | ||
sudo update-alternatives --set editor /usr/bin/vim.python | sudo update-alternatives --set editor /usr/bin/vim.python | ||
+ | </pre> | ||
+ | |||
+ | === some others that I like to set === | ||
+ | |||
+ | <pre> | ||
+ | sudo update-alternatives --set pager /usr/bin/vim-pager-wrapper | ||
+ | sudo update-alternatives --set x-terminal-emulator /usr/bin/urxvt | ||
+ | sudo update-alternatives --set www-browser /usr/bin/w3m | ||
+ | sudo update-alternatives --set x-www-browser /usr/bin/firefox | ||
</pre> | </pre> | ||
Revision as of 06:40, 1 November 2008
I like Ubuntu. Every Linux distro has quirks, but I like working with Ubuntu quirks more than any others.
Contents
what security updates do I need?
Report which packages need security updates:
apt-get update apt-get --dry-run upgrade | grep "^Inst" | grep "-security"
Set default binaries for MIME types
Use the 'update alternatives' system. To interactively set the default editor for any text editable MIME type:
sudo update-alternatives --config editor
Or just set it to Vim directly use one of the following:
sudo update-alternatives --set editor /usr/bin/vim.basic sudo update-alternatives --set editor /usr/bin/vim.python
some others that I like to set
sudo update-alternatives --set pager /usr/bin/vim-pager-wrapper sudo update-alternatives --set x-terminal-emulator /usr/bin/urxvt sudo update-alternatives --set www-browser /usr/bin/w3m sudo update-alternatives --set x-www-browser /usr/bin/firefox
unknown group in statusoverride file
This has only happened to me once, but you may also see an error like this when using a package manager:
dpkg: syntax error: unknown group `Debian-exim' in statusoverride file E: Sub-process /usr/bin/dpkg returned an error code (2)
This is due to a faulty package removal. The package maintainer may have forgotten to remove the override when uninstalling a package. Usually it is safe to fix this by manually running something like the following:
dpkg-statoverride --remove /etc/exim4/passwd.client
How to unmark all packages marked to be upgraded in aptitude
If you hit 'U' to mark all upgradable packages to be you may change your mind and decide that you don't want to risk upgrading 20 different system critical packages. The trick is that it difficult to convince Aptitude to forget about these queued packages. You can select each one and hit '-' to unmark them, but that can be a drag is you have a lot of them in the list. Oddly, aptitude does not provide a way to unmark them all from inside the curses GUI, but you can easily do this from the command-line:
aptitude keep-all
selecting text in Aptitude
Aptitude takes control of the mouse which disables xterm mouse text selection. To override this simply hold SHIFT while you select text with the mouse.
supporting old releases in apt
Sometimes you find yourself needing to support an old release of Ubuntu and the original apt repositories are no longer supported or mirrored. Luckily, Ubuntu archives the old repositories at http://old-releases.ubuntu.com/ubuntu/dists/. You will need to update your /etc/apt/source.list file. For example, if you wanted to have access to edgy you would add the following to the top of sources.list:
deb http://old-releases.ubuntu.com/ubuntu/ edgy-updates main restricted deb http://old-releases.ubuntu.com/ubuntu/ edgy-security main restricted deb http://old-releases.ubuntu.com/ubuntu/ edgy main restricted deb http://old-releases.ubuntu.com/ubuntu/ edgy universe deb http://old-releases.ubuntu.com/ubuntu/ edgy-security universe
rc.d maintenance
This covers `sysv-rc-conf` and `update-rc.d`.
sysv-rc-conf
The `sysv-rc-conf` command similar to RedHat's `chkconfig`. It is intended as an easy user interface to the rc.d links. It’s a replacement for programs like ntsysv(8) or rcconf(8).
If you just run it with no options it will start a curses console GUI. It's pretty simple to use.
sysv-rc-conf
You can also perform all actions through CLI options similar to `chkconfig` except there are no --add and --del options. You don't need them -- just put your new start-stop script in /etc/init.d and use the 'on' or 'off' described commands below. The 'on' and 'off' commands work on run-level 2,3,4,5 by default.
sysv-rc-conf --list sysv-rc-conf --list consolekit sysv-rc-conf consolekit on sysv-rc-conf consolekit off
update-rc.d
The `update-rc.d` command is more intended for use in scripts that manage rc.d links. Use this if you want to install new default links to a start-stop script. It will do nothing if any links already exist. A start-stop should have a comment section that starts with '### BEGIN INIT INFO'. This is used to define the default run level actions. To install a new start-stop script with the defaults use this:
update-rc.d foobar defaults
ConsoleKit -- AKA console-kit-daemon
You may see this daemon running and wonder what the hell it's for. It does a lot of stuff that I don't need at the moment. The simplest explanation is that ConsoleKit is used to implement "fast user switching" -- you know, where you can switch to a different user without logging the current user out. It is annoying that there are no man pages for it, but you can find some documentation under /usr/share/doc/consolekit. ConsoleKit was initially written by William Jon McCann. The homepage for it is here http://freedesktop.org/wiki/Software/ConsoleKit.
You can shutdown ConsoleKit -- this seems harmless:
/etc/init.d/consolekit stop