Showing posts with label administration. Show all posts
Showing posts with label administration. Show all posts

Adorn a dumb terminal

 Sometimes, you need to sit in front of a servers terminal, one without any window manager.
So you lack the cut&paste function of your mouse.
And to make things worse, it's keyboard isn't your native one, so you start trying out certain characters like . / and so on.

An administration nightmare!

So here come some instructions to get rid of these burdens so you can focus on the real problems.

Set your favourite keyboard

Just load another keyboard translation table that fits your fingers needs:

loadkeys [keymap]

# Examples:
# loadkeys de   # german keymap
# loadkeys es   # spanish keymap
Available keymaps can be found mostly in /lib/kbd/keymaps.

Cut&paste mouse functionality

If your server has internet connection than go and install the gpm package, a cut and paste utility and mouse server for virtual consoles, which permits to use your mouse on the terminal, even if it's very basic it permits selection and pasting with middle button.
# Install the gpm package
yum install | apt-get install | etc.   gpm

# Launch the daemon
gpm -m /dev/input/mice -t exps2

SSH key handling

If you have to work with servers, especially with Linux ones, sooner or later you'll have a confrontation with SSH.

I'll give here some tips and tricks I used so far.

Force user and port for certain servers

When you try to login into a server, by default ssh uses your username and port 22 by default.
But maybe you need to use always another user name or another port.
You could specify this always as parameters for ssh:
ssh -p 22022 [notme@]server-ip

But it is much easier to configure your ssh client to these by default.
Therefore, you just add the following to your ~/.ssh/config file:
host server-ip another-server-name
Port 22022
User notme

host *
User root
You can put here as many hosts with different parameters as you want, '*' is also supported for creating regular expressions.

Change order of authentication methods

There's a another very useful parameter that you might want to add to your server configurations:
host *
User root
PreferredAuthentications publickey,password

This would only allow to use keys or passwords and prevents to use other methods which might not work in your setup and slow down connection attempts.
Put this whenever you notice that it take several seconds to log into a server.

Copy your own key to server

This used to be the first step I do, whenever I access a certain server several times.
So I don't have to give the password each time I access the server.
# Copy my machines public key to the server (will prompt for password):
ssh-copy-id [user@]server-ip

# Unfortunately, ssh-copy-id only works with SSH port 22, so if you have to specify another
# one, you might use this instruction:
ssh-add -L | ssh -p22022 [user@]server-ip "umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys"

# Verify the granted access (now without password prompt):
ssh [user@]server-ip
# or when copying
scp afile.txt server-ip:test/ 

Fix non-working ssh public keys

Sometimes, the sshd server doesn't accept a previous copied ssh-key (ssh-copy-id). In that case, make sure you have the following configuration in /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

# If it still doesn't work apply the correct permissions to folders and files:
# chmod go-w ~
# chmod 700 ~/.ssh
# chmod 600 ~/.ssh/authorized_keys

# If it still doesn't work, then disable the permissions checking:
StrictModes no
Restart the ssh daemon again after applying this new configuration.

Debugging and sorting out further problems

The permissions of files and folders is crucial. You can get debugging information from both the client and server. if you think you have set it up correctly, yet still get asked for the password, try starting the server with debugging output to the terminal. /usr/sbin/sshd -d
To connect and send information to the client terminal ssh -v ( or -vv) username@host's

Remove authorized keys

