Category Archives: Linux

Problems Mounting Drives Under Linux

Lately I have not being having much luck with mounting external usb drives in my Ubuntu 8.04 install. All that seems to happen, is that the drive will appear under “computer” but that is about as far as it goes. When I click on the external drive it just errors and does not open. So a solution that I discovered on the net uncovered part of the solution but I will attempt to put it together for you πŸ˜‰ .

First of all you have to work out where you drive is mounted and what it is called. Under the Ubuntu distro, they are located under eg. /dev/sdb or something similar to that. The only thing that will change is the letter on the end. If you are not sure of which one you external drive is, you can unplug the drive then run this command :

ls -la | grep sd

Then plug the drive back in and run that same command to see what drive appears. This will tell you what the drive identifier is. Another way you might be able to find this information is by running the command :

dmesg | tail -n 50

This command will show you the tail end of the error message log, so from this you may also be able to determine what the drive identifier is from the message :

[ 2159.443365] FAT: bogus number of reserved sectors
[ 2159.443371] VFS: Can't find a valid FAT filesystem on dev sdb1.
[ 2159.488509] FAT: bogus number of reserved sectors
[ 2159.488515] VFS: Can't find a valid FAT filesystem on dev sdb1.
[ 2159.661736] FAT: bogus number of reserved sectors
[ 2159.661742] VFS: Can't find a valid FAT filesystem on dev sdb1.

As you can see from this message, it is telling me that it is trying to mount my drive as a VFAT system which is incorrect as it is actually NTFS. Now that this has identified my problem I can run a few commands to see if I can get it mounted. First I will make sure it is unmounted before I try to remount the file system:

sudo umount /dev/sdb1
umount: /dev/sdb: not mounted

That was just telling me that is was not already mounted, now I will create a directory for the file system to be mounted into. This can be anywhere you like but the standard spot in ubuntu is “/media/”. So next I run the command :

sudo mkdir -p /media/external_drive

Then if I am lucky all I have to do is mount the drive using :

sudo mount -t ntfs /dev/sdb1 /media/external_drive

Now you should be able to navigate to the folder you just created and view/edit the contents of the drive. If this still failed, try running the original dmesg command and see if you can track down what the problem is.

Normalizing Your Music

Listening to un-normalized music can be a painfull thing, considering one second it will be a normal volume and the next you will be deaf :omg . Anyway, I had a bit of a look on the net for a solution and by using Mp3Gain this is actually a pretty simple solution to fix.

Basically, Mp3Gain has the ability to normalize the volumes of all music without actually editing the mp3 files. It does this by analysing the levels and applying tags to the files which lets the player know how much to increase/decrease the volumes. The good thing is that it can do this over albums, to make the files pretty generic in their levels. Another good thing is that this can be done with a one liner πŸ˜‰ . First install then run:

sudo apt-get install mp3gain
find . -iname '*.mp3' -execdir mp3gain -a -k "{}" + &

What that command is doing :

    find . -iname β€˜*.mp3β€²
  • searches for all mp3 files.
  • -execdir
  • executes the command on a directory basis.
  • "-a"
  • tells mp3gain to use Album gain instead of Track gain (very important!)
  • "-k"
  • tells mp3gain not to increase the volume with no distortion.

For windows users this is a lot simples considering all you have to do is open the gui and tell it to run! πŸ˜› .

Convert Video for Xbox 360

This is just a walk through on how I have managed to convert video for playback on the 360 from my Ubuntu Hardy install. Basically, I could not be bothered setting up the whole media center and all of that type of stuff. I did gave uShare a “very” quick go but could not get the xbox to connect so I gave up. Pretty soft of me wasnt it πŸ˜› .

Anyway, after that effort I went searching for what the xbox will actualy support in the way of codecs and found some usefull information on the support site. This had me thinking “sweet” considering most of my shows are already in avi. But, as usual it was not going to be this simple. I spent ages trying all of the different codecs and kept getting nothing. The xbox would either show the red cross of death, play audio and no video or the other way round. I spent ages trying all of the different converstion, including video codecs and audio codec combinations. However, after all that stuffing about I noticed on the support site that the video/audio and extenstion information had to match, as well as the container. Now, I am not sure if this is something that everyone knows but I personally had no idea about the container??

