Server Migration Complete
So, I am now hosting this site with JustHost.com as I got tired stressing about keeping my own server up and running and not being able to upgrade it and mess with it in case I mess anything up.
Hopefully things will now be more reliable and I shall see if I can add any more services.
If you want to use JustHost.com’s services, click the small advert below and I’ll earn $60 apparently!
Some random Linux tips: mutt 127 exec error and rsync operation not supported error
I’ve been fixing a few issues with my Linux server recently and had to search to find the fixes, so I though I’d post the fixes here.
Up until about a week ago, I was using ssmtp as my mail server to allow my Ubuntu server to email me certain things. It uses the gmail ssmtp server to send me mail. It was working fine for about a year, but suddenly stopped working recently, so I thought I would sort the problem out. I ended up removing ssmtp and installing postfix, which now is installed by default on ubuntu systems, using the guide from here. It worked very well, except my default user wasn’t able to send email using the default mail client I was using (mutt). I kept on getting the same error: Error sending message, child exited 127 (Exec error.)
It turns out I had a .muttrc file in my home folder, from an earlier failed attempt to set up an email server that had some stupid settings, most noticeably a sendmail setting. I simply deleted the .muttrc file and the above error went away.
However, it turned out that installing postfix meant that my server started emailing me whenever cron ran a job from /etc/crontab. Which in some cases was every two minutes! So, I found out that simply adding: " >/dev/null 2>&1 " to the end of every entry would stop the results being emailed to me.
This turned out to be quite useful, since cron emailed me with the results of my daily back up, that uses rsync, saying that it had failed with litteraly hundreds of the following error: /bin/cp: cannot create link Operation not supported some more googling revealed that this usually occurs when cp (copy) is trying to make a symlink on a disk that does not support symlinks, such as a Windows formatted NTFS disk. This was exactly my situation, so I simply reformatted my backup disk using gparted as ext3 and now rsync is much happier.
Make Your Own Video Baby Monitor
I’ve been quite quiet on the blog front lately, mostly because my Wifey is pregnant and we’ve only got one month to go! Being a through-and-through geek, I am always looking for ways to make my life easier or to do something cheaper through a clever technical hack and I plan to make my, my Wife’s and my baby’s lives as easy as possible through the power of the geek!
One thing I planned to do was to make my own baby monitor, rather than dropping up to £150 on some pre-built device. I wanted to be able to see as well as hear my baby when it is asleep upstairs, but those devices are very expensive. I thus thought I would try to make my own device using things lying around the house already. It actually wasn’t too difficult in the end, but I was lucky that I had the right equipment lying around. The first and most important piece of equipment is a Webcam. There are loads of options out there, but I wanted to use one that didn’t need to be connected to a PC to use. I had a Dlink DCS-2120 IP Webcam, that can connect to a Wireless network and doesn’t need a PC to run, it perfectly suited my needs.
The DCS-2120 includes some built-in features that are very useful, but I’ll mention that later. You can use other Webcams, even just simple USB versions, but you’ll need something to handle the video feed. If you don’t want to run a PC all the time, you could use something smaller, like a Fonera 2.0 router, that allows you to plug a USB Webcam.
So, next, you need a wireless network. Now, I didn’t want to carry around a huge router just to get this system up and running, because after all, this system should be portable enough to take to other people’s houses when we go travelling with the baby, so I chose to use the smallest WiFi router I could get my hands on. Luckily, I had one of the smallest routers already, a La Fonera. I already had another La Fonera installed and connected to the excellent free WiFi-sharing FON network, so I didn’t mind using this router for my own devices. Since the firmware (the software that runs on the router) that comes pre-installed on the router isn’t suitable for use as a normal router, I had to install (called flashing) some alternative Firmware. I chose to use DD-WRT, since it is fully supported on the Fonera and is very flexible. I used the guide from here that had some very detailed instructions on how to install DD-WRT on the Fonera. I shall summarise it here:
- Enable SSH access to the Fonera using a special web page hack.
- Enable the Redboot boot loader (allowing you load alternative firmware on the Fonera).
- Copy over the DD-WRT firmware and flash it on the Fonera.
It isn’t that simple, there are lots of steps involved, but the guide is very clear and easy to follow. Once I had DD-WRT installed, I now had a cool mini router, that I could then set-up to use with my IP Webcam.
Finally, I had to figure out how to actually view the feed. I wanted both a portable and a static solution. The Webcam I was using provides a feed using the rtsp protocol, so I needed a video player that could handle the rtsp stream. For my portable solution, I decided to use my Nokia N82 mobile phone, that has built in WiFi and can run the Core Media Player, that supports rtsp streams. For my static solution, I decided to use my laptop, running VLC on Ubuntu Karmic. In fact, because the Webcam just sends out the stream, any client that can access the wireless network and can play an rtsp stream will work. So, I can view the stream on my Windows Desktop upstairs, using VLC, whilst my wife can view the same stream on her Ubuntu Karmic netttop downstairs (yes Jobsworth, nettops can be useful).
I set-up the Fonera router, so that it provided a WiFi network with the same name (SSID) and security credentials as my main WiFi network at home. Thus, the Webcam automatically connects to my WiFi network when at home and my phone connects to it automatically also. Then, if I take the baby elsewhere, the Fonera replicates the WiFi network, so as far as the Webcam and phone is concerned, it is connected to the same network (this is very useful, because, the only way to change the wireless connection on the Webcam is through a wired interface, which is a bit of a complicated pain).
The real advantage of using this set-up is that you can have as many clients connected as you want to the video feed. The Webcam features a powerful microphone, so you can hear as well as see that the baby is ok and finally, the DCS-2120 includes some handy additional features, including the ability to take a photo at set intervals and upload them to an FTP server. Thus, I will be able to create one of those cool time-lapse movies of my baby as it sleeps and grows over time. I also chose the Fonera, because you can connect alternative aerials to it, most noticeably the La Fontenna, so this set-up should even work in my parent’s old house that has 12″ thick solid stone walls.
Since this whole system is meant to allow me to check up on our baby whilst it sleeps, I wanted to make sure it doesn’t look quite so scary and also allow it to be quite versatile. I thus bought a little teddypig, put the Webcam inside and used a Gorillapod camera stand to keep the Webcam in place (and also so I could attach it to pretty much anything).
It might look a little freaky, but I think it looks much less scary than the Webcam on its own.
Finally, here is a quick movie of the WebPig in action, alongside my laptop and mobile phone, showing it all working. The Core Media Player isn’t the best app in the world, so the video feed on the phone occasionally breaks up, as the video shows, but in general, it works very well.
Automount a drive in Ubuntu
I wrote this as a post on XBMC forum, but I thought I should share the wealth. The following is a guide to automounting a drive in a minimal install of Ubuntu with no GUI or desktop, only CLI access.
To manually get a minimal install of Ubuntu to auto-mount a USB drive at boot:
First off, you need command line access (also called The Terminal) to your installation and also you need to boot WITHOUT your USB drive connected. So, shutdown your box and then disconnect your USB drive. Now restart the box. Then, when XBMC has loaded, press Alt and F7 together, which should bring up a new Terminal screen with a log in.
Then log in using your username and password that you set up when you installed Ubuntu.
Next you need to type the following:
tail -f /var/log/syslog
This basically prints out the system log as it changes. Once you have typed this, plug in your USB drive. You should see a load of new stuff being printed in your terminal, this is the Ubuntu system recognising and loading your USB drive (though not mounting it). You should see something like this:
Jan 8 13:13:34 xpuntu kernel: [ 1671.616121] usb 2-2: new high speed USB device using ehci_hcd and address 5
Jan 8 13:13:34 xpuntu kernel: [ 1671.750917] usb 2-2: configuration #1 chosen from 1 choice
Jan 8 13:13:34 xpuntu kernel: [ 1671.752477] scsi6 : SCSI emulation for USB Mass Storage devices
Jan 8 13:13:34 xpuntu kernel: [ 1671.752815] usb-storage: device found at 5
Jan 8 13:13:34 xpuntu kernel: [ 1671.752820] usb-storage: waiting for device to settle before scanning
Jan 8 13:13:39 xpuntu kernel: [ 1676.753513] usb-storage: device scan complete
Jan 8 13:13:39 xpuntu kernel: [ 1676.754606] scsi 6:0:0:0: Direct-Access WDC WD16 00AABB-56PUA0 7H00 PQ: 0 ANSI: 2 CCS
Jan 8 13:13:39 xpuntu kernel: [ 1676.755793] sd 6:0:0:0: Attached scsi generic sg2 type 0
Jan 8 13:13:39 xpuntu kernel: [ 1676.756402] sd 6:0:0:0: [sdb] 312581808 512-byte logical blocks: (160 GB/149 GiB)
Jan 8 13:13:39 xpuntu kernel: [ 1676.757163] sd 6:0:0:0: [sdb] Write Protect is off
Jan 8 13:13:39 xpuntu kernel: [ 1676.757171] sd 6:0:0:0: [sdb] Mode Sense: 00 38 00 00
Jan 8 13:13:39 xpuntu kernel: [ 1676.757176] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Jan 8 13:13:39 xpuntu kernel: [ 1676.761108] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Jan 8 13:13:39 xpuntu kernel: [ 1676.761119] sdb: sdb1
Jan 8 13:13:39 xpuntu kernel: [ 1676.774572] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Jan 8 13:13:39 xpuntu kernel: [ 1676.774583] sd 6:0:0:0: [sdb] Attached SCSI disk
You want to look out for the reference to “[sd*]“, in my case it is [sdb]. This is the name that Ubuntu has given to your USB drive.
Next stop the tail command, so press:
Ctrl and C
This stops the tail command, then type the following:
sudo blkid
You will have to enter your password. This should give you something like the following:
/dev/sda1: UUID="1024B74F24B73696" TYPE="ntfs"
/dev/sda5: UUID="015273a3-e1a8-4d53-867f-ffec83b3df60" TYPE="swap"
/dev/sda6: UUID="50b2512a-4d07-4a83-860e-be608a5b2cb7" TYPE="ext4"
/dev/sdb1: LABEL="" UUID="48D3-B1C9" TYPE="vfat"
What you see should be different from this. This basically lists all the drives attached to your system, alongside two important pieces of info, the drives UUID number and what the drive is formatted as. You need to find the reference to the “sd*” that you found out earlier, so in my case it is /dev/sdb1. Then, make a note of the UUID number and the TYPE as well, in my case it is vfat.
So, now we know where our USB drive is and what it is called.
Next, we want to tell Ubuntu to automount it each time it boots.
So, you need to edit the /etc/fstab file that tells Ubuntu what drives to mount at boot. Be careful here, don’t delete or change anything that is already in this file, since it will stop your device from booting. It is ok to add new stuff to this file however. To be safe, we shall make a backup of the /etc/fstab file, just incase we mess up. If we do mess up, simple copy this backup over the /etc/fstab file and reboot and everything will be back as we found it. So, to make a backup simple type:
sudo cp /etc/fstab /etc/fstabackup
This copies the /etc/fstab file to /etc/fstabackup, which we can use as a backup.
To edit the /etc/fstab file, you need to use the command line Text editor called Vi ([url]http://en.wikipedia.org/wiki/Vi[/url] and [url]http://www.cs.colostate.edu/helpdocs/vi.html[/url]) I would recommend reading about it first, since it is a bit of an arse to use in Terminal mode.
Start Vi to edit your file using:
sudo vi /etc/fstab
Use your arrow keys to move down to the very end of the file. Then press “a” to Append stuff to the end of the file. Press Return to start a new line and then type the following:
UUID=YOURUUIDNUMBERHERE /home/xbmc/usb vfat defaults 0 0
Add your own UUID number after the = and change the TYPE if yours wasn’t vfat. /home/xbmc/usb is where you will be mounting your USB drive, this can be anything you want, but to make your life easy, since XBMC defaults to showing your home directory in the file browser, put it under your home directory, so in my case, the main user on my box is xbmc, so I use /home/xbmc/usb.
Press Enter again after typing that, then press Escape, then press and hold Shift and press Z twice, this saves and exits Vi.
Next, you need to make the folder that the drive will be mounted in, so type:
mkdir /home/xbmc/usb
Replace /home/xbmc/usb with whatever you put in the /etc/fstab file earlier.
Finally, that is it. Hopefully, if all went well, you can now simply reboot, with your USB drive attached, and the drive will be found at /home/xbmc/usb which you can navigate to from XBMC.
Best of luck!!
Backup Backup Backup – Updated
So, my main storage drive failed yesterday. Admitedly I have been having problems with it over the past few months, with fsck throwing errors on reboot, but yesterday it totally died. One minute it was happily sharing my music out via samba, the next, everything had gone
Luckily, I run a good backup solution, so all I had to do was get myself a new drive (upgrading to 1TB in the process) and copy over my backed up files.
Simple, but if I wasn’t running my backup solution, I would have been screwed – bye bye to my music, photos and work files.
Thank you rsback and rsync….
(Update)
What is even more awesome, is that since Linux regards everything as a file (so all drives are effectively referred to as files (via the UUID) in Linux (in my case Ubuntu)) swapping out a drive with a new one is very simple. I just updated /etc/fstab with the UUID of the new drive, and then copied over my backed up files to it.
As far as Ubuntu is now concerned, it is the same drive, now only bigger. So all my samba shares and rsync folders all work as before.
God I love Linux.
XBMC and 1080p
I got myself a full HD TV over Xmas, a 32″ Full HD LCD TV from Panasonic (ok ok, the purests may say that you don’t need FullHD with a 32″ screen, but I say I dont need or want a TV half the size of my wall dominating my sitting room…). XBMC on it is just out of this world beautiful. Totally awesome. Anyone who is using XBMC on an old CRT needs to update NOW, it makes it SO much better.
Google Gives £12.4 Million To Charity For Christmas
At least one company hasn’t forgotten the true meaning of Christmas. Google has announced that it will be giving £12.4 million to charity for Xmas. Good on you Google.
Happy Christmas To All
So, it’s that time of year, and I’d like to wish all my readers a very Happy Christmas and a great New Year (well, it can’t be much worse than this one
). It’s been a brilliant year for pruperting, we’ve been going for just over a year now and we have already quadrupled our readership. I look forwarding to regaling you all with hints, tips, rants and posts next year.
Keep on rocking
You know it’s Xmas when VLC tells you so ;)
Ahh, good old VLC, you always know it’s Christmas time again when your VLC icon changes to a nice Xmassy one:
Yup, it’s definately Christmas now.
Happy Xmas and a great New Year to all my readers, lets hope 2010 is the year that gets us out of this horrible global mire….