If you have hundreds of keys in your machines ~/.ssh/authorized_keys and you're to lasy to edit that by hand, these one-line shell commands maybe handy.
Just use sed to rip out anything which doesn’t match the regex pattern (for example machine names, part of the hash, whatever:
# rip out anything which doesn’t match the regex pattern
sed ‘/your host name/ ! D’ -i.old ~/.ssh/authorized_keys

# or something more complicated
sed ‘/\(host1\|host2\)/ ! D’ -i.old ~/.ssh/authorized_keys

# with many patterns it is easier with this command
cp ~/.ssh/authorized_keys{,.old} && for p in pat1 pat2 pat2 ; do sed '/$pat1/ ! D' ~/.ssh/authorized_keys ; done

Just the ones specified will be maintained, a backup file will be created.
If you want to do the opposite, remove some specific keys and let the rest untouched:
sed ‘/\(host1\|host2\)/ D’ -i.old ~/.ssh/authorized_keys

Mint Update Manager does not show Changelogs

If you are using Linux Mint, you might have noticed that the latest versions ship with an Update Manager that is able only to show you Changelogs of the packages from the Mint repositories and often they are cut off.

After searching through bug reports and forums finally I prepared a change of the underlying Python code which resolves the issue.

I hope they will integrate similar changes in the next version.

For more details you can have a look at these bug reports, where I got ideas and copied parts:

Install instructions

You can download the needed difference file from here, or just copy and paste the following into a file named mintUpdate.py.diff:
87c87,91
<                 changelog = source
---
>                 changes = source.split("\n")
>                 for change in changes:
>                     change = change.strip()
>                     if change.startswith("*"):
>                         changelog = changelog + change + "\n"
93c97,101
<                     changelog = source
---
>                     changes = source.split("\n")
>                     for change in changes:
>                         change = change.strip()
>                         if change.startswith("*"):
>                             changelog = changelog + change + "\n"
98,102c106,111
<                 source = commands.getstatusoutput("apt-get changelog " + self.source_package) 
<                 if source[0] != 0 or source[1].startswith("Err Changelog of"):
<                     changelog = _("No changelog available") + "\n" + _("Click on Edit->Software Sources and tick the 'Source code' option to enable access to the changelogs")
<                 else:
<                     changelog = source[1]
---
>                 source = commands.getoutput("aptitude changelog " + self.source_package)                    
>                 changes = source.split("urgency=")[1].split("\n")
>                 for change in changes:
>                     change = change.strip()
>                     if change.startswith("*"):
>                         changelog = changelog + change + "\n"
Then you can apply the patch with this command, it will leave a copy of the original script:
sudo patch -lb /usr/lib/linuxmint/mintUpdate/mintUpdate.py mintUpdate.py.diff
It has been created and checked with version 4.3.8.

Install LibreOffice 3.5

The current version of LibreOffice which ships with Ubuntu Oneiric is 3.4.4.
Lately, I was getting very angry about this version, because it gave me constant trouble:
  • it looses somehow control about its lock-files, therefore I wasn't able to save my open files any longer, neither with the old nor with a new name
  • graphics in calc files suddenly jumped to another sheet when opening the files
I loved LibreOffice so far, but this behaviour really pi.... me of.
So the other day, I read about the new release 3.5, its new features and so I decided to update it by hand.

Below, you can find the update script that I programmed for that task.

After using it for some time, here I list the most interesting stuff about the new version.
  1. No problem with the lock-files any longer.
  2. Graphics stay in their sheets.
  3. Conditional formatting now lets you define more then three conditions, this was really necessary, I use that feature a lot. I'm just missing an easy way for reordering.
  4. Bigger text box for writing formulas.
  5. The import of Microsoft Visio files.
  6. The print preview of all pages.
  7. and lots more

Install instructions

Just save the following lines as InstallLibreOffice.sh and execute it with the -h parameter to see the usage text. You can also download it from here directly.
#! /bin/bash

#
## LibreOffice installation from Debian Packages from website
## @author Sven Rieke
# 

language=en-US
version="3.5.0"

function Usage() {
    cat <<EOF
Usage: ${0##*/} [-h] [-v] [-l lang-id] [p lang-id] [-d version-id] [-u]

  Options:
    -h             Show this help.
    -v             Be verbose about processing steps.
    -l lang-id     Set language for main installer and documentation (default = ${language})
    -p lang-id     Set language for interface translation (not installed by default)
    -d version-id  Specify another package version (default = ${version})
    -u             Start with a clean user-profile
 
EOF
}

function AndOut() {
    popd
    exit
}

trap AndOut ERR

########################################################################
# Interpretation and validation of command line parameters and options #
########################################################################

while getopts :hvl:d:u OPT; do
    case $OPT in
 h|+h) Usage ; exit 0     ;;
 v|+v) VERBOSE=true       ;;
 l|+l) language="$OPTARG" ;;
 p|+p) langpack="$OPTARG" ;;
 d|+d) version="$OPTARG"  ;;
 u|+u) NEWUSER=true       ;;
 *)    Usage
       exit 2
    esac
