You are not logged in.

#1 2015-04-11 18:06:20

bus
Member
Registered: 2014-10-12
Posts: 25

[SOLVED] GRUB is confused, has to be booted manually

So one day I fiddled a bit with SATA cables in my computer (which may or may not have contributed to the problem, because I didn't do anything crazy). During the boot right after that GRUB immediately gave me this:

error: no such device: <UUID that none of my drives ever had, as far as I remember>.
Entering rescue mode...
grub rescue> 

I googled around, found a way out:

grub rescue> prefix=(hd2,msdos2)/boot/grub
grub rescue> root=(hd2,msdos2)
grub rescue> insmod normal
grub rescue> normal

After these commands everything boots completely fine, just like it always used to. But I'm not really in the mood to type them out every time I turn on the computer, so this needs a permanent fix.

The boot is located on a separate ext2 partition (should it be something different? like fat16? let me know)  that is right at the end of the main drive, which always worked perfectly.

I tried installing GRUB on that partition again (which I just realized is apparently really unreliable, is it really?) but all I got is the same thing while also getting "error: symbol 'grub_real_boot_time' not found." after "insmod normal".
I don't have the original command I used to install everything the first time, so I used this one:

$ sudo grub-install --target=i386-pc --boot-directory=/run/boot/boot/ --recheck --force /dev/sda2      # boot partition /dev/sda2 is mounted at /run/boot

Final questions:
1) Which step of the GRUB installation on a separate partition do I completely not understand?
2) Is GRUB on a partition actually unstable? Seems like that to me, but who knows what triggered this in my case.
3) What should I fix about my boot setup? (change file system of the partition, move the boot partition somewhere else, etc.)
4) How can I prevent this situation from ever happening again?

Last edited by bus (2015-04-14 22:19:05)

Offline

#2 2015-04-11 20:44:44

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] GRUB is confused, has to be booted manually

As you appear to have an MBR disk, you should just try to install GRUB to the MBR using:

# grub-install --target=i386-pc --recheck /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg

Offline

#3 2015-04-11 20:58:36

bus
Member
Registered: 2014-10-12
Posts: 25

Re: [SOLVED] GRUB is confused, has to be booted manually

Head_on_a_Stick wrote:

As you appear to have an MBR disk, you should just try to install GRUB to the MBR using:

# grub-install --target=i386-pc --recheck /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg

This page says I need to have a separate boot partition (I use basic unencrypted boot with encrypted everything else). But oh well, I'll try what you've suggested tomorrow.

Offline

#4 2015-04-12 17:14:24

bus
Member
Registered: 2014-10-12
Posts: 25

Re: [SOLVED] GRUB is confused, has to be booted manually

Head_on_a_Stick wrote:

As you appear to have an MBR disk, you should just try to install GRUB to the MBR using:

# grub-install --target=i386-pc --recheck /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg

Nope.
After I successfully installed GRUB with your command nothing changed at all, except the GRUB went into "error: symbol 'grub_real_boot_time' not found." state which forces me to restore the whole boot partition from my backup.

Offline

#5 2015-04-12 17:21:57

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] GRUB is confused, has to be booted manually

bus wrote:

I googled around, found a way out:

grub rescue> prefix=(hd2,msdos2)/boot/grub
grub rescue> root=(hd2,msdos2)
grub rescue> insmod normal
grub rescue> normal

After these commands everything boots completely fine, just like it always used to.

With those commands, you are instructing GRUB to boot a root partition located at /dev/sdc2

Please post the output of:

lsblk -f
# parted -l

Offline

#6 2015-04-12 17:30:17

bus
Member
Registered: 2014-10-12
Posts: 25

Re: [SOLVED] GRUB is confused, has to be booted manually

Head_on_a_Stick wrote:
bus wrote:

I googled around, found a way out:

grub rescue> prefix=(hd2,msdos2)/boot/grub
grub rescue> root=(hd2,msdos2)
grub rescue> insmod normal
grub rescue> normal

After these commands everything boots completely fine, just like it always used to.

With those commands, you are instructing GRUB to boot a root partition located at /dev/sdc2

Please post the output of:

lsblk -f
# parted -l

I haven't used /dev/sdc drive for years and also I wiped it with /dev/urandom a couple of days ago.

