boot-repair

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
hagensieker
Level 1
Level 1
Posts: 46
Joined: Mon Jan 13, 2014 12:04 pm

boot-repair

Postby hagensieker » Sat Oct 17, 2015 9:42 pm

I haven't poked around in this forum much but yesterday I took a 750 GB drive in a laptop and replaced it with a 250 GB SSD. I used Clonezilla to clone the disk then realized no way it would fit. Then I shrunk and cloned the linuxmint partition and proudly installed it, then realized there was no boot drive. D'oh!

Found boot-repair and lo and behold it made my partition and laptop bootable. Booted to a LinuxMint install USB drive and ran these commands in terminal.

Code: Select all

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair

User avatar
phd21
Level 13
Level 13
Posts: 4683
Joined: Fri Jan 10, 2014 2:42 am
Location: Florida

Re: boot-repair

Postby phd21 » Sun Oct 18, 2015 4:26 am

Hi hagensieker,

Well done, and good for you.

This program "boot-repair" is also called "boot-repair-disk" and is a great utility program to have on a bootable CD or USB flash drive.

For boot-up problems: You could try the great "boot-repair-cd" program, and or the great "super grub2 rescue disk". You have to download the ".iso files and burn a CD or DVD or USB flash drive, then reboot to either one and run it. You can also boot up to your live DVD of Linux Mint and repair it that way, from console terminal prompt, type in: sudo update-grub

boot-repair-cd (disk) - easiest boot repair program
http://sourceforge.net/projects/boot-repair-cd/files/

Super Grub2 and Rescatux programs - Super Grub2 allows you to boot into your system even with a corrupt Grub or MBR boot issue(s), usually.
http://www.supergrubdisk.org/

gParted Live - great bootable disk partitioning program
http://gparted.org/download.php
Phd21: Mint KDE 17.3 & 18.1, 64-bit Awesome OS, Ancient Dell OptiPlex 780 Core2Duo E8400 3GHz,3gb Ram,160gb hdd, Video: Intel 4 Graphics, DVD Lightscribe. Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

hagensieker
Level 1
Level 1
Posts: 46
Joined: Mon Jan 13, 2014 12:04 pm

Re: boot-repair

Postby hagensieker » Sun Oct 18, 2015 9:09 am

Thank you! That ought to be a sticky here.
Last edited by Pierre on Sun Oct 18, 2015 11:12 am, edited 1 time in total.
Reason: Sticky

Lisa_P
Level 1
Level 1
Posts: 8
Joined: Tue Dec 22, 2015 12:51 pm

Re: boot-repair

Postby Lisa_P » Tue Dec 22, 2015 1:03 pm

I faced a similar problem with my dual-boot system after Windows 10 upgraded itself to version 1511 (build 10586). Apparently it changes something in the EFI partition and I was unable to boot into my Mint 17.3 (Cinnamon). The ubuntu entries simply booted windows (I'm not proficient enough with EFI to edit it manually and in my opinion we shouldn't need to).

I tried booting from the live USB, which worked, but "sudo update-grub" didn't.

