Wednesday, May 04, 2011

ubuntu and cisco anyconnect

Our office uses cisco anyconnect for vpn. And of course like most offices, we only officially support windows clients. Cisco makes clients for lots of OS's, but our sysadmin only has it configured for the MS monster.

So I wanted to connect to it with Ubuntu, and it was actually pretty easy. I just had to install:
  • openconnect
  • network-manager-openconnect
  • network-manager-openconnect-gnome
I could then go to the network manager - vpn connections - configure vpn.
  • Click add.
  • Select cisco anyconnect compatible vpn (openconnect)
  • Click create.
  • Entered the IP of the vpn gateway
  • Entered the connection name
  • Clicked save.
To connect, just click on network manager - vpn connections and select the one you just added and enter your login creds.

wep cracking messed up my wifi card

So I thought I'd mess around with WEP cracking with my laptop and aircrack. It's pretty easy since all the tools needed are in the repos.

I found out the hard way that the wireless card in my HP dv2000 wasn't up to the task. It wouldn't go into monitor mode when I tried to dump the wireless data. So I gave up. The problem was that it put my wireless card into some state that I couldn't get it out of.

I finally fixed it by using rfkill:
sudo apt-get install rfkill
rfkill unblock all

Thursday, May 13, 2010

Upgrade to lucid 10.04

So I finally decided to upgrade this box to the latest.

I actually went through the upgrade process instead of a reinstall. Everything seemed to have worked except for deluge and the raid array.

Deluge is now in the repositories for 10.04, so I just had to do:
sudo apt-get install deluge-web
sudo apt-get install deluged
And went to the url localhost:8112 to get to the web ui.

As for the raid array, it didn't work of course. I noticed that the drives weren't the same as before (old raid was sdc1 and sde1) so I needed to figure out which was raid drives. I ran fdisk -l on all the drives to figure out which ones were the 500G drives. Turns out it's sdc and sde this time.

I ran this command:
sudo mdadm --examine --scan

And it returned:
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=3c0abf28:e3777924:ffe566c0:e15f2e9c
I copied that to the /etc/mdadm/mdadm.conf since the UUID seems to have changed.
sudo vi /etc/mdadm/mdadm.conf
and put this in:
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=3c0abf28:e3777924:ffe566c0:e15f2e9c
changed my fstab entry to:
/dev/md0 /raid-drive ext3 defaults,errors=remount-ro 0 2
ran this command:
sudo update-initramfs -u
tell mdadm to assemble the array:
sudo mdadm -A --scan
mount the array:
sudo mount /raid-drive

Friday, June 12, 2009

Happy Birthday Eric!

Today is my nephew Eric's birthday. I won't be able to see him this weekend but I hope he has a good one. In a few weeks he'll be living real close since they're moving to the same city I live in. Exciting!

Happy Birthday Eric from Uncle Gary and Aunt Andrea.

Monday, May 11, 2009

Boston 2010 here I come!

I ran the Fredericton Marathon yesterday and I managed to get my target time of 3:15 and qualify for the Boston marathon!! I'm pretty excited about going next year.

I'm just glad that all this training was not wasted. The weather was a bit chilly, and we got rained on a couple of times, but the course has to be one of the best we have around here. I was feeling great till the last 4 kilometres and it was a mental battle after that. I wasn't sore anywhere in general, more of a fatigue thing where you're body is running low on energy.

I'm feeling quite sore today and limping around the house for the next few days is expected.

Andrea did a great job as my 'support' crew handing out bananas and watermelon.

Dean ran and got another PB of 3:05, and Steve ran his 1st marathon and qualified for Boston as well with a time of 3:27. Steve's older, so he's lucky enough that he doesn't need the same time as Dean or I do. He needed to be under 3:30, while Dean I needed to be under 3:15.

I managed to come in 12th out of almost 200 marathoners and 2nd for my age group. Of course Dean was 1st for our age group the bugger. Always 2nd to Dean... :-)

Friday, March 06, 2009

Off to Bangor for the weekend for some ultimate

I'm off for my 1st road trip to an ultimate tournament this weekend. We're playing indoors, but it's a full sized field gym. Should be interesting playing indoors in a gym the size of a soccer field.

I also need to get 20km in for my training. That's going to be hard since these guys like to drink...

Thursday, February 26, 2009

