Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Failed to fetch and can't install grub

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
quentinthornton
Posts: 8
Joined: 2017-05-17 12:32

Failed to fetch and can't install grub

#1 Post by quentinthornton »

Hey guys, I'm having a horrible time setting up Debian. It's the newest version (debian 8.8.0 amd64). When I installed debian from the dvd it wasn't able to install grub, so I just skipped that and finished installing it. Then I went onto a live usb of kali linux and attempted to install grub. I put all of this into the terminal:

Code: Select all

sudo mount /dev/sda2 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install /dev/sda                        <---------where it fails
CTRL-D
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys
sudo umount /mnt

The error was something to do with not being able to find the EFI partition. I've tried pretty much everything on the first and second page of google that has to do with installing, reinstall, and fixing the grub. Finally, I decided to uninstall grub, and reinstall it (i know, it was a stupid idea), but now I'm running into a failed to fetch problem. If I ran apt-get update for example, it would say 'failed to fetch http://ftp.debian.org...', and so on for every other source I have. This happens every time I try to install something, including grub. I'm really frustrated, as I've been trying to fix this for the last 3 days straight, so please, if you have any idea at all please let me know. Thanks

extra info:
sources.list:

Code: Select all

deb-src http://security.debian.org/ jessie/updates main
deb http://ftp.debian.org/debian/ jessie-updates main
deb-src http://ftp.debian.org/debian/ jessie-updates main

the rest are commented out
This entire time I've been running commands through a live usb terminal that's chroot'ed to the main debian partition.
computer: 64x hp 15-ay103dx
when I installed debian from the cd I did a full installation (no dual boot), but originally it was a windows 10 computer
the live usb runs 64x kali linux that is fully up-to-date.

n_hologram
Posts: 459
Joined: 2013-06-16 00:10

Re: Failed to fetch and can't install grub

#2 Post by n_hologram »

quentinthornton wrote:When I installed debian from the dvd it wasn't able to install grub, so I just skipped that and finished installing it.
Terrible idea, but, you learned your lesson now, right? :wink:
Then I went onto a live usb of kali linux and attempted to install grub. I put all of this into the terminal:

Code: Select all

sudo mount /dev/sda2 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install /dev/sda                        <---------where it fails
CTRL-D
...
The error was something to do with not being able to find the EFI partition. I've tried pretty much everything on the first and second page of google that has to do with installing, reinstall, and fixing the grub.
1) I wouldn't post Kali Linux questions here as this is the Debian forums, so if you can't resolve this, I would update this post with the results from a Live DEBIAN environment.
2) Usually, when I chroot, I bind mount /dev/pts as well. Not sure if that's of any use here.
3) As a rule of thumb for the forum, if you're getting a specific error, please post that error as well. In this case, I know you won't be able to post the error since you're out of grub, as you mentioned below.
Finally, I decided to uninstall grub, and reinstall it (i know, it was a stupid idea), but now I'm running into a failed to fetch problem. If I ran apt-get update for example, it would say 'failed to fetch http://ftp.debian.org...', and so on for every other source I have. This happens every time I try to install something, including grub.
Reinstalling grub isn't a stupid idea, but sounds like your chroot doesn't have internet access; I get the same error whenever I'm knocked offline and without realizing it. Can you ping websites within it? If not, before you enter chroot, try copying /etc/resolv.conf to /mnt/etc/resolv.conf. Of course, if the Kali environment isn't getting internet (I assume it is), then, well, that's another story.
bester69 wrote:There is nothing to install in linux, from time to time i go to google searching for something fresh to install in linux, but, there is nothing
the crunkbong project: scripts, operating system, the list goes on...

quentinthornton
Posts: 8
Joined: 2017-05-17 12:32

Re: Failed to fetch and can't install grub

#3 Post by quentinthornton »

Thanks of the reply
Yeah, I tried pinging within the chroot, but I still tried copying the resolv.conf and it didn't work. I should mention that this was a problem when installing debian. It wasn't able to configure the network, and none of the network mirrors worked. I'd tried restarting the installation multiple times because of this and the grub not installing, but eventually I just skipped past them, thinking I could fix them later. Because it was a problem from the very beginning, do you think that it's something to do with the fact that it's a brand new computer and the uefi/boot/partition settings might be different than older computers? Thanks

Dai_trying
Posts: 1101
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: Failed to fetch and can't install grub

#4 Post by Dai_trying »

If it's a new computer I would use Stretch and not Jessie, it will give you an easier installation as there is more (newer) hardware detected and configured better. If you really want Jessie though I used a method of getting the Jessie Live-cd UEFI bootable and installed from that, instructions can be found in this post . I used this method to install Jessie on my new laptop but due to driver issues I decided it would be easier/better to use Stretch, which has been working ever since.

I think there are other and maybe better ways to do this but I have used this method so I know it works (for me at least).

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Failed to fetch and can't install grub

#5 Post by Head_on_a_Stick »

Did you use a "live" ISO image to install?

Those jessie images are not UEFI capable and GRUB will fail on a GPT disk unless it has a BIOS boot partition to hold the non-UEFI bootloader.

If this is the case, try enabling "CSM" or "Legacy" mode in your firmware ("BIOS") options.

