Saturday 28 November 2009

Hosing the dual boot and recovering from it

I recently installed Fedora 12 in a PC that came pre-installed with Vista. Usually, Windows XP and even Windows 7 is happy to get loaded by Grub - so I went ahead and installed Grub as the default bootloader. Everything went fine until I tried to reboot back to Vista and got the following error message:

BOOTMGR is missing. Press Ctrl+Alt+Del to restart.

I followed many articles in the internet that all advocated using either the Vista startup recovery tools or the command prompt but none worked. So for posterity here's how I fixed the issue:

1. Boot the computer using a Vista CD

2. Select the Language and Keyboard layout from the first screen and click Next.

3. Click on Repair your computer in the next screen.

4. Select your Vista installation from the dialog box and click next.

5. Click on Command Prompt to start a new command prompt

6. Type the following command:
bootrec /FixMbr

7. Type exit to close the command prompt. Then hit the Reboot button.

8. The computer should now boot back to Vista..hurrah! but where's the Fedora installation?

9. Pop the Fedora DVD in to the drive and reboot the computer

10. Select the Rescue option from the Fedora DVD boot menu

11. The installer will prompt you with a few questions (Which unfortunately I can't remember now). They are fairly obvious and simple questions so there should be no issue in getting past them.

12. Finally the installer will mount your Fedora installation into /mnt/sysimage and provide you with a menu to start a shell or reboot. Select the option to start the shell.

13. Run the following command to see a list of partitions:
fdisk -l

14. You have to figure out the device path of your Linux partition. This is usually where /boot is mounted or if you don't have a separate boot partition, where / is mounted. In my case it was /dev/sda5

15. Run grub-install with the correct device path to install Grub in the Linux partition.
grub-install /dev/sda5

16. Now exit the shell and reboot the computer. (Remove the Fedora disk from the drive to prevent booting from the CD)

17. You will boot back to Vista.

18. Download and install EasyBCD (http://neosmart.net/dl.php?id=1)

19. Run EasyBCD and click on Add Remove Entries

20. Click on the Linux tab and select the drive where Grub was installed from the Drive drop-down. You can optionally change the name from "NeoSmart Linux" to "Fedora" if you like.


21. Click Add Entry to save the entry.

22. Restart the computer. You should now be presented with a boot menu. Select the Fedora option (If you named it Fedora in the previous step) and Fedora should boot up!

Monday 6 July 2009

Truecrypt 6.2 install guide for Fedora 11

For Truecrypt 6.2, nothing much has changed from the Truecrypt 6.1 install process except for the line numbers that need to be modified to make the source compile correctly.

1. Download the TrueCrypt 6.2 source tarball from www.truecrypt.org
2. Untar the source
tar xvf TrueCrypt\ 6.2a\ Source.tar.gz
3. Install required libraries
sudo yum install nss-pkcs11-devel fuse-devel wxGTK wxGTK-devel
You might also need the following packages if you haven't installed them already.
sudo yum install gnome-keyring-devel gcc-c++
4. Export the Cryptoki include folder
export PKCS11_INC=/usr/include/gp11
5. Run make
make
You may get the following error messages:
../Common/SecurityToken.cpp:660: error: ‘CKR_NEW_PIN_MODE’ was not declared in this scope
../Common/SecurityToken.cpp:661: error: ‘CKR_NEXT_OTP’ was not declared in this scope

5.1 Open Common/SecurityToken.cpp in your favourite editor.
5.2 Scroll to line 660
5.3 Comment out line 660 and 661. It should look like this:
//TC_TOKEN_ERR (CKR_NEW_PIN_MODE)
//TC_TOKEN_ERR (CKR_NEXT_OTP)

5.4 Save and exit
5.5 Run make again
[Some people may not like to fiddle with code like this. But these two lines are only used to generate error messages. At the very worst, you will end up getting a generic error message instead of a more focussed one. ]
6. TrueCrypt is now compiled. You can find the executable inside the folder titled 'Main'. You might want to make it available from your bin directory for easy access.
sudo cp Main/truecrypt /usr/share/bin

All done!

Sunday 14 June 2009

Changing the Plymouth Theme in Fedora 11 Leonidas

Plymouth is the new graphical boot system introduced with the release of Fedora 10 Cambridge. It replaced the rhgb (RedHat Graphical Boot) with a snazzier boot screen that supported cool animations. The first version of Plymouth that shipped with Cambridge used a plugin system where each graphical boot animation had to be coded from scratch - something that did not encourage many people to create new boot screens. With the release of Fedora 11, Plymouth has also gone through a major change. It now supports "themes" instead of "plugins" - making it much easier for theme developers to focus on the graphical elements rather than raw coding.

Currently there are 4 Plymouth themes in the Fedora repositories.
  • Charge (Default theme in Leonidas)
  • Spinfinity (A throbber that moves in a path shaped like the infinity sign)
  • Solar (Default theme in Cambridge - the planet with exploding pulsars)
  • Fade-In (Fedora logo fading in and out in a star field)
To check out these themes, you need to download them first.

sudo yum install plymouth-utils "plymouth-theme-*"

After the themes are downloaded, install them as follows:
sudo plymouth-set-default-theme spinfinity
sudo /usr/libexec/plymouth/plymouth-update-initrd


Replace "spinfinity" above with the name of either one of the themes you would like to try out.

EDIT: You can list the installed themes by running the following command
plymouth-set-default-theme --list

Hopefully the new theme system will encourage people to come up with new and exciting themes for Fedora boot-up.

Sunday 3 May 2009

Installing the FCEUX NES Emulator on Fedora 10

FCEUX is a Famicom/NES emulator that merges the different branches of the FCE Ultra project in to a single project. It is a great tool to have if you are a fan of classic NES games such as "Super Mario Brothers" and want to play them on your Linux machine. FCEUX has a host of features such as recording, Lua scritping etc. But as a casual gamer, you are probably only interested in getting the emulator up. For serious ROM hackers and advanced users, www.fceux.com is the place to start looking for additional info.

Installing FCEUX

FCEUX comes in two flavours. The Win32 edition and the SDL edition. We are only interested in the SDL version here. For Debian/Ubuntu users, a pre-packaged deb file already exists, but for the rest of us, it needs to be compiled from the source.

Step 1 : Install dependencies
sudo yum instal scons SDL SDL-devel zlib zlib-devel lua lua-devel zenity

Step 2 : Download and extract FCEUX
Download the source tar ball from http://fceux.com/web/htdocs/download.php and extract it.
wget http://downloads.sourceforge.net/fceultra/fceux-2.1.0a.src.tar.bz2
tar xvf fceux-2.1.0a.src.tar.bz2

This will create 2 folders names fceu and gfceux

Step 3 : Compile and install FCEUX command line tool
cd fceu
scons
sudo scons install


Step 4 : Install GFCEUX GUI
cd ../gfceux
sudo python setup.py


Step 5 : Run the emulator
gfceux

You will need to download NES ROMS to start playing. This part is left as an exercise to the reader ;)


Sunday 26 April 2009

Useful Bash Tips

TuxRadar has a very useful list of Bash keyboard shortcuts at http://www.tuxradar.com/content/bash-tips-power-users. Scroll to the bottom to see the list.

Sunday 1 March 2009

Convert videos for Sony Walkman

I own a Sony Walkman NWZ-S639F. It's a great mp3 player possibly much better than the ipod itself. Best of all it integrates well with Linux without needing any extra libraries or software. Rhythmbox can be used for syncing music files from my computer to the Walkman and Nautilus can be used to simply drag and drop pictures or videos.

When copying videos however, the Walkman is only capable of playing mp4 files of size 320x240. It also needs a jpg file of the same size and name as the mp4 file to display a nice thumbnail in the player interface. ffmpeg can be used to achieve all this very simply.

To convert a flv video downloaded from the internet to Walkman compatible video:
ffmpeg -i video.flv -s 320x240 -ac 2 video.mp4
To generate the thumbnail:
ffmpeg -i video.flv -s 320x240 -an -ss 00:01:00 -r 1 -vframes 1 video.jpg

All that is left now is to copy the generated mp4 file and the jpg file to the video folder in your Walkman.

Monday 9 February 2009

Office 2007 On Linux

I recently managed to get Office 2007 working on Fedora 10 with Wine 1.1.14. I was helped along the way by this article at the excellent wine-reviews blog.

1. Download the latest Wine source tarball from http://www.winehq.org
2. Extract the source. tar xvf wine-1.1.14.tar.bz2
3. Run the installer. This may take a long time. On my Dual Core 1.8GHz laptop with 2GB of RAM, the compilation took about an hour. cd wine-1.1.14
./tools/wineinstall

4. Download winetricks. wget http://www.kegel.com/wine/winetricks
5. Install the MSXML parser, .NET Framework 2, GDI+, RichEdit controls and Visual C++ 2005 Runtime. sh winetricks msxml3 dotnet20 gdiplus riched20 riched30 vcrun2005sp1
6. Run the Office 2007 installer. wine setup.exe

Office 2007 should now be installed in your machine.




Sunday 25 January 2009

Enable Guest USB Access on VirtualBox

Although I have been using Linux exclusively for a long time now, there are still occasions where some pesky applications demand a Windows environment. For those rare moments, I have Windows XP installed as a guest OS on VirtualBox. VirtualBox is an absolutely wonderful virtualization tool that provides almost every function I need from a Windows box.

Recently however, I had to plug in a USB device to the Guest OS and I found out that the USB device menu is grayed out, preventing me from switching the device over from the host to the guest. I tried messing with the settings but none seemed to have an effect. A quick search of the internet revealed this article which worked like a charm!

First create a new group and add yourself to it
sudo groupadd usb
sudo usermod -G usb `whoami`

Find out the gid of the new group by running the following command
MYGID=`cat /etc/group | grep usb | awk -F ":" '{print $3}'`
Create a new entry in fstab
sudo echo "none /sys/bus/usb/drivers usbfs devgid=$MYGID,devmode=664 0 0" >> /etc/fstab
Restart the computer
sudo reboot

Now when you start VirtualBox, the USB devices can be freely assigned to the guest OS.

Monday 19 January 2009

Mobile Phone Management With Wammu

I recently needed to backup the contents of my Sony Ericsson K750i. Since the utilities provided with the phone only work on Windows, I had to hunt for a similar application for Linux.

Wammu is a GUI application that can be used to manage a vast number of mobile phones. It uses the Gammu utilities in the back-end and provides a nice GUI front-end to control every aspect of the mobile phone such as the Address book, Calendar, Task list, Call lists, Messages etc. A large number of mobile phones are supported by this tool, a comprehensive list can be found here. Phones can be connected either via USB, IrDA or Bluetooth.


The setup was straightforward.
sudo yum install wammu pybluez

The pybluez package is only required if you want to connect to the phone via bluetooth.

The GUI is quite easy to navigate through. Therefore I am not going to go in to specifics. A screenshot is more than enough to see how intuitive the interface is.

Thursday 1 January 2009

Fixing Bluetooth and PackageKit problems in Fedora 10

I began to suspect that something was wrong with the D-BUS permissions on my Fedora 10 system when I started getting the following error at the end of a Yum session:
ERROR:dbus.proxies:Introspect error on :1.46:/org/freedesktop/PackageKit: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: A security policy in place prevents this sender from sending this message to this recipient, see message bus configuration file (rejected message had interface "org.freedesktop.DBus.Introspectable" member "Introspect" error name "(unset)" destination ":1.46")

This seemed to have affected the Bluetooth daemon as well. No matter how I tried, I could not get bluetooth-properties to remember my preferences. My computer was not visible to other Bluetooth enabled devices and I could not browse my phone via Bluetooth. (It used to work flawlessly in Fedora 9). I diagnosed that the problem is with D-Bus by running the following command:
sudo bluetoothd -n -d
bluetoothd always terminated with the error:
Unable to get on D-BUS

I tried mucking around with D-Bus policy settings in /etc/dbus-1/system.d/ but had no luck until I came across this helpful post at FedoraForums.

After editing /etc/dbus-1/system.conf as mentioned, I restarted the computer and voila ! Bluetooth started working and yum stopped complaining !!

For completeness, this is the interesting bit from my new /etc/dbus-1/system.conf
<!-- allow sending valid replies -->
<!-- commented out part
<allow send_requested_reply="true" send_type="method_return"/>
<allow send_requested_reply="true" send_type="error"/>
-->
<!-- Newly added line to fix permission problems -->
<allow send_requested_reply="true" />


Kudos to all the helpful people at Fedora Forums !