Armed with this new information I tried the H.264 codec with the AAC audio and MPEG4 containerΒ  but to no avail. So, I just went straight for the wmv+wma+asf combination and omg it worked. Now I know I should have tried the other combinations, as they are better. But after hours of frustration I was totally over the whole process and not even remotely interested in watching the show that this was all in aid of :( . Ok, so I will show you the command that I came up with and it “should” convert any format over to the required xbox format:

mencoder "BBC-Planets_9.avi" -o "BBC-Planets_9.wmv" -of lavf -lavfopts format=asf -ovc lavc -lavcopts vcodec=wmv2 -oac lavc -lavcopts acodec=wmav2

You should already have mencoder installed but if not just :

sudo apt-get update
sudo apt-get install mencoder

Well just a brief description of the code is :

mencoder "BBC-Planets_9.avi" -o "BBC-Planets_9.wmv"

This section will take the input file of type avi and output to file type wmv. However, just remember this is only a name and does not have any smarts based on the extension. The next section is to do with the container that I was talking about earlier :

-of lavf -lavfopts format=asf
  • The “-of” stands for output format
  • The “lavf” is the codec you have chosen to do the conversion for you
  • “-lavfopts” is the options command specific to that codec “lavf”
  • “format=asf” and this is creating the video using the container asf

Next is the output video codec information :

-ovc lavc -lavcopts vcodec=wmv2
  • “-ovc” stands for output video codec
  • “lavc” is the library you have chosen to transcode you video, This is chosen based on the format you need.
  • “-lavcopts” the options command specific to lavc
  • “vcodec=wmv2” use lavc’s wmv2 library to convert the video to wmv

The final part is the audio codec information :

-oac lavc -lavcopts acodec=wmav2
  • “-oac” stands for output audio codec
  • “lavc” is the library used for transcoding to this audio type
  • “-lavcopts” is the options param for lavc
  • “acodec=wmav2” tells the transcoder to convert the audio to the type wma

Now that is pretty much it. I did spend a lot of time looking though the forums but most of the solutions did not work. All of the information needed was from using the man page of mencoder and the xbox format requirements on the page listed earlier. At some stage I would like to have a go at getting some of the other formats to work as well as having a look at vpass=2 which should make the video a lot better. When I do I will list the new command on the page for you guys.


Hey Again, this is just an update that might be useful for getting a little better resolution on the files

For first pass run this one:

mencoder -noskip "BBC-Planets_7.avi" -o "BBC-Planets_7_1.wmv" -of lavf -lavfopts format=asf -ovc lavc -lavcopts vcodec=wmv2:vbitrate=5000:vpass=1 -passlogfile "libvcodecstats.txt" -oac lavc -lavcopts acodec=wmav2

For second pass run this one:

mencoder -noskip "BBC-Planets_7.avi" -o "BBC-Planets_7_1.wmv" -of lavf -lavfopts format=asf -ovc lavc -lavcopts vcodec=wmv2:vpass=2 -passlogfile "libvcodecstats.txt" -oac lavc -lavcopts acodec=wmav2

Note, you might also want to check out different vbitrate settings?

Adobe Air in Ubuntu Hardy Herron

I had recently started using Twitter as suggested by a friend and it seems pretty cool. But, because of its fast and lite nature I needed some “pretty” way of posting and tracking my friends on it. I did the usual thing of searching the net for gnome packages and some were ok, but most were lacking and average. Anyway, I had a look for a similar thing on my windows machine, and came across spaz. This is a “widget” type install for the new Adobe Air . The adobe air suite allows widgets like spaz and analytics reporting suite to sit on the desktop, similar to the new vista style widgets.

Anyway, enough crapping on… The cool part is that, Adobe has released a package for linux :) . This is sweet news that they have taken the time to develop for linux, it is only in the Alpha atm but should be in beta very shortly. Here is a pic that shows the Analytics plugin and the Spaz one :

The install is pretty straightforward:

  • Download the deb package from adobe
  • Run these commands on the downloaded file :
  • chmod +x adobeair_linux_a1_033108.bin
    sudo ./adobeair_linux_a1_033108.bin

The package management system should take over from here, and .air packages should be installed with a double click from then on.

The plugins that I think are pretty sweet are here :

Ubuntu and Wireless Dropout

