How to recover Grub 2 without using a live cd

Sometimes, GRUB 2, the bootloader that comes by default with many distributions Linux, stop functionMost of the time it stops working because for some reason it tries to boot from a wrong or non-existent device, due to a bad program configuration.

Here we present a brief tutorial to solve this problem without need to use a livecd to perform the rescue.


In those cases, it leaves us at a GRUB rescue console prompt.

grub rescue

It may seem a bit complicated but it is simple and can save you more than once. First I accessed the list of available partitions:

ls

This command will show the available partitions, like this:

(hd0) (hd0,1) (hd1) (hd1,1) (hd1,5) (hd2) (hd2,1) (hd3) (hd3,1)

Now you have to find out which partition contains the / boot / grub folder, with all the data needed to boot. To do this, all you have to do is do an "ls" for each of the partitions, like this:

ls (hd1,1) /

… The same goes for the rest of the partitions.

Don't forget the bar / at the end!

Once the partition containing the boot folder is found, we add the corresponding prefix so GRUB knows where it is:

set prefix = (hd1,1) / boot / grub
Don't forget to change (hd1,1) to the appropriate partition in your case.

Finally, enter the following command:

insmod (hd1,1) /boot/grub/linux.mod

Configure the root partition:

set root = (hd1,1)

Load the Linux kernel image:

linux /boot/vmlinuz-2.6.32-23-generic root = / dev / sdb1

If you don't know what version of the kernel you have installed, you can run the command "ls" in the boot directory to find out.

The nomenclature of the mount point sdb1, is given by the name of the partition: (hd1,1) is sdb1, in the same way that (hd0,2) would be: sda2.

Now the kernel needs to be loaded:

initrd /initrd.img

And finally, you can restart:

boot

Once inside the system, it is recommended to reinstall GRUB to avoid this error in the next load:

grub-install / dev / sdb

Source: Quimateur


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

