Install Debian from USB

Download the boot.img.gz and zcat it to the USB stick after making sure it’s unmounted:

wget http://ftp.nl.debian.org/debian/dists/stable/main/installer-amd64/current/images/hd-media/boot.img.gz
zcat boot.img.gz > /dev/sdc

You need to be root to zcat it to the device, replace device name with the name of your USB stick. Then mount the drive, download the netinstall image and copy it to the drive:

mkdir /mnt/usb
mount /dev/sdc /mnt/usb
wget http://cdimage.debian.org/debian-cd/6.0.4/amd64/iso-cd/debian-6.0.4-amd64-netinst.iso
cp debian-6.0.4-amd64-netinst.iso /mnt/usb

Now the stick should be ready to boot with.

Bash while-loop

In my bash scripts I often need to loop through lines in a file (or from stdout) to look for something. I have two ways of doing this, one way I use when I have a file to loop through and another when I’m just going to loop through the output from a command. From file:

while read LINE; do
echo “$LINE”
done < /path/to/file

And from output:

datastrings=”`ls -l /home`”
while read LINE; do
echo “$LINE”
done <<< “$datastrings”

Note that the redirect used in the second method is a bit “fancy” and is not supported as often as the first method.

Replace word in line

I prefer using sed for this, to replace only the first occurence of the word in a line use:

sed -ie ‘s/oldstring/newstring/’ /path/to/file

Or if you want to replace all occurrences of a word in a line:

sed -ie ‘s/oldstring/newstring/g’ /path/to/file

Check if network cable is plugged in

There are two common ways to test this, either by digging in /sys or using ethtool, here is how to using /sys:

cat /sys/class/net/eth0/carrier

If this returns 1 the interface has a cable plugged in. Here is how to using ethtool:

sudo ethtool eth0 | grep Link

Should return “Link detected: yes” if a cable is plugged in.

Scan for SSH-servers with nmap

Using nmap it is (among many other things) possible to scan for machines listening on port 22, meaning they are most likely running SSH on that port.

apt-get install nmap

nmap -p 22 –open -sV 10.0.0.0/24 | grep Interesting

This will return the IP-addresses of the machines listening on port 22.

Debian Preseed LVM bug

I’ve been wrestling for a while now with a most annoying bug (described towards the end in this bug report) in the Debian installer, if you want to install with LVM but there already exists a volume group with the same name as the one you want to create the installer will fail. This is very annoying if you want to be able to run the same preseed whenever you want to reinstall a machine. The only solution I’ve found so far is to use the partman/early_command option to run a dd wipe on the hard drive the volume group is located on, here is the excerpt from my preseed config:

d-i partman/early_command string dd if=/dev/zero of=/dev/cciss/c0d0 bs=1M count=300

You will probably want to replace /dev/cciss/c0d0 with for instance /dev/sda or whatever is your hard drive.

Linux Mint look on Debian

If you already are on Debian testing there is nothing to worry about, if you are on stable however you’ll need to install packages from testing which might cause things to break on your system. You have been warned.

First we need to grab the Linux Mint stuff with icons, GTK themes etc:

mkdir ~/mint
cd ~/mint
wget http://packages.linuxmint.com/pool/main/m/mint-x-theme/mint-x-theme_1.0.5_all.deb
wget http://packages.linuxmint.com/pool/main/m/mint-x-icons/mint-x-icons_1.0.7_all.deb
dpkg -i mint-x-icons*
dpkg -i mint-x-theme*

Then we need a newer version of gtk2-engines-murrine than the one available in Debian Squeeze so we turn to testing by first adding the following to /etc/apt/preferences.d/pref (you’ll have to create the file):

Package: *
Pin: release a=stable
Pin-Priority: 900

Package: *
Pin: release o=Debian
Pin-Priority: -10

And add the following line to your /etc/apt/sources.list:

deb http://ftp.se.debian.org/debian/ testing main contrib non-free

Then we update the apt cache and grab our package by specifically telling apt to get it from testing:

apt-get update
apt-get -t testing install gtk2-engines-murrine

Now we just have to activate the Mint themes, you do this by using the Appearance tool located in the Preferences directory in the menu and (in Debian LXDE) the Openbox Configuration Manager also found in the Preferences directory.

Aurora on Debian Squeeze/Testing

Mozilla have a nice website with instructions on how to install Firefox Aurora on Debian Squeeze and Testing, although there are different instructions for Squeeze and Testing you actually have to follow the instructions for Squeeze even if you’re on Testing because of some bug with dependencies. Here is how you do it:

Add the following lines to /etc/apt/sources.list:

deb http://backports.debian.org/debian-backports squeeze-backports main
deb http://mozilla.debian.net/ squeeze-backports iceweasel-aurora

Then install the GPG-key to authenticate the added repository:

cd /tmp
wget http://mozilla.debian.net/pkg-mozilla-archive-keyring_1.0_all.deb
dpkg -i pkg-mozilla-archive-keyring_1.0_all.deb

And finally update the apt cache and install:

apt-get update
apt-get install -t squeeze-backports iceweasel

Sun Java for Debian

Recently had some trouble getting the Sun Java plugin working in Iceweasel (firefox), as it turned out the problem wasn’t Iceweasel but rather a systemwide setting in Debian that controls what Java platform is preferred. Here are the steps I followed from beginning (installing the Sun Java package) to the end (making it the preferred Java platform);

First edit your /etc/apt/sources.list to add a repo for non-free packages if you haven’t already;

Add this line: deb http://ftp.se.debian.org/debian squeeze main contrib non-free

Then install the Sun Java runtime and plugin packages after updating your package cache;

apt-get update
apt-get install sun-java6-jre sun-java6-plugin

Finally we make Sun Java the preferred Java platform;

update-alternatives –config java
Enter the number for java-6-sun which should be the last entry in the list and press enter

Try it in your browser! In Iceweasel/Firefox you should now see “Java(TM) Plugin” listed under Tools>Addons>Plugins.

Siduction, new distro

Being a regular reader of Distrowatch I recently noticed something interesting, a new distribution forked from aptosid, based on Debian’s unstable branch. The new distribution is Siduction and claims to be more community-oriented compared to aptosid. After doing a bit of reading on their website I decided there was three things I really liked about the project:

  1. The distro is based on Debian’s unstable branch which means fairly up to date software and a heapload of packages available
  2. It was available bundled with Xfce, a desktop environment that have turned into a refuge for former Gnome-users unimpressed with the direction Gnome is taking these days
  3. The team appeared focused on making the project a community effort, ready to listen to the wishes of the users

So I decided to give it a go on my netbook, see if it was maybe good enough to replace my install of Linux Mint Debian Edition.

Continue reading ‘Siduction, new distro’