done

sudo -v

mkdir -p /tmp/LibO.3.5
pushd /tmp/LibO.3.5

#### Download from http://www.libreoffice.org/download/?type=deb-x86
[[ -v VERBOSE ]] && echo "---[ Installing LibreOffice ${version}-${language} ]" >&2
[[ -v VERBOSE ]] && echo "*** Downloading packages ***" >&2

for i in install helppack ; do
    package="LibO_3.5.0_Linux_x86_${i}-deb_${language}.tar.gz"

    if [ ! -f $package ]; then
 [[ -v VERBOSE ]] && echo "*** Downloading new package $package ***" >&2
 wget http://download.documentfoundation.org/libreoffice/stable/${version}/deb/x86/$package
    fi
done

if [ -v langpack ]; then
    package="LibO_3.5.0_Linux_x86_langpack-deb_${language}.tar.gz"
    if [ ! -f $package ]; then
 [[ -v VERBOSE ]] && echo "*** Downloading new package $package ***" >&2
 wget http://download.documentfoundation.org/libreoffice/stable/${version}/deb/x86/$package
    fi
fi

[[ -v VERBOSE ]] && echo "*** Decompressing downloaded archives ***" >&2
for t in LibO_3.5.0_*.tar.gz ; do tar xzf $t ; done

[[ -v VERBOSE ]] && echo "*** Removing old LibreOffice installation ***" >&2
sudo apt-get remove libreoffice-core

for d in $(find -maxdepth 1 -mindepth 1 -type d) ; do
    [[ -v VERBOSE ]] && echo "*** Install packages from $d ***" >&2    
    pushd $d/DEBS
    sudo dpkg -i *.deb

    if [ -d desktop-integration ]; then
 [[ -v VERBOSE ]] && echo "*** Install desktop integration ***" >&2
        cd desktop-integration
        sudo dpkg -i *.deb
        cd ..
    fi
    
    popd
done

if [ -v NEWUSER ]; then
    [[ -v VERBOSE ]] && echo "*** Remove old user profile ***" >&2
    mv ~/.config/libreoffice/3/user ~/.config/libreoffice/3/user_old
    [[ -v VERBOSE ]] && echo "*** Old one can be found in ~/.config/libreoffice/3/user_old ***" >&2
fi

AndOut

From repository

There also exists a repository which gets updated from time to time with the latest versions.
sudo add-apt-repository ppa:libreoffice/ppa
sudo apt-get update
sudo apt-get upgrade

Troubleshooting

In two installations I had trouble with my old user profile. LibreOffice claimed about templates already installed. Therefore, I added the -u switch to my install script which moves the whole user profile to a backup location, so LibreOffice will start with a new profile. Just copy your old templates to the new profile and reapply all your settings again.

Managing printers from CUPS web interface

Installed printers are listed here.
Recently, I had problems with my printer settings, I wanted to change the duplex setting and wanted to install a new network printer, but without success.
The problem I have is that in Linux Mint the Printers configuration applet fails, crashes and doesn't offer all options.

But finally I found a way. Linux Mint, like other distributions use the CUPS as printing system and it offers a web based administration interface.

Just point your web browser to http://localhost:631/. There you can add and manipulate all kind of printers and manage the print queues as well.

This is a nice workaround, until these options will be supported in the printer settings applet.

Update to Ubuntu 11.10 Oneiric Ocelot

These days, Ubuntu's new release hit the repositories, so I upgraded my three systems as soon as possible to see if some annoying Unity bugs have been solved finally. Here is the resume and the reasons why I'll evaluate to switch to KDE finally: Upgrade
During the upgrades I had two issues:
  1. Emacs got somehow broken on one system y prevented the upgrade process to finish completely. It even said, the process had been aborted, but the only thing missing was the last Cleanup step.
    I removed emacs packages and reinstalled them, then everything went fine.
  2. Screenblanker got stuck on one of my machines during upgrade, so I could hit on any button to enter the last Cleanup step.
    I connected via Remote Desktop to that machine and could finish the process correctly.
Updating custom repositories
As usual, the upgrade process disables all your custom repositories to prevent problems. You'll have to adapt and enabled them by hand, or you might use these instructions to do this with a few commands.
# Become super-user
sudo -i

