<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:default="http://www.w3.org/1999/xhtml">
  <title xmlns="http://www.w3.org/2005/Atom">Dobrica Pavlinušić's random unstructured stuff: grub</title>
  <id xmlns="http://www.w3.org/2005/Atom">https://saturn.ffzg.hr/rot13/</id>
  <link xmlns="http://www.w3.org/2005/Atom" type="text/html" rel="alternate" href="https://saturn.ffzg.hr/rot13/index.cgi?grub"/>
  <link xmlns="http://www.w3.org/2005/Atom" type="application/atom+xml" rel="self" href="https://saturn.ffzg.hr%2C%20saturn.ffzg.hr:443/feed/workspace/rot13?page=grub;type=Atom"/>
  <updated xmlns="http://www.w3.org/2005/Atom">2007-04-03T16:17:43Z</updated>
  <entry xmlns="http://www.w3.org/2005/Atom" xmlns:default="http://www.w3.org/1999/xhtml">
    <title xmlns="http://www.w3.org/2005/Atom">grub</title>
    <link xmlns="http://www.w3.org/2005/Atom" type="text/html" rel="alternate" href="https://saturn.ffzg.hr/rot13/index.cgi?grub"/>
    <content xmlns="http://www.w3.org/2005/Atom" xmlns:default="http://www.w3.org/1999/xhtml" type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml"><div>Creator: Dobrica Pavlinušić</div><hr/><div>Tags: howto</div><hr/><div class="wiki">
<p>
Examples of grub usage (as a reminder mostly)</p>
<div class="nlw_phrase"><table class="wafl_container">
  <tr>
    <td>
      <div class="wafl_box">
        
          <div class="wafl_titlebox">
            <div class="wafl_title">
              
                Contents: [Dobrica Pavlinušić's random unstructured stuff]
              
            </div>
          </div>
          <div class="wafl_items">
            
              <div class="wiki">
<ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#install">Dobrica Pavlinušić's random unstructured stuff (install)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] install} --></span></li>

<ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#lvm_gotchas">Dobrica Pavlinušić's random unstructured stuff (LVM gotchas)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] LVM gotchas} --></span></li>
</ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#fallback">Dobrica Pavlinušić's random unstructured stuff (fallback)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] fallback} --></span></li>
</ul>
</div>

            
            
          </div>
        
      </div>
    </td>
  </tr>
</table>
<!-- wiki: {toc: }
--></div><br/><br/><h1 id="install">install</h1>
<p>
Sometimes, <tt>grub-install</tt> won't owerwrite MBR. If that happends, first reinstall MBR and then grub:</p>
<pre>
install-mbr /dev/sda
grub-install /dev/sda
</pre>
<br/><p>
If you forget to make <tt>/boot/grub/menu.lst</tt> (as I did), you will have to do a <strong>lot</strong> of typing in grub console, so be sure to also run</p>
<pre>
update-grub
</pre>
<br/><h2 id="lvm_gotchas">LVM gotchas</h2>
<p>
There is also corner-case when you have <tt>lvm</tt> compiled into kernel and <tt>/boot</tt> partition on LVM. grub will be confused, and simplest solution that I found so far is to move <tt>/boot</tt> to partition. If you don't have any free space handy, you might try to move swap to LVM and <tt>/boot</tt> onto swap partition.</p>
<h1 id="fallback">fallback</h1>
<p>
After you have installed grub, you might want to configure fallback kernels. First configure different kernels, with fail-safe one as last one:</p>
<p>
<tt>/boot/grub/menu.lst</tt></p>
<pre>
default         saved

fallback        1 2

title           OpenVZ 2.6.18-028test010
root            (hd0,2)
kernel          /vmlinuz-2.6.18-028test018 root=/dev/mapper/vg-root ro
initrd          /initrd.img-2.6.18-028test018
savedefault     fallback
boot

title           Debian GNU/Linux, kernel 2.6.18-028test007.2-ovz-enterprise
root            (hd0,2)
kernel          /vmlinuz-2.6.18-028test007.2-ovz-enterprise root=/dev/mapper/vg-root ro
initrd          /initrd.img-2.6.18-028test007.2-ovz-enterprise
savedefault     fallback
boot

title           Debian GNU/Linux, kernel 2.6.18-3-686
root            (hd0,2)
kernel          /vmlinuz-2.6.18-3-686 root=/dev/mapper/vg-root ro
initrd          /initrd.img-2.6.18-3-686
savedefault
boot
</pre>
<br/><p>
Here is simplier alternative:</p>
<pre>
default         0

fallback        1

title Debian GNU/Linux
root (hd0,0)
kernel /boot/vmlinuz root=/dev/md0 reboot=warm

title Debian GNU/Linux, with the old kernel
root (hd0,0)
kernel /boot/vmlinuz.old root=/dev/md0 reboot=warm
</pre>
<br/><p>
Then setup reset to default kernel (0) upon successful boot. On debian, you can just add following line in /etc/rc.local:</p>
<pre>
grub-set-default 0
</pre>
<br/><p>
You might also want to run this once by hand, so that first boot is in first kernel (most recent one presumably).</p>
</div>
</div>
    </content>
    <id xmlns="http://www.w3.org/2005/Atom">https://saturn.ffzg.hr/rot13/index.cgi?grub</id>
    <author xmlns="http://www.w3.org/2005/Atom">
      <name xmlns="http://www.w3.org/2005/Atom">Dobrica Pavlinušić</name>
    </author>
    <updated xmlns="http://www.w3.org/2005/Atom">2007-04-03T16:17:43Z</updated>
    <category xmlns="http://www.w3.org/2005/Atom" term="howto" label="howto"/>
  </entry>
</feed>
