Below you will find pages that utilize the taxonomy term “Linux”
Linux RedHat / CentOS / Fedora : Uninstall a package along with dependencies
If you’ve been wondering how to delete a package you mistakenly installed (or which is no longer needed) along with all its dependencies, here’s a neat way to achieve just that.
The idea is that whenever you use yum to perform some operation on packages, a transaction is created. If you installed a package along with its dependencies, then you can undo just that by undoing that transaction.
Fedora 20 Linux + bitcoind : Setting up firewalld for running a full bitcoin node
If you feel like running a full bitcoin node on your Fedora Linux server (and it’s a great way to help the bitcoin network if you have spare capacity / bandwidth), you’ll need to update the firewalld rules in order to allow foreign nodes to connect to yours.
Here’s how…
Docker 101 : Creating an Elasticsearch image
Creating an image in Docker is rather easy and well documented.
You start by editing a file which describes the image, then run a few commands, and voilà .
In this post we’ll cover how to create a very basic Docker image which will let us spawn elasticsearch instances very easily.
Linux : Encrypted LVM quick and easy howto
The goal of this tutorial is to show you how to create an encrypted LVM on Linux. This will help you keep your data safe in the event of, for example, your laptop computer being stolen.
Unix 101 : Shell wildcards expansion, to quote or not to quote
Or why you usually use ls -l *txt without quotes, but use quotes in find . -name “*txt”.
Getting Spotify to run on Gentoo/Linux: A Gross and Cruel Hack
Spotify is a great way to listen to music. Unfortunately the official client only runs on Windows and Mac machines. There is an experimental unsupported client for linux, however it’s provided as a DEB (ubuntu/debian) package.
Here’s a gross hack for whom is desperate to get it working on Gentoo.
Unix 101 : Showing non-printing characters in text files (ex : DOS files)
A non-printing character is a character which won’t actually get directly printed (or displayed) but rather interpreted. Such non-printing characters are for example line-feed or tabulation. The interpretation of those characters can differ from one system to the next. For example the line-feed character is different on Unix or DOS.
If you need an easy way to confirm that a text file is DOS or UNIX formatted (they differ with respect to the end of line character(s) for example) or if you wish to display normally non-printing characters of a text file, you can use the -vET command line switches of the cat utility.
As explained in the man page :
- -v : will use the ^ and M- notation for control and multibytes characters
- -E : will make ends of lines visible
- -T : will make tabulations visible
For example :
Linux + Xorg : Remapping caps lock key to escape
In this post I’ll revisit the classical “how to remap caps lock into something useful” once again. In this post, I’ll show how to remap the caps lock key to have an extra Escape key, which is very useful for all VI/Vim users.
Gentoo + OpenVPN : getting things started in the correct order
I’m running an OpenVPN server, configured in bridging mode.
I had quite a bit of trouble getting OpenVPN to start after networking is up, but before the the bridge is setup so that the tap0 device, which is created by OpenVPN can be added to the bridge.
The solution is simpler : let the tap0 be automatically created and added to the bridge by Gentoo Linux, then start OpenVPN with a config file instructing to use the already created tap0 device.
This post shows the configuration snippets to get things started in the right order on Gentoo.
Perl : Counting occurences of IP addresses in Apache logs
This Perl one-liner is intended to print the 10 most frequent client IP addresses in an Apache log file. It can easily be recycled to count anything, though.
Linux / Unix : Disk usage and identifying biggest files
When working as a systems administrator, you’ll always end up having to solve a file system full error in a hurry. Here are a few commands and hints to help you get out of it quickly on a UNIX like system.
Gentoo Linux / Portage : How to know which package provided an installed file
If there’s a file installed on your disk for which you’d like to know what package provided it, you can use the equery command like below :
Gentoo : Xorg X Server 3D hardware acceleration
You need to have read/write permissions to /dev/dri/cardX to benefit from 3D hardware acceleration in Xorg X Server. On a Gentoo linux machine, this file has the following permissions set by default :
ls -l /dev/dri/card0
crw-rw---- 1 root video 226, 0 2009-10-14 16:12 /dev/dri/card0
Gentoo : Running Cacti with LigHTTPD
If you use Gentoo and tried to install Cacti with Lighttpd instead of Apache, chances are that you ran into this error message :
/usr/lib/python2.6/site-packages/WebappConfig/content.py:27: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5, re, os, os.path
* Fatal error: Your configuration file sets the server type "Apache"
* Fatal error: but the corresponding package does not seem to be installed!
* Fatal error: Please "emerge >=www-servers/apache-1.3" or correct your settings.
* Fatal error(s) - aborting
HAL + Xorg X server : Using HAL to set hardware specific configurations for Xorg Xserver
The Xorg X Server can now rely on HAL to get information about the hardware the machine is running. This allows the X Server to auto-configure most of its components such as keyboard / mouse / screen / graphic adapter. But there is still room for tweaking it if needed.
This post explains how to configure extra properties for a keyboard at the HAL level, so that X Server will correctly auto-configure it for you.
rTorrent : Probing downloads status through XML-RPC
rTorrent is a very efficient BitTorrent client for linux. It has a very small memory footprint, a very customizable configuration file, and exposes it’s internals through XML-RPC. This is convenient to implement 3rd party GUI or web interfaces.
Let’s see how to setup and use XML-RPC to probe rTorrent downloads.
VIM: using the modeline for file based customized editing parameters
The “modeline” is a common way to set (or override) VIM settings on a file by file basis. Let’s see a few of the key concepts of the VIM modeline.
Linux : SATA hot plug / unplug
I have 3 hard disks in SATA-to-eSATA external enclosure which I occasionally need to plug to perform backups and to unplug when done. I found it annoying to have to restart the whole computer at every turn, especially when SATA is supposed to bring hotplug abilities. If you mainboard / SATA chipset and disks support hot plugging and unplugging, you can do this by following those instructions.
SSH : Multiplexing connections
There is a feature in OpenSSH since v3.9 which allows multiple SSH connections with the same caracteristics (host, port, remote login) to be made through a single TCP connection. This is useful because you’ll have to authenticate only once, and besides the new SSH connections will be much faster to establish.
Linux : Configuring a network bridge for your Virtual Machines
My new center of interest those days being virtualization, I tried quite a few software starting with Xen, then QEMU, then KVM, and finally VirtualBox. But as far as giving a network access to the VM is concerned, I’ve always sticked to a network bridge for the reason that this makes the VM appear on the network just like any other computer of your network.
This post provided a sample script to setup a bridge suitable to use with all of the named virtualization softwares.
D-Bus introduction in Perl
As stated in Wikipedia :
D-Bus (Desktop Bus) is a simple inter-process communication (IPC) system for software applications to communicate with one another.
This post provides a simple code snippet in Perl to help you getting started with D-Bus programming.
Xen : OpenSolaris 2008.11 DomU running on a Linux Dom0
This post is a step by step explanation about how to get an OpenSolaris 2008.11 run as a Xen DomU on a Linux Dom0.
To follow this, you’ll need a Linux machine ready for Xen (I run Xen 3.3.0), with vncviewer installed.
This post doesn’t explain the basics of Xen, so you might want to start by learning Xen if you don’t already know a bit of it.
shell tip : identify broken symlinks
If you need to identify broken symlinks, you can do the following :
find -L . -type l
The -L options instructs find to follow symlinks when possible. Hence no “working symlink” will ever get returned as the targets won’t match -type l (meaning “file is a symlink”).
On the other hand, find will not be able to follow broken symlinks, so the information will be taken from the symlink itself and not from the non-existent or otherwise unreachable target. The -type l will then be a match and the broken symlink filename will be returned.
Gentoo : Managing software packages
In this post I’ll cover the basics one needs to know to install, upgrade and remove packages on a Gentoo linux system.
Gentoo : First thoughts after the switch
I’ve recently switched to the Gentoo Linux distribution (mostly to experiment with this Linux distro) and I don’t regret it so far. This post is about my first impressions about Gentoo.
Ubuntu 8.04.1 : Xen 3.2 package broken ?
I’m trying to install xen on Ubuntu 8.04.1 and here is what I get :
spaghetti% sudo apt-get install ubuntu-xen-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
Since you only requested a single operation it is extremely likely that
the package is simply not installable and a bug report against
that package should be filed.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
ubuntu-xen-server: Depends: python-xen-3.2 but it is not going to be installed
Depends: xen-utils-3.2 but it is not going to be installed
E: Broken packages
spaghetti%
I’ve tried to follow the package dependencies but without success. As for now I’m growing tired of Ubuntu and I’m considering moving away to a more robust distribution … I’d be glad to hear your point of view about that too.
Linux : find out the kernel command line
If you have multiple linux kernels with differents options in the command line in your bootloader (grub, lilo or other) and you wonder which one was used to boot, you can find out by looking in /proc/cmdline. Ex :
[root@picolo:~]# cat /proc/cmdline<br /> ro root=LABEL=/<br /> [root@picolo:~]#
NFS : see what’s exported from an NFS server
To know what directories are exported by a NFS server, you can use the showmount -e nfs_server from a NFS client.
[root@client:~]# showmount -e server<br /> Export list for server:<br /> /data/dir1 (everyone)<br /> /data/dir2 client1 client2 client3
(The /data/dir2 is exported only to specified clients)
Backups : a personnal implementation
If you’ve been following my blog for a while, you might have seen posts about SSH, RSYNC, ZFS Snapshots and so on. This article aims at describing the big picture, and to explain how I’ve been using those tools and technologies to build my own home backup system.
Securing automated rsync over SSH
Quoting the RSYNC homepage : “rsync is an open source utility that provides fast incremental file transfer.”
To make rsync both secure and automated (i.e : non-interactive), you can use SSH as the transport and set up a key pair. This is what will be discussed in this post, along with a few improvements.
SSH slow to connect to a Solaris 10 host
If you experience a slow SSH connection to a Solaris 10 host while after connection everything works fine, then read on !
Ubuntu 8.04 + IBM T40 = No sound
If you upgraded your Ubuntu on an IBM T40 Laptop only to find out that there is no sound anymore, you’re not alone in this 😉
Follow the bug report for more information !
Edit 2008-05-11 : As of today I don’t have this problem anymore … update your machine if you haven’t yet !
Edit 2008-06-22 : Sound vanished again … I really need to look into this before this drives me crazy !!
CFEngine : Checking for processes
CFEngine can do wonders to keep a cluster in shape, but it can be very useful for a single server as well. Here is a configuration sample to monitor a few common services and restart them should they fail.
Unix : shell tips
I ran into this into the following article, “Learn 10 good UNIX usage habits“. This article is mainly common sense, but there are interesting points, such as :
- avoid piping when you can, in order to save performance (the classical construct grep | wc to count the lines is useless as most versions of grep can count with grep -c)
- use awk to “grep” on a specific field of a line with “… | awk ‘$1 == “XXX”‘ which is cool and I never use
- the find | xargs construct (I’d add “find -print0 | xargs -0”, useful if your find brings back filenames with a space inside …)
All in all it is worth a reading, if only to refresh your memory.
X10 Home automation : Heyu a tool for managing a CM11
I currently manage all my X10 home automation with MisterHouse which is a fantastic tool but is a bit on the heavyweight side. Plus you need to know a bit of Perl to take full advantage of it.
If you are looking for something simpler to use, you might want to consider HEYU.
dsh : a distributed shell
A common problem when you deal with a pool of servers (clusters or server farms, you name it) is to execute the same command line on each server. It is usual to solve this with a “for” construct such as :
for i in server1 server2 ; do ssh $i "uname -a"; done
But this is basically re-inventing the wheel everytime. Here comes Distributed Shell (DSH).
Linux : Clusters, Vitualization, High Availability, Load balancing
I’m back from a 3-day-training about clusters with Linux which was pretty exciting, and here are the main points which were covered :
- Vitualization with Xen
- Sharing data with GFS / GNBD
- Clusters with RedHat Cluster Suite
- Load Balancing with Linux Virtual Server (LVS)
Perl : Convert time from Epoch to local time