# Set some variables (these can be changed to adapt to other Ubuntu versions)
export old=natty
export new=oneiric

# Enter repository list folder
cd /etc/apt/sources.list.d/

# Change old distribution list files and store them as newer ones
for sl in *-${old}.list ; do echo "Creating ${sl/${old}/${new}}" ; sed 's/\(.*\) '${old}'\(.*\)/\1 '${new}'\2/' $sl > ${sl/${old}/${new}} ; done

# Enable and remove the "disabled ..." comment
for sl in *-${new}.list ; do echo "Enabling ${sl}..." ; sed -i.bak 's/^# \(.*\) disabled on upgrade to '${new}'$/\1/' $sl ; done

# Check they are all fine
for sl in *-${new}.list ; do echo "Content of ${sl/${old}/${new}}:" ; cat $sl ; done

# Cleanup backup files and old distribution list files (not needed any longer)
rm *-${old}* *${new}.list.bak

Obtain some basic hardware details of your Ubuntu system

Unix systems are capable of recognizing lots of details of your hardware, so instead of having to open your PC for obtaining information like serial numbers, just use some shell commands.
Here is a list of such useful commands.

General system

grep -r . /sys/class/dmi/id/ 2>/dev/null
lsusb
lspcmcia
lspci -vvnn
udevadm info --export-db
lshal
sudo lshw

BIOS

sudo vpddecode    # Serials from BIOS, Motherboard
sudo biosdecode   # More details about BIOS
sudo dmidecode -q # Show information about valid BIOS components
sudo dmidecode    # Show also unknown/invalid BIOS components

CPU

lscpu
cat /proc/cpuinfo

Audio

cat /proc/asound/card*/codec#*

Drivers

lsmod

Manager for installing applications from PPA repositories

Search results for Chromium package.
I just discovered an application I was hoping for: Y PPA Manager.

Find easily the corresponding repository for a specific application, remove added PPA-repositories, etc., with this simple desktop tool.

Install instructions

The following command lines will install the tool, and I almost promise; this is the last time you add a repository from the command line.
# Add repository
sudo add-apt-repository ppa:webupd8team/y-ppa-manager

# Add description to repository for easier identification
sudo sed -i.bak 's/$/ #Y-PPA-Manager/' /etc/apt/sources.list.d/webupd8team-y-ppa-manager-natty.list

# Install
sudo apt-get update
sudo apt-get install y-ppa-manager

Features

  • For example, search for Chromium and it will offer you more than 20 repositories, from daily, beta, official ones.
  • It advises, if there isn't a repository for your current distro, for example, Ailurus still isn't available for Natty.
  • You can browse all packages offered by a repository before enabling it for your system.
  • Somehow, I often run into problems with PPA keys, maybe because I just copy the corresponding PPA entries from /etc/apt/sources.list.d to another machine.
    Each time I run the apt-get update command, I get lots of warnings about missing GPG keys.
    Y-PPA-Manager offers a command to clean up all these errors by automatically importing all missing keys.
  • The PPA-purge option disables a PPA from your Software Sources and reverts your system to normal after testing a new version from a PPA.
In short words: A-must-have-tool for Ubuntu.

Command line

You can also use Y-PPA-Manager commands directly from the shell (in case you still miss the terminal), just execute this to see all available commands:
y-ppa-cmd
launchpad-getkeys  # import all missing keys
ppa-purge              # remove a PPA repository source from your system

Convert existing PPA repositories to Natty

I'll offer you here some commands you might want to use to convert your existing PPA repositories to your upgraded distro.
When upgrading Ubuntu to a newer version, all your personal repositories will be disabled to prevent problems.
After the upgrade you'll have to enable them by hand, even worse, the ones you had disabled before upgrading still point to the repositories of the previous distro.
You might use some of these commands to make these changes automatically.
# Become super-user
sudo -i
# Enter repository list folder
cd /etc/apt/sources.list.d/
# Change maverick to natty for all maverick specific list files and store them as natty ones
for sl in *-maverick.list ; do echo ${sl/maverick/natty} ; sed 's/# \(.*\) maverick\(.*\)/\1 natty\2/' $sl > ${sl/maverick/natty} ; done
# Remove the "disabled ..." comment
for sl in *-natty.list ; do echo ${sl} ; sed -i.bak 's/ disabled on upgrade to natty$//' $sl ; done
# Check they are all fine
for sl in *-natty.list ; do echo ${sl/maverick/natty} ; cat $sl ; done
# Cleanup backup files and maverick list files (not needed any longer)
rm *-maverick* *.list.bak

