Archive for the ‘Ubuntu’ Category

Random Freezing in Amarok, Banshee, Rhythmbox

Friday, June 19th, 2009

I am a big fan of Amarok – as a music application I think it is the best there is (much better than iTunes).

I have for some time however had problems with it freezing up on a regular basis. It seemed to happen with no particular pattern, even if I opened the application and left it on screen without playing any music or touching the mouse or keyboard, after a few minutes it would freeze up. It generally didn’t freeze for very long – maybe 10 seconds or so, but seemed to be doing it quite regularly every few minutes.

I eventually got so fed up with it that I tried switching to Banshee, but had exactly the same issue. I then tried Rhythmbox and had the same issue yet again, so decided it had to be a common library in Ubuntu rather than the apps themselves.

I have tried various things to get to the bottom of the problem. I stumbled across quite a few posts relating to issues with ESD (Enlightenment Sound Daemon) causing problems in all sorts of applications, but switching to OSS or ALSA didn’t seem to improve matters.

So, for now I have still not found a solution – please let me know if you have any suggestions!

Ubuntu Gnome Application Menu Missing

Monday, September 8th, 2008

I have had a rather annoying problem on my Ubuntu box for the last few days. Not sure how it happened, but my application menu suddenly stopped working. Whenever I clicked on the menu I just got a tiny grey box with nothing in it where the menu should have been.

After a lot of googling with no success, I finally stumbled on a post that mentioned some files in ~/.config/. When I had a look in there, there was a subdirectory called menus which contained a file called applications.menu. I had a look at that file, and sure enough it was empty. After having a quick look at my other Ubuntu box I noticed that box had no applications.menu, so I deleted the empty file and hey presto!

Handy Shell Commands

Thursday, March 20th, 2008

I thought I would share some commands and small single line bash scripts I have found useful in the past:

AWK

Output every 50th line from a file into a new file :

cat infile.csv | awk ' (NR % 50) == 0 { print $0 } ' > outfile.csv

Print the 13th column (space delimited):

awk ' { print $13} '

Print the 13th column (colon delimited):

awk -F":" '{ print $13 }'

Find

Recursive Grep (starting from current directory):

find . -name "*" -exec grep -i "searchValue" {} /dev/null \;

Compare files in two directories (-N for new files, -a for forcing ASCII, and -r for recursing subdirectories):

diff -Nuar dir1 dir2

Find all files under /dir older than 7 days, and delete them:

find /dir -type f -mtime +7 | xargs rm -f

Do a global search and replace from “html” to “shtml” across all html files in the current directory and all subdirectories:

find . -name "*.html" -exec perl -pi -e 's/\.html/\.shtml/g' {} \;

Rename all html files to shtml files in the current directory and all subdirectories:

find . -name "*.html" | while read f
do
mv ./"$f" "${f%html}shtml";
done

Find the largest files and directories on your hard disc (starting from the current directory):

du -k * | sort -nr | more

List Hardware in your machine:

sudo lshw

Using Printers in Linux Without a Linux Driver

Sunday, February 17th, 2008

I recently bought a Lexmark X4550 all-in-one printer, scanner and copier. What I didn’t realise before I bought it is that Lexmark are horribly bad at providing Linux support for their printers. After speaking to their support people and finding out that the printer really doesn’t have any linux drivers and is unlikely to have any in the near future I began looking into ways of getting it to print.

The solution I came up with is a bit nasty, and not something you will probably want to do unless you really really want to get things printing from Linux.

Here’s how it works:

1) Install Innotek VirtualBox? (or some other virtualisation tool)

2) Create a new Windows virtual machine (I used Windows 2000 – I had a spare license I got free with an old PC and am not using)

3) Install the printer driver software on your windows virtual machine

4) Install GPL Ghostscript in your Windows VM – available here: http://sourceforge.net/projects/ghostscript/

5) Install “PrintFile” in your Windows VM – available here: http://hem1.passagen.se/ptlerup/prfile.html

6) Create a network share on your Linux machine and map to it from your Windows VM so it has a drive letter (e.g. K:)

7) Create a directory in this shared directory that you will monitor for new print jobs (e.g. K:\printspool)

8 ) Run PrintFile and configure it as follows:

Set “enable spooler function” to ticked
Click the “Conversion” button
Tick Enable Conversion for PostScript? Files
In the program box enter the path of your ghostscript installation
In the Parameters box enter the following:
-Ic:\gstools\gs8.61;c:\gstools\gs8.61\fonts -dSAFER -dBATCH -dNOPAUSE
-sDEVICE=mswinpr2 -dGraphicsAlphaBits=4 -sOutputFile=”\spool\&p” &i -c quit
(All on one line)
Click OK, then Save and the close the PrintFile

9) Create a new batch file in your Windows VM containing the following:

“C:\Program Files\PrintFile\prfile32.exe” /s:K:\printspool\*.ps
(Where K:\printspool is the spool directory you want to monitor)

10) Run your batch file and it will start monitoring your directory for new jobs to print

11) In your Linux PC you can now print from any application – in the print dialog tick the “print to file” box and save your print job in the shared print spool directory that is being monitored by your windows machine.

Not a neat solution I admit, but it works :)

Using RSync to backup from Windows to Linux

Monday, January 21st, 2008

I have a laptop running Windows Vista and a PC running Ubuntu Linux. When I take photos I generally transfer them to my laptop initially, but I wanted a simple way of keeping a copy of all the photos on the linux box too as a backup. Linux boxes have a great tool for data synchronisation called rsync. rsync is a very powerful tool that can copy across only files that have been modified, and is even clever enough only to copy the differences between the files rather than the whole file. It can also compress the file before transferring it and decompress it at the other end seamlessly to improve network performance.

To use rsync to backup from the windows laptop however, I first needed to find a windows rsync server application. Luckily there is a very nice free application called DeltaCopy , which is bascically the linux rsync with a windows wrapper around it (using cygwin). I found it was easy to install and runs as a service in Windows. You can get DeltaCopy from here: http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp

Most versions of linux come with rsync included by default, so the linux end was easy to set up. I created a small script to run the actual synchronisation, and added it to cron so that it runs every hour and checks for new Photos on the laptop. You can see the script below:

 #!/bin/bash
 if [ ! -f "/tmp/synchronising" ]
 then
   echo "Running" > /tmp/synchronising
   rsync --verbose --progress --stats --compress --recursive --times 192.168.10.101::Photos /home/adam/Photos > /home/adam/Scripts/synchronisation.log
   rm -f /tmp/synchronising
 fi

Another good article on how to use rsync can be found here: http://everythinglinux.org/rsync/

Video Editing in Ubuntu

Thursday, December 6th, 2007

This post is a record of the tools I have used in Ubuntu Linux (7.04, Feisty Fawn) to capture and edit digital video, as well as transcode, author and burn it onto DVD.

Software

The main pieces of software I used were:

  • DVGrab – Utility for grabbing digital video from a DV camcorder
  • Kino – Video calture and editing tool
  • Kdenlive – Non-linear video editing tool
  • Cinelerra – Another video editing tool. Installation instructions are available here: https://help.ubuntu.com/community/CinelerraOnFeistyAMD64
  • VLC Media Player – Very powerful video player, decoder, encoder, streamer, etc.
  • Tovid – Very handy tool for transcoding any video format into DVD format. Instructions on how to install this are available here: http://tovid.wikia.com/wiki/Installing_tovid/Ubuntu
  • mplayer – Video player and transcoding tool (used by Tovid)
  • faad – Audio decoder, useful for working with Divx/XVid files
  • DVDStyler – DVD Menu creator and burning tool. I had to compile from source and I also had to get the wxsvg library – this tutorial helped: http://ubuntuforums.org/showthread.php?t=482761
  • QDVDAuthor – A slightly more advanced DVD menu editor, but a bit more difficult to get to grips with than DVDStyler

Transcode an mp4 (xvid) video into DVD format

Using tovid (adding subtitles when found):

Widescreen:

tovid -overwrite -pal -dvd -wide -quality 8 -autosubs -in "Video.mp4" -out "Video.mp4.tovid_encoded"

Normal:

tovid -overwrite -pal -dvd -quality 8 -autosubs -in "Video.mp4" -out "Video.mp4.tovid_encoded"