Creating a server for torrents, usenet, PS3 Media server, vmware server and software raid

I have a PS3 and it's awesome at playing media files over UPnP. Divx, xvid, mpeg etc.

  • I had a server running Ubuntu 7 with a headless version of Azureus for downloading torrents and general network storage of movies, music etc. I also installed the WebUI for it so I could upload torrents remotely.
  • I then decided I wanted software raid, so I added a couple of 500G drives and implemented software raid. It was real easy using mdadm.
  • Then I wanted to start streaming to the PS3 from this server. I then installed Mediatomb and it worked fairly well. It had the ability to transcode incompatible files to a format the PS3 liked. But it never worked the greatest transcoding so I only used videos the PS3 could play natively.
  • Then I finally signed up for a usenet account, so I wanted the ability to download usenet files. But since the server is in the basement, it needed a webUI. So I installed hellanzb with the Zussaweb interface.
Then came PS3 Media Server. PMS for short. :-) I thought i'd give it a try to see if it was any better than mediatomb. The guy who started this really had it right. Small Java application that was built with the PS3 in mind. And transcoding was using mencoder, and it just works! No tweaking or anything. So now it's what I use for UPnP.

I then thought I'd try some HD content in 1080P. But this server just couldn't handle the load and stuttered. I thought it was time to rebuild the OS since it's an older version of Ubuntu, and I have other software on it that's no longer in use (mediatomb). But this also meant a hardware upgrade. So I bought:
So I built it and installed Ubuntu 8.10 desktop. There were no issues installing Ubuntu. It recognized everything (video, audio, network etc).

Hellanzb with Zussaweb

Next I installed hellanzb and what it needs:
sudo apt-get install rar unrar par2 python-dev python-twisted python-pyopenssl wget tar screen hellanzb

Create the hellanzb.conf file.
sudo cp /usr/etc/hellanzb.conf.sample /usr/etc/hellanzb.conf
sudo vim /usr/etc/hellanzb.conf
  1. Make sure you configure the server information in the .conf file. It’s pretty self explanatory and gives examples.
  2. If you’re planning to use SSL; make sure you enable the SSL option and change the port from 119 to 443. I use SSL since astraweb supports it.
  3. Set the PREFIX dir to something like /home/username/ or /mnt/storage/hellanzb/
Now you need to have hellanzb start in /etc/init.d
sudo vi /etc/init.d/hellanzb
Add this:
# Provides: hellanzb
# Required-Start: $network $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Usenet Binary Downloader
# hellanzb Start the hellanzb
# hellanzb init-script v0.6 dedicated
# the following vars are used:
# NAME= leave it to hellanzb, its just a display name and it is used to connect to it with screen
# USERNAME= your username, this is used to run hellanzb in
# *_PIDFILE= the pid file which the script checks

DESC="Binary Usenet Download Services:"

trap "" 1
export LANG=C

. /lib/lsb/init-functions

case "$1" in
log_acti else
log_end_msg 1

log_action_msg "Stopping $DESC"
log_daemon_msg " Stopping $NAME.."
if start-stop-daemon -K --pidfile $HELLANZB_PIDFILE; then
log_end_msg 0
log_end_msg 1

$0 stop
$0 start
echo "Usage: /etc/init.d/$NAME start|stop|restart}"
exit 1

exit 0
on_msg "Starting $DESC"

log_daemon_msg " Starting $NAME.."
if start-stop-daemon -S -c $USERNAME -m -b --pidfile $HELLANZB_PIDFILE --exec /usr/bin/screen -- -S $NAME -D -m $HELLANZB_BIN; then
log_end_msg 0
Change change_me_to_the_user_to_run_this_as to the correct user to run this as. To get this script to start when the box starts:
sudo chmod +x /etc/init.d/hellanzb
sudo update-rc.d hellanzb defaults

Start it up:
sudo /etc/init.d/hellanzb start

Make sure it's running:
ps-ef |grep hella
You should see it running.

I wanted to have a web interface for hella, so I decided to use zussaweb. But it needs apache. So I installed it and the php mod:
sudo apt-get install apache2 libapache2-mod-php5
So I then downloaded zussaweb and extracted it to /var/www. I also wanted to have it password protected, so I needed to create an .htaccess file in the /var/www/zussaweb page.