Nightly icon cache update for Gnome

Sometimes it happened on my Ubuntu system, that a newly added application didn't had its icon.
This can happen due to an not updated icon cache of GTK.
This can be fixed with the command
gtk-update-icon-cache
, which rebuilds the GTK+ icon cache.

So why don't do this automatically in the background on a daily basis (during the night)?

Install instructions

Just execute the following commands, which will put a script into /etc/cron.daily so that the cache is fixed and the missing icon appears overnight.
sudo -i
echo '#!/bin/sh
#
# 

for theme in $(find /usr/share/icons -mindepth 1 -maxdepth 1 -type d)
do 
    if [ -f "$theme/index.theme" ]
    then gtk-update-icon-cache -f -q "$theme"
    fi
done

exit 0' > /etc/cron.daily/update-icon-cache
chmod a+x /etc/cron.daily/update-icon-cache

Setup GDM2 startup graphically


GDM2Setup is a graphical tool that allows us to setup the new GDM2 included since Ubuntu Karmic.

After installation, a new entrance in the menu appears: System > Administration > Login Screen (GDM2Setup)

See also my post about other graphical setup tools for the Ubuntu bootup process.

Install instructions


sudo add-apt-repository ppa:gdm2setup/gdm2setup
sudo apt-get update
sudo apt-get install python-gdm2setup

Tweaking Ubuntu

There exist applications that provide many useful desktop and system options that the default desktop environment doesn't provide or are hard to find inside the Gnome configuration.

The following applications complete very well and you should use both of them, as each one offers a different set of tweaking options.

Ubuntu-Tweak




Ubuntu Tweak is an application designed to adjust Ubuntu easier for everyone, handling package caches, tweaking nautilus, offering a bunch of application to install.

Install instructions


sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update && sudo apt-get install ubuntu-tweak


Ailurus



Ailurus is a similar Ubuntu enhancement application. It can install/remove applications which do not provide Debian packages at all. It can change system settings. Moreover, it can detect which Ubuntu repository is the fastest one for your connection.

Install instructions


sudo add-apt-repository ppa:ailurus
sudo apt-get update && sudo apt-get install ailurus

Cleanup broken package

I tried to downgrade the flashplugin to the previous 9 release, but all .deb installer packages I found on the web fail, cause they try to download a non-existing file from Macromedia website.

The problem I run into was that my Ubuntu system thought that the flashplugin-nonfree package was installed on the system, but I always failed to remove it with aptitude, apt-get or synaptic, leaving the package marked as broken.

Couldn't reinstall, nor purge, nor install any other package, because my system always claimed about the flashplugin-nonfree package.

Errors like these appeared:
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
Finally, I found some instructions which are able to remove the package information completely from the system, leaving apt in a state, where the package isn't marked as installed nor broken.

Install instructions

sudo rm -rf /var/lib/dpkg/info/flashplugin-nonfree.*
sudo dpkg --remove --force-depends --force-remove-reinstreq flashplugin-nonfree

Just replace flashplugin-nonfree with any package name that gives you trouble.

Global problems with the package repository

Sometimes you might not be able to install any package and you receive strange errors, like this:
Could not initialize the package information
A unresolvable problem occurred while initializing the package information.
Please report this bug against the 'update-manager' package and include the following error message:
'E:Encountered a section with no Package: header, E:Problem
 with MergeList 
/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_hardy-updates_multiverse_binary-i386_Packages,
 E:The package lists or status file could not be parsed or opened.'
Somehow, apt's internal package repository cache got corrupted, so with the following commands you can recreate it from scratch.
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update
Now, you should be able to install packages as usual.

Trying to install from an outdated repository

It might be even worse, your Ubuntu version is an old release and is not supported any longer.
In that case, it's repositories are moved to an archive server.
You get errors like:
Reading package lists... Done               
Building dependency tree       
Reading state information... Done    
E: Couldn't find package xyz

