LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 12-01-2012, 09:03 PM   #1
rng
Member
 
Registered: Aug 2011
Posts: 746

Rep: Reputation: 23
Grub problem in newly installed debian testing


I installed debian testing on an external usb drive. However, grub was installed on the main hard disk mbr. To correct this, I used grub legacy- copied its grub folder from another installation to /boot/ folder of external usb drive and corrected the menu.lst file. Then I booted from a live cd with grub legacy and at grub prompt gave commands: root (hd1,0); setup (hd1).

Now I have a well functioning debian testing installation on external usb drive. However, I am worried that grub installation will be altered when I run 'apt-get update' and 'apt-get upgrade' or 'apt-get dist-upgrade' commands. How can I prevent upgrade process from touching grub-legacy of my system? I want to use grub-legacy and not grub2. Thanks for your help.
 
Old 12-01-2012, 09:57 PM   #2
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Squeeze
Posts: 585

Rep: Reputation: 118Reputation: 118
I'm not familiar with the package names for grub-legacy. But if you installed it from a repo, you can set it's status to hold with:
Code:
echo "<package-name> hold" > dpkg --set-selections
This will prevent the package manager from updating the held-back packages during an update/upgrade.

If you need further help, please post the output of:
Code:
dpkg --get-selections | grep grub
Hope it helps.

BTW: GRUB-legacy is no longer maintained either by Debian or the grub developers, so bugs and the like are no longer fixed. It's recommended that you upgrade to GRUB2 since it also provides enhanced features and filesystem support.

Last edited by towheedm; 12-01-2012 at 09:59 PM.
 
Old 12-01-2012, 10:30 PM   #3
rng
Member
 
Registered: Aug 2011
Posts: 746

Original Poster
Rep: Reputation: 23
Thanks for your reply. The output of the command "dpkg --get-selections | grep grub" is:
Quote:
$ dpkg --get-selections | grep grub
grub-common install
grub-pc install
grub-pc-bin install
grub2-common install
 
Old 12-01-2012, 10:56 PM   #4
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Squeeze
Posts: 585