Error: /dev/sdc: unrecognised disk label
Model: ATA WDC WD800JD-00LS (scsi)                                        
Disk /dev/sdc: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

I really don't think (hd2,2) corresponds to /dev/sdc2. The second 2 might correspond to /dev/sda2 where boot is actually located, or it might be a coincidence, I don't know.

Offline

#7 2015-04-12 17:43:40

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] GRUB is confused, has to be booted manually

bus wrote:

I really don't think (hd2,2) corresponds to /dev/sdc2. The second 2 might correspond to /dev/sda2 where boot is actually located, or it might be a coincidence, I don't know.

http://www.gnu.org/software/grub/manual … convention

bus wrote:

I haven't used /dev/sdc drive for years and also I wiped it with /dev/urandom a couple of days ago.

Can you elaborate on this please?

Along with the output I have already requested, please also post:

ls -la /dev/sd*

You can direct the command output to a text file & copy that out to a USB stick if you need to post it from a another computer.

command > output.txt

Or use `sprunge` if you have an internet connection:

<command> | curl -F 'sprunge=<-' http://sprunge.us

https://wiki.archlinux.org/index.php/Li … in_clients

Offline

#8 2015-04-12 18:10:40

bus
Member
Registered: 2014-10-12
Posts: 25

Re: [SOLVED] GRUB is confused, has to be booted manually

Head_on_a_Stick wrote:
bus wrote:

I haven't used /dev/sdc drive for years and also I wiped it with /dev/urandom a couple of days ago.

Can you elaborate on this please?

The /dev/sdc drive is my oldest and smallest drive. It hasn't stored anything valuable for a couple of years because I'm afraid of it failing, and it sure has never been my main drive for distributions. It had some useless data on it, but I decided to wipe it clean (for no particular reason). That was done after GRUB failing on me, so it couldn't have caused it.

Head_on_a_Stick wrote:

Along with the output I have already requested, please also post:

ls -la /dev/sd*
brw-rw---- 1 root disk 8,  0 Apr 12 23:44 /dev/sda
brw-rw---- 1 root disk 8,  1 Apr 12 23:44 /dev/sda1
brw-rw---- 1 root disk 8,  2 Apr 12 23:44 /dev/sda2
brw-rw---- 1 root disk 8,  3 Apr 12 23:44 /dev/sda3
brw-rw---- 1 root disk 8,  5 Apr 12 23:44 /dev/sda5
brw-rw---- 1 root disk 8,  6 Apr 12 23:44 /dev/sda6
brw-rw---- 1 root disk 8,  7 Apr 12 23:44 /dev/sda7
brw-rw---- 1 root disk 8,  8 Apr 12 23:44 /dev/sda8
brw-rw---- 1 root disk 8, 16 Apr 12 23:44 /dev/sdb
brw-rw---- 1 root disk 8, 17 Apr 12 23:44 /dev/sdb1
brw-rw---- 1 root disk 8, 18 Apr 12 23:44 /dev/sdb2
brw-rw---- 1 root disk 8, 32 Apr 12 23:44 /dev/sdc
brw-rw---- 1 root disk 8, 48 Apr 12 23:49 /dev/sdd
brw-rw---- 1 root disk 8, 49 Apr 12 23:54 /dev/sdd1
brw-rw---- 1 root disk 8, 64 Apr 12 23:44 /dev/sde
brw-rw---- 1 root disk 8, 80 Apr 12 23:44 /dev/sdf
brw-rw---- 1 root disk 8, 81 Apr 12 23:44 /dev/sdf1

and

