Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Trying to fix my apt-get upgrade, it always stopped at setting up grub-pc... I read somewhere that I should purge remove my grub2 and then reinstall it.

I did that and after lots of paying around i was able to remove it(wasn't such a smart move). Now i can't get it to install again.

I am trying sudo apt-get install grub-pc and it just stops at "Setting up grub-pc.." and does nothing and because of this it isn't allowing me to do any kind of upgrade or install.. It asks me to sudo dpkg --configure -a which again stops at setting up grub-pc

I think I need help and real soon. Thanks, I really appreciate any inputs here to get my system in place before the next reboot.

share|improve this question
    
"does nothing" means it stops and gives a prompt or it hangs and you have to stop it manually? Do you see any messages in /var/log/syslog when this happens? –  arrange Feb 9 '11 at 21:04
    
Assuming that you have only one hard drive and it is /dev/sda, could you post the output of sudo grub-install /dev/sda? If it hangs without any output then try sudo grub-install --debug /dev/sda and post the complete output. –  Jordan Uggla Mar 10 '11 at 20:18
    
What version of Ubuntu do you have? What is the output of cat /etc/issue? –  djeikyb Mar 21 '11 at 0:18
add comment

migrated from superuser.com Feb 9 '11 at 16:21

This question came from our site for computer enthusiasts and power users.

3 Answers

do you have SuperGrubDisk (http://www.supergrubdisk.org/)? This could help troubleshout. If it's more aptitude-related, have you tried stuff like apt-get update or apt-get clean?

share|improve this answer
add comment

I could recover grub many times by following these instructions at: https://wiki.ubuntu.com/Grub2#Recover

First of all, you must start your system from a live cd. Then

"METHOD 3 - CHROOT

This method of installation uses the chroot command to gain access to the broken system's files. Once the chroot command is issued, the LiveCD treats the broken system's / as its own. Commands run in a chroot environment will affect the broken systems filesystems and not those of the LiveCD.

1) Boot to the LiveCD Desktop (Ubuntu 9.10 or later). Please note that the Live CD must be the same as the system you are fixing - either 32-bit or 64-bit (if not then the chroot will fail).

2) Open a terminal - Applications, Accessories, Terminal. 3) Determine your normal system partition - (the switch is a lowercase "L")

sudo fdisk -l

If you aren't sure, run

df -Th 
Look for the correct disk size and ext3 or ext4 format.

4) Mount your normal system partition:

Substitute the correct partition: sda1, sdb5, etc.

sudo mount /dev/sdXX /mnt  
# Example: sudo mount /dev/sda1 /mnt

5) Only if you have a separate boot partition: sdYY is the /boot partition designation (for example sdb3)

sudo mount /dev/sdYY /mnt/boot 

6) Mount the critical virtual filesystems:

sudo mount --bind /dev  /mnt/dev
sudo mount --bind /dev/pts  /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys  /mnt/sys 

7) Chroot into your normal system device:

sudo chroot /mnt 

8) If there is no /boot/grub/grub.cfg or it's not correct, create one using

update-grub 

9) Reinstall GRUB 2:

Substitute the correct device - sda, sdb, etc. Do not specify a partition number.

grub-install /dev/sdX 

10) Verify the install (use the correct device, for example sda. Do not specify a partition):

sudo grub-install --recheck /dev/sdX 
11) Exit chroot: CTRL-D on keyboard 12) Unmount virtual filesystems:

sudo umount /mnt/dev/pts
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys 

13) If you mounted a separate /boot partition:

sudo umount /mnt/boot 

14) Unmount the LiveCD's /usr directory:

sudo umount /mnt/usr 

15) Unmount last device:

sudo umount /mnt 

16) Reboot.

sudo reboot 
"

share|improve this answer
add comment

Run

chmod -x /etc/grub.d/README

Then try the upgrade again.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.