What worked for me was the following (found here: https://superuser.com/questions/376470/ ... -grub2-efi )

Make sure that Secure Boot is disabled in your BIOS. Insert the live CD and boot it via UEFI. The CD's GRUB menu will show. the Press "c" to get to the command line.

Code: Select all

configfile (hd#,gpt$)/EFI/ubuntu/grub.cfg

Where # is the drive your EFI partition lives on and $ is the actual partition number.

If it returns to the grub command-line you didn't enter the correct drive/partition. Mine was shifted up by 1 (instead of hd0 it was hd1). Keep trying until you see your "old" boot menu. Then complete as follows:

After your system has booted from the hard disk, it should be enough to re-install grub on the EFI system partition and to register it with the firmware via grub-install.


Code: Select all

sudo grub-install


I did a

Code: Select all

sudo update-grub
afterwards for good measure, while the install might have been enough I didn't want to take any chances.

cobalt_ethon
Level 1
Level 1
Posts: 12
Joined: Thu Dec 24, 2015 10:20 am

Re: boot-repair

Postby cobalt_ethon » Sun Dec 27, 2015 2:52 pm

yeah but you were able to boot into a live cd.

I don't have a linux install on my pc right now.
I can't boot from a live cd, or usb.
I get stuck on a black screen after trying to launch from my bootloader.
I tried linux mint 17.3 which didn't work.
I tried linux mint 17.2 which used to work before I had a hardware upgrade and changed my bios to AHCI mode.
I used multiple images from different sources in case they became corrupt.

Thank you for your help, but it's a different problem.
Still appreceate the kindness of people.

Seff
Level 3
Level 3
Posts: 183
Joined: Mon Aug 31, 2015 10:40 pm

Re: boot-repair

Postby Seff » Thu Jan 14, 2016 8:28 pm

Now I'm confused... Here's where I was told to install boot-repair: http://www.linuxquestions.org/questions/linux-newbie-8/two-boot-partitions-bad-idea-4175563141/ Are the commands suggested simply wrong or outdated?
Mint "Rafaela" Cinnamon x64
Satellite L755D

Tuxkid
Level 1
Level 1
Posts: 22
Joined: Mon Nov 02, 2015 2:53 am

Re: boot-repair

Postby Tuxkid » Fri Jan 15, 2016 11:09 pm

phd21 wrote:boot-repair-cd (disk) - easiest boot repair program
http://sourceforge.net/projects/boot-repair-cd/files/

Super Grub2 and Rescatux programs - Super Grub2 allows you to boot into your system even with a corrupt Grub or MBR boot issue(s), usually.
http://www.supergrubdisk.org/

gParted Live - great bootable disk partitioning program
http://gparted.org/download.php

This is the closest I've seen to what I'm trying to figure out. How do I use that idea to deal with this?

This is part of my inxi output:

System: Host: XXX Kernel: 3.16.0-38-generic x86_64 (64 bit, gcc: 4.8.2)
Desktop: KDE 4.14.2 (Qt 4.8.6) Distro: Linux Mint 17.2 Rafaela

Machine: Mobo: ASUSTeK model: M5A97 version: Rev 1.xx Bios: American Megatrends version: 0705 date: 08/22/2011

CPU: Hexa core AMD FX-6100 Six-Core (-MCP-) cache: 12288 KB flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 sse4a
+ssse3 svm) bmips: 39732.2
Clock Speeds: 1: 1400.00 MHz 2: 3300.00 MHz 3: 1400.00 MHz 4: 3300.00 MHz 5: 1400.00 MHz 6: 3000.00 MHz

Network: Card-1: 3Com 3c905B 100BaseTX [Cyclone] driver: 3c59x port: c000 bus-ID: 04:05.0
IF: eth1 state: up speed: 100 Mbps duplex: full mac: <filter>
Card-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
driver: r8169 ver: 2.3LK-NAPI port: d000 bus-ID: 02:00.0
IF: eth0 state: down mac: <filter>

Drives: HDD Total Size: 1160.2GB (6.1% used) 1: id: /dev/sda model: SAMSUNG_HD161HJ size: 160.0GB
2: id: /dev/sdb model: ST1000DM003 size: 1000.2GB

Partition: ID: / size: 909G used: 67G (8%) fs: ext4 ID: /boot size: 236M used: 48M (22%) fs: ext2
ID: swap-1 size: 8.53GB used: 1.32GB (15%) fs: swap

I don't quite follow how it happened, but if I attempt to disconnect
Drive 1 in order to use Drive 2 alone, I get a message about no boot
sector and thus there's no opportunity to select from a grub menu. In
order to use the distro on /dev/sdb I need to have both drives
connected and interrupt the boot process when the splash-screen
appears. That seems to indicate that the boot sector on the 160 Gb
disk is being read.

There's a fair bit of information about temperatures and voltages but
there are precious few options available. The only options relate to
which disk to use. Puzzling to me is the fact that the Disk 2 is the
default but if I select that, I just get a blinking cursor and nothing
else happens. I can select the 160Gb (Samsung) disk which then comes
up with the sort of grub menu that is familiar.

From that menu, the default is the installation on /dev/sdb which then
works fine. That indicates that most of the grub configuration is OK
but not in quite the right place. What I need is to make that come up at the
beginning by default so I can remove the 160Gb disk.

I assume I need to edit /etc/default/grub somehow, the beginning of
which says:

Code: Select all

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

That info file is voluminous and I don't know what to look for. In
the days of lilo it was simple and grub (in the days of hdx before
sdx) was fairly easy to follow in the beginning too, but it's
progressed beyond my comprehension in recent years.

Do I need to understand this stuff? My main confusion is how to deal with the fact that
/dev/sdb will become /dev/sda when I remove the 160Gb disk, so the updated
configuration will be addressing a non-existent disk.

How do I avoid that?

User avatar
austin.texas
Level 20
Level 20
Posts: 11622
Joined: Tue Nov 17, 2009 8:57 pm
Location: at /home

Re: boot-repair

Postby austin.texas » Sat Jan 16, 2016 12:27 am

Tuxkid wrote:From that menu, the default is the installation on /dev/sdb which then
works fine. That indicates that most of the grub configuration is OK
but not in quite the right place. What I need is to make that come up at the
beginning by default so I can remove the 160Gb disk.

So you have Grub installed on /dev/sda, and you need it on /dev/sdb - boot into the Mint on /dev/sdb and run the command:

Code: Select all

sudo grub-install /dev/sdb
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2017

Tuxkid
Level 1
Level 1
Posts: 22
Joined: Mon Nov 02, 2015 2:53 am

Re: boot-repair

Postby Tuxkid » Sat Jan 16, 2016 6:32 am

austin.texas wrote:
Tuxkid wrote:From that menu, the default is the installation on /dev/sdb which then
works fine. That indicates that most of the grub configuration is OK
but not in quite the right place. What I need is to make that come up at the
beginning by default so I can remove the 160Gb disk.

So you have Grub installed on /dev/sda, and you need it on /dev/sdb - boot into the Mint on /dev/sdb and run the command:

Code: Select all

sudo grub-install /dev/sdb

That seems likely to allow me to use /dev/sdb by default, but how will it deal with
the fact that /dev/sdb will become /dev/sda once the Samsung disk is disconnected?

There's something important I haven't yet grasped. If I look in /boot/grub/grub.cfg
I don't see any mention of /dev/sdb, so how does grub know to boot that device?
For instance:

Code: Select all

 #df -h
Filesystem                 Size  Used Avail Use% Mounted on
udev                       3.9G   12K  3.9G   1% /dev
tmpfs                      794M  1.6M  792M   1% /run
/dev/mapper/mint--vg-root  909G  167G  697G  20% /
none                       4.0K     0  4.0K   0% /sys/fs/cgroup
none                       5.0M  4.0K  5.0M   1% /run/lock
none                       3.9G  1.6M  3.9G   1% /run/shm
none                       100M   24K  100M   1% /run/user
/dev/sdb1                  236M   48M  176M  22% /boot

Does /boot/grub/grub.cfg have nothing to do with the MBR?

User avatar
austin.texas
Level 20
Level 20
Posts: 11622
Joined: Tue Nov 17, 2009 8:57 pm
Location: at /home

Re: boot-repair

Postby austin.texas » Sat Jan 16, 2016 7:19 am

Tuxkid wrote:There's something important I haven't yet grasped. If I look in /boot/grub/grub.cfg
I don't see any mention of /dev/sdb, so how does grub know to boot that device?

grub.cfg references the partition to boot with UUID numbers, not device designations (/dev/sda). The UUID number stays the same no matter if the drive is sda or sdb.

EXAMPLE:
I run the command: "inxi -pou"

Code: Select all

dan@skynet1 ~ $ inxi  -pou
Partition: ID-1: / size: 31G used: 22G (74%) fs: ext4 dev: /dev/sda2 uuid: a2cd308e-2307-4bb4-8382-b54b792b8a79
           ID-2: /home/dan/sdb2_data size: 411G used: 192G (50%) fs: ext4 dev: /dev/sdb2
           uuid: a299e544-0371-4856-912b-70458aa37ee1
           ID-3: swap-1 size: 9.25GB used: 0.00GB (0%) fs: swap dev: /dev/sdb3
           uuid: 037e00a5-7ef7-42cd-9353-aa2bda20f592
Unmounted: ID-1: /dev/sda1 size: 33.55G label: sda1_Netrunner15 uuid: 12114c9c-c48e-4ead-9408-c782664a5a09
           ID-2: /dev/sda3 size: 33.55G label: sda3_korora23 uuid: 3cb150db-dbe0-464b-adc0-a84964e23a41
           ID-3: /dev/sda4 size: 899.54G label: sda4_LM17.3Mate uuid: b1bde976-50e2-4c32-a760-17b091b4202f
           ID-4: /dev/sdb1 size: 19.92G label: sdb1_LM17KDE uuid: c0fc2b1f-398f-49ec-99e2-dd21e12eaeac
           ID-5: /dev/sdb4 size: 22.21G label: sdb4_LM17xfce uuid: 4664636d-e916-4dc2-a3a7-f66e06abd3d1

That tells me that my root partition ( / ) is /dev/sda2, and the UUID is a2cd308e-2307-4bb4-8382-b54b792b8a79
If I look in /boot/grub/grub.cfg I will see that grub will look for that number to boot the OS.
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2017

Tuxkid
Level 1
Level 1
Posts: 22
Joined: Mon Nov 02, 2015 2:53 am

Re: boot-repair

Postby Tuxkid » Sat Jan 16, 2016 10:40 am

austin.texas wrote:
Tuxkid wrote:There's something important I haven't yet grasped. If I look in /boot/grub/grub.cfg
I don't see any mention of /dev/sdb, so how does grub know to boot that device?

grub.cfg references the partition to boot with UUID numbers, not device designations (/dev/sda). The UUID number stays the same no matter if the drive is sda or sdb.

Thanks so much for that. I feel less ignorant already. :)