> $ lsblk -f                                                                                                                         
NAME              FSTYPE      LABEL       UUID                                   MOUNTPOINT
sda                                                                              
├─sda2            ext2        boot        ad6ff36c-9613-4e42-92aa-004780b9fd5e   /run/boot
├─sda3            crypto_LUKS             9300ce20-a645-4945-acd0-88a2642628d4   
│ └─bmain3        LVM2_member             uhc7tw-xTGd-UwCD-hJOS-P8nn-b2gC-D5yt9s 
│   └─bmain-bmain ext4                    3d90af4f-49a3-47b9-bbb5-9687a659d3fa   /media/bmain
├─sda5            crypto_LUKS             6d7a2762-0706-4f2f-b3ac-924c9f175dd2   
│ └─arch          LVM2_member             N26ADq-b0HO-wrXl-vLzG-8GYI-YyuB-DTg0O8 
│   └─arch-arch   ext4                    3042a665-d5a6-4641-ad9f-a058f66f4528   /
├─sda6            crypto_LUKS             327c2137-21fe-424a-ba36-8601f7a68482   
│ └─bmain1        LVM2_member             ZaUVyn-jWOZ-6gGc-LAau-ubfU-uQO8-Vu9XXY 
│   └─bmain-bmain ext4                    3d90af4f-49a3-47b9-bbb5-9687a659d3fa   /media/bmain
├─sda7            crypto_LUKS             921230d3-acff-4b67-8ee7-bcfe9e6f7401   
│ └─bmain2        LVM2_member             7VeTPU-LcGl-nGpU-qoed-iNuE-47qj-YIVUX3 
│   └─bmain-bmain ext4                    3d90af4f-49a3-47b9-bbb5-9687a659d3fa   /media/bmain
└─sda8                                                                           
sdb                                                                              
├─sdb1            crypto_LUKS             9532a06c-4d52-4300-afc0-2cfb07c22978   
│ └─bold1         LVM2_member             oiy78A-bpN1-RZbN-bCie-we1F-6Mex-SN6eSn 
│   └─bold-bold   ext4                    d4451310-ba91-4682-bc57-dab88e4d85a8   /media/bold
└─sdb2            crypto_LUKS             ba3fad5e-2260-4841-ade5-46393b0003c6   
  └─bold2         LVM2_member             shpuKU-NRVU-B9eL-7UrP-yfWI-62Ny-xV8YiW 
    └─bold-bold   ext4                    d4451310-ba91-4682-bc57-dab88e4d85a8   /media/bold
sdc                                                                              
sdd                                                                              
└─sdd1            ext4        busext      7d669b8a-989e-406e-9b17-32dad7f8b169   
sde               ext4                    0988f139-700d-44d7-a412-5fdcbda7b51b   /run/media/bus/0988f139-700d-44d7-a412-5fdcbda7b51b
sdf               iso9660     ARCH_201406 2014-06-01-15-54-52-00                 
└─sdf1            vfat        multiboot   0077-1D77                              /run/media/bus/multiboot
sr0

Offline

#9 2015-04-12 18:50:51

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] GRUB is confused, has to be booted manually

Did you use the `grub-install` command after using `arch-chroot`?

Is /dev/sda2 definitely mounted as /boot?

What exactly did you do with those SATA cables?

Offline

#10 2015-04-12 19:35:43

bus
Member
Registered: 2014-10-12
Posts: 25

Re: [SOLVED] GRUB is confused, has to be booted manually

Head_on_a_Stick wrote:

Did you use the `grub-install` command after using `arch-chroot`?

Is /dev/sda2 definitely mounted as /boot?

What exactly did you do with those SATA cables?

I only remember using "arch-chroot" during the very first install of GRUB, but it was too long ago. Haven't even remembered it since and that must be a part of the problem.

Yes. I verified it with "df -P /boot/grub | tail -1 | cut -d' ' -f 1" command which indeed returned "/dev/sda2". (from StackOverflow)

Whatever I did to SATA cables doesn't really matter because I've tried plugging everything back to it's original ports and it didn't fix anything.

Offline

#11 2015-04-12 19:42:26

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] GRUB is confused, has to be booted manually

bus wrote:

I only remember using "arch-chroot" during the very first install of GRUB, but it was too long ago. Haven't even remembered it since and that must be a part of the problem.

You will need to mount all your partitions correctly and use `arch-chroot` before you attempt to re-configure GRUB.

GRUB itself will install fine without chroot'ing but the `grub-mkconfig` command needs to be directed to /boot/grub/grub.cfg in your installed Arch system (rather than that location in the filesystem of the Arch live ISO).

Offline

#12 2015-04-12 19:51:59

bus
Member
Registered: 2014-10-12
Posts: 25

Re: [SOLVED] GRUB is confused, has to be booted manually

Head_on_a_Stick wrote:
bus wrote:

I only remember using "arch-chroot" during the very first install of GRUB, but it was too long ago. Haven't even remembered it since and that must be a part of the problem.

You will need to mount all your partitions correctly and use `arch-chroot` before you attempt to re-configure GRUB.

