{"id":706,"date":"2011-11-11T21:38:31","date_gmt":"2011-11-12T04:38:31","guid":{"rendered":"http:\/\/jaredrobinson.com\/blog\/?p=706"},"modified":"2011-11-11T21:38:31","modified_gmt":"2011-11-12T04:38:31","slug":"the-dog-ate-my-grub-conf-unwanted-lvm-indirection","status":"publish","type":"post","link":"https:\/\/jaredrobinson.com\/blog\/the-dog-ate-my-grub-conf-unwanted-lvm-indirection\/","title":{"rendered":"The dog ate my grub.conf; unwanted LVM indirection"},"content":{"rendered":"<p>In September, I updated packages on my Fedora 14 machine using &#8216;yum&#8217; (Yellowdog Updater Modified), and rebooted. I was greeted with an unfriendly grub prompt. Boot was broken, and I didn&#8217;t know why.<\/p>\n<p>Normally when I want to rescue a Linux system, I use the Fedora install DVD&#8217;s rescue mode. Unfortunately, my DVD drive stopped working just after the warranty expired. So I booted using a Linux-on-a-USB image that I carry around with me.<\/p>\n<p>I planned on replicating the rescue mode experience by manually mounting the partitions in \/mnt\/sysimage, then chroot, and then run &#8216;grub-install&#8217; to fix things. And that&#8217;s what I did, except for a few snags.<\/p>\n<p>The first snag is that I had installed Fedora with default partitioning options (something I rarely do), and it had helpfully used LVM to configure my disk drive. LVM adds a layer of indirection, so I had to figure out how to mount an LVM volume instead of a disk partition. As a general rule, I never use LVM on desktop or laptop machines because I don&#8217;t like the additional complexity, especially when I&#8217;m trying to mount a drive to recover data.<\/p>\n<p>The next snag is that Linux uses UUIDs for hard disks these days, instead of helpful, human-readable labels. In the good old days, Linux distributions would label the root partition, the home partition, and others. But not when I let the installer work its default magic. So, I had to figure out which volume contained my root partition, my boot partition, and so forth.<\/p>\n<p>Once I mounted my partitions properly, I was ready to &#8220;chroot \/mnt\/sysimage&#8221;, and after I did, I ran &#8220;grub-install&#8221;. No luck. This was the third snag.<\/p>\n<p>I realized that \/boot\/grub\/grub.conf was empty. And grub-install doesn&#8217;t fix the problem &#8212; it can&#8217;t populate information that is completely missing, like knowing what disk UUID to use for the root partition.<\/p>\n<p>&#8220;No problem,&#8221; I thought, &#8220;I&#8217;ll just restore from backup&#8230;&#8221;. Except, I didn&#8217;t have a backup. As a general rule, I back up \/var, \/home and \/etc, but not \/boot. Now I know better.<\/p>\n<p>Surely, I thought, there should be a copy of grub.conf that the package updates had left around. But there wasn&#8217;t.<\/p>\n<p>Such a critical file, and there was no automated backup. No &#8220;restore point&#8221;. No way to recreate it from data in \/etc. What an oversight!<\/p>\n<p>This is the first time I can remember having had an update eat my grub.conf file, and I&#8217;ve been running Linux since before distributions switched to grub as a boot loader. On the other hand, maybe I jumped to to an incorrect conclusion &#8212; it&#8217;s possible that the updates didn&#8217;t eat my grub.conf. Regardless, grub.conf was empty and my system wouldn&#8217;t boot.<\/p>\n<p>It seems to me that something this important should have been designed with more resilence.<\/p>\n<p>There were two ways to fix it, as far as I could see. One is upgrade from Fedora 14 to Fedora 14 (thus preserving my data). The second is to recreate grub.conf by hand, and for that, I needed an example &#8212; a template. I used the one at http:\/\/forums.fedoraforum.org\/showthread.php?t=227358. My boot up screen isn&#8217;t as pretty as it once was, but it is functional.<\/p>\n<p>Lastly, I made copy of \/boot\/grub\/grub.conf. Now where did I put it?&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In September, I updated packages on my Fedora 14 machine using &#8216;yum&#8217; (Yellowdog Updater Modified), and rebooted. I was greeted with an unfriendly grub prompt. Boot was broken, and I didn&#8217;t know why. Normally when I want to rescue a Linux system, I use the Fedora install DVD&#8217;s rescue mode. Unfortunately, my DVD drive stopped &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/jaredrobinson.com\/blog\/the-dog-ate-my-grub-conf-unwanted-lvm-indirection\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;The dog ate my grub.conf; unwanted LVM indirection&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,17],"tags":[],"class_list":["post-706","post","type-post","status-publish","format-standard","hentry","category-linux","category-tech"],"_links":{"self":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/706","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/comments?post=706"}],"version-history":[{"count":3,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/706\/revisions"}],"predecessor-version":[{"id":709,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/706\/revisions\/709"}],"wp:attachment":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/media?parent=706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/categories?post=706"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/tags?post=706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}