But your package is probably available at http://old-releases.ubuntu.com
 The reason for this is that it is now out of support and no longer receiving updates and security patches.
If you don't want to upgrade to a newer distribution but want to continue using your outdated release then edit /etc/apt/sources.list and change archive.ubuntu.com to old-releases.ubuntu.com
sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
sudo apt-get update

Pin down the oficial Firefox version in Ubuntu

Today, I'll write an article about a more complicated administration tool: APTs pinning.

What is pinning?



Pinning is used to prevent your Ubuntu system to upgrade a package to a higher version through its automatic update system.

Why do you want to prevent an update?


Well, maybe the newer version of an application isn't working the way you want to or is buggy and you prefer to use the older version.

In my example, this happened to me with Firefox. The version 3.5 that ships with the official Ubuntu repositories works perfect.
But as I enabled the Mozilla-Daily repository from Launchpad to install the better Thunderbird 3.0 (see my article about installing it), that same repository also holds a newer version from Firefox. So my system all the time tries to upgrade to the version from Launchpad, which works worse for me.

How could I prevent upgrading Firefox from that repository, but still be able to use and update my Thunderbird 3.0 package from that one?

Obtain list of priorities


After searching through several articles and forum post, finally I found the tool I needed to setup the pinning.
apt-cache policy
apt-cache policy firefox-3.5

Whereas the first command shows a list of all your enabled repositories and their priorities, the second one gives you information about a concrete package.

In my case it shows:
firefox-3.5:
Installed: 3.5.4+nobinonly-0ubuntu0.9.10.1
Candidate: 3.5.5+nobinonly-0ubuntu0.9.10.1
Version table:
3.5.6~hg20091129r26611+nobinonly-0ubuntu1~umd1~karmic 0
50 http://ppa.launchpad.net karmic/main Packages
3.5.5+nobinonly-0ubuntu0.9.10.1 0
500 http://archive.ubuntu.com karmic-updates/main Packages
500 http://archive.ubuntu.com karmic-security/main Packages
*** 3.5.4+nobinonly-0ubuntu0.9.10.1 0
100 /var/lib/dpkg/status
3.5.3+build1+nobinonly-0ubuntu6 0
500 http://archive.ubuntu.com karmic/main Packages

You can see the installed version is 3.5.4, there is a newer version 3.5.5 from the official Ubuntu repositories, and a newer version 3.5.6 from the Luanchpad repository.
Interesting to look at is the Candidate: line, which shows the version that will be installed next by the update mechanism. Normally, this would be 3.5.6, but in my case, I lowered the priority of the Launchpad repository to 50, which is lower than the default, so it is not selected any more.

You want to know how this is possible? Read on.

Use pinning to lower upgrade priorities


The trick lays inside the /etc/apt/preferences, use man apt_preferences to read more about it.
Just execute the following instruction:

sudo echo "Package: *
Pin: release o=LP-PPA-ubuntu-mozilla-daily
Pin-Priority: 50" > /etc/apt/preferences.d/Mozilla-Daily

## or if that doesn't work for you (tried it only on Karmic):
sudo echo "Package: *
Pin: release o=LP-PPA-ubuntu-mozilla-daily
Pin-Priority: 50" > /etc/apt/preferences

sudo apt-get update


How to obtain the correct values


Remember the apt-cache policy command? Searching its output, you find the information:
 500 http://ppa.launchpad.net karmic/main Packages
release v=9.10,o=LP-PPA-ubuntu-mozilla-daily,a=karmic,n=karmic,l=Ubuntu,c=main
origin ppa.launchpad.net

From the release line I just selected the o=LP-PPA-ubuntu-mozilla-daily, enough to clearly select which packages will be pinned.

After the apt-get update, you will not be troubled any longer by the firefox updates from that repository, but the thunderbird-3.0 updates will still show up, because it doesn't exist in the official repositories.

Troubleshooting


I run into some trouble and will share the solutions here as well.

Can't find the o=LP-PPA-ubuntu-mozilla-daily entry


This happened in one of my machines, so at the end I had to pin down the whole Launchpad repositories, not only the Mozilla-Daily one.
sudo echo "Package: *
Pin: origin ppa.launchpad.net
Pin-Priority: 50" > /etc/apt/preferences.d/Mozilla-Daily
sudo apt-get update