Rep: Reputation: 118Reputation: 118
Code:
grub2-common
is a GRUB2 package. Did you run this after booting from the USB drive? You can check the version of GRUB with (don't know if this works with GRUB-legacy):
Code:
sudo grub-install --version
 
Old 12-01-2012, 11:24 PM   #5
rng
Member
 
Registered: Aug 2011
Posts: 746

Original Poster
Rep: Reputation: 23
I did not run grub2 after installation. As I mentioned earlier, I had manually copied grub folder (grub-legacy) to boot folder and adjusted the menu.lst file.

Do you think I can use "apt-get purge grub" and "apt-get install grub-legacy" to get proper installation of grub legacy on my system?
 
Old 12-01-2012, 11:31 PM   #6
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Squeeze
Posts: 585

Rep: Reputation: 118Reputation: 118
OK, so GRUB-legacy was not install from a package. There are two ways to block GRUB-legacy from being upgraded to GRUB2.
  • Save the /boot/grub directory, purge the GRUB2 packages and the move the backed-up /boot/grub directory back to /boot/grub:
    Code:
    sudo cp -r /boot/grub /boot/grub_orig    # Backup the GRUB dir
    sudo apt-get purge grub-pc grub2-common    # Purge the GRUB2 packages
    sudo mv /boot/grub_orig /boot/grub    # Restore the original GRUB directory
    You may also have to redo the root (hd1,0); setup (hd1), but I'm not sure about this.
  • The simpler way is to set the GRUB2 packages to hold status:
    Code:
    sudo su
    echo -e "grub-common hold\ngrub-pc hold\ngrub-pc-bin hold\ngrub2-common	hold" > dpkg --set-selections
    exit
    Code:
    dpkg --get-selections
    should now return:
    Code:
    grub-common					hold
    grub-pc						hold
    grub-pc-bin					hold
    grub2-common					hold
 
Old 12-01-2012, 11:34 PM   #7
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Squeeze
Posts: 585

Rep: Reputation: 118Reputation: 118
There is no grub-legacy package in the Wheezy (testing) repos. It's in the Squeeze repos. I'm not sure if it will install properly in Wheezy.

A big OOPS. My mistake, grub-legacy is in fact in the Wheezy repos. You can try and install it from there.
Code:
sudo apt-get purge grub-pc grub2-common
sudo apt-get install grub-legacy
This should certainly fix it.

Last edited by towheedm; 12-02-2012 at 12:02 AM.
 
Old 12-02-2012, 01:21 AM   #8
rng
Member
 
Registered: Aug 2011
Posts: 746

Original Poster
Rep: Reputation: 23
Thanks for your replies.

Quote:
You may also have to redo the root (hd1,0); setup (hd1), but I'm not sure about this.
This I know that one does not need to repeat setup if just folder is moved in and out (as long as partition number remains same).

Do I need to purge "grub-pc grub2-common" or just "grub"?

Also, will installing grub-legacy reinstall grub on mbr also? Will it ask for any confirmation? Or I can just purge grub2 and leave grub-legacy as it is since it is working well.
 
Old 12-02-2012, 07:52 PM   #9
towheedm
Member
 
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Squeeze
Posts: 585

Rep: Reputation: 118Reputation: 118
You have to remove grub=pc and grub2-common. grub is a transitional package used to handle upgrades to GRUB2:
Code:
apt-cache show grub
Package: grub
...
Version: 0.97-64
...
Description: GRand Unified Bootloader (dummy package)
 This is a dummy transitional package to handle upgrades.
 .
 Note: This package depends on `grub-pc', which upgrades your
 system to GRUB 2.  If you want to continue using GRUB Legacy, it
 is provided in the `grub-legacy' package.
...
I suggested you use apt-get purge instead of apt-get remove because purge removes the packages plus their configuration files.

I tried it on my Wheezy installation in a VM and effed it up. After doing:
Code:
apt-get purge grub-pc and grub2-common
apt-get install grub-legacy
Checking the version of GRUB gave:
Code:
sudo grub-install --vgrub-install
(GRUB) 0.97-something
But on rebooting, I still got my GRUB2 boot screen.

Checking the /boot/grub directory still showed grub.cfg and other GRUB2 related files. There was no stage1 or stage2 etc files. I purged the grub-legacy package and deleted all GRUB2 related files and re-installed the grub-legacy package:
Code:
sudo apt-get purge grub-legacy
sudo rm -r /boot/grub /etc/default/grub* /usr/share/grub
sudo apt-get install grub-legacy
But now there was no /boot/grub directory. So grub-install gave:
Code:
sudo grub-install /dev/sda
Stage1 file not read correctly.
I knew better but still decided to reboot since I saw grub-legacy files in /boot/grub. Now I'm at the grub rescue prompt. Ah well, serves me right. Now I need to get my Wheezy bootloader up but I have no idea what to do at the rescue prompt.

Will try though and let you know.

Edit: I think it's failing of my ext4 fs. As far as I can recall, grub-legacy did not support ext4 fs.

Last edited by towheedm; 12-02-2012 at 09:38 PM.
 
Old 12-02-2012, 11:33 PM   #10
rng
Member
 
Registered: Aug 2011
Posts: 746

Original Poster
Rep: Reputation: 23
Thanks for your efforts. The best (and simplest) way to install grub-legacy is to copy grub folder from a working grub-legacy installation to your partition, boot to grub-legacy prompt and give commands: root (hdx,y) ; setup (hdx) or setup(hdx,y). It will install required stages to mbr of (hdx) or partition boot record of (hdx,y). Both x and y start from 0 in grub-legacy. Grub legacy supports ext4 partitions (I am using in on ext4 partitions).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
grub cannot load my newly installed kernel saman_artorious Linux - Newbie 2 02-28-2012 01:25 PM
[SOLVED] Newly installed debian sid & saved debian wheezy home would like to transfer files EDDY1 Linux - Newbie 11 01-20-2012 07:43 PM
Newly Installed Win XP hides my debian issacnewton Linux - Newbie 4 01-07-2011 08:45 PM
No internet in newly installed Debian macubex Linux - Newbie 5 04-11-2009 04:27 AM
Newly installed HDD boot problems using GRUB felixmvg Linux - Laptop and Netbook 1 02-25-2005 06:51 PM


All times are GMT -5. The time now is 08:27 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration