Showing posts with label install. Show all posts
Showing posts with label install. Show all posts

Monday, June 14, 2010

Watching DVDs in Linux by installing one library

The only thing you have to do really is add in a repository for Ubuntu and install the playback/codec that you need for Ubuntu or Salix. Since most people I know use Ubuntu or Linux Mint, these steps remain the same. Open up the terminal, then copy and paste the following line:

sudo wget –output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get –quiet update && sudo apt-get –yes –quiet –allow-unauthenticated install medibuntu-keyring && sudo apt-get update

What this does is that it adds the repository as well as the GPG key that says it can be trusted and installed from. This is only for Ubuntu and spinoffs of Ubuntu, seeing as Salix has the component we need in their default repositories. Before closing the terminal, issue this command:

sudo apt-get install libdvdcss2 w32codecs -y

which will then install the DVD playback as well as media playback of non-standard formats.

Sunday, May 9, 2010

Install Windows after Ubuntu Lucid Lynx

Sh*t happens. There is no more applications to manage my 6th generation iPod Classic 160 GB under Linux/Ubuntu. I have to install Windows as the second operating system along with newly installed Ubuntu Lucid Lynx (it rocks but this is for another post) to run iTunes.

For rather long time I’ve been using gtkpod, amarok, banshee, exaile or rhythmbox to sync my ipod under Linux/Ubuntu and load my music collection there. As we all know The Elder Brother Apple fights with interoperability and makes ipod/iphone users to use iTunes only. Any other applications that can read/write to ipod data format are prohibited by Apple. This also concerns Rockbox and ipod4linux alternative firmwares — once Apple encrypted ipod firmware it became impossible to use them. It definitely sucks. At least due to the fact there are millions of Linux users who are real or potential customers of Apple products. Anyways these facts have been discussed in various forums, blogs like this and similar but this post about how to install Windows as the second operating system along with Ubuntu or any other Linux.

gparted exampleThe first that we need to do is to create new partition for Windows and format it to NTFS. Exact steps to accomplish this depend on your HDD partition table e.g. there is one large ext3/ext4 partition for Ubuntu or there are several partitions for various distributions or mount points. Anyway you should use partition manager to create and/or format NTFS partition. I use gparted. It is graphical and it just works (use ‘sudo apt-get install gparted‘ if you run Ubuntu/Debian).

Second you should backup your MBR record and restore it after Windows installation that silently erases existing bootloader and installs windows one, use “dd if=/dev/sda of=/mbr.bin bs=446 count=1” to save MRB into mbr.bin file and “dd if=/media/sda/mbr.bin of=/dev/sda bs=446 count=1” to restore it from file to HDD.

To sum everything up here is the algorithm:

0. BACKUP ALL YOUR DATA!
1. Create NTFS partition using gparted.
2. Backup MBR using dd command e.g. “dd if=/dev/sda of=/mbr.bin bs=446 count=1″ (/dev/sda means your HDD).
3. Boot Windows installation CD and install it onto newly created NTFS partition.
4. Boot into Linux live CD e.g. Ubuntu Live CD.
5. Restore MBR using dd e.g. “dd if=/media/sda/mbr.bin of=/dev/sda bs=446 count=1″.
6. Reboot.
7. Select Ubuntu in grub menu and boot it.
8. Setup grup for Windows booting.

In order to accomplish the last 8th item you should add the following text block to the end of grub config (read this article for detailed information):

title Microsoft Windows XP
root (hd0,1)
savedefault
makeactive
chainloader +1

Good luck!

P.S. If something goes wrong or you need more details you can take a look at the following article at ubuntu.com: Recovering Ubuntu After Installing Windows. It’s written in rather tangled manner but still informative.

Wednesday, February 4, 2009

Recovering Ubuntu After Installing Windows

Using the Ubuntu Desktop/Live CD

Quick Start

This option will use the Desktop/Live CD to install Grub into your MBR (Master Boot Record). This option will overwrite your Windows Boot Loader It is OK to do this, in fact that is the goal of this how to (in order to boot Ubuntu)

1. Boot the Desktop/Live CD. (Use Ubuntu 8.04 or later)