Firefox and/or xulrunner still update from Mozilla-Daily


That happens when some packages have been updated from the Mozilla-Daily repository before. You'll need to downgrade them to a version from the official repositories.
Here an example (find the correct version with the apt-cache policy command):
sudo aptitude install firefox-gnome-support=3.5.5+nobinonly-0ubuntu0.9.10.1

Instrumentation tools for Ubuntu

If you are a developer, administrator or you just want to track down some malfunction of your system, then some of these tools can be very handy.

sysdig

sysdig is a open source, system-level exploration: capture system state and activity from a running Linux instance, then save, filter and analyze.
Think of it as strace + tcpdump + lsof + awesome sauce.

systemtap


SystemTap provides infrastructure to simplify the gathering of information about the running Linux system. This assists diagnosis of a performance or functional problem. SystemTap provides a simple command line interface and scripting language for writing instrumentation for a live running system.

htop


Htop is an ncursed-based process viewer similar to top, but it allows to scroll the list vertically and horizontally to see all processes and their full command lines.

ethtool


ethtool can be used to query and change settings such as speed, auto- negotiation and checksum offload on many network devices, especially Ethernet devices.

EtherApe


EtherApe displays network activity graphically. Active hosts are shown as circles of varying size, and traffic among them is shown as lines of varying width.

Bandwidth Monitor NG


Bandwidth Monitor NG is a small and simple console-based live bandwidth monitor.

dstat


Dstat allows you to view all of your network resources instantly, you can for example, compare disk usage in combination with interrupts from your IDE controller, or compare the network bandwidth numbers directly with the disk throughput.

hping


hping3 is a network tool able to send custom ICMP/UDP/TCP packets and to display target replies like ping does with ICMP replies.

nast


nast is a packet sniffer and lan analyzer and can sniff in normal mode or in promiscuous mode the packets on a network interface and log it. Filters can be applied and the sniffed data can be saved in a separated file.

Install instructions


sudo aptitude install systemtap htop ethtool etherape bwm-ng hping3 nast
curl -s https://s3.amazonaws.com/download.draios.com/stable/install-sysdig | sudo bash

Duplicate file cleanup

CloneSpy (Windows)


CloneSpy can help you free up hard drive space by detecting and removing duplicate files. Duplicate files have exactly the same contents regardless of their name, date, time and location. Also, CloneSpy is able to find files that are not exactly identical, but have the same file name, or the file size differs only a bit.

FSlint (Linux)


FSlint is an utility to fix problems with filesystems' data, like duplicate files
is a toolkit to clean filesystem

fdupes (Linux)

FDupes uses md5sums and then a byte by byte comparison to find duplicate files within a set of directories. It has several useful options including recursion. This is the fastest one.
sudo aptitude install fdupes

You can instruct fdupes to delete duplicate files automatically, but you can't be sure it will delete always from the system folder.
Therefore, you could execute the following command:
fdupes -r a/ b/ | grep -o "^b/.*" | xargs -d '\n' rm ; find b/ -empty -delete

Linux shell commands

In an Ubuntu forum, they worked out a pipe of shell commands, to generate the same output as fdupes. So you don't have to install any software, but it's also much more slower (see benchmarks below).
find . ! -empty -type f -printf "%s " -exec ls -dQ {} \; | sort -n | uniq -D -w 1 | \
cut -d" " -f2- | \
xargs md5sum | sort | \
uniq -w32 -d --all-repeated=separate | \
cut -c35-


Benchmarks

722 groups
994 duplicate files
6205 files

FSlint 10 minutes
fdupes 5,5 minutes
Piped commands 13 minutes

Hard links


If you don't want to remove duplicates, but save memory you can use hardlink (or fdupes) on Linux which detects multiple copies of the same file and replaces them with hardlinks.
For example in my case:
Files:    5935
Linked:   991 files
Compared: 4022 files
Saved:    4.87 GiB
Duration: 12.6 minutes

Ubuntu 9.04 Jaunty - Disable Update Notifier


