Ubuntu can mount ISO files, and IMG files after converting them to ISO

Today I needed to create an OEM Microsoft Office 2007 CD and found that I could download the disks directly from the Microsoft site. However, the files that I downloaded were in IMG format. At first I was puzzled, but quickly (via Google) found out that they were essentially ISO files. However, I did not quickly find anything in Ubuntu that would burn an IMG to disk.
Diligent searching finally revealed that while there were not really ways to burn an IMG to disk, or mount an IMG file directly, there is a tool called ccd2iso that converts the IMG to ISO format.

First I had to install the ccd2iso package via Synaptic package manager, or I could have used ‘sudo apt install ccd2iso’.

After installing this I could simply run the following command from terminal:

ccd2iso myfile.img myfile.iso

The same methods can be used for other image type files:
mdf2iso -> myfile.mdf
nrg2iso -> myfile.nrg

Now I have a regular iso file that can be used to serve our purposes by burning to disk or mounting:

sudo mount -o loop myfile.iso mountname
 
or
 
sudo mount -o loop -t iso9660 myfile.iso mountname

The .nrg files can also be mounted in this manner without converting to ISO by using:

sudo mount -o loop,offset=307200 myfile.nrg mountname

NOTE: if this doesn’t work and you get an error like: “Unrecognized sector mode (0) at sector 0!” it may be due to the limitations of the ccd2iso. In my case the MS Office disk had multiple sessions, and I could not convert it to ISO.

Another post I found on Ubuntuforums said to try the following:

growisofs -dvd-compat -Z /dev/dvdrw=dvd.img

Where /dev/dvdrw is your dvd/cd burner.

FOLLOWUP:
The IMG file I had from Microsoft was a multi-session disk so I was not able to use the steps above. However, when I simply changed the file extension to ‘.iso’ it worked fine. There seems to be very little difference between IMG and ISO.

Finding a text string inside a file on a Linux server

It never fails that I find myself hunting for a way to search for a particular text string in files.  Usually I know the file, but often times I also find that I am completely unsure what file contains the string.  Or while I am writting some code I need to find how many files use a certain function.

I know that using grep is the best way to search on a Linux server, so I start there.  Here is the command syntax:

grep "text string to search for" /path/to/search

Examples
To search for a string called “myFunction” in all text files located in /var/www/html/*.php use:

grep "myFunction" /var/www/html/*.php

To search recursively in all sub-directories you would alter the command by adding the -r option:

grep -r "myFunction" /var/www/html

Now you have probably noticed that grep prints out the matching lines containing your string, but you may also need the filenames of the files containing the string instead. You can use the -H option to narrow the output the filename followed by the line containing your search string, like so:

grep -H -r "myFunction" /var/www/html

This would output something like:

...
your_file.php: line containing myFunction
..

To print out just the filename you can cut command like this to clean the output further: (Note the one after the f, not an L)

grep -H -r "myFunction" /var/www/html | cut -d: -f1

The new cleaner out put would be like:

...
your_file.php
...

UltraEdit on Linux and MAC…finally ! ! !

I received an email that just made my day. It was the announcement that UltraEdit will finally be available on Linux! The screenshots show it on Ubuntu, and they say there will also be a version for MAC. (Initially it will only be packaged for Ubuntu with tar balls for the others, but soon there will also be packages for Suse, and Redhat) And it is very close to release, supposedly Alpha in April 2009.

UltraEdit on Ubuntu
UltraEdit on Ubuntu

You can find out more on the Blog Post, or you can see the Formal Product Page.

MySQL not creating mysql.sock and broken on Hardy Heron

Recently I started receiving errors when I tried to connect to MySQL using command line or PHPMyAdmin. In command line I would get “ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)”, and with PHPMyAdmin I would get “#2002 – The server is not responding (or the local MySQL server’s socket is not correctly configured)”.

The system in question is my Dell Inspiron 1720 running Hardy Heron Ubuntu. I knew of a few changes to my system, but none of them seemed to have caused the problem. So I hunted for a few days trying to figure it out. I performed multiple searches on the net, and each led me to a dead end. Many said, “Set this … in your php.ini” or “Set that … in your my.cnf”, and some even said Apache was to blame. However, I found the solution to be very simple.

MySQL was expecting the mysql.sock to be located in ‘/tmp/mysql.sock’. However, for some reason it had moved or the symbolic link to it’s actual location was deleted by some update or install I did recently.

I fixed the problem by adding a symbolic link to the actual home of mysqld.sock, which was /var/run/mysqld/mysqld.sock. Here is how I created the symbolic link: (at the command line)

sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

sudo puts us in super user mode, “ln -s” creates a symbolic link followed by the target the links sould point to and last by the location of the link.

Edited on Sep. 26th with update below:

The fix above did not work as a permanent fix. I found that whenever I rebooted the OS it forced me to recreate the symbolic link. MySQL was failing to recreate the symbolic link on it’s own. To permanently fix the issue I needed to add the creation of the symbolic link to my SESSION startup. Here is how I did that:

By going to the System->Preferences->Sessions to edit the Startup Programs. I added an item that automatically issues the command above, but without the “sudo”.

Mission accomplished…permanently.

Ubuntu Hardy Heron sound broken

Recently I was having a consistent problem with the sound on my Dell Inspiron 1720, which is running on Ubuntu Hardy Heron. It would consistently stop working all together, and I had a terrible time finding the cause of the problem. If I viewed a flash video on the web, the sound would die afterwards. If I listened to streaming Internet radio, the sound would die. If I received an emial or IM the sound would die.

Finally it dawned on me, and I am not sure why or how. But a few weeks prior I had been toying with a Bluetooth stereo headset and had turned on the Audio service in the Bluetooth manager on the services tab.

Problem fixed: I simply turned off the Audio service in the Bluetooth manager, and all is working normally again. However, if I ever need the Audio service I suppose it will break my sound.