Archive for the ‘Ubuntu’ Category

On Ubuntu 9.10 and SATA

February 23, 2010 3 comments

DISCLAIMER: I am by no means an Ubuntu or Linux expert. The information in this post may not be the most correct or efficient way to solve the issue that I describe. It is simply the resolution I found and what worked for me. Conduct all changes at your own risk and remember to always backup your data before doing work on your system.

I finally decided to bite the bullet and turn my desktop computer into an Ubuntu machine. Up until now I’ve kept it running windows for the ease of gaming. I haven’t been gaming much lately and had never run Linux on a machine with a halfway decent graphics card or processor so I thought it would be nice to see what Ubuntu could kick out on something other than my lower end laptop.

I’ve done many Linux installs in the last few years, most of which have been Ubuntu or other Debian derivatives and have yet to run into any major issues. This install decided to break that cycle. I could boot off the Ubuntu 9.10  live CD perfectly, but after the system loaded my hard drive was nowhere to be found. After testing a myriad of things to insure that it wasn’t something to do with 9.10 I figured it had to be a hardware issue. I’ll spare you the gory details of my lengthy searching and simply say that I ended up at a bug report that mentioned an issue with Ubuntu recognizing SATA drives. This, as it turned out, was my problem.

The issue can be resolved on the initial live CD boot by doing the following:

1- Insert the live CD and power on the machine

2- When prompted with menu choices hit F6 for other options, then hit ESC to exit the pop-up

3- There will be a line of boot options at the bottom of the screen. At the end of that line type: pci=nomsi

4- Hit enter.

Once you’ve completed these steps you should be able to see your SATA drive and complete the install as usual. After this the two most common scenarios are: you have a dual boot setup with Windows and Ubuntu, or you only have Ubuntu installed. If you have a dual boot system set up then, after the post install reboot, Grub should come up normally and you will be able to perform the next set of instructions. If you only have Ubuntu installed then you will need to put the live CD back in and boot from it again; this time select the”boot from the local hard drive first” option.

Regardless of which of those two methods you used, you should end up at the Grub boot loader. In order to successfully mount the SATA drive and load the OS you will need to do the following:

1- Select the desired kernel to boot, most likely the first on the list.

2- Hit “e” to allow you the edit the boot commands

3- Go down to the line that starts with “linux /boot/…” and ends with “… quiet splash”

4- To the end of this line add:  pci=nomsi

5- Hit enter and the system should boot correctly into your newly installed OS.

After you’ve got Ubuntu up and running successfully there’s one last thing to do. You need to add the “pci=nomsi” command permanently to Grub so you don’t have to complete those last four steps every time you boot up your machine. To add the command follow these steps:

1- Open up a terminal and backup your grub.cfg file:  sudo cp /boot/grub/grub.cfg /boot/grub/grub.cfg.backup

2- Edit grub.cfg in the editor of your choice, I used nano:  sudo nano /boot/grub/grub.cfg

3- This file will have the same information you saw when editing the boot commands in the last step three.

4- Repeat steps 3 and 4 from the last set of instructions.

5- Save the file and exit. For nano hit ctrl+x, yes, and hit enter

After doing some more research about Grub2 I came across this extremely helpful Ubuntu forum post. As it turns out, my previous instructions for editing grub were wrong (see: struck out text above). With Grub2 the following steps are correct:

1- Open up a terminal and back up your default Grub file:  sudo cp /etc/default/grub /etc/default/grub.backup

2- Edit the default grub file in the editor of your choice, I used nano:  sudo nano /etc/default/grub

3- Change the line GRUB_CMDLINE_LINUX_DEFAULT so that the quotes include:  “quiet splash  pci=nomsi”

4- Save the file and exit: for nano it’s ctrl+x, yes, and enter.

5- Once you are back to your terminal prompt type: sudo update-grub

6- The command should output that it is modifying grub.cfg, when it’s complete you can exit the terminal

When you’re done with these steps you should be able to remove the live CD and boot normally. Keep in mind that after any system upgrades or changes that modify Grub you will have to edit grub.cfg again in order to resume normal booting. With the corrected Grub2 editing instructions I added your custom settings should not need to be changed if system updates or changes modify grub.cfg.

I haven’t done enough follow up research to know if this whole situation is a bug that will be fixed in the future or if it’s an issue that will remain. Admittedly, I couldn’t even tell you the specifics of why the fix works or is needed. I’m just your average Linux user who found a solution and wanted to share the information.

If you have any questions, or improvements on the info in this post please leave a comment.

Categories: Linux, Ubuntu

My Ubuntu Background Changing Script

February 8, 2010 Leave a comment

I am an indecisive person. To the extreme. Naturally this personal trait lead to some issues when I decided that I wanted to change my background image on my Ubuntu laptop.

When I started looking I found no lack of Linux and Ubuntu related wallpapers available and came across many that I liked. I saved all the images to a directory, settled on one, and sat back to enjoy my newly decorated desktop. Little did I realize that approximately thirty minutes later I would be changing it again. Before long I came to the conclusion that, left to my own compulsions, I would be manually changing my background image at an annoying rate forever. I’m no scripting guru by any stretch so this situation seemed like a great opportunity to learn and solve a problem at the same time.

The script is designed to check a designated directory for image files to use as your desktop background. You can use the Ubuntu default of /usr/share/backgrounds or set a custom location in the configuration area at the beginning of the script. Once a list of the available images is generated it will pick a new one to set. Finally it will check to make sure that the new background is not the same as the current one, if it is another will be selected; if not the new background will be set.

To automate the process you simply need to add a cron job to handle running the script. For example, if you wanted your background image to change every ten minutes you would add the following line to crontab:

1-59/10 * * * * /path/to/the/script

To find out more about scheduling cron jobs, or cron in general, Google is your friend.

If anyone has questions, tips, code improvements, etc. please feel free to leave comments!

Script code can be found here!

Categories: Linux, Ubuntu