My blog has moved!

You should be automatically redirected. If not, visit
http://benohead.com
and update your bookmarks.

Showing posts with label Debian. Show all posts
Showing posts with label Debian. Show all posts

Friday, April 27, 2012

Debian: Configure a static IP address

In order to configure a network device statically, you have to edit /etc/network/interfaces:

# vi /etc/network/interfaces

There you can configure a static IP address and the subnet mask:

auto eth0
iface eth0 inet static
address 192.168.128.128
netmask 255.255.255.0

In order to have the changes enabled, you need to restart the network interface either with:

# /etc/init.d/networking restart
or
# /etc/init.d/networking stop
# /etc/init.d/networking start
or
# ifdown eth0
# ifup eth0

You can then check the new eth0 settings with:

# ifconfig -a

Debian: change the keyboard layout from the console

I've installed a new test system to play around a little bit (a Debian Squeeze install). Since I was too lazy to install it from scratch and I'm using VMWare anyway, I thought I'd just download a pre-installed virtual machine.

Now this virtual machine had a US keyboard configured and I'm using a German keyboard. After googling for how to change the keyboard layout from the console, I found a few hints:

dpkg-reconfigure console-data

Unfortunately the package console-data is not installed on my system.

Then I found the following:

dpkg-reconfigure keyboard-configuration

This package is installed and you can choose a keyboard layout. Great !

After saving, I pressed "Z" and got a "Y" on the console. So still having a US keyboard configured.

Since keyboard-configuration modifies the file /etc/default/keyboard, I checked this file:

# cat /etc/default/keyboard
# Check /usr/share/doc/keyboard-configuration/README.Debian for
# documentation on what to do after having modified this file.
 
# The following variables describe your keyboard and can have the same
# values as the XkbModel, XkbLayout, XkbVariant and XkbOptions options
# in /etc/X11/xorg.conf.

XKBMODEL="pc105"
XKBLAYOUT="de"
XKBVARIANT="nodeadkeys"
XKBOPTIONS=""

# If you don't want to use the XKB layout on the console, you can
# specify an alternative keymap. Make sure it will be accessible
# before /usr is mounted.
# KMAP=/etc/console-setup/defkeymap.kmap.gz

Everything looks fine... But the hint in the beginning of the file might be pointing to the solution. So let's check this README.Debian file:

# cat /usr/share/doc/keyboard-configuration/README.Debian
After modifying /etc/default/keyboard, you can apply the changes to the linux console by running setupcon. If X is configured to use that file too, then the changes will become visible to X only if

udevadm trigger --subsystem-match=input --action=change

There is the solution:

#setupcon

And the keyboard layout is German !!

Monday, April 23, 2012

Debian: Remove packages in status rc

The status rc says that the package was removed but the configuration files are still on disk. This happens either when the packages are deleted with apt-get remove or they are automatically removed due to a dependency. In this second case, it also happens if the main package was purged and not only removed.

You can determine which package are in this status with:

# dpkg -l | grep ^rc

So executing this will return only the names of all these packages:

# dpkg -l | grep ^rc | awk '{print $2}'

And to purge all these packages:

# dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P

If you want to first see what dpkg would do, use:

# dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg --no-act -P

Wednesday, April 18, 2012

Debian Lenny: 404 when using apt-get

Support for Debian 5 (Lenny) has been officially discontined on February, 6th 2012. All Lenny software packages have been removed from Debian mirrors and whenever you use apt-get update or apt-get install to update or install new packages, you get an error message:

W: Failed to fetch <URL> 404 Not Found


It is of course recommended to upgrade to Debian 6 (Squeeze). But if you still want to update packaged for Lenny, you need to update the following in /etc/apt/sources.list:

deb http://ftp.de.debian.org/debian/ lenny main
deb-src
http://ftp.de.debian.org/debian/ lenny main

to:

deb http://ftp.de.debian.org/debian-archive/debian/ lenny main
deb-src
http://ftp.de.debian.org/debian-archive/debian/ lenny main

(replace ftp.de.debian.org by the repository you actually want to use)

After an apt-get update you can install Lenny packages again (although it is really recommended to upgrade to Squeeze).