It had been a while since I had messed with wireless. But since I just brought a fancy new antenna, it was time to investigate some exciting new stuff. Well, as with most things I find exciting they usually end up costing me heaps of time :( .

Once I had setup the new antenna I wanted to have a look at the performance difference, which is a bit flaky from the network manager. But I noticed as I started messing with some commands something happened which was unexpected. I started getting the dreaded “wireless dropout” that occurs infrequently at about 20 second intervals just to piss me off. I tried to retrace my steps to find out what I had changed and ended up spending a whole day looking for the solution. It turns out that with the “cool” new commands that I had learned to do things like:

  • restart the network interfaces
  • lift the interfaces up and down
  • list other networks in my area and
  • finally, one to show the status of my own network

Even though it was nice to be able to type a few words and have the interfaces restart afresh I was leaning toward this being the problem. Then, I remembered that orignally when I was having these sorts of problems in the begining, I downloaded an app called Wicd! This was the solution for my problems orignally and funnily enough did the same again πŸ˜‰ .

Well, there were some good things to come from this “journey”?? Not sure what they were, but here is a list of the commands that I found and are pretty handy! Also, remember Wicd might also be a simple solution for you?

Show status of “my” wireless interface: ‘iwconfig ath0

xxxxxxxx@HAL:~$ iwconfig ath0
ath0    IEEE 802.11g  ESSID:"xxxxx"  Nickname:""
          Mode:Managed  Frequency:2.442 GHz  Access Point: 00:xx:xx:xx:xx:8B
          Bit Rate:36 Mb/s   Tx-Power:18 dBm   Sensitivity=1/1
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=58/70  Signal level=-36 dBm  Noise level=-94 dBm
          Rx invalid nwid:52311  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Show list of all wireless broadcasts within range: ‘iwlist ath0 scan

xxxxxxxx@HAL:~$ iwlist ath0 scan
ath0      Scan completed :
          Cell 01 - Address: 00:xx:xx:xx:xx:8B
                    Frequency:2.442 GHz (Channel 7)
                    Quality=59/70  Signal level=-36 dBm  Noise level=-95 dBm
                    Encryption key:on
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                              48 Mb/s; 54 Mb/s
                    IE: IEEE 802.11i/Encryption here :)
                        Group Cipher : TKIP
                        Pairwise Ciphers (1) : TKIP
                        Authentication Suites (1) : PSK
          Cell 02 - Address: 00:xx:xx:xx:xx:78
                    Frequency:2.442 GHz (Channel 7)
                    Quality=28/70  Signal level=-67 dBm  Noise level=-95 dBm
                    Encryption key:on
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                              48 Mb/s; 54 Mb/s
                    IE: IEEE 802.11i/Encryption here :)
                        Group Cipher : TKIP
                        Pairwise Ciphers (1) : TKIP
                        Authentication Suites (1) : PSK

Restart all network interfaces

xxxxxxxx@HAL:~$ sudo /etc/init.d/networking restart

Vpn setup using PPTP

A client I have been working on recently asked me to setup a Vpn for them to work remotely and still maintain security. Now I knew the definition of Vpn connections but had never needed to implement one. What I did know was that there are two main configurations: Microsofts PPTP and IpSec but that was about as far as it went πŸ˜› . So I did some reading and it turns out that the fastest and most used is PPTP for remote connections. However, IpSec seems to be the obvious choice for bridging locations such as office_1 to office_2. The security features of PPTP are not that strong, due to the high level of abstraction before the encryption takes place. IpSec is a much lower and “raw” layer which has much stronger security features, but suffers on speed because of this.

In this case I will be only using remote connections, so PPTP “seems” the way to go?? Anyway, it seemed a sinch to setup the user connections on the “Billion 7404 Vgp(M)” having only to select username, pass and some default configuration settings like: Encryption type; session mode and timeout. At this stage I was thinking how easy πŸ˜‰ . To my suprise it was not this easy!

