Happy time with recent GRUB2 update with Ubuntu 12.04 LTS

My short story of dealing with failed grub2 install which rendered my server unbootable.

It was all good till recent update of grub2. Apparently it no longer fits into MBR and I missed related warnings. Or may be I had grub-legacy. I do not know honestly, but in result I had un-bootable remote server.

Using rescue mode (which is like Live-CD, but instead of GUI gives you SSH access so you could restore your server) I was able to get into server and try to update grub. Here is what I got for grub-install /dev/sda:

# grub-install /dev/sda
/usr/sbin/grub-setup: warn: This msdos-style partition label has no post-MBR gap; embedding won't be possible!.
/usr/sbin/grub-setup: warn: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub-setup: error: will not proceed with blocklists.

Basically, it is saying that it needs to put its installer somewhere and can’t find place for it. For grub2 there is relatively small part of code which get executed after code in MBR finish. This code run different modules to detect file systems, software raids, etc. It is small, few kilobytes. There are two places where it can be placed on MBR partitioned disk – either right before first partition (called embedding) or placing all code in the regular files system and store specific physical position of these files on the disk in the MBR (called blocklists.) Blocklists approach is not reliable due to the fact that files might move and if physical location in MBR will not update – grub code will never get a chance to start.

After I figured out all of the above (which took a while – I have problem like this for the first time, so if I explained something wrong – please let me know,) I decided to find a place before first partition to use embedding option. I’ve found there is about 700Kb of free space between 1st and 2nd partition:

Number  Start   End     Size    Type     File system     Flags
        0.00B   511B    512B             Free Space
 1      512B    512MB   512MB   primary  ext2            raid
        512MB   513MB   753kB            Free Space
 2      513MB   2560MB  2047MB  primary  linux-swap(v1)
 3      2560MB  954GB   951GB   primary  ext4            raid
        954GB   1000GB  46.3GB           Free Space

Somehow my server was setup with first partition starting with sector 1 while usually first partition starts with sector 63 specifically for purposes to give enough space for all kind of pre-boot software. So in theory I can move 1st partition closer to 2nd and get these necessary few kilobytes to put grub2 code. Easiest for me was to mount /boot partition (that’s what first partition used for currently,) copy all files in a safe location, delete this partition and recreate it on a new place.

To do precise positioning on the disk, I switched to “sector” units in “parted”:

# parted
(parted) unit s
(parted) print free                                                      
Model: ATA WDC WD10EARS-003 (scsi)
Disk /dev/sda: 1953525168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number  Start        End          Size         Type     File system     Flags
        0s           0s           1s                    Free Space
 1      1s           1000000s     1000000s     primary  ext2            raid
        1000001s     1001471s     1471s                 Free Space
 2      1001472s     4999167s     3997696s     primary  linux-swap(v1)
 3      4999168s     1863024639s  1858025472s  primary  ext4            raid
        1863024640s  1953525167s  90500528s             Free Space

So now I remove old partition, create new one, format it with same file system, mount and copy all files over:

(parted) mkpart primary 1471s 1001471s
Warning: The resulting partition is not properly aligned for best
Ignore/Cancel? Ignore
(parted) set 1 raid on                                                   
(parted) quit                                                            
# mke2fs /dev/sda1

At this point I have empty ext2 partition at /dev/sda1 which starts at sector 1471. Now copy all files back over to new boot partition and run grub-install to finally get no errors!

# mount /dev/md1 /mnt
# mount /dev/md0 /mnt/boot
# mount --bind /proc /mnt/proc
# mount --bind /dev /mnt/dev
# mount --bind /sys /mnt/sys
# grub-install --boot-directory=/mnt/boot /dev/sda

Reboot and after that it likely will boot :)