Previous versions of Ubuntu notified with a simple panel icon about new available updates.
With Ubuntu Jaunty this behaviour changed, and the update manager window is opened automatically.
In my opinion, this is very annoying, I prefer the panel icon advisor where I can launch the update manager whenever I want.

So I searched and found the corresponding setting in the systems Configuration Editor.

From the GUI


Open Gnome's Configuration Editor from Applications-->System Tools (maybe you'll have to install it first).
Enter the key /apps/update-notifier and uncheck the auto-launch flag as shown in the screenshot.

From a terminal


gconftool -s --type bool /apps/update-notifier/auto_launch false


Post note: After writing this post I found a thread from the Ubuntu forum discussing this problem.

Tweak your Ubuntu startup - the graphical way


There exists two handy GUI applications that you can install from the applications menu:
Search for StartUp-Manager and BootUp-Manager and install the one which is interesting for you.

StartUp Manager

configures some settings for grub and splash screens (colors of grub screen, if messages will be shown during booting, ...).

BootUp Manager

is a graphical tool to allow easy configuration of init services in user and system runlevels, as far as changing Start/Stop services priority.
See also this post about this tool.

Install instructions from shell


sudo aptitude install startupmanager bum
or click these links: Install Startup Manager, install BootUp Manager.

Picasa Photo Organizer


Picasa is a very powerful image manager.
It's main features are:
Organize

Organize
Manage your photos in one place, and find photos you forgot you had

edit

Edit
Eliminate scratches & blemishes, fix red-eye, crop and more

create

Create
Turn photos into collages, slideshows and more

share

Share
Upload seamlessly to Picasa Web Albums to share with friends, family & the world


Install instructions for Linux


Just copy and paste the following instructions into a Terminal (you'll have to do it twice, as the first sudo -v stops the rest of instructions):
sudo -v
# Add Google's public package signing key on your system to prevent warnings or errors
wget -q https://dl-ssl.google.com/linux/linux_signing_key.pub -O- | sudo apt-key add -
echo "deb http://dl.google.com/linux/deb/ stable non-free #Google repository" > /tmp/GooglePicasa.list
# If you don't want to install the beta testing version, don't paste the following line:
echo "deb http://dl.google.com/linux/deb/ testing non-free #Google testing repository" >> /tmp/GooglePicasa.list
sudo mv /tmp/GooglePicasa.list /etc/apt/sources.list.d/
sudo aptitude update
sudo aptitude install picasa

Add missing network settings to Ubuntu Intrepid

Network Settings Dialog
If you remember the screen-shot on the right than you used to add host aliases, set your host name etc. from Ubuntu Hardys menu System --> Administration --> Network.

After upgrading to Ubuntu 8.10 (Intrepid) this menu was gone, and the options can't be found anywhere.

Install instructions


sudo aptitude install gnome-network-admin

After this instruction the menu entry returned and you can tweak your network as usual.

Add Ubuntus default repositories from shell

Often you see instructions for this step which refer either to use the graphical tools like Synaptic or Software Sources, or to edit the /etc/apt/sources.list by hand (bad habbit).

Why not use Software Sources command line parameters to do this automatically?

Add default repository


The tool that's accessed from Ubuntus administration menu is called software-sources-gtk. It can be given the name of the repository that should be enabled on the command line.

Example for installing partimage from universe repository


sudo software-sources-gtk -e universe
sudo apt-get update
sudo apt-get install partimage


That way, you can enable any of the four repositories main, universe, restricted, and multiverse.

Update for Ubuntu Hardy


The command changed lately from software-sources-gtk to software-properties-gtk.

Add third party repositories


Again, you shouldn't edit the /etc/apt/sources.list configuration directly, but instead you simply create a new file xyz.list in the /etc/apt/sources.list.d folder.

Example of adding repository for KeepassX


sudo add-apt-repository ppa:keepassx

# For Hardy
sudo echo "deb http://ppa.launchpad.net/keepassx/ubuntu/ hardy main # KeepassX" > /etc/apt/sources.list.d/keepassx.list
sudo apt-get update

That way, it's much simpler to automate tasks like adding and removing third party repositories from shell scripts and keep your /etc/apt/sources.list file clean.

Y-PPA-Manager

With Natty there comes another repository manager, more graphically, but can be used from shell too. Read more about it in this post.