2. Open a terminal (Applications -> Accessories -> Terminal)

3. Start grub as root with the following command :

  • sudo grub

4. You will get a grub prompt (see below) which we will use to find the root partition and install grub to the MBR (hd0,0)

  •          [ Minimal BASH-like line editing is supported.   For
    the first word, TAB lists possible command
    completions. Anywhere else TAB lists the possible
    completions of a device/filename. ]

    grub>
    Type the following and press enter:
    find /boot/grub/stage1
    If you get "Error 15: File not found", try the following:
    find /grub/stage1
    Using this information, set the root device (fill in X,Y with whatever the find command returned):
    grub> root (hdX,Y)
    Install Grub:
    grub> setup (hd0)
    Exit Grub:
    grub> quit

5. Reboot (to hard drive). Grub should be installed and both Ubuntu and Windows should have been automatically detected.

6. If, after installing grub, Windows will not boot you may need to edit /boot/grub/menu.lst (That is a small "L" and not the number 1 in menu.lst)

  • Open a terminal and enter :
     gksu gedit /boot/grub/menu.lst
    Or, in Kubuntu:
     kdesu kate /boot/grub/menu.lst
    Your Windows stanza should look something like this :
     title Windows XP/Vista # You can use any title you wish, this will appear on your grub boot menu
    rootnoverify (hd0,0) #(hd0,0) will be most common, you may need to adjust accordingly
    makeactive
    chainloader +1
    Note: Put your Windows stanza before or after AUTOMAGIC KERNEL LIST in the menu.lst

Overwriting the Windows bootloader

Boot from a Live CD and open a terminal. You'll need to run a few commands as root so you can use sudo -i to get a root shell and run them normally instead of using sudo on each of them. Be extra careful when running a root shell, especially for typos !

We'll need to find which partition your Ubuntu system is installed on. Type the command fdisk -l. It will output a list of all your partitions, for example :

fdisk -l

Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 8 64228+ 83 Linux
/dev/hda2 9 1224 9767520 83 Linux
/dev/hda3 * 1225 2440 9767520 a5 FreeBSD
/dev/hda4 2441 14593 97618972+ 5 Extended
/dev/hda5 14532 14593 498015 82 Linux swap / Solaris
/dev/hda6 2441 14530 97112862 83 Linux

Partition table entries are not in disk order

Here I have three Linux partitions. /dev/hda2 is my root partition, /dev/hda1 is my /boot partition and /dev/hda6 is my /home partitions. If you only have one, obviously this is the one your Ubuntu system is installed on. If you have more than one and you don't know which one your Ubuntu is installed on, we'll look for it later. First, create a mountpoint for your partition, for example :

mkdir /mnt/root

Then mount your partition in it. If you don't know which one it is, then mount any of them, we'll se if it's the correct one.

mount -t ext3 /dev/hda2 /mnt/root

Of course, replace /dev/hda2 with the correct name of your partition. You can check if it's the correct one by running ls /mnt/root, which should output something like this :

bin    dev      home        lib    mnt   root     srv  usr
boot etc initrd lib64 opt sbin sys var
cdrom initrd.img media proc selinux tmp vmlinuz

If what you have looks not at all like this, you didn't mount the correct partition. Do umount /mnt/root to unmount it and try another one. You also need to mount your /boot partition if you made one, like this :

mount -t ext3 /dev/hda1 /mnt/root/boot

To make sure it was the correct one, run ls /mnt/root/boot, which sould output something like this :

config-2.6.18-3-686      initrd.img-2.6.18-3-686.bak  System.map-2.6.18-3-686
grub lost+found vmlinuz-2.6.18-3-686
initrd.img-2.6.18-3-686 memtest86+.bin

Once again, if what you have doesn't fit, unmount it and try another partition.

Now that everything is mounted, we just need to reinstall GRUB :

sudo grub-install --root-directory=/mnt/root /dev/hda

If you got BIOS warnings try:

sudo grub-install --root-directory=/mnt/root /dev/hda --recheck

Of course, replace /dev/hda with the location you want to install GRUB on. If all went well, you should see something like this :

Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0) /dev/hda