myface64
Level 3
Level 3
Posts: 161
Joined: Wed Jan 06, 2016 1:49 pm

Re: boot-repair

Postby myface64 » Sat Jan 16, 2016 1:23 pm

I was messing with gru customizer and made my laptop unbootable. If not for boot resque disk, I will have to reinstall the Mint.

User avatar
austin.texas
Level 20
Level 20
Posts: 11622
Joined: Tue Nov 17, 2009 8:57 pm
Location: at /home

Re: boot-repair

Postby austin.texas » Sat Jan 16, 2016 1:24 pm

Actually, there is more to it. In addition to referencing the UUID number, Grub also uses the (hd0,msdos2) code to record partitions.
(hd0,msdos2) is sda2
(hd1,msdos2) is sdb2
But in at least one specific example I have encountered, those references don't seem to be the deciding factor.
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2017

srs5694
Level 6
Level 6
Posts: 1389
Joined: Mon Feb 27, 2012 6:42 pm

Re: boot-repair

Postby srs5694 » Sat Jan 16, 2016 6:03 pm

Tuxkid wrote:I don't quite follow how it happened, but if I attempt to disconnect
Drive 1 in order to use Drive 2 alone, I get a message about no boot
sector and thus there's no opportunity to select from a grub menu. In
order to use the distro on /dev/sdb I need to have both drives
connected and interrupt the boot process when the splash-screen
appears. That seems to indicate that the boot sector on the 160 Gb
disk is being read.


