headless VPN on linux with minimal VPN traffic and selective DNS

I needed to setup a VPN client connection on a headless system where the VPN is slow and so I want to route the minimal amount of traffic through it. I need DNS to use the VPN but only for one domain.

This is my setup using pptp and dnsmasq (tested on centOS)

Basic VPN config is here /etc/ppp/peers/office

Read more

Reinstall grub after windows breaks it

One of those things that happens from time to time on a dual boot system...

Windows breaks grub, usually if I've reinstalled windows, this can lead to a unbootable system.

Boot from a Ubuntu (or other distro) live disk or USB stick.

Figure out which your disks and partitions are.

sudo mount /dev/sdXY /mnt
# if there is a boot partition
sudo mount /dev/sdUV /mnt/boot
sudo grub-install --recheck --root-directory=/mnt /dev/sdZ

When you reboot grub should be back to normal.

Read more

How to create a custom yum repository on Centos 6

If you want to create custom rpms and install then with the usual automated dependency management you'll need your own yum repository. This is just the RPMS and metadata in the format of static xml files served by a webserver.

Read more

Monitor filesystem for deletions

On a project I'm working on at the moment we have a problem, files are going missing.

We don't know which part of the system could be trashing these files (user uploaded images in this case) and they are on a shared filesystem so there are plenty of places to point fingers.

I've discovered a very handy toolset inotify-tools Which hooks into the linix kernel and allows you to monitor actions like file deletion.

Read more

Device eth0 does not seem to be present, delaying initialization.

I had a centos VM that I hadn't used in a while, I think I cloned it from another version.

When I came to use it again I had no network andtrying to start the network I got the error message in the title.

There seem to be a few issues

Firstly netowrking isn't endabled by default

http://wiki.centos.org/FAQ/CentOS6#head-b67e85d98f0e9f1b599358105c551632c6ff7c90

Read more

verbose remote ssh (with echo)

I usually manage website deployment with bash scripts that run remote commands on the servers

In order that I can see what is going on and debug any errors verbose output is useful.

Running "bash -ex" causes each line to be output as it progresses and halt on any error so that you don't miss it.

within the remote command "set -x" cuase bash to echo all commands

#!/bin/bash -ex
ssh -T user@server << EOF
set -x
echo foo > /dev/null
EOF

Read more

RAID ext4 disk problems

One of those posts for myself in case I need to come back to this later

I have a new PC which is very fast apart from problems with disc access seeming slow (and the disks being physically noisy)

The following related links led me to try a solution

http://forums.gentoo.org/viewtopic-t-843292.html

http://marc.info/?l=linux-raid&m=128506852210452&w=2

/etc/fstab

UUID=317f7912-9956-41f1-9855-7bee69c950b3 / ext4 errors=remount-ro,barrier=0 0 1

NB adding barrier=0 here seems to have solved the problem

Read more

How to turn off notifications in Banshee

The music player banshee which is part of the default Ubuntu setup pops up a message each time a new track starts playing.

To turn this off

  1. Open Banshee
  2. Go to Edit, preferences, extensions
  3. Enable Notification Area Icon
  4. The Icon should now show up - right click on it
  5. Uncheck Show notifications
  6. Disable the Notification Area Icon again
    1. Very annoying - the option to turn off notifications is hidden on a menu you can't get to by default.

Read more

Drupal files directory permissions for continuous integration

I want the drupal user uploaded files to be manageable by both apache and a non-root user

In my case I'm using hudson to rebuild the site with data and "files" from live periodically.

So I have added the apache group to the hudson user

/usr/sbin/usermod -G hudson,apache hudson
/etc/init.d/hudson restart

and set the umask for apache so that files are created group writebale

For Redhat

echo "umask 002" >> /etc/sysconfig/httpd
/etc/init.d/httpd restart

For Debian/Ubuntu

echo "umask 002" >> /etc/apache2/envvars

Read more

Ubuntu 10.04 Bluetooth Audio

It wasn't immediately obvious to me

What I needed to do to get blutooth audio working was to install the blueman package

After that configuration via GUI was pretty straightforward

Now I have fantastic sound via my bluetooth enabled HIFI :-)

Read more