This little Perl one-liner can get handy when you need to translate “time in seconds since the Epoch” (for example in logs) to local time :
% perl -e 'print scalar(localtime(1202484725)), "\n";'<br /> Fri Feb 8 16:32:05 2008<br /> %
This was pretty useful today when browsing through Nagios event logs, where times are given in seconds from the Epoch.
By the way, the Epoch is defined as 00:00 UTC on January, 1st, 1970.
Linux : Using loop devices (eg : mounting an ISO file)
If you downloaded an ISO file and you want to mount it into your filesystem, you can proceed as follows :
spaghetti% sudo losetup /dev/loop0 cdrom.iso<br /> spaghetti% sudo mount /dev/loop0 /mnt<br /> spaghetti% ls /mnt<br /> Autorun.inf setup.exe setup.ico<br /> spaghetti%<br /> [...]<br /> spaghetti% sudo umount /mnt<br /> spaghetti% sudo losetup -d /dev/loop0
This will use the feature known as “loop devices”, which lets you use a file as a device, and subsequently mount it as it would be one.
Perl : A module to play with a GSM mobile
As you might have read in my previous post about accessing your cell phone with the AT-commands under Linux.
If not, you might want to start there for a little context.
I finally wrote and released on CPAN a Perl module which will help to automate cell phone operations such as saving/restoring the phonebook or sending an SMS.
Examples are included in the documentation. I believe I made it easy to use, but let me know if I’m wrong 😀 .
Perl : Optimizing pattern searches with Regexp::Assemble
When you perform a pattern matching with multiple “or” (|) clauses, such as /pattern1|pattern2|pattern3/, Perl regexp engine will try to match each of them one after the other in sequence, resulting in poor performance if you have a long list of “or” clauses.
In order to optimize such a pattern matching, you can use the Regexp::Assemble module.
Linux : Taking control of Virtual Terminals (VT) from command line
When you use Linux in text mode (as opposed to with an X server), you readily have access to multiple Virtual Terminals (aka VT for short) by hitting one of your
This lets you access one of the VTs which are initialized at boot time, but won’t let you create new ones even if your kernel configuration would allow more VTs. Furthermore, what if you want to deal with VTs from a script ?
This post covers the 3 commands which will let you control your VTs from the command line or from a script.
Unix : the “script” command
The script command is a must for any unix sysadmin.
Once invoked, it will faithfully write anything you typed as well as any output generated in your terminal into a file of your choice (defaults to “typescript”).
This is great when you want to document everything you did on a specific server, for example.
spaghetti:~$ script<br /> Script started, file is typescript<br /> spaghetti:~$<br />
When launched, you don’t see anything, but everything displayed goes to a file as well as the terminal.
sed : replacing a text in a file
To replace a text in a file, you can invoke sed as in the following example :
% cat file.txt | sed -e 's/text/replacement/g' > result.txt
This will change all the occurences of “text” to “replacement” in “file.txt” and output the result in “result.txt”
Note : As suggested by Matthias from adminlife in the comments, if you wanted to do “in place” text replacement (that is modify the file without a temporary file in between), you can do the following :
CFEngine – Installing on Debian GNU/Linux
In this post we’ll install CFEngine on a Debian system. Debian make is really simple to install any packages, so let’s follow the “standard” package installation procedure (I’ll assume that apt is correctly setup on your system ! If you have troubles with it, let me know, I’ll write a post on this topic).
CFEngine – What is it ?
CFEngine is a configuration management engine. I’m going to write a series of short posts as I’m going to use CFEngine in a current project. Let’s start with a short description of CFEngine purpose and main features.
Keeping track of changes with cfengine and SubVersioN
Cfengine is a tool which purpose is to describe what is a healthy system and how to bring it back to normal when something fails.
I won’t go into an explanation about how cfengine works, because the project webpage already has a neat tutorial and complete reference. Instead of that, I’ll explain how I used cfengine to build a fool proof Linux firewall.