Compile mplayer from source in Ubuntu Karmic

Monday, October 19, 2009
I have had some trouble the last little while with mplayer and mencoder in Karmic (beta). I am not sure if it is the result of mixed repositories or not, but I had to find a solution.
I was unable to find a procedure that worked completely. I mixed up what I had read from forums and mplayerhq. I wrote a script to compile mplayer from source and install using "checkinstall".
I have only tested this on my laptop (Karmic 64bit) and my desktop (Karmic 64bit) and they both compiled without any issues.

Here is the script


Just save it to your home directory.
Make it executable with
chmod +x updatemplayer
and execute it by typing
./updatemplayer
Enjoy!!




How to create a Multiboot ISO with Grub2

Thursday, October 8, 2009
Edit(March 17 2011): I now use Multisystem.


Edit: Before you read this article, You should be aware that This method only works when burned to a cd/dvd or by using the iso file in a virtual machine. I have used the Ubuntu USB Startup Disk Creator as well as Unetbootin and I haven't figured out how to make things work just yet. Please bookmark the link to this article and I will update as soon as I get everything working.


I have been playing with grub2 and booting linux iso files since I watched episode 602 of Hak5.
This method is attractive to me bacause I do not need a separate usb stick for each distro I want to play with or install. I could have a 16 gig usb stick with 20 distros or more on it if I wanted to. I have found a way that is fairly simple to install grub2 to my usb stick and boot linux iso's with the "loopback" option of grub2. There is a package in Ubuntu called grub-rescue-pc.
You can install this software by issuing the command
sudo apt-get install grub-rescue-pc
Or by using synaptic if you prefer.
While we are at it why don't we install qemu and isomaster as well.
sudo apt-get install isomaster qemu
After installing this package there will be two files in /usr/lib/grub-rescue. The grub-rescue-cdrom.iso is the file that we will be using. This file contains a bootable image of grub2. We can also edit this image file with a program called Isomaster (also available in the repositories). If you prefer, you can install the grub image onto the usb by using the ubuntu 'usb-creator' or unetbootin.
This will make the editing and adding of iso files easier but to test the end result you will need to reboot your pc every time. Time can be saved by editing the grub2 iso image directly and testing the file with Virtualbox, VMWare or Qemu yada, yada, yada. Pick your poison.

After you have installed grub-rescue-pc, Virtualbox and Isomaster, we can open up the grub-rescue-cdrom.iso image with Isomaster. In the directory "/boot" of the grub2 image you will need to create a folder called "iso". Once the folder exists you can now add your linux iso files in this folder. It is as easy as browsing to the iso file that you want to add in the top pane of the program and clicking on the Add button. Now that you have some distros in there, let's see if we can make them work.

The file we will be editing is /boot/grub/grub.cfg of the grub2 image file. Not the one installed on your hard drive. (This can be done within Isomaster)
I used this site as a reference for the distributions that I am playing with.
Just under the line that says:

# For booting GNU/Hurd
you can start to add entries for your distros that you want to boot.

I decided to try Ubuntu 9.04 (32 bit) as well as Ubuntu 9.04 (64 bit).
Here are my two entries that allow them to load.

menuentry "Ubuntu Live 9.04 32bit" {
loopback loop /boot/iso/jaunty-desktop-i386.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/jaunty-desktop-i386.iso --
initrd (loop)/casper/initrd.gz
}

menuentry "Ubuntu Live 9.10 64bit" {
loopback loop /boot/iso/karmic-desktop-amd64.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/karmic-desktop-amd64.iso --
initrd (loop)/casper/initrd.lz
}