Now you can reboot and the GRUB menu should appear. If you see a warning message regarding XFS filesystem, you can ignore it.

Preserving Windows Bootloader

The method shown above puts GRUB back on the MBR (master boot record) of the hard drive instead of in the root partition. But you probably won't want that, if you use a third-party boot manager like Boot Magic or System Commander. (The original poster also suggested that this would be useful to restore the Grub menu after a re-ghosting.) In that case, use this alternative.

This alternative, used without a third-party boot manager, will not cause Ubuntu to boot.

If you have your Linux system in a second (or third...) hard disk this method will not work. Please check Super Grub Disk's method that address this problem.

1. Boot from a Live CD, like Ubuntu Live, Knoppix, Mepis, or similar.

2. Open a Terminal. Open a root terminal (that is, type "su" in a non-Ubuntu distro, or "sudo -i" in Ubuntu). Enter root passwords as necessary.

3. Type "grub" which makes a GRUB prompt appear.

4. Type "find /boot/grub/stage1". You'll get a response like "(hd0)" or in my case "(hd0,3)". Use whatever your computer spits out for the following lines. Note that you should have mounted the partition which has your Linux system before typing this command. (e.g. In Knoppix Live CD partitions are shown on the desktop but they're not mounted until you double-click on them or mount them manually)

5. Type "root (hd0,3)".

6. Type "setup (hd0,3)". This is key. Other instructions say to use "(hd0)", and that's fine if you want to write GRUB to the MBR. If you want to write it to your linux root partition, then you want the number after the comma, such as "(hd0,3)".

7. Type "quit".

8. Restart the system. Remove the bootable CD.

From: http://ubuntuforums.org/showpost.php?p=121355&postcount=5

From Inside Ubuntu

You have to run "grub" not from the Ubuntu Desktop/Live CD, but from your disk installation to make it work. To do this mount your root partition (following examples assume a root partition on hda1):

sudo mkdir /mnt/linux
sudo mount /dev/hda1 /mnt/linux

then change directory to your installation sbin and run grub from there

cd /mnt/linux/sbin
sudo ./grub

Using the Unofficial "Super Grub Disk"

From within Windows

  • Download Auto Super Grub Disk

  • Double-click auto_super_grub_disk_1.0 icon, install it, and reboot.

  • On the next boot, select the UNetbootin-supergrubdisk menu entry; this will launch the Auto Super Grub Disk.

  • Do nothing till you see your Grub menu again.

  • Next time you boot Windows, click yes when asked to remove UNetbootin-supergrubdisk to remove the Super Grub Disk menu entry.

As a standalone cd/floppy/usb

  • Download Super Grub Disk

  • Burn into a cdrom (better) or a floppy
  • Boot from it
  • Select: GRUB => MBR & !LINUX! (>2) MANUAL |8-)

  • Select the Linux or Grub installation you want to restore.

  • You see the message: SGD has done it!
  • Reboot
  • You're done.

Preserving Windows Bootloader

The method shown above puts GRUB back on the MBR (master boot record) of the hard drive instead of in the root partition. But you probably won't want that, if you use a third-party boot manager like Boot Magic or System Commander. (The original poster also suggested that this would be useful to restore the Grub menu after a re-ghosting.) In that case, use this alternative.

This alternative, used without a third-party boot manager, will not cause Ubuntu to boot.

This alternative will let you boot your second hard disk Linux installations from Windows while the Using the Ubuntu Desktop/Live CD Preserving Windows Bootloader instructions will not.

Either:

  • Download Super Grub Disk

  • Burn into a cdrom (better) or a floppy
  • Boot from it

Or:

  • Download UNetbootin Super Grub Disk Loader (Windows .exe version)

  • Run the installer and reboot when once done installing.
  • On the next boot, select the "UNetbootin-supergrubdisk" menu entry; this will launch the Super Grub Disk interface.

Then:

  • Super Grub Disk (WITH HELP) :-)))

  • Select: your language

  • Select: Windows

  • Select: Windows chainloads Grub!

  • Select the Linux or Grub installation you want to restore to its own partition.

  • You see the message: SGD has done it!
  • Reboot
  • You're done.

