- Debian Tips
- Changing the Hostname
- Package Mangement
- Package Versions
- Package Priority
- Downgrading
- Removing packages with broken scripts
- Repository
- Chkrootkit
- Producing and using website statistics
- Automount with Gnome
- System V init scripts
- Boot command line
- Default Editor
- Installing and building from source packages
- Fixing mpg123
Debian Tips
Changing the Hostname
Basically /etc/hostname must contain only the host name, not the fully qualified domain name.
How the domain name is determined varies according to your setup (getting it either from a DNS service or from /etc/hosts). See man hostname for details, but often it'll be read from /etc/hosts which has an entry that includes the fully qualified domain name, either for 127.0.0.1 or for the static IP address if you have one. It seems to need to be the first entry for the particular IP address, e.g.
$ head -n 2 /etc/hosts
82.71.196.65 www.smartpixie.com www
127.0.0.1 localhost localhost.localdomain
or if only local interface, (but not very sure about this) or what to do if using DHCP:
$ head -n 1 /etc/hosts
127.0.0.1 www.smartpixie.com www localhost localhost.localdomain
Debian determines the fully qualified host name during boot by running /etc/init.d/hostname.sh so after making the changes:
# /etc/init.d/hostname.sh start
Note: stop does nothing in the hostname.sh script
To check that all is correct:
$ hostname
www
$ hostname --fqd
www.smartpixie.com
See also http://www.debian.org/doc/manuals/reference/ch-gateway.en.html
Package Mangement
Specifying the interface and priority
Run the following to change either the interface you wish to use during package installs or the level of configuration questions you are prompted for.
- dpkg-reconfigure debconf
The defaults are usually 'Dialog' and 'medium'
Reinstalling
Extract from http://lists.debian.org/debian-user/2004/10/msg01103.html
<quote>
The following command will reinstall all packages on your system:
COLUMNS=200 dpkg -l | awk '/^ii/ {print $2}' | xargs apt-get --reinstall install
</quote>
Package Versions
- apt-show-versions | grep /testing
Package Priority
The following shows which package the apt mechanism is choosing
- apt-cache policy mypackage
To show the priority of each source
- apt-cache policy
For example:
cat /etc/apt/sources.list
deb http://security.debian.org/ stable/updates main contrib non-free
deb http://ftp.uk.debian.org/debian/ sarge main contrib non-free
deb http://ftp.uk.debian.org/debian-non-US sarge/non-US main contrib non-free
deb http://ftp.uk.debian.org/debian/ etch main
deb http://volatile.debian.net/debian-volatile sarge/volatile main contrib non-free
cat /etc/apt/apt.conf
APT
{
Default-Release "stable";
Clean-Installed "false";
Get
{
List-Cleanup "true";
};
};
Note: the 'Default-Release' statement gives that source a priority of '990'
cat /etc/apt/preferences
Package: *
Pin: release o=volatile.debian.net,a=sarge,l=debian-volatile
Pin-Priority: 999
Package: *
Pin: release a=testing,o=Debian
Pin-Priority: -10
Downgrading
To downgrade from testing to stable
Set up your /etc/apt/preferences as follows:
Package: *
Pin: release a=stable
Pin-Priority: 1001
Package: *
Pin: release a=testing
Pin-Priority: 60
Package: *
Pin: release a=unstable
Pin-Priority: 50
You also might need to temporarily remove APT::Default-Release "stable" from /etc/apt/apt.conf as it seems to prevent downgrading
Then run
# apt-get --dry-run dist-upgrade
Remove the --dry-run option once it all looks OK.
Use
$ apt-show-versions | grep /testing
To find any remaining packages. Some packages are risky to downgrade, e.g. libc6, so don't worry if not absolutely everything downgrades. For further hints on removing packages that fail to downgrade:
See also Downgrading report from testing to stable
-- Frank Dean - 16 Mar 2007
Removing packages with broken scripts
The install/remove scripts are all under /var/lib/dpkg/info/ named by their package.
If you can't fix the script, you can have it ignore errors by removing the '-e' flag to #!/bin/sh or comment out the 'set -e' line in the script.
See http://www.debian-administration.org/articles/251
-- Frank Dean - 20 Mar 2007
Repository
http://www.debian.org/doc/manuals/repository-howto/repository-howto
Chkrootkit
False reports of LKM Trojan
http://lists.debian.org/debian-user/2004/03/msg00282.html
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=222179
Producing and using website statistics
http://www.debian-administration.org/articles/85
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=341308
Automount with Gnome
Make sure Gnome is set to automount devices. Desktop | Preferences | Removable Drives and Media
Add your user name to the plugdev group
- grep plugdev /etc/group
- sudo adduser me plugdev
Logout and log back in and automounting should be working!
System V init scripts
Have a look at the 'update-rc.d' command for an easy way to amend the symbolic links for the startup scripts.
Boot command line
To see how the system was booted:
$ cat /proc/cmdline
Default Editor
Administrators who wish to change the default editor for all users will have to update the alternatives system using:
Adminstrator can update the default editor with:
# update-alternatives --config editor
Users should define the EDITOR environment variable by including the following lines in their profile:
EDITOR=vi
export EDITOR
alias editor=$EDITOR
Installing and building from source packages
http://www.uk.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-sourcepkgs
$ apt-get source foo
$ : Check for build dependencies
$ sudo apt-get build-dep foo
Use '--download-only' for the apt-get source command if you do not want the download to be unpacked.
To build, download the .dsc, .tar.gz and .diff.gz source files.
If they need extracting into a package subdirectory:
$ dpkg-source -x foo_version-revision.dsc
To compile the binary:
$ cd foo_version-revision
$ dpkg-buildpackage -rfakeroot -b
Add '-tc' to the dpkg-buildpackage command to clear the directory tree after the build completes, i.e.
$ cd foo_version-revision
$ dpkg-buildpackage -rfakeroot -b -tc
The deb package will be created in the directory above the build directory.
If can then be installed with:
# dpkg -i ../foo_version-revision_arch.deb
Fixing mpg123
Running mpg123 under Debian 5 (Lenny) results in the following error:
[module.c:110] error: Failed to open module alsa: file not found
See Bug #561857
Fix by running with a specified library path:
$ LD_LIBRARY_PATH=/usr/lib/mpg123 mpg123 myfile.mp3
or use mp3blaster instead ;-)
-- Frank Dean - 3 Apr 2010
Related Topics: AptitudeTips, GnomeTips, JigdoTips, CreatingRescuePartition, SystemVStartupScripts
-- Frank Dean - 15 Dec 2004