Notice that the last line for each entry is different. Ubuntu 9.04 says /casper/initrd.gz and the Ubuntu 9.10 says /casper/initrd.lz . This is important, so if you do any editing, keep this in mind. You can make your own entries for other distrobutions as you wish. Once you are satisfied you will have to save the image as a new iso file.( this will be the one you will load to your usb drive.

I find the easiest way to test the end result is with qemu. It loads fast and your results are prety much instant. I have also made a nautilus script so that I can launch an iso with qemu right from the right click context menu.
Here is the script
qemu -cdrom $* -boot d
If you want to allocate a certain amount of memory to the virtual machine add " -m 700". This will allow 700 mb of system memory to be used by the vm. Place this in a text file. Name it qemu-livecd and save it to ~/.gnome2/nautilus-scripts/ and make it executable. Now when you right click on the iso file go to Right Click>Scripts>qemu-livecd.

Once your configuration is complete and you have tested that all of the menus work you can load the image to your usb stick using unetbootin or the ubuntu USB Startup Disk Creator. Or your favorite app that you normally use for this task.

If you decide later that you want to update any of the distributions on your usb stick you can just plug it in to your pc and replace the iso files with the new ones. Pretty simple huh?

If there is anyone that wants to make a gui for this, please let me know.




How to run hamachi ( VPN) as a service on Ubuntu (All) 32 bit and 64

Monday, July 13, 2009

This procedre will make hamachi start as a service without any interaction from the user on ubuntu 8.04, 8.10, 9.04, 32 and 64 bit versions.

Hamachi is a vpn solution that will not require any firewall port forwarding. I use this program to connect to my work computer from home and vice versa. I have been using it for a couple of years and I find that I could not live without it. Through many months of searching and testing I have created an easy way to get hamachi to run as a service in ubuntu. Normally you would have to run /sbin/tuncfg with sudo to get hamachi to run. If you are logged in to a remote location and you rebooted the remote machine, there was no way to log back in until someone ran “sudo /sbin/tuncfg”, and “hamachi start” from the keyboard of the remote machine.

I have been using a script that I found in the ubuntu forums that works perfectly. I have gone a step further and made another script to automate the process of installation. Below you will find two files that are needed to install hamachi from scratch. The first file is my script, and the second is a text file.

The first thing you will have to do is download both files posted below and save them to your home directory. On line #5 in the text file it reads

USER=username

You have to change 'username' to the user you are logged in as. Ie: drew

You will also have to edit line #9 in the script to reflect the username that you are logged in as.

Before running the script you must make it executable by typing

chmod +x autostarthamachi

You will need to run the script with sudo, so you can run the script by typing

sudo ./autostarthamachi

The script will download and install hamachi from sourceforge.net and install it as well as create the files needed to run hamachi as a service.

Now it is time to setup hamachi. First you will need to run

sudo tuncfg

And then run

hamachi-init

This will generate the keys for hamachi

Then you will need to start hamachi

hamachi start

Then run

hamachi login

to put the daemon online and to create an account.

hamachi join 

to join the network.

hamachi go-online 

to go online in the network.

hamachi list

to list network members and their status.

Once you have hamachi installed and running you can reboot your machine and check that hamachi is running and logged in by typing

hamachi list

If hamachi does not complain then everything was a success.

If you would like to try a very nice gui, I highly recommend 'hamachi-gui'


autostarthamachi

autostarthamachi64

hamachi

Reinstall Ubuntu without losing your data

Thursday, February 28, 2008
I can't remember where I learned this but I use it whenever I need to reinstall Ubuntu on my machines, or when I am doing a fresh install on a new machine.
What this does is very simple. The first step creates a text file with a list of installed programs and after reinstalling Ubuntu you will be able to apply that list and reinstall all of the programs without searching through endless amounts of packages trying to find out what programs you are missing.

Pros:

Very easy to do. Just three commands and you are back up and running. Not much interaction from the user.It just works.

Cons:
Requires some initial setup. Depending on the amount of applications you originally had installed, downloading and installing those packages may take some time.


Prerequisites:
Your 'home' folder must be on a separate partition. I will explain later in this article.


Let's get started.

The first step you will have to do is create a text file.
Go to 'Applications>Accessories>Terminal'
Type in the terminal

sudo dpkg --get-selections > backup.log

You will be required to provide your user password.
Now you have created a text file in your home directory. Keep this file somewhere safe. Maybe a thumb drive or something. Or you could email it to your yahoo or gmail account.
You also have a very small backup of your installed programs.
This will not backup any of your files. ie - photos, documents,videos, etc. Standard backup practices apply to those types of files.


Next you can take this file to any computer running Ubuntu and all of those applications.
If now is the time, reinstall Ubuntu and make sure that after the install you have that 'backup.log' file in your home directory.
Now you can apply that to a list of programs to download and install.
First you will have to make sure that all of your repositories are enabled that you originally downloaded the software from. If you added sources to your sources.list file, then you will have to do that now before you go on.
If you haven't added any repositories, then you are ok to continue.
Next you will have to go back to a terminal and type

sudo dpkg --set-selections < backup.log

Supply your password if asked.

The next step requires a package that is not installed by default in Ubuntu.
To install the program, type in the terminal


sudo apt-get install dselect

Supply your password if asked.

Now all that is left is to type one last command into the terminal.
Now type


sudo dselect

Supply your password if asked.

Now select 'install'

Now you can walk away, make a beverage and come back to check on it once in a while.
You may have to click 'next' or 'ok'.
Once it is finished you can exit.
Now you are finished and you can use all of the programs you were using before we started this procedure.


Notes:

The reason for having your home folder on a seperate partition is because of the hidden files and folders in your home folder. All of your program's settings are stored in your home folder.
For example: all of your bookmarks, extensions and browsing history in firefox are stored in there as well as your desktop wallpaper and all of your settings. Once the programs are all installed they will still have the same settings as they did before. If you are a former windows user and have had to reinstall the OS, then you know that it can take many hours to set windows up the way it used to be. Not with linux. If you want to install a dual boot system with Fedora and Ubuntu, just make sure that both of the installs use the same home folder. That way both of your desktop settings will be the same.



Enjoy!

Compiling the linux kernel 2.6.24 in Ubuntu for the intel iwl4965 driver

Saturday, February 23, 2008
I have decided to try to compile my laptop's kernel to the latest 2.6.24 from kernel.org.
I followed the directions from Dave Yates at the lottalinuxlinks podcast.
http://lottalinuxlinks.com/blog
I tried several times and did not have much luck. The first time I had my wireless card working (intel 4965) but my sound card was not working. I did not test this for very long as I really like to have sound on my machine. I decided to try again. The next time I tried to compile I had my sound problem fixed but my wireless had stopped working. So, back to the drawing board. I tried again and again without success. Searched google and the Ubuntu forums and I was able to find one post stating that to get the iwl4965 module to load at boot you would need to copy the files from /lib/firmware/ to /lib/firmware/
so in the terminal I typed

sudo cp -r /lib/firmware/2.6.22-14-generic/ /lib/firmware/2.6.24.2


I also downloaded the latest iwl4965 microcode from the site http://intellinuxwireless.org/
placed the file iwlwifi-4965-1.ucode into the folder /lib/firmware/2.6.24.2 and then continued to compile the kernel. After about an hour and a half the kernel had compiled and the deb packages were ready to install. I installed the deb packages and rebooted the machine and the wireless and sound worked great. The wireless card is now stable (24 hours now and no disconnect) and my sound works as well as compiz 3d effects and all of the wobbly goodness.
The only thing that is not working is my virtual machines - virtualbox & vmware-server.
This isn't really a big deal because I can always reboot my machine and use the old kernel.
The other thing that stopped working is my built in webcam. Not a big deal either. I can live without it.

My machine seems to be a bit more snappy now that the kernel is optimuzed for my intel processor. Graphics seem a little crisper and the whole system just seems to be better and more stable than it was before.
I guess I could have waited until the next release of Ubuntu ( Hardy Heron ), but I just didn't want to wait.
Maybe I will try fixing the other things that broke this weekend.
I will post my results if they are interesting enough.

Toshiba U300-NS5 on Ubuntu

Monday, February 18, 2008
I have recently purchased a laptop from Toshiba and I absolutely love this thing.
The first thing I did was boot into Vista and snoop around.
That took about 5 minutes.
Then I took my Ubuntu 7.10 cd and layed down a fresh copy of linux on the hard drive.
Out of the box the display did not work correctly and the sound was not working at all.
Getting the display was kind of a treat since I was fortunate enough to get the new intel x3100 or gma965 chipset in my new machine.
After a little searching around I found that a lot of people were trying different things that may or may have not worked but what I came to was a blog post stating that it was as easy as typing in the terminal 'sudo apt-get install linux-backports-modules'.
Sure enough, this is what I needed. After a reboot everything worked perfectly.
My display fit the screen as well as the resolution. Compiz worked right away as well as my sound card.
After a couple of months of enjoying my new machine I decided it was time to get rid of windows and reclaim my hard drive for Ubuntu.
I installed a program called 'remastersys' from the linux mint repositories and it woked great.
I was able to install an exact copy of my system backto the hard drive with the live install cd that I had created with remastersys.
WOW!! That was awesome!
Coming from a windows background, I have never been able to do something like that before.

My overall views of the Laptop and the software that I have mentioned here, five out of five penguins.


Links back to sources:

http://www.howtoforge.com/ubuntu-linux-mint-livecd-with-remastersys
http://www.ubuntu.com/

Update:
I am still using the same laptop. Now running Ubuntu 9.04 Jaunty Jackalope. and soon to be 9.10.
I am still enjoying the laptop and have no complaints about this hardware.