Using Microsoft Vista

If you have Vista installed and you installed Ubuntu and when you rebooted it didn't show up as a dual boot option, try going into Vista (since that is all you can do), use the program EasyBCD version 1.7 It looks like this: http://aycu01.webshots.com/image/31560/2002188190250314159_rs.jpg

Add your Linux install to the boot sequence.

Troubleshooting

This section applies to...

  • Dual-boot setups in which Windows was installed after Ubuntu
  • Conditions where Windows failure forced a re-installation
  • Windows recovery techniques involving the "restoration" of the MBR
  • Cases where GRUB failed to install

Prerequisites:

  • Your Ubuntu partitions are all still intact
  • You have a LiveCD, such as the Ubuntu Desktop CD, or anything you're comfortable with
  • You're familiar enough with your LiveCD to gain access to a console
  • You remember how you set up your partitions (having a printout of /etc/fstab is ideal, though you can make do with the output of fdisk -l /dev/hda)

  • Knowledge of how your kernel works (specifically with regards to initrd), if you're using a non-Ubuntu kernel or built your own
  • Your kernel's version; this howto assumes 2.6.10-5-386

Preparing Your Working Environment

To begin the restoration procedure, insert your LiveCD and reboot your computer. Proceed with your LiveCD's bootup proceedure until you are presented with an interface. If your LiveCD does not immediately present you with a console, also called a terminal, open one -- to do this with the Ubuntu LiveCD, click Applications -> System Tools -> Terminal.

Note: Since this is a LiveCD environment, any changes to user accounts or filesystem layouts at this level will not be permanent. This means you can set a temporary root password and create directories without affecting your actual installation.

Now, you need to gain root access. Under Ubuntu, this can be done with the following commands:

sudo -i

Under Knoppix, the following command will suffice, and you will not be prompted for a password.

su -

Now that you have root access, you need to mount the partition(s) containing your bootloader files.

You will need access to both your /sbin/ and /boot/ directories. If you have a /boot/ listing in your fstab, you are among those who will need to mount two partitions.

Begin by creating a mount point for your working environment -- you'll notice this is the same as creating a directory.

mkdir /mnt/work

If you need to mount /boot/, too, run the following command.

mkdir /mnt/work/boot

Now it's time to actually load your filesystem data. Review your fstab and identify the location(s) of / and /boot/; these will likely look something like /dev/hda3 and /dev/hda4, though the letter 'a' and the numbers 3 and 4 may differ.

Note: For the remainder of this howto, /dev/hda3 and /dev/hda4 will be assumed, so alter them as needed when typing them in yourself.

Enter the following commands to load your filesystem and some information GRUB may need.

mount /dev/hda4 /mnt/work
mount -o bind /dev /mnt/work/dev
mount -o bind /proc /mnt/work/proc
cp /proc/mounts /mnt/work/etc/mtab

Now, you have to enter your working environment. The following command will take care of that.

chroot /mnt/work/ /bin/bash

Warning: From this point on, any files you modify will affect your Ubuntu system. You have left the safety of the LiveCD. Excercise caution.

Recovering GRUB Automatically

If you have a separate /boot/ partition, type the following line.

sudo mount /dev/hda3 /boot/

Reinstalling GRUB from this point is easy. Just enter the following command.

sudo /sbin/grub-install /dev/hda

If the command you used above failed, which is unlikely, you will need to configure GRUB manually (it isn't too hard); if it succeeded, you should read the note at the start of the final section: "Configuring the GRUB Menu".

Recovering GRUB Manually

Before you can undertake the next step, it's important that you understand how GRUB identifies partitions.

To GRUB, numbers begin with 0, and letters are expressed numerically, also beginning with 0.

For example, /dev/hda1 is "hd0,0" to GRUB. Similarly, /dev/hdb3 is "hd1,2".

Note: The "root" line must point to the location of your /boot/ partition if you have one. If you do not have one, point it at your / partition.

sudo /sbin/grub
grub> root (hd0,2)
grub> setup (hd0)
grub> quit

Note: This step does not need to be done if you're just trying to recover your MBR. Installing Windows will not alter the contents of your existing menu.lst, so if everything was working right before, everything will continue to work right now, and you can restart your computer.

Open the GRUB menu file, /boot/grub/menu.lst, with your favourite text editor. An example follows.

sudo nano /boot/grub/menu.lst

Note: Your menu.lst file is used to control the operating systems GRUB displays on startup, as well as its visual appearance. This howto will only explain how to get your operating systems to boot; it will not tell you how to make your bootloader pretty.

A sample menu.lst, stripped of unnecessary comments, appears below. It is based on the /dev/hda3 and /dev/hda4 example above, and assumes Windows resides at /dev/hda1.

timeout 5 #The number of seconds GRUB should wait before booting an OS
default 0 #The entry which should be booted by default
fallback 1 #The entry which should be booted in the event of the first one failing

title Ubuntu, 2.6.10 #A 32-bit Ubuntu entry
#This (or something like it) should be in your configuration
root (hd0,2)
initrd /initrd.img-2.6.10-5-386
kernel /vmlinuz-2.6.10-5-386 root=/dev/hda4

title Ubuntu, 2.6.10 #Another 32-bit Ubuntu entry
#This is an example of an Ubuntu entry which does not have a separate /boot/ partition
#(it is provided only as an alternate to the example above -- do not use them together)
root (hd0,2)
initrd /boot/initrd.img-2.6.10-5-386
kernel /boot/vmlinuz-2.6.10-5-386

title Microsoft Windows XP Home #An entry for a Windows installation
#If you're reading this guide, you probably want this
root (hd0,0)
makeactive
chainloader +1

And that's it. Save and close the file, then reboot and try out the entries.

Using the Ubuntu Alternate/Install CD

This section explains how to rescue GRUB (the GRand Unified Boot loader), using the Ubuntu alternate/install CD ROM.

  1. Enter your computers BIOS to check computer can boot from CD ROM. If you can boot from CD, insert CD ROM into drive. Exit the BIOS (if needed save your settings to make sure the computer boots from the CD ROM).
  2. When the Ubuntu splash screen comes up with the boot: prompt, type in rescue and press enter.

  3. Choose your language, location (country) and then keyboard layout as if you were doing a fresh install.
  4. Enter a host name, or leave it with the default (Ubuntu).
  5. At this stage you are presented with a screen where you can select which partition is your root partition (there is a list of the partitions on your hard drive, so you are required to know which partition number Ubuntu is on). This will be dev/discs/disc0/partX, where the X is a partition number.

  6. you are then presented with a command prompt (a hash).
  7. type $ grub-install /dev/hdaX where X is your Ubuntu root install.

The GUI Way: Using the Alternate/Install CD and Overwriting the Windows bootloader

  1. Boot your computer with the Ubuntu CD
  2. Go through the installation process until you reach "[!!!] Disk Partition"
  3. Select Manual Partition
  4. Mount your appropriate linux partions:
    • /
    • /boot
    • swap
    • ...
  5. DO NOT FORMAT THEM.

  6. Finish the manual partition
  7. Say "Yes" when it asks you to save the changes
  8. It will give you errors saying that "the system couldn't install ....." after that
  9. Ignore them, keep select "continue" until you get back to the Ubuntu installation menu
  10. Jump to "Install Grub ...."
  11. Once it is finished, just restart your computer

From: http://doc.gwos.org/index.php/Restore_Grub and http://ubuntuforums.org/showthread.php?t=76652

GRUB Resources

Monday, December 22, 2008

How to Rebuild your Computer and Reinstall Windows Without Headache

If you are planning to rebuild a ’slow’ computer by reinstalling Windows (XP or Vista) from scratch, here’s a pre-installation checklist + some time saving tips.

Fix Problems by Reinstalling Windows

As a tech blogger, part of my job involves reviewing software which is so interesting but frequent installation (followed by un-installation) of software programs also tend to slow down the computer.

To deal with this problem, I did a clean installation of Windows last weekend and re-installed all the important software programs from scratch. As expected, the boot-up time has reduced and the computer’s performance has improved significantly. Luckily, this task is not as complex as it may sound but here are a few things you should remember before taking the plunge:

Pre-Installation Checklist

1. Get Magical Jelly to retrieve a list of product keys that were used to install Windows and Microsoft Office on your computer. Print this information.

2. Get Belarc Advisor to create a detailed report of all software programs, hotfixes and hardware devices available in your system. Print this report as well.

3. Uninstall all software programs that had to be activated at the time of installation (e.g. Adobe Creative Suite or Microsoft Office). It’s important that you do a proper un-installation of these programs through Add/Remove Programs because simply deleting the folder from Program Files directory will not free up the license on the manufacturer’s activation server.

4. Install Driver Max to create a backup of all device drivers currently installed on your system. This will come handy after reinstallation incase you are not able to locate the driver installers on the vendor’s website.

5. Create a backup folder on c: (say c:\old_files) and add the following files to this folder

i. Your Outlook pst file that has all the mails, contacts, tasks and other Outlook items.
ii. If you have purchased any custom fonts, copy the relevant ttf files from the c:\windows\fonts folder. c. All documents, Live Writer drafts, pictures, music and videos from your My Document folder.
iii. Backup your custom dictionaries from Firefox, Microsoft Word, Live Writer, etc.
iv. Export all browser bookmarks and copy them to the backup folder.
v. Open your Firefox add-ons window, take a screenshot and paste that image in the backup folder. This is a good way to remember your favorite Firefox extensions.
vi. Export your podcast subscriptions in iTunes as as OPML (XML) file.
vii. Product keys (serial numbers) of all licensed software.

6. If you have a partitioned hard drive (say C: and D:), just copy* the backup folder created in step 5 to the D: drive. If you don’t have a partitioned hard disk or if the size of partition is small, install Live Mesh, add c:\old_files folder to your Live Mesh account and wait until all the files are uploaded on to the web. Mesh offers 5 GB of space and it may therefore be a good idea to burn all the heavy files (like videos, music, etc) onto a DVD instead of transferring them online.

*You can copy large folders across drives through Windows Explorer or the xcopy utility.

Re-Install Windows from Scratch

Now is the time to do a clean installation of Windows. This is probably the easiest part. You can either boot your computer from the original Windows installation CD** or, while you are running Windows, pop-in the installation CD and run the setup.exe program just like you would install any other Windows app. Always choose "Fresh Installation" instead of "Repair".

**If you installation media doesn’t include the latest service packs, try creating one yourself. Windows XP with SP3 is available as a downloadable ISO while you can slipstream SP1 into Vista fairly easily.

Post-Installation Tips

It can take around 30 minutes (or more) for the whole installation to finish. Now jump to the Windows Update website and let your browser download all the hotfixes, security updates, driver updates, etc. If your computer is unable to connect to the Internet, chances are that your computer doesn’t have the proper network drivers. No problem as you can easily get the drivers from the dump that you created using DriverMax utility.

If your display is acting funny or there’s no audio, just install the right drivers from the vendor’s website (preferred approach) or use your backup media. Once all the patches are installed, Windows Vista users can free up few gigabytes of disk space by making SP1 permanent. Windows XP users may skip this step.

Now turn on the Firewall and install all the other software programs and associated updates in any order. The next important step is to clone your disk image via DriveImage XML (free software), Acronis True Image or Norton Ghost. Windows Vista Ultimate also comes with a "Backup & Restore Center" that you may use to create a complete backup image of your entire computer to another drive, external disk or a DVD.

These disk images will come very handy after few months when your Windows PC get slow again. You won’t have to repeat the rebuilding exercise as the PC can be easily restored to the original state through these disk images.

Don’t experiment on your main PC

If you are tech enthusiast who loves to try new software / browser add-ons, I would strongly recommend that you don’t install these software on your main system - instead get Virtual PC (it’s free), create a Windows XP / Windows Vista virtual machine and use that environment as your new playground.

Another recommendation - do get a cane of compressed air to remove all the dirt from components inside the computer case. Sometimes software may not be the reason behind your slow and slugging PC - the culprit could be the dust sticking on the CPU heat sink.