That conclusion sounds correct.

Puzzling to me is the fact that the Disk 2 is the
default but if I select that, I just get a blinking cursor and nothing
else happens. I can select the 160Gb (Samsung) disk which then comes
up with the sort of grub menu that is familiar.


Your firmware may be checking the boot sector, seeing that it contains no boot code, and then dropping back to the next boot option. That's just speculation on my part, though.

I assume I need to edit /etc/default/grub somehow, the beginning of
which says:

Code: Select all

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

That info file is voluminous and I don't know what to look for.


Unfortunately, GRUB 2 configuration has become a monstrous swamp. I'm not a fan of it; it's overly-complex.

In the days of lilo it was simple and grub (in the days of hdx before sdx) was fairly easy to follow in the beginning too, but it's progressed beyond my comprehension in recent years.


You can still use LILO if you like, although it's reaching end-of-life. The official LILO Web site[/quote] includes a notice saying it will no longer be developed after December of 2015. Of course, somebody could pick it up, but AFAIK nobody has done so. A better choice for a simple BIOS-mode boot loader is probably SYSLINUX, which AFAIK is still under development. Action has shifted to the EFI world, though, and there are several good EFI alternatives; see [url=http://www.rodsbooks.com/efi-bootloaders/]my Web page on the subject for details. In fact, I maintain one of them, the rEFInd boot manager.

Do I need to understand this stuff?


If you expect to maintain a complex multi-boot environment, yes. The automated tools that maintain GRUB 2 can do a good job up to a point, but beyond that point you really have to understand it. One of my objections to GRUB 2 is that it adds a lot of complexity to help the automated tools do their job, but this complexity becomes a burden once the automated tools fail. This becomes a positive feedback loop, encouraging ever-greater complexity to deal with more and more corner cases where the earlier rules fell down.

My main confusion is how to deal with the fact that
/dev/sdb will become /dev/sda when I remove the 160Gb disk, so the updated
configuration will be addressing a non-existent disk.

How do I avoid that?


GRUB 2 attempts to avoid it by using filesystem UUID numbers to help GRUB identify disks and partitions. This doesn't always work, though.