In this case I was not connecting to the vpn using Win pc’s but Mac’s instead. Mac’s have a built in Vpn client that supports PPTP and IpSec connections under “Internet Connections”. This made it a lot easier since I did not have to install a client. So I opened the vpn client and tried to connect to the network and found that it would not connect?? This is due to a bug in the mac vpn client which does not support “statefull” connections ( Bug ID# 4581573).

So with this new info i went back to the configuration settings for the vpn and made sure the settings were :

  • Encryption Enabled
  • Force 128bit
  • Force Stateless

When I tried the connection again all was good and I was connected. However, there still remains some strange behavior. Once connected I cannot access the internet using the Vpn and I also cannot connect to the servers using names, but only IP’s. This is not a show stopper but it is a little annoying as the clients will only be able to do work without accessing the internet. To me this looks like a simple dns problem but I have no idea how to correct it. I have submitted a post to the billion forum and hope they will resolve the problem for me, but I will keep playing in the meantime to see what is going on.

I am also wondering if this is the same problem that I am having with my linux box? I can make the connection to the vpn network and ping/connect to the server, but I have no access to anything else on the network. I cannot ping any machines and connect to the smb shares. So basically I can do nothing when connected unless i use a mac. I have not had a chance to try a pc but will see if i can have a go next week to see what happens?

So my current status is: I got the vpn setup relativly easy and can connect using my mac but not my linux box; when connected I can access the shares using the mac but cannot access the internet and the linux box cannot do anything. So, hopefully billion lends a hand and tells me what I need to do to get this working sweet?

Skinning Ubuntu 7.10 Gutsy

This will just be a short topic on how to skin ubuntu and get it looking a little sweeter than the standard orange look. Basically, will find all that you ever need, including heaps of themes, wallpapers and icon sets at on gnome-look.

However, if you are like me and just download a theme for, in my case GTK 2.., and expect it to install, then get ready for a suprise πŸ˜› . In most cases it was just a matter of opening “Appearance” under System -> Preferences -> Appearance, then dragging the theme tar-ball onto the theme section and away it goes. But if you are like me, then you may also want the icons that go with the theme to be applied as well? Some of the doco that I read suggested to copy the icon folder to /home/you/.icons. Then they would just show up in the appearance app under Customize -> icons. But every time I tried that nothing happened :( .

What i ended up finding was a few short commands that will get you started, at the very least:

    sudo apt-get install gnome-themes-extras

    sudo apt-get install gnome-extra-icons

    sudo apt-get install gdm-themes

Between these three commands you will be automatically provided with a new list of themes, icon sets and even login pages.

I can really take no credit for this find, as the instructions came straight from Kris at Geekybits. So a big thanks to chris for putting this together for us πŸ˜‰

Running Scribes as root

For a little while I had a painful time in getting the text editor scribes to run as root. You are probably wondering why i would want to run the text editor as root, but when you cant be bothered using vi or gedit and would like some pretty code highlighting then that is what you need to do. Anyway, as you may know I am running Ubuntu 7.10 Gusty and it is going “pretty” well for the most part. So the objective i wanted was to be able to launch scribes from the shell then have it edit my “whatever” configuration files. The problem that i was having looked somthing like the following :

binneyd@HAL:~$ sudo scribes /etc/fstab[sudo] password for binneyd:Traceback (most recent call last):  File "/usr/bin/scribes", line 38, in    main(argv[1:])  File "/usr/lib/python2.5/site-packages/SCRIBES/", line 45, in main    __open(uris)  File "/usr/lib/python2.5/site-packages/SCRIBES/", line 58, in __open    __open_via_dbus(uris)  File "/usr/lib/python2.5/site-packages/SCRIBES/", line 76, in __open_via_dbus    dbus_service = __get_dbus_service()  File "/usr/lib/python2.5/site-packages/SCRIBES/", line 109, in __get_dbus_service    from info import dbus_iface, session_bus  File "/usr/lib/python2.5/site-packages/SCRIBES/", line 34, in    session_bus = SessionBus()  File "/var/lib/python-support/python2.5/dbus/", line 218, in __new__    mainloop=mainloop)  File "/var/lib/python-support/python2.5/dbus/", line 107, in __new__    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)  File "/var/lib/python-support/python2.5/dbus/", line 121, in __new__    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

After quite a bit of searching i found out that the Scribes application does not like to be run as root and will, not very gracefully, fail if you try to do it. So, you need to bypass this problem by using the dbus launch and away you go eg. :sudo dbus-launch scribes /etc/fstabThis was a little ugly of a solution so i just cleaned it up with an alias and that is about it.alias suscribes=’sudo dbus-launch scribes’So hope this helps and saves you some time as well πŸ˜‰

CD ripping with ubuntu – fiesty

At the moment i am attempting to rip a cd to mp3 format. As a new user of Ubuntu i am not that familiar with all of the apps and packages that you need to effectively use this system but for some simple tasks like this, it does seem a little more difficult than it should be.

Anyway, i have tried a few apps so far like soundjuicer, songbird and amarok. i am trying to make it work with amarok because i would like to not have to use multiple apps to do common tasks like audio. When using amarok and trying to import the cd tracks into the library via right click, all i get is some grayed out options which is not much help. However, I will keep looking for a solution to the amarok problem and will provide an update when i find one??

Well after some messing around with packages and other crap like that, i have given up on the idea of using amaroK to do the ripping and moved to soundjuicer. It does seem to do the job but is extremely slow to the point of sleep, and does not seem to have even gotten track names or any of the correct information. Uuuumm, it turns out that there is more to track information than i originally thought.

What seems to happen when you insert a disk, is that the track lengths and number of tracks are sent to one of many online directories eg. cdda and there the cd information is compared against a database to see if there is a similar cd available. Now, considering that there will not be a similar cd, because this is a custom one, it will find no results. This will leave you with a cd full of songs and no associated information, which sucks. Anyway, it turns out that you can upload the newly created cd, using iTunes to the appropriate online directory and then move to the new computer where the track information will be grabbed. Definitely, not an ideal solution but it is late and i am getting annoyed. Another alternative is: If you have a friend who has a mac, you can use a script CD Text to CD Info v1.2″ to apply the tag information to the songs before they are burnt or imported. This means that when you go to import/record the disk you will be able to grab the track information automatically which is a lot better of a solution.I know that this is not a solution for ubuntu but i have given up for the moment in hope that someone else can shed some light on a better alternative.