GRUB itself will install fine without chroot'ing but the `grub-mkconfig` command needs to be directed to /boot/grub/grub.cfg in your installed Arch system (rather than that location in the filesystem of the Arch live ISO).

Okay, another problem.
Ever since going LVM-on-LUKS I stopped using "grub-mkconfig" completely and started changing grub.cfg manually, it was faster to tune things that way. Is this a horrible idea or just a bad one?

If the problem lies in grub.cfg then I'm willing to learn how to use "grub-mkconfig". But I was sure that the config was right but wrong was everything about my use of "grub-install".

Offline

#13 2015-04-12 19:58:03

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] GRUB is confused, has to be booted manually

bus wrote:

Ever since going LVM-on-LUKS I stopped using "grub-mkconfig" completely and started changing grub.cfg manually, it was faster to tune things that way. Is this a horrible idea or just a bad one?

That sounds like a good idea -- if I hadn't dropped GRUB completely I would probably be doing the same myself.

All I can suggest is going through grub.cfg and checking that all the entries are completely correct.

Offline

#14 2015-04-13 14:13:42

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: [SOLVED] GRUB is confused, has to be booted manually

Ever since going LVM-on-LUKS I stopped using "grub-mkconfig" completely and started changing grub.cfg manually, it was faster to tune things that way. Is this a horrible idea or just a bad one?

You might try grub-mkconfig and see if it generates a working grub.cfg file, after backing up your manual grub.cfg. If that doesn't work nothing is lost, and if it works you have solved your problem.

Offline

#15 2015-04-13 15:27:39

bus
Member
Registered: 2014-10-12
Posts: 25

Re: [SOLVED] GRUB is confused, has to be booted manually

teateawhy wrote:

Ever since going LVM-on-LUKS I stopped using "grub-mkconfig" completely and started changing grub.cfg manually, it was faster to tune things that way. Is this a horrible idea or just a bad one?

You might try grub-mkconfig and see if it generates a working grub.cfg file, after backing up your manual grub.cfg. If that doesn't work nothing is lost, and if it works you have solved your problem.

I experimented with that. It didn't generate anything usable (because I've never configured it to do so), but I'll compare my grub.conf to that to see what may be wrong.

Offline

#16 2015-04-14 21:54:59

bus
Member
Registered: 2014-10-12
Posts: 25

Re: [SOLVED] GRUB is confused, has to be booted manually

Minor development:

I've got an SSD now, it has become my main system and boot drive. The boot partition (copy of the previous one) is located right at the beginning of the SSD. It shows up as /dev/sda2 in the system (same as before, totally a coincidence), but in GRUB rescue now I have to type out:

prefix=(hd3,msdos2)/boot/grub
root=(hd3,msdos2)

and everything boots as good as ever.

I also don't see anything wrong with my grub.cfg (except for it looking like a total mess, but that's because I have no idea what I'm doing):

insmod part_gpt
insmod part_msdos

load_env

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

set menu_color_normal=light-blue/black
set menu_color_highlight=light-cyan/blue

load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
set gfxmode=1920x1080
set gfxpayload=keep

terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=3
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=3
fi

menuentry "Arch Linux" --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-32521b82-8a0d-4664-bcdd-8a77c2760198' {
        insmod gzio
        insmod part_msdos 
        insmod ext2
        echo    'Loading Linux linux ...'
        linux   /boot/vmlinuz-linux cryptdevice=/dev/disk/by-uuid/32521b82-8a0d-4664-bcdd-8a77c2760198:bussd:allow-discards root=/dev/mapper/bussd-bussd rw resume=/dev/mapper/bussd-bussd resume_offset=26701824
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initramfs-linux.img
}

if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi

EDIT:
Well, I just ran this command:

grub-install --target=i386-pc --boot-directory=/run/boot/boot --recheck --force /dev/sdb2    ### the boot partition was sdb2 at that moment, not sda2. can they stop changing letters please?

and everything is fine now, without "grub rescue" or anything.

Thanks to Head_on_a_Stick and teateawhy for putting up with my lack of knowledge.
The best solution is usually the easiest one -- get an SSD, it will solve absolutely all your problems.

Solved.

Last edited by bus (2015-04-15 09:31:31)

Offline

Board footer

Powered by FluxBB