You may want to run the Boot Info Script on your system. This will produce a file called RESULTS.txt that summarizes a lot of boot-related information. A lot of it will seem like gibberish initially, but if you read through it two or three times, and do a Web search on parts you don't understand, you'll probably figure out the most important parts.

Incidentally, you're inserting line feeds unnecessarily in your text. This causes it to wrap at sub-optimal locations on many displays. It's better to enter line feeds only to separate paragraphs (or where they occur in code listings, which should be formatted with code tags).

User avatar
rijnsma
Level 4
Level 4
Posts: 306
Joined: Wed May 06, 2009 12:28 pm
Location: NL

Re: boot-repair

Postby rijnsma » Wed Mar 23, 2016 12:26 am

Other 'boot-problem' with Mint 17:

New computer.
I made a live-usb with systemback, which is a great program, and installed on the new pc on a partition.
All fine, but.. Mint 17 halts booting after the Btrfs-test (I did nosplash).

It is NOT Systemback. For instance PCLinuxOS is doing super. It addapts to the new machine with new configuration.
By the way also an Asus-board.
I can't change it and I don't know what means what Mint 17 says: resume: libgcrypt 1.5.3

Has anybody an idea please? It is nothing serious, but I'm really curious. :wink:

beeshyams
Level 1
Level 1
Posts: 4
Joined: Sat Mar 19, 2016 5:05 pm

Re: boot-repair

Postby beeshyams » Wed Mar 23, 2016 3:34 pm

Apologies for posting as a reply whereas, it is more of a question but being closely linked doing this

Absolute noob and a pro active question
Am dual booted with WIN XP and Mint 17.3 (Love the latter and hate myself for not trying earlier)
I still need WIN XP being a common laptop
If i have a boot problem- what is the best way to recover to current working status - since i see multiple replies above and some of them seem to be conflicting

Thanks in advance

AllanPen
Level 1
Level 1
Posts: 38
Joined: Sat Nov 02, 2013 1:33 am
Location: Nanoose Bay, B.C., Canada

Re: boot-repair

Postby AllanPen » Sun Jun 05, 2016 1:08 am

I can't recall where I got this, but the following was dead simple even for me. This is assuming Mint is installed and Grub2 has been messed up or over written by Windows:
1. Boot live Linux (Mint) and run "Gparted". When it loads you should see all the partitons that are on the hard drive. Linux Mint partitions will probaly be EXT4 and the windows partitions will probaly be NTFS.

2. "sudo mount /dev/sda? /mnt"

3. "sudo grub-install --root-directory=/mnt/ /dev/sda" (no number)

Close and reboot

There was one thing that confused me and I thought it hadn't worked. I got an error message after the Grub install that I can't remember the wording; something to do with "can't locate COW". Bottom line though; it worked.

Rebel Dog
Level 2
Level 2
Posts: 60
Joined: Sat Apr 02, 2016 3:05 pm

Re: boot-repair

Postby Rebel Dog » Sat Jun 11, 2016 3:29 pm

hagensieker,,,,,GOOD JOB

I had a Hard Drive going bad, moody, so I used Clonezilla and copied it just the way you did onto a brand new Hard Drive. It has Ubuntu 14.04LTS with Windows 7 in a VM BOX.
My main drive is Running,,,,,,,,,Linux Mint Rosa ,,,,,,nice
Exiled, I have no country

rdcuff
Level 1
Level 1
Posts: 3
Joined: Wed Jun 29, 2016 9:22 pm

Re: boot-repair

Postby rdcuff » Wed Jun 29, 2016 11:35 pm

AllanPen wrote:
2. "sudo mount /dev/sda? /mnt"



Should the "?" be replaced with the number corresponding to the Mint root partition? E.g. /sda6 in my instance?

Thanks--Richard

myface64
Level 3
Level 3
Posts: 161
Joined: Wed Jan 06, 2016 1:49 pm

Re: boot-repair

Postby myface64 » Tue Jul 12, 2016 3:01 pm

I mess-up really bad. Installed Linux distro on another partition to see how it works in real time. After a while, I deleted the partition and my grub quit on me. Got the "grub rescue" prompt. I had no idea what command I had to use, so I put boot rescue disk in. From there, I boot Mint and use the grub customizer to restore the grub. Not a first time, and probably, not a last time. All working fine now. Some people said that "you learn from your own mistake" - I guess, that I am not that person, because I did that before. I could blame this on my age.


Return to “Installation & Boot”

Who is online

Users browsing this forum: No registered users and 5 guests