All Posts

KVM Serial console and VNC console

Configuration for libvirt to get serial and graphics working at the same time: virt-install \ --name centos6_golden \ --ram 2048 \ --arch x86_64 \ --vcpus 4 \ --disk path=/var/lib/libvirt/images/centos6_golden.disk,format=qcow2,sparse=true,size=24,bus=virtio \ --location \ --hvm \ --accelerate \ --nographics \ --os-type linux \ --os-variant virtio26 \ --extra-args 'acpi=force noipv6 console=tty0 console=ttyS0,115200 ks= ksdevice=52:54:00:A8:7A:0A ip= gateway= netmask= dns= ' \ --network bridge:br250 \ --mac 52:54:00:A8:7A:0A Serial console in GRUB: serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1 terminal --timeout=15 serial console Change the kernel command line to attach ttys in the right spots.

Easy OpenSSH VPN using tunneling

This is a simple VPN for those times when you want the ease of use of a VPN but only have a ssh server available. Both servers need to have ssh configured to allow tunnels. You need to change the configs for ssh under /etc/ssh Remote server sshd_config: PermitTunnel yes Local server ssh_config: Tunnel yes Remote server Setting up the tunnels requires you to use root when sshing.


This is just a simple script for doing a diff of two web pages. #!/bin/bash TMP1=$(mktemp) TMP2=$(mktemp) wget -q $1 -O $TMP1 wget -q $2 -O $TMP2 diff $TMP1 $TMP2 rm -f $TMP1 $TMP2

Installing stock CentOS kernel on an OVH or Kimsufi server

I recently signed up for a small dedicated server at for the grand price of £14 a month which I think is pretty good price for what you get. Brand Intel Model Celeron / Atom Frequency 1.20+ GHz Architecture 64 bits NIC

Set txqueuelen on virtual vnetX devices with libvirt

The txqueuelen is a value in the kernel on network interfaces that sets the transmit queue length. This value can be tuned for different work loads. In the case of modern networking the defaults can sometimes be changed to get better line speeds over ethernet. Most people will do this using a rc.local command to set it on the physical ethX devices like this. vim /etc/rc.local Add the following

Reverting to a previous snapshot using Linux LVM

Reverting to a previous snapshot has been possible for over a year!!!!! How did I miss that ?? This has for a long time been one of my only real criticisms of LVM and I just discovered that it was quietly committed into the kernel back in 2.6.33 The command used to do the revert is contained within lvconvert. From the lvconvert man page: --merge Merges a snapshot into its origin volume.

Turn off the Caps-Lock key

I HATE THE CAPS_LOCK KEY!!!! I don’t like it when people send me messages with full caps and I don’t like accidentally pressing it and then sending messages to other people who then think I am yelling at them. It also wastes too much keyboard space and is in an easy place to accidentally hit. Time to get rid of it. The following method is for Fedora 15 but will probably work on other Gnome 3 systems.

Linux network bond without restarting the network

This is quite handy to know if you need to create a new network bond on a live system without disrupting traffic. First of all create your bond configs in the normal way so that in the event of a reboot it will come back up working. See the Redhat documentation for how to do it in RHEL6. Now because we cannot just restart the networking to bring that up we need to construct it by hand.

Repairing MySQL multi-master replication

We have 2 servers, server1 is the known good and server2 is the one that is out of synchronisation. Make sure nothing is actively querying server2. You can do this by turning on full query logging and tailing the log file for any queries. mysql> SHOW GLOBAL VARIABLES like 'general_log%' ; +------------------+-------------------------------+ | Variable_name | Value | +------------------+-------------------------------+ | general_log | OFF | | general_log_file | /var/lib/mysql/server2.log | +------------------+-------------------------------+ 2 rows in set (0.

Checking SSL certificate expiry dates

This is just a quick note to save this useful bit of information. I may make in to a script one day or use it in something else. echo ''|openssl s_client -connect localhost:636 2>/dev/null | openssl x509 -noout -enddate | sed 's/^not.*\=//'