Otherwise, try https://wiki.debian.org/GrubEFIReinstall
deadbang

n_hologram
Posts: 459
Joined: 2013-06-16 00:10

Re: Failed to fetch and can't install grub

#6 Post by n_hologram »

quentinthornton wrote:I should mention that this was a problem when installing debian. It wasn't able to configure the network, and none of the network mirrors worked. I'd tried restarting the installation multiple times because of this and the grub not installing, but eventually I just skipped past them, thinking I could fix them later.
Find your network driver (https://wiki.debian.org/HowToIdentifyADevice/PCI or Google search a better method), and make sure you have the correct driver loaded -- and installed. If it's just a wifi issue, and your ethernet port works, that'll be a decent temporary workaround, just to get your system running, at least. My laptop, for instance, requires a non-free driver, so I had to download it (via ethernet) after I installed Debian.

By the way, is Kali getting internet?
Because it was a problem from the very beginning, do you think that it's something to do with the fact that it's a brand new computer and the uefi/boot/partition settings might be different than older computers?
UEFI is outside my scope of knowledge, if we're being honest, but Head on a Stick offered some sage advice. You certainly want to check for a BIOS legacy boot feature, etc. For further reading, you can also check the UEFI documentation.
https://wiki.debian.org/UEFI

EDIT: One last thought. Using Stretch can be a hit-or-miss, so throwing yourself into that could make more issues without solving the current one(s). I would work through whatever is going on with Jessie before switching to Stretch, unless you find it is (for some reason) truly unworkable in Jessie.
bester69 wrote:There is nothing to install in linux, from time to time i go to google searching for something fresh to install in linux, but, there is nothing
the crunkbong project: scripts, operating system, the list goes on...

Dai_trying
Posts: 1101
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: Failed to fetch and can't install grub

#7 Post by Dai_trying »

n_hologram wrote:One last thought. Using Stretch can be a hit-or-miss, so throwing yourself into that could make more issues without solving the current one(s). I would work through whatever is going on with Jessie before switching to Stretch, unless you find it is (for some reason) truly unworkable in Jessie.
I would normally agree with this, but being so close to Stretch being the stable version I think the chance of "breakage" are pretty minimal at this time, I've been running it for close to a year with only a couple of very small issues but maybe I've just been lucky...

User avatar
phenest
Posts: 1702
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Failed to fetch and can't install grub

#8 Post by phenest »

n_hologram wrote:
quentinthornton wrote:When I installed debian from the dvd it wasn't able to install grub, so I just skipped that and finished installing it.
Terrible idea, but, you learned your lesson now, right? :wink:
Not a terrible idea at all.

@ OP:
This can be done without any Live distros. This is a quick How-To that does depend on whether you created a separate EFI System Partition (ESP). If you didn't then you need to start again or create some space and create one with your Live distro, then continue here.

Install GRUB2 on ESP How-To:
Assumes / is /dev/sda2
Assumes ESP is /dev/sda1
Change the above 2 /dev/sdaX accordingly.

Use the DVD you installed Debian with and instead of selecting "Install", use "Advanced options > Rescue mode". Select region and language, etc as normal, skip networking (just cancel it), then select the device you used as your root system, and "Execute a shell in /dev/sda2":

Code: Select all

mount /dev/sda1 /boot/efi
apt-get install grub-efi
grub-install /dev/sda1
No need to grub-update as grub-install does that. If /boot/efi doesn't exist:

Code: Select all

mkdir /boot/efi
That should do it.
Type:

Code: Select all

exit
... to exit the shell and reboot the system.
ASRock H77 Pro4-M i7 3770K - 32GB RAM - Pioneer BDR-209D

quentinthornton
Posts: 8
Joined: 2017-05-17 12:32

Re: Failed to fetch and can't install grub

#9 Post by quentinthornton »

Thanks for all the help guys!
I took most all your advice and installed debian stretch. I was able to set up the internet connection, but I wasn't able to set up grub like last time. So I did what you said to do, phenest, and went into rescue mode. Everything worked fine until I got to the 'apt-get install grub-efi'. It said something about mounting the cd drive so it could install grub. I then went into the sources.list file using this

Code: Select all

nano /etc/apt/sources.list
and I commented out the 'cdrom:'...... by putting a '#' in front of it. Then I went back and ran apt-get install grub-efi again, and it said it had installed grub-efi. I restarted and tried to boot back in but it still wouldn't work. After that, I went back into rescue mode and typed 'update-grub', restarted, and it worked! Thanks a lot guys!

User avatar
phenest
Posts: 1702
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Failed to fetch and can't install grub

#10 Post by phenest »

What about the rest of the commands I posted? The package grub-efi might be installed, but did you run

Code: Select all

grub-install /dev/sda1
Swap sda1 with whatever your EFI System Partition is.
ASRock H77 Pro4-M i7 3770K - 32GB RAM - Pioneer BDR-209D

quentinthornton
Posts: 8
Joined: 2017-05-17 12:32

Re: Failed to fetch and can't install grub

#11 Post by quentinthornton »

Yeah, I did everything you said to do, then typed update-grub.

Post Reply