I am trying to install Ubuntu Server 12.04 64 bit on a Windows Hyper-V virtual machine. I am having issues with the following error:

the grub-pc package failed to install into /target/

I have tried the suggestion of doing a "rescue failed system" and doing the apt-get to repair the boot loader, but my virtual machine can't download the updates due to DNS issues (for some reason, it's not getting DNS resolution).

I have also tried reinstalling the boot loader in the rescue failed system, and the loader appears to install correctly (no errors). But after rebooting the system, it will not boot.

I'm including a screenshot.

  • a temporary solution for your dns issue is: sudo echo "nameserver" >> /etc/resolv.conf && sudo /etc/init.d/networking restart but this will get overriden on next reboot.
    – user91091
    Oct 11, 2012 at 18:47
  • Will this work when booted from the CD in rescue mode?
    – Marc
    Oct 11, 2012 at 20:39
  • I've never used rescue mode. But if you have connection to modem but having dns issues, this should work. For example, if you can ping your IP, but can't ping google, this should work.
    – user91091
    Oct 11, 2012 at 20:49
  • 2
    I got this to work...I have no idea why it worked. I wiped the install and reinstalled without network connectivity (I disabled the virtual network interface). The boot loader installed without issue. After rebooting, Ubuntu Server came up. I shut it down, reconnected the virtual NIC, brought it back up, and we're good!
    – Marc
    Oct 11, 2012 at 20:53

2 Answers 2


I found that the "the grub-pc package failed to install" grub installation problem for Ubuntu 12.04.1 Server was related to the degree of network access. If there was no network connection (cable unplugged) Grub-PC installed OK (but then you need to configure the network by hand). If it was connected to an isolated or limited network (LAN access only or bad DNS) that could not contact an external ubuntu server, the Grub-PC installation failed. Only if it had full network access, was Grub-PC able to install correctly, ah including networking.

So my suggestion is to first troubleshoot your local network to make sure that it is providing complete Internet access. If it isn't, fix it, or completely disconnect from the network, do the install and then install and troubleshoot the network after the rest of the installation is complete.

  • 6
    I don't see how network/internet access is related to a Grub installation. Please clarify.
    – gertvdijk
    Dec 28, 2012 at 15:13
  • Connecting to a network worked for me. But 'm curious as too why Mar 5, 2017 at 11:01
  • I had a similar problem: I was installing Parrot in virtualbox: my network went off while installing and I got this same error. I forund a video on youtube (youtube.com/watch?v=eM023W7D6OQ) by I guy who suggested to manually install grub-pc via apt-get in terminal. I did give a try to that but the network did not work. So I repeated the installation from scratch. When I got the error I switched to a terminal renenabled dhcp (issuing the command 'dhclient') added manually to /etc/resolf.conf and next I could complete the installation. I guess it simply downloads grup-pc Apr 3, 2020 at 8:31

Indeed it is a problem of network access. I cannot figure it out why. I unplugged the network cable and repeated the installation procedure. With success! Grub installed without any issues.

  • 2
    So why not accept the correct answer by @J.Porter? Jul 8, 2013 at 14:14

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