The first step is to add zussaweb to the httpd.conf file:
sudo vi /etc/apache2/httpd.conf
add this to httpd.conf:

Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
Allow from all

Now we need to create a password file:
sudo mkdir -p /home/secure/
sudo htpasswd -c /home/secure/apasswords ogden
Change 'ogden' to whatever user you wish to log into the web interface with.

Now allow apache user www-data to read our password file:
sudo chown www-data:www-data /home/secure/apasswords
sudo chmod 0660 /home/secure/apasswords

Create the .htaccess file:
sudo vi /var/www/zussaweb/.htaccess
Add the following:
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /home/secure/apasswords
Require user ogden
Change the user ogden to the user you used to create the password file.

Restart apache:
sudo /etc/init.d/apache2 restart
You should be able to navigate to the web server and get prompted for a username/password:
I then forwarded all port 21 access on my internet router to this server. That way I can download any usenet file I want whenever I'm not home. My Asus router has the ability to configure an account on, so I can just connect to my dyndns address.


Now I want to install deluge. Get deluge. The one I used was here. To install the deb package, run the command:
sudo dpkg -i deluge-torrent_1.1.2-1_amd64.intrepid.deb
sudo vi /etc/default/deluge-daemon

Change the DELUGED_USER to a user on the server.
Make the init.d script executable and have it startup at boot:
sudo chmod +x /etc/init.d/deluge-daemon
sudo update-rc.d deluge-daemon defaults
sudo /etc/init.d/deluge-daemon start
You should now be able to navigate to the deluge webui at the server ip with port number 8112. The default password is deluge and you can configure the directories where it stores the files.

Next is PS3 Media Server
I installed the latest code from SVN, so you're going to need a few packages. Plus I want the multithreaded version of mplayer.
sudo apt-get install subversion build-essential git-core checkinstall yasm libgpac-dev ant sun-java6-jdk

I can't recall all the libs that are needed, so you may need to add more as needed. But here's a list to ensure you have everything:
sudo apt-get install em8300-headers gawk gettext html2text \
intltool-debian ladspa-sdk libaa1-dev libartsc0 libartsc0-dev \ libasound2-dev libatk1.0-dev libaudio-dev libaudio2 \
libaudiofile-dev libavahi-client-dev libavahi-common-dev \
libcaca-dev libcairo2-dev libcdparanoia0-dev libcucul-dev \
libdbus-1-dev libdbus-glib-1-dev libdirectfb-dev \
libdirectfb-extra libdts-dev libdv4-dev libenca-dev libenca0 \
libesd0-dev libexpat1-dev libfaac-dev libfaac0 \
libfontconfig1-dev libfreebob0 libfreetype6-dev libfribidi-dev \ libggi-target-x libggi2 libggi2-dev libggimisc2 \
libggimisc2-dev libgif-dev libgii1 libgii1-dev \
libgii1-target-x libgl1-mesa-dev libglib2.0-dev libglide3 \
libglu1-mesa-dev libglu1-xorg-dev libgtk2.0-dev libice-dev \
libjack-dev libjack0 libjpeg62-dev liblzo-dev liblzo1 \
liblzo2-2 liblzo2-dev libmad0 libmad0-dev \
libmail-sendmail-perl libmp3lame-dev libmp3lame0 libmpcdec-dev \
libmpcdec3 libncurses5-dev libogg-dev libopenal-dev libopenal1 \ libpango1.0-dev libpixman-1-dev libpng12-dev libpopt-dev \
libpthread-stubs0 libpthread-stubs0-dev libpulse-dev \ libpulse-mainloop-glib0 libsdl1.2-dev libslang2-dev libsm-dev \ libsmbclient-dev libspeex-dev libsvga1 libsvga1-dev \ libsys-hostname-long-perl libsysfs-dev libtheora-dev \
libtwolame-dev libtwolame0 libvorbis-dev libx11-dev libxau-dev \ libxcb-render-util0-dev libxcb-render0-dev libxcb-xlib0-dev \
libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev \
libxdmcp-dev libxext-dev libxfixes-dev libxft-dev libxi-dev \ libxinerama-dev libxrandr-dev libxrender-dev libxt-dev \
libxv-dev libxvidcore4 libxvidcore4-dev libxvmc-dev libxvmc1 \ libxxf86dga-dev libxxf86vm-dev mesa-common-dev po-debconf \
sharutils x11proto-composite-dev x11proto-core-dev \
x11proto-damage-dev x11proto-fixes-dev x11proto-input-dev \
x11proto-kb-dev x11proto-randr-dev x11proto-render-dev \
x11proto-video-dev x11proto-xext-dev x11proto-xf86dga-dev \ x11proto-xf86vidmode-dev x11proto-xinerama-dev xtrans-dev \
zlib1g-dev libschroedinger-dev libstdc++5 libfaad-dev \
libgsm1-dev libdc1394-22-dev libfaad-dev libsdl1.2-dev
Get the latest mplayer:
svn checkout svn:// mplayer
Get the multithreaded version of ffmpeg:
git clone git://
Get the latest of x264:
git clone git://
Compile and install x264:
cd x264
./configure --enable-shared
sudo checkinstall --fstrans=no --install=yes --pkgname=x264 --pkgversion "1:0.svn`date +%Y%m%d`-ubuntu"
sudo ldconfig
Compile and install ffmpeg:
cd ffmpeg-mt
git clone git://
sudo make install
Compile and install mplayer:
cd ../mplayer
cp -rf ../ffmpeg-mt/libavcodec libavcodec
cp -rf ../ffmpeg-mt/libavutil libavutil
cp -rf ../ffmpeg-mt/libavformat libavformat
sudo make install
Get the latest PMS:
cd ..
svn checkout ps3mediaserver-read-only
cd ps3mediaserver-read-only/ps3mediaserver
Now we want to have PMS start up on boot. Since I'm starting it headless we don't want the actual java GUI to start. We need to modify the script.


Use this for the contents of the script. Ensure you change the DIRNAME to where you've just put PMS. Notice I added the 'console' parm at the end to ensure no java GUI is started.



# Setup PMS_HOME
if [ "x$PMS_HOME" = "x" ]; then
PMS_HOME=`cd $DIRNAME/; pwd`
export PMS_HOME

# Setup the JVM
if [ "x$JAVA" = "x" ]; then
if [ "x$JAVA_HOME" != "x" ]; then

# Setup the classpath

# Execute the JVM
exec "$JAVA" $JAVA_OPTS -Xmx768M -Djava.encoding=UTF-8 -jar "$PMS_JAR" "$@" console
Now we need to create an /etc/init.d script:
sudo vi /etc/init.d/ps3mediaserver
Put this in the script and make sure you update the directories in red:



DESC="PS3 media server"

case "$1" in
start-stop-daemon --start -b -m --pidfile $PMS_PIDFILE --exec $DAEMON
start-stop-daemon -K --pidfile $PMS_PIDFILE
$0 stop
$0 start
echo "Usage: /etc/init.d/$NAME start|stop|restart}"
exit 1

Now we need to create the proper rc.d files:

sudo update-rc.d ps3mediaserver defaults

Next is to create directories. I have videos on various drive and different mount points through SAMBA. I didn't want to modify the PMS.conf file for all of these, so I decided to create one directory and it has symbolic links to all the other folders. Here's what mine looks like:

gmo@gmo-server:~/videos$ ls -l
total 4
drwxr-xr-x 51 gmo gmo 4096 2009-02-24 22:38 action
lrwxrwxrwx 1 gmo gmo 24 2009-02-15 15:40 comedy -> /mnt/asus-videos2/comedy
lrwxrwxrwx 1 gmo gmo 24 2009-02-15 16:29 crime -> /media/sdb1/videos/crime
lrwxrwxrwx 1 gmo gmo 28 2009-02-15 15:39 documentary -> /mnt/asus-videos/documentary
lrwxrwxrwx 1 gmo gmo 24 2009-02-15 16:29 drama -> /media/sdb1/videos/drama
lrwxrwxrwx 1 gmo gmo 25 2009-02-15 15:39 exercise -> /mnt/asus-videos/exercise
lrwxrwxrwx 1 gmo gmo 23 2009-02-15 15:39 horror -> /mnt/asus-videos/horror
lrwxrwxrwx 1 gmo gmo 22 2009-02-15 15:40 kids -> /mnt/asus-videos2/kids
lrwxrwxrwx 1 gmo gmo 22 2009-02-15 15:40 music -> /mnt/asus-videos/music
lrwxrwxrwx 1 gmo gmo 24 2009-02-15 15:40 romance -> /mnt/asus-videos/romance
lrwxrwxrwx 1 gmo gmo 23 2009-02-15 15:40 scifi -> /mnt/asus-videos2/scifi
lrwxrwxrwx 1 gmo gmo 25 2009-02-15 16:30 sports -> /media/sdb1/videos/sports
lrwxrwxrwx 1 gmo gmo 27 2009-02-15 16:30 thriller -> /media/sdb1/videos/thriller
lrwxrwxrwx 1 gmo gmo 20 2009-02-15 16:29 tv_shows -> /media/sde1/tv_shows
To create the links above, you would do something like this:
cd /home/gmo/videos
ln -s
/media/sde1/tv_shows tv_shows
Now edit the PMS.conf:

cd /home/gmo/ps3mediaserver/current_version
vi PMS.conf
The lines I changed are folders, hostname, port, language, nbcores, mencoder_audiolangs, mencoder_sublangs, and mencoder_audiosublangs. I also added the sort type at the bottom. I checked the source and the functionality exists, but it wasn't added to the conf file.
folders = /home/gmo/videos,/raid-drive
hostname =
port = 16111
language = eng
thumbnails = true
thumbnail_seek_pos = 1
nbcores = 2
turbomode = false
minimized = false
hidevideosettings = false
usecache = false
charsetencoding = 850
engines = mencoder,avsmencoder,tsmuxer,mplayeraudio,ffmpegaudio,tsmuxeraudio,vlcvideo,mencoderwebvideo,mplayervideodump,mplayerwebaudio,vlcaudio,ffmpegdvrmsremux
autoloadsrt = true
avisynth_convertfps = true
avisynth_script =
transcode_block_multiple_connections = false
tsmuxer_forcefps = true
tsmuxer_preremux_pcm = false
tsmuxer_preremux_ac3 = false
audiochannels = 2
audiobitrate = 384
maximumbitrate = 0
skiploopfilter = false
enable_archive_browsing = false
mencoder_fontconfig = false
mencoder_font =
mencoder_forcefps = false
mencoder_usepcm = false
mencoder_intelligent_sync = true
mencoder_decode =
mencoder_encode = keyint=1:vqscale=1:vqmin=2
mencoder_nooutofsync = true
mencoder_audiolangs = eng
mencoder_sublangs = eng
mencoder_audiosublangs = eng
mencoder_subfribidi = false
mencoder_ass_scale = 1.0
mencoder_ass_margin = 10
mencoder_ass_outline = 1
mencoder_ass_shadow = 1
mencoder_noass_scale = 3
mencoder_noass_subpos = 2
mencoder_noass_blur = 1
mencoder_noass_outline = 1
mencoder_subcp = cp1252
mencoder_ass = true
mencoder_disablesubs = false
mencoder_yadif = false
mencoder_scaler = false
mencoder_scalex = 0
mencoder_scaley = 0
ffmpeg = -g 1 -qscale 1 -qmin 2
#this is the sort method for the file listing - by date or alphabetical
# 0 = alpha 1=date
key_sort_method = 0

You should now be able to start up PMS.
sudo /etc/init.d/ps3mediaserver start
Go to your PS3 and you should be good to go for viewing the videos.

Software RAID
I already had RAID 1 configured on the older box and was worried that I'd have to redo it all over again on the new machine. I backed up all the files to a USB drive just in case.
But once I got Ubuntu 8.10 installed and hooked the 2 500G SATA drives up I was able to add them to a raid device.

It's been a while, but here's what I think I did to 'rebuild' that raid array. I know that at a basic level you create the raid device (/dev/md0) and then add the discs to the raid device. It warned me that the discs already had a filesystem on them but I did it anyways.
sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdc1
I'd need to mount it to access it, so I created a directory for it:
sudo mkdir /raid-drive
sudo chmod -R 777 /raid-drive
Then I added it to the /etc/fstab to mount at boot:
sudo vi /etc/fstab
Add this to the fstab file:
/dev/md0 /raid-drive ext3 defaults,errors=remount-ro 0 2
You should then be able to mount the drive and use it like any other mounted drive:
sudo mount /raid-drive

New home of

So I've decided to use blogger as my new home for

I did have it hosted by a friend, and then I was hosting it myself, but it's a bit slow over DSL.

So here's hoping this works out.