103 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Solid Rugs Pacheco said

    wow, excellent, I came to think that it depended on a live cd 😀 but I see that no, thanks

  2.   Lucas said

    When doing ls the partitions that it marks me are: (hd0) (hd0, msdos8) (hd0, msdos7) (hd0, msdos6) (hd0, msdos5) (hd0, msdos2) (hd0, msdos1) ... the boot / grub folder Find in (hd0, msdos6) ... what would be the syntax for the command "linux /boot/vmlinuz-2.6.32-23-generic root = / dev / sdb1"? that is, what should I put in place of sdb1? .. try trying some values ​​by trial and error but always with the same error message: file not found….

    1.    Amadeus said

      You said that the folder / boot / grub is located in (hd0, msdos8), so in the command "linux / boot / vmlinux ..." you must put "root = / dev / sda8" because your partition hd0, msdos8 is equivalent to sda8 in linux , I hope my help will help you.

  3.   mikVidal said

    At the end of the process it tells me: 'no suitable mode found' what can I do? Thank you!

  4.   Daniel Coke said

    One more solution for the repertoire of useful things in linux. Good contribution

  5.   Let's use Linux said

    So is…

  6.   UnaWeb + Libre said

    Very useful, it has happened to more than some of us

  7.   Leo said

    It's very good, but in the end you finish the live CD sooner. The truth, what can not be done with linux….

  8.   Let's use Linux said

    First, let's explain the origin of the letters:

    sda -> the disks that are SATA (Serial ATA) are called and I think
    that also the SCSI

    hda -> are the PATA (Parallel ATA, the ones with the old IDE connector)

    On the other hand, the third letter has to do with the order of the disks:
    sda -> would be the first hard drive

    sdb -> would be the second

    The origin of the numbers:

    sda is the entire hard drive

    sda1 would be the first partition of this hard disk

    sda2 would be the second partition of the same hard disk

    Cheers! Paul.

    1.    room said

      I can't find any .mod file in boot

  9.   Jose Daniel Ramirez Amador said

    A question? The grub of my machine is fine, only that I have noticed that I have two boot options of my windows, one ends in sda1 and the other sdb1 I think? What does this mean?

  10.   Let's use Linux said

    And yes ...: S
    You can also print them ...
    Cheers! Paul.

  11.   pandacriss said

    It is very useful but when I need it I must have another pc to be able to read the instructions xk they are something alrgas XD

  12.   Zytum said

    In the notes that I have been taking for 4 years (the one that I have only been in GNU / Linux) I have another annotation; Is it still valid?
    sudo grub
    find / boot / grub / stage2
    root (hdx, x)
    setup (hdx) -> here I doubt if I wrote it down correctly, since when indicating the entire disk it should not have the parentheses
    quit

  13.   Andres Mauricio Gallego Herrer said

    by putting insmod (hd1,1) /boot/grub/linux.mod
    It tells me that the file does not exist, what can I do? please help

    1.    Gabriela said

      Hello, you managed to solve it. I feel the same as you.

      1.    neil said

        ONLY PON
        insmod linux
        GREETINGS

      2.    Ronald said

        Hello, did you manage to solve the problem? the same happens to me..

    2.    shere said

      Good afternoon, can I solve? The same error happens to me

  14.   Daniel said

    Hello
    I have a similar problem, I have deleted it. How can I reinstall it. It gives me the following error

    Missing operating system.
    error: unknown file system.
    grub rescue

  15.   ceballos said

    Hi, I'm almost new to linux and commands, but if you can solve my question in the last step, it throws me a not found error
    (initramfs) grub-install / dev / sdb7 // or (sdb)
    / bin / sh: grub-install: not found

  16.   Pablo said

    Thank you. It worked perfectly.

  17.   alexander said

    how do i do it in fedora 19?

  18.   Hector Caballero said

    emm, it gives me the following error: file '/grub2/i386-pc/normal.mod' not found.

    and send me to grub rescue>

    where I tried what comes here, however I have raids in mirror ...

    now, at the time of installation it appears to me that it is due to mbr ... while I create a mirror / boot partition. (I have no idea if that is fine or if I leave it in /) ...

    now when I try the following command to load the linux image it tells me that sdb1 does not exist, nor sdb2, I try with the md0 raid and neither ...

    any suggestions? ... thanks

  19.   alberto said

    hola que tal
    a question
    What happens is that in all the partitions that are on my hard drive, it appears in all of them after applying the "ls (hd ...)" error: unknown filesystem.
    What can I do in this case?
    please help

    1.    josuenaro said

      Yes. You could fix your problem, the same thing happens to me!

  20.   francisca fernandez letasset, paqui said

    I'm going to copy this and try to follow it step by step; If I want to use linux I have no other solution than to handle the terminal even though it scares me

    I am on ubuntu at the moment, because on the other computer I made you with the grub
    and I could never enter the mint again and I don't have the live cd xq they installed it for me
    Even if I downloaded a mint from the internet, it wouldn't be the same, right? And wouldn't it be useful to me?
    How good if someone could reply to my email

    1.    ErickIsos said

      Well, maybe it's too late xD but it's the same, no matter the version, you only use the LiveCD to load the GRUB configuration or "Reinstall it" so you could well use any LiveCD from any distro that loads with GRUB (Still I'm not really sure if they all "pull" with grub, because I've seen other bootloaders), you probably already know by now, or someone else has responded to your email.

  21.   deby said

    thank you! the info very useful

  22.   Wilson said

    Great! Very good guide, I didn't know you could recover without a live cd. =)

    Question: Is it possible to put together a PDF with all the articles or TIPS made in this blog?
    There are so many useful posts, that I would love to have them in a PDF and print them =).

    Thank you! = D

  23.   harold zarate stolen said

    Hello friend, when placing insmod (hd0, msdos7) /boot/grup/linux.mod, it appears that the file does not exist, you can tell me what to do I need help.!

  24.   Felix Ivana said

    It doesn't work for me, just when I put
    insmod (hd1,1) /boot/grub/linux.mod
    file not found, I am trying to lift from a usblive

  25.   Erik said

    in the part of :
    insmod (hd1,1) /boot/grub/linux.mod
    I get: error: incompatible license

    1.    Julian said

      Solution a: «It doesn't work for me, just when I put
      insmod (hd1,1) /boot/grub/linux.mod »

      Instead of "linux" put "boot"

      1.    Jonathan said

        I keep getting an error: file not found

        Other solution?

        Is appreciated.

  26.   German said

    This article saved my life I forgot to update GRUB and spend a while typing the solution at the end I already have Mint only on my net thanks for sharing

  27.   Carlos said

    I do not walk

  28.   Luis said

    The same thing happens to me, did you manage to fix it?

  29.   Erick said

    Hello! I just realized that it is necessary to leave a space between the "ls" and the parenthesis that contains the name of the partition. Without that, or those spaces, nothing will be displayed. DLB!

  30.   josuenaro said

    What if I don't even know which partition the boot has? Help

  31.   claw said

    no system found in any partition ...

  32.   Victor said

    Thanks, I was able to recover my ubuntu, without using a live-cd

  33.   Francisca said

    I tried, but it gives me unknown filesystem could it be a hardware problem? Because despite having the new battery, the date is modified. It is Ubuntu 11.10. If the problem is already in the setup, it is difficult to give a solution, or can it be?

  34.   I have Ubuntu 12.04 said

    I already tried all the partitions that it gives me, but it does not accept me any

  35.   placido gutierrez said

    use the mini Puppy Linux operating system that is used to fix Grub, it is installed on a pendrive and booted from it then select the program that comes with the system called grub for dos, and there the operating systems installed in the computer, it is very simple, do not complicate life, I have been applying the same method for a long time after installing Windws after Linux

  36.   Will said

    Hey what is the command to know the version of my kernel?

    1.    elav said

      uname -a

  37.   Miguel said

    Ubuntu is bad I tried it I did not like it very much ..

  38.   nacho said

    I need help

    I have a triple boot laptop (Windows 7 Ultimate, Ubuntu 14.04.1 LTS and Mac Os Snow Leopard)
    The three systems work perfectly (Mac more or less) but since I recovered the grub I can't configure it as I want. I put the list that I would like to have:

    Windows 7 Ultimate (*)
    Ubuntu LTS 14.04.1
    Mac OSX Snow Leopard
    Ubuntu advanced options
    Ubuntu ...
    Ubuntu ...
    Ubuntu ...
    Ubuntu ...
    Mem test
    Memtest86x ...
    Memtest86x ...

    The asterisk is the default one and what is more inserted is what is inside a submenu (Similar to how it would appear in Grub customizer)

    To begin with, the memtests do not appear in grub or burg.
    I try to configure it in burg, but in this I do not see the default version of Ubuntu, only the advanced options of which the versions that do not put recovery, but do not load the same, serve me.
    Finally, I cannot make the entries that I have entered manually (the one for mac and an attempt to rewrite the original version of Ubuntu) have their icon, a blue circle with a question mark appears.

    I know that what I am asking is a lot of trouble, but I am already desperate and I don't know what to do to make it go well ...

    1.    let's use linux said

      Hello Nacho!

      We recommend that you ask this question in our question and answer service called Ask FromLinux so that the whole community can help you with your problem.

      A hug, Pablo.

      1.    nacho said

        ok i just did, thanks a lot for the advice. In case someone is going to answer here I have to add that the memory tests I have taken from another computer with Ubuntu and they seem to work. If anyone knows if that is wrong, let them know.

  39.   Daniel said

    Ami I get this helpsaaa

    GRUB loading.
    Welcome to GRUB!

    Error: file not found
    Entering rescue mode ...
    Grub rescue>

    1.    let's use linux said

      Hello Daniel!

      I think it would be better if you ask this question in our question and answer service called Ask FromLinux so that the whole community can help you with your problem.

      A hug, Pablo.

  40.   Jeremias said

    when I run the initrd, linux and insmod commands it tells me: unknow command "command" what do I do?

    1.    let's use linux said

      Do you have to execute "su -" first?

      1.    Jeremias said

        when I run it it tells me "unknown command"

      2.    matias said

        hello I have a problem when I put insmod it tells me error file not found and I tried putting boot instead of linux and putting insmod linux and nothing happens the same error appears. Please I need help, thank you very much in advance.

      3.    matias said

        hello I need a solution when I put insmod it tells me error file not found, I already tried putting boot instead of linux and putting insmod linux and I keep getting the error please help friends, thank you very much in advance!

    2.    Ronald said

      Friend, did you manage to solve? the same happens to me.

  41.   Jesús López said

    Many thanks!! It has helped me to start. You are a crack !!

  42.   Jose Luis said

    When I get to the command insmod… ..boot / grub / linux.mod
    It gives me: error: file 'boot / grub / linux.mod »not found
    How do i do it? Because in a single partition I have boot. In. No other is boot.
    From already thank you

    1.    KZKG ^ Gaara said

      Are you putting / boot / or boot /?

  43.   Luis said

    Entering insmod (hd0,6) /boot/grub/linux.mod
    Appears
    error: file not found
    Thank you for your help.

    1.    matias said

      did you solve it friend? I am the same as you, please help, I already tried with insmod linux only and changing for boot and nothing I get that error

      1.    Ronald said

        friend, did you solve the problem? the same happens to me

  44.   Jose Santos said

    I get the error message: symbol 'grub_term_highlight_color' not found-
    I need help please.

  45.   Germán said

    Hi. I enter the ls command and the list of partitions appears, like this:

    (hd0) (hd0, msdos1) (hd1) (hd1, msdos6) (hd1, msdos5) (hd1, msdos1) (hd2)

    I look for each one with the ls (hd0), etc, but in all I get «error: unknown filesystem

    How do I continue?

    1.    let's use linux said

      Hello German!

      I think it would be better if you ask this question in our question and answer service called Ask FromLinux so that the whole community can help you with your problem.

      A hug, Pablo.

      1.    matias-linux said

        I get a file not found error, when I put insmod and the rest, what can I do? I already tried to put boot and put insmod linux alone. I had linux and windows 7 and I deleted the linux partition. I would appreciate very much if you help me, thank you very much in advance!

  46.   daniel said

    hello my problem is the following I apply the ls command but I get until it gives me three partitions in my case but none comes out like the one with boot root

  47.   Alvaro Olarte placeholder image said

    Everything was fine but when I load the Kernel with the command: linux / boot / vmlinuz… .. I get the error: Unknow command 'linux'. Could you help me please. Thank you

  48.   Mauro Hernandez said

    excellent, thank you!

  49.   Manual L. said

    That I am blocked and desperate with this. I cannot use my equipment because of this problem. I follow all your instructions, but when I get to the insmod part with any of the combinations that you propose I ALWAYS get an error message: incompatible license.

    What I can do?. Help please

  50.   Gabriela Michelle Fernandez said

    Hello, I have had a serious problem for days. Searching in many places and after doing several things that they recommended, my pc only starts from grub rescue and eventually I can access as root if I press when starting f1 or f2 or several (the truth is, I don't know how it arrives but it arrives)
    Anyway, when trying to follow all this procedure that you and many others mention, I find myself facing the serious problem that there are no files in / boot / grub !!!! and therefore I can't find linux.mod
    What I do?? Please I need to fix this problem and I don't know what to do anymore. I can't format everything, that would be the last thing. I need to recover files from the disk that are still there !!! then I just want to have linux on that machine so I don't need (I think) grub.
    If you can guide me I will thank you greatly !!!

  51.   Emmanuel said

    The grub seems to only list me the (hd0) that can be ???
    The structure of the disc is
    Primary part (win7)
    Extended part
    Part ntfs (data)
    Part SWAP
    BRTFS part (root)
    Part XFS (home)
    It was walking me for a while but when changing the default system and fiddling around a bit,
    the grub died.

  52.   Luis said

    very good explanation, I could even follow the steps one by one, thanks from LP

  53.   Alfred said

    Hi, please help me ... when trying to load the kernel with the command: "linux /boot/vmlinuz-3.13.0-36-generic root = / dev / sda1" (my partition is (hd0, gpt1) I don't know if the "sda1" is fine) I get "file not found" ... What should I do ???? From already thank you very much !

  54.   clau said

    Hello I already put the commands as it says here and nothing happens when I put set I get this if prefix = (hd0,2) / blót / grub / robot = hd0,2 hopefully you can help me.

  55.   jose said

    some command does not accept it x example initrd Linux insmod

  56.   jose said

    mine (hd0,1) but in initrd it tells me error

  57.   fede chavez said

    Hello, on the screen after it turns on it only says GRUB_ and nothing else, it doesn't let me write any command, what could I do? Thank you.

    1.    let's use linux said

      Hello! First of all, sorry for the delay in answering.
      I suggest you use our Ask From Linux service (http://ask.desdelinux.net) to carry out this type of consultation. That way you can get the help of the entire community.
      A hug! Paul

  58.   genoveva said

    hello, I have problems, when inserting insmod (hdp0, gpt7) /boot/grub/linux.mod it tells me error: file /boot/grub/linux.mod not found, what do I do in that case? won't let me continue, what should I do? just in case the boot is in (hd0, gpt7)

    1.    edgar said

      did you solve your case?

    2.    let's use linux said

      Hello! First of all, sorry for the delay in answering.
      I suggest you use our Ask From Linux service (http://ask.desdelinux.net) to carry out this type of consultation. That way you can get the help of the entire community.
      A hug! Paul

  59.   Luis Miguel said

    Kind regards, I am new to linux but very interested in the subject, this is what happened to me:

    error: unknown file system.
    Entering rescue mode ...
    grub rescue> ls
    (hd0) (hd0, msdos1) (hd1) (hd1, msdos1) (fd0)
    grub rescue> ls (hd0) /
    error: unknown file system.
    grub rescue> ls (hd0, msdos1) /
    error: no search partition.
    grub rescue> ls (hd1) /
    error: unknown file system.
    grub rescue> ls (hd1, msdos1) /
    error: unknown file system.
    grub rescue> ls (fd0) /
    error: failure reading sector 0x2 from 'fd0'.

    My question at the end is what is telling me this? I understand that if you mark an error in read sectors it is likely that the hard disk is no longer useful, but could the above rescue some information?

    1.    let's use linux said

      Hello! First of all, sorry for the delay in answering.
      I suggest you use our Ask From Linux service (http://ask.desdelinux.net) to carry out this type of consultation. That way you can get the help of the entire community.
      A hug! Paul

  60.   Ruben said

    Hello, I have placed the ls command and it appears this: ls / dir: Cannot open current directory - No Mapping and nothing happens, what can I do?

    1.    let's use linux said

      Hello! First of all, sorry for the delay in answering.
      I suggest you use our Ask From Linux service (http://ask.desdelinux.net) to carry out this type of consultation. That way you can get the help of the entire community.
      A hug! Paul

  61.   Mariano said

    Dear,

    As it happened to many, I had the same problem and I got the error: file 'boot / grub / linux.mod ”not found
    I found another simpler solution, I just booted my system and I am writing these lines, it is not my authorship, so I quote the source.

    https://www.youtube.com/watch?v=i1QpN9IWSoc

    Basically we must follow the steps of searching with ls where is the partition that contains the folder with / boot / grub /
    To those who also happened the "error: unknown filesystem", it is true that it appears in some partitions, or in almost all, it also happened to me, but there has to be ONE where the whole directory tree appears (in my case NO I made a separate partition for the / boot folder)
    Well for example in my case it was (hd0, msdos1).

    Be patient, do ls on all partitions, I had (hd0, msdos1); (hd0, msdos2); (hd0, msdos3); (hd0, msdos4); (hd0, msdos5) and (hd0, msdos6) and I had started backwards… when I found my user folder (for / home I did make a separate partition) I realized that it was already close, the rest still kept coming back « error: unknown filesystem », until I finally found the one indicated, which as I already mentioned was (hd0, msdos1).

    That is all the information we need to know.
    Then it would be to adapt the following to each case.

    set boot = (hd0, msdos1)
    set prefix = (hd0, msdos1) / boot / grub
    normal insmod
    normal

    As soon as we press enter after entering normal, our grub menu appears as it was before! It is really satisfying to see that it was so easy.

    It remains for me to find out what will happen when I restart, but at least we already have our system functional again.

    I hope it helps you.

    Greetings to all!

  62.   Brian said

    Hello ami I see (hd0) (hd0, msdos7) (hd0, msdos6) (hd0, msdos5) (hd0, msdos2) (hd0, msdos1) when I pressed ls what I do help me

  63.   judd said

    Brian!

    Sure is the (hd0, msdos7)

    So you do this =

    set boot = (hd0, msdos7)
    be prefix = (hd0, msdos7) / boot / grub
    normal insmod
    normal

    and after this your grub will appear again

    Good luck and regards!

    1.    Nelson said

      You are the best friend of mine !!!!

    2.    Ezekiel said

      You are a grosooooooo

  64.   Francisco said

    hello friend, is there any way to change keyboard settings? I can't get it right because the keys change a lot: /

  65.   anony said

    What is GRUB? | GRUB main features
    https://www.youtube.com/watch?v=7hBO1q85ZSY

  66.   ezio said

    Hello there I have a problem with that my canaima is one of the new ones and I have linux 4.0 and put the command insmod (hd0, msdos2) /boot/grub/linux.mod and change the linux for boot and I still get the error invalid object file.
    and also I put linux /boot/vmlinuz-3.13.0-generic root = / dev / sda2 and I get Unknown command "linux" that I do HELP PLEASE

  67.   daniel said

    GRUB loading.
    error: file not found.
    Entering rescue mode ...
    grub rescue>

    I have this problem when applying the ls it only appears (hd0) (hd0, msdos2) (hd0, msdos1)
    I apply
    set boot = (hd0, msdos1)
    be prefix = (hd0, msdos1) / boot / grub
    normal insmod
    normal
    but after executing this line
    normal insmod
    either for msdos1 or msdos2
    an error is generated that says unknown filesystem
    I'd appreciate your help

    1.    Rethny Ramos said

      Friend I have your midmo problem but when I give it ls (hd0, msdos2) / it appears to me where I have the boot but from there I do not know what follows

  68.   Anonymous said

    Hello look good, I hope nobody has this problem that I wanted to make me scream but after 3 hours awake I finally could find a way to solve it. If someone by pure chance threw an error with "insmod" (For example boot / grub / i386-pc / mod does not exist) or something like that, just repeat the step to make it root but doing it boot "set boot = (hdaX, msdosX) and it will let them continue with the normal, normal and ready insmod command.

  69.   Anonymous said

    I also forgot, when you give "Set prefix" make sure it is "set prefix = (hdX, msdosX) boot / grub

  70.   Lenny's said

    Hello, I followed your steps but none of the commands give me…. after placing ls, I get (hd0) (hd0, msdos3), (hd0, msdos2), (hd0, msdos1)
    I put them all with / at the end and nothing…. and now what do i do?

  71.   Reinaldo said

    good, these procedures are always the same for all distro, I use slackware 14.2, 64bits, could I apply these same steps and they work ?.

    or you have to verify if it only works for a specific distro, I had a problem with grub2 recently but I recover it with liveusb, but not having that tool I came across this merial but I wanted to know if those command is for all architectures ...