If the audio extraction fails, extract it separately and re-multiplex as follows:

faad -o outputfile.wav Video.mp4
nice -n 0 ffmpeg -i outputfile.wav -vn -ab 224k -ar 48000 -ac 2 -acodec ac3 -y ./Video.mp4.tovid_encoded/audio.ac3
mplex -V -f 8 -o
    ./Video.mp4.tovid_encoded.mpg
    ./Video.mp4.tovid_encoded/video.m2v
    ./Video.mp4.tovid_encoded/audio.ac3

Transcode a Matroska (mtk) file into DVD format

Do the initial extraction using tovid as per the steps shown above. When I did this the audio extraction failed, so I did it like this (I’m sure there is a easier way however):
Note – for the first step you will need to install the mkvtoolnix package from synaptic.

mkvextract tracks Video.mkv 2:audio.aac
faad -o outputfile.wav audio.aac
nice -n 0 ffmpeg -i output.wav -vn -ab 224k -ar 48000 -ac 2 -acodec ac3 -y audio.ac3
mplex -V -f 8 -o Video.mpg video.m2v audio.ac3 

Installing and configuring Ubuntu 7.04

Tuesday, November 27th, 2007

This is a record of how I configured Ubuntu Linux 7.04 (Feisty Fawn) to run on my PC. This is purely for my own reference in case I need to reinstall it in the future, but it may be of use to other people who have similar hardware.

My hardware is as follows:

  • CPU: AMD Athlon 64 3000+
  • Graphics: ATI Radeon 9550
  • Wireless: Belkin 802.11g (Broadcom BCM4306 chipset)
  • Sound: Realtek AC’97 (on motherboard)
  • Video Capture: Conexant BtPCI
  • Webcam: Logitech Quickcam
  • Hard Drive: IDE
  • Other: iPod Nano, USB Memory Stick
  • Printer: Epson Stylus Photo 915
  • Printer: Lexmark All-in-one X4550

The good news:

The basics were detected fine and worked straight away once I installed Ubuntu. My video card was detected, I got a decent screen resolution, and the sound worked. Also, my memory stick worked, and I could browse the files on my iPod. I could also see files on the NTFS partition of my hard drive, but they were read-only.

Wherever possible I am sticking to versions of apps and libraries in the Ubuntu Feisty Universe (using Synaptic).

The bad news:

  • My wireless card didn’t work (luckily I had a wireless bridge I was able to borrow to plug into a wired port until I got it working).
  • The 3D effects (Compiz/Beryl) did’t work – no 3d acceleration.
  • Adobe flash player wouldn’t work because there is no 64 bit version :(

3D acceleration

To start with there was some acronyms to deal with. ATI offer a Linux driver on their web site, but it is not fully open source. It referred to as the fglrx driver. I didn’t have much luck with this driver – after installing it I still couldn’t get the 3D acceleration to work. There is an open source driver that seems to be referred to as the SGI driver, or just the “open source driver” – in the end this one worked for me.
There are lots of posts in forums that discuss ways of making it work, but it was this forum that had the answer that worked on my system: http://www.howtoforge.com/ubuntu_feisty_beryl_ati_radeon

I do still get a problem when I first start up my PC. I have to manually restart Beryl and the Emerald theme manager by typing:
(beryl &) &
(emerald &) &

Flash Player

To get flash working in firefox, I had to use something called npwrapper to allow a 64bit firefox to run a 32bit plugin. The tutorial that I found worked was this one: http://ubuntuforums.org/showthread.php?t=341727 Make sure you follow the instructions carefully and don’t skip any steps.

Wireless Network

I struggled to get my Belkin wireless card working before giving up and buying a Netgear card instead :) The worked fine with the madwifi drivers that come with Ubuntu, but I did have a problem with the link dropping every so often. It appears to be a bug described here: https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/64173

Webcam

Haven’t had a chance to try this out yet.

Printing

My Epson printer was detected and showed up correctly as an Epson Stylus Photo 915, but when I tried to print the colours didn’t come out correctly. To fix it I installed the gutenprint driver – http://www.linuxprinting.org/show_driver.cgi?driver=gutenprint&fromprinter=Epson-Stylus_Photo_915

With the Lexmark printer I had more problems – it seems there is no Linux driver for the X4550. I spoke to the Lexmark technical support people and they apologised but confirmed it is not supported :(

Other Apps

Some other useful apps I installed:

  • Java – I had some difficulties with the versions of Java available using Synaptic, so I downloaded the binary installer for Java 6 from the Sun website and that seems to work fine.
  • IDE: Eclipse – The version of Eclipse available in Synaptic is 3.2 so not the latest, but seems to work ok.
  • IDE: Netbeans – I had a problem running this that it transpires is a problem with all swing apps when using Beryl. The only way around it at present seems to be switching back to another window manager like metacity. I tried the latest daily builds of Java 6 and even Java 7 but they all seem to have the same problem. The only workaround (of sorts) I have found is the rather clever idea of running a nested X session within the current one. Details are available here: http://www.vikrammohan.com/blog/2006/12/31/how-to-make-java-swing-work-on-beryl-with-aiglx/
  • Instant Messenger: Pidgin – A slightly newer version of Gaim. I got this one from their website, only Gaim is available in Synaptic. The sound didn’t work at first but I followed the instructions here to fix it: http://modfree.org/index.php?topic=458.msg5125 . Also, I wanted support for the sametime protocol, which meant that before compiling I had to install the libpurple-meanwhile and libpurple-meanwhile-dev packages.
  • Password Safe – This is an app I used to use on Windows and find really useful. I found that it can be run in Wine – details here: http://appdb.winehq.org/appview.php?iVersionId=8739 . Wine is also not available in Synaptic as far as I can tell, so follow these instructions to add it: http://www.winehq.org/site/download-deb
  • Browser: Firefox – Installed by default
  • Email: Thunderbird – Available in Synaptic
  • Launcher: Katapult – Available in Synaptic
  • Video Editing – I will do a separate post on this topic..
  • Podcasts – Podnova client – available from http://www.podnova.com/subscriptions/download/
  • Photo Management – Desktop Flickr Organiser. Great tool for viewing and editing your online Flickr photo collection. Available from http://code.google.com/p/dfo/
  • Album Cover Art – A clever little script you can use to display your albums in the Nautilus file manager with their cover art: http://ubuntuforums.org/showthread.php?t=486359
  • Cover Art Downloader – A handy tool for adding cover art to your music collection: http://www.unrealvoodoo.org/hiteck/projects/albumart/ . An extra step was required to make it work in Feisty: http://ubuntuforums.org/showthread.php?p=2809331
  • Screenlets – nifty little widgets to show clocks, CPU meters, calendars etc on the desktop: http://tombuntu.com/index.php/2007/08/24/osx-like-widgets-with-ubuntu-screenlets-and-compiz-fusion/

Themes

Once you have switched in the 3d effects in the appearances settings, you then have the option of two different kinds of window decorations (and therefore two different types of themes): GTK or Emerald. Switching between these and configuring them however is a bit of a pain. I came across this page which explains how to install some packages to make it all a lot easier: http://www.linuxquestions.org/questions/fedora-35/cant-get-berylemerald-theme-working-629177/

To get themes I found this site was the best: http://www.gnome-look.org

Recording Real Audio Streams

Sunday, September 30th, 2007

Recording a real audio stream can be done in Linux fairly easily. The basic process is to play the stream and instead of sending the audio to your sound card you send it to a virtual sound card which saves it as a wav file. You can then encode it as an mp3 for later listening.

To do this you will need three apps installed:

  • mplayer – you will use this to play the stream
  • vsound – this is the virtual sound driver that will send the output to a wav file
  • lame – this is the mp3 encoder you will use to encode the wav file to an mp3

You can now use a simple script to record a stream and convert it to mp3. The below script takes two parameters – the first being the URL of the stream to record, and the second the filename of the mp3 to output

Script:

#/bin/bash
echo Recording stream: $1
echo To filename: $2
/usr/local/bin/vsound -f outputfile.wav /usr/bin/mplayer $1
/usr/bin/lame -v --nohist outputfile.wav $2