DWI trickets need all of the prodessional tricks most used in defense law. Defending a OVI is initiated with determining not any of one's constitutional rights were violated. Because law enforcement is in front of you, and they are essentially the single witness all of the time, their training and procedural conduct is of the substance. We all create mistakes, and law enforcement are no no exception to the rule. It begins when common suspicion that will lead to probable cause. An example, someone gets forced over for driving too slow at 4 AM. The police officer has reasonable suspicion that the driver committed a traffic offense, reckless driving. Now, when the cop begins to start eye contact or moves in closer to the vehicle, she may remark you posess watery eyes, or there is an smell of beer. This raises the acceptabel intuition of speeding to providing the police a fact that a person is operating while under the influence. eighty% of law enforcement will say odor of liquor, watery ojos, or mumbiling speech. The police will also say you are fumbling around getting your license and insurance handy. At this point the person driving will be likely told to get out from the ride and do universal physical sobriety checks. These are SFST’s are learned under NHTSA (National road Traffic Safety Administration) standardizations and must be assumed per instance. when you do perform the tests, the officer may make mistakes that will have the check, or tests excluded from evidence. Things such as physical impairments and optimal field conditions can be factored into results of your field sobriety test. (i.e. a person can not perform a hop on one leg and turn test on crooked sidwalk). A person will usually take a analkyzation of the breath test. There are defects in these devices as well, after all they are machines that need to be maintained and specialized training on every day. The arrest is captured at the time the law enforcement turns on their lights. Through this captured footage we are able to inform an learned opinion on the law enforcement administration of the checks, to the clients performance taking the tests. If you give an OK to the checks or not, someone will go to lock up. If you know someone that has been incarcerated for Driving under the inflence or any criminal charges or know some one who needs a criminal defense Attorney take a look at my info here <a href=https://www.bouchardcincinnaticriminalduiattorney.com/practice-areas/vio... color=#000_url>top dui attorney in Ohio</font></a> best regards

Hey there all. My wife and I are really glad we heard the posts. Ive been poking around for this info since last fall and I will be telling my bro to drop by. The other afternoon I was flipping through the web world trying to scope out an answer to my persistant questions. Now I am hoping to take it all the way in whatever avenues I can. We are getting all spaced out on the spiritual implications we are observing. Moreover, I just came back to thank you tremendously for such beneficial knowledge. This has forced me out of an old rut. Many novel creations are gaining momentum my world. Its really a fantastic forum to make new connections. I must make mention that I am investigating. when you get a chance, take a look my newly created business:<a href=https://drywallpatchguys.com/drywall-repair-services-water-restoration-i... damage renovation around GRAND TERRACE CA</a>

I'm elated that we were shown such a great site, it is unbelievably specific things my brother happen to be were hoping for sundays. The detailed information on the webpage is rare stuff - needed and is going to be a wealth of knowledge for my brother and I on Sundays. Appears like everyone on here learned tons of one of a kind and a lot of benefitial topics pertaining to this I am interested in and other pages and bases of knowledge definitely show it. I'm not typically on the net all of the time however when my friends get a chance i'm usually avidly searching for this sort of factual information or others closely concerning it. I have several of my cohorts that have also acquired an interest in this due to what I have learned about the subject and they're for sure going to be visiting the website because it's an one of a kind discovery. I am also learning more about in politics and dealing with the democratic line ups new changes in home remodeling techniques as well as searching for new hunting resources companies to satisfy making progress in my endeavors. <a href=https://www.stephburtcashoffers.com/we-buy-houses-in-conyers-georgia/><font color=#000_url>compare house values near atlanta GA and South Fulton Georgia 30213</font></a>

<a href="https://is.gd/BGijrp">жизни</a>

I'm totally excited having clicked on the blog, it's exactly the thing my friends from work and I have been searching for. The details here on the website is definitely helpful and will assist my family and friends quite often. It appears as if everyone has a significant amount of specifics concerning the stuff I am interested in and the other links and information definitely show it. I'm usually not on the web most of the time however when I have some time I am usually searching for this sort of factual information or stuff similarly related to it. I have a few of my family members that have acquired an interest in this because of what I have learned about it and they will for sure going to be visiting this blog since it is such an work changing discovery. I am also interested in government issues and coping with the constant changes in climate change. When someone gets a chance, check out at my site: <a href=https://www.aandwassociates.net/tampa/nonprofit-bookkeeping-services/><font color=#000_url>trust account ledger template at close quarters of Sarasota FL</font></a>

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
3 + 7 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.