Inhaltsverzeichnis
Alter Kram
Alter Linux Kram, gesammelt über die Jahre, keinen sittlichen Nährwert, aber bevor ich es wegschmeiße …
Hello, on this page I just collect some linux (mandrake/ubuntu resp.
debian) or software et al related stuff, problems I got and solutions I found in wilde...
It's just a scratchbook for myself, if anyone else read it, on own
danger :-)<br>
<br>
In some cases, I just copied the web pages, but everytime with the link.<br>
If anybody is offended by this, just mail, and the content will be
removed.<br>
<br>
<pre>This page ist optimized for nothing, I'm pretty sure, it isn't compliant to any W3C standard :-)
<br>It's just hacked in with Mozilla Composer (initially), now with an ordinary texteditor with ftp support (pspad)
...Hey, I don't want a design award ...<br></pre>
<h2><br>
</h2>
Useful Firefox Extensions
<UL>
<LI>Must Haves
<UL>
<LI>mouse gestures
<LI>tab mix plus (includes session saver)
<LI>adblock (bzw. <a href="http://adblockplus.mozdev.org">adblock plus</a>)
<LI>adblock filterset.g updater
<LI>fasterfox
<LI>stumbelupon
</UL>
<LI>Might Haves
<UL>
<li>open link in
<LI>linkification
<LI>dictionary tooltip
<LI>plain text links
<LI>bug me not
<LI>dictionary search
<LI>gTranslate
</UL>
</UL>
Mandrake 10 Fallstricke
<p><br>
<br>
</p>
<p>NVIDIA Treiber:</p>
<p>Kernel Sourcen müssen installiert sein. Wenn das Setup nicht
funktioniert, dann</p>
<pre>sh NVIDIA-Linux-x86-1.0-5336-pkg1.run --add-this-kernel <br>Dadurch wird<br>NVIDIA-Linux-x86-1.0-5336-pkg1-custom.run <br>erzeugt, was dann laufen sollte...<br><br>In der XF86Config-4 dann:<br>Bei Module: <br> Load "glx" # 3D layer<br><br>Bei Device<br>nv ersetzen durch nvidia<br><br><br><br><br>KDE<br><br>Kslideshow: Setup funktioniert anfangs nicht, die Datei <br>$HOME/.kde/share/config/kslideshow.kssrc<br>muss folgendermassen angelegt werden:<br><br>[KFileDialog Settings]<br>Preview Size=60<br>Recent Files=/usr/share/backgrounds/images/<br>ShowPreviews=false<br>ViewMode=SmallColumns<br><br>[KFileDialog Speedbar]<br>Speedbar IconSize=32<br><br>[Settings]<br>Delay=60<br>Directory=$HOME/<br>PrintName=false<br>RandomPosition=false<br>ShowRandom=true<br>SubDirectory=true<br>ZoomImages=false</pre>
<p>Dann funktioniert das Setup.</p>
<p><br>
</p>
<p><br>
</p>
Ubuntu
<p>Zum Java Installieren: <br>
<br>
<br>
</p>
<p><a href="http://wiki.osuosl.org/display/DEV/Java+on+Debian">http://wiki.osuosl.org/display/DEV/Java+on+Debian</a><br>
</p>
<p><br>
</p>
<p>Evt. kein Sound in Spielen (Tuxracer etc...) :<span
style="font-family: monospace;"><br>
</span></p>
<pre><span style="font-family: monospace;"></span>sudo apt-get install libsdl1.2debian-all</pre>
<p>hat geholfen ...<br>
</p>
<p><br>
</p>
<p>Allgemeines:<br>
Mozilla, recht gute Sammlung guter Extension:<br>
http://www.silentblue.net/mtarchives/000576.html<br>
</p>
<p> Dictionary Search, Autoscroll, MultiZilla, OptiMoz<br>
</p>
<p>Noch ein paar Extensions: http://piro.sakura.ne.jp/xul/xul.html<br>
</p>
<p><br>
</p>
<h2>Ubuntu/Debian <br>
</h2>
Probleme mit qt3: evt. die links unter /usr/share/qt3 neu anlegen:<br>
ln -s /usr/lib/qt3/plugins plugins<br>
ln -s /usr/include/qt3 include<br>
<br>
<br>
Probleme mit apt-get/synaptic:<br>
wenn z.Bsp. so was kommt:<br>
<pre>Entpacke Ersatz für libwxgtk2.4-python ...<br>dpkg: Fehler beim Bearbeiten von /var/cache/apt/archives/libwxgtk2.4-python_2.4.2.6.1_i386.deb (--unpack):<br> versuche »/usr/bin/helpviewer« zu überschreiben, welches auch in Paket wxpython2.5.3 ist<br>Fehler traten auf beim Bearbeiten von:<br>/var/cache/apt/archives/libwxgtk2.4-python_2.4.2.6.1_i386.deb<br></pre>
<br>
dann hilft vielleicht<br>
<pre>dpkg -i var/cache/apt/archives/libwxgtk2.4-python_2.4.2.6.1_i386.deb</pre>
dann<br>
<br>
<pre>apt-get install -f<br><br>und dann evt.<br>apt-get upgrade<br></pre>
<br>
<br>
<br>
<p>Kernel Compile: <a
href="http://ubuntuforums.org/showthread.php?t=12823&page=1&pp=10">http://ubuntuforums.org/showthread.php?t=12823&page=1&pp=10</a><br>
</p>
<p>Auszug:<br>
</p>
<p>4. Unpack the sources (make sure to move/rename any previous
directories which conflict, like /usr/src/modules/nvidia-kernel and
/usr/src/linux-source-2.6.8.1)<br>
<br>
$ cd /usr/src<br>
$ tar jxvf linux-source-2.6.8.1.tar.bz2<br>
$ tar zxvf nvidia-kernel-source.tar.gz<br>
$ ln -s linux-source-2.6.8.1 linux<br>
<br>
5. If you want to use your current kernel's configuration (which you
probably do) you can copy it from /boot like this (if your current
kernel version is older, it will tell you about any new kernel
configuration options. You can choose the defaults by pressing enter):<br>
<br>
$ cd /usr/src/linux<br>
$ cp /boot/config-`uname -r` .config<br>
$ make oldconfig<br>
<br>
6. Configure the kernel to not include the Nvidia Riva framebuffer
driver (FB_RIVA under Device Drivers->Graphics Support->Support
for frame buffer devices), because it might conflict with the new
nvidia driver. You can also change any other kernel option you like,
then save the kernel configuration and exit. Note that this step is
recommended by Nvidia in their README file which accompanies their
kernel module source package, but in most cases the module will work
even without performing this step:<br>
<br>
$ cd /usr/src/linux<br>
$ make gconfig<br>
<br>
7. Compile the kernel and nvidia module (note you can replace "custom1"
with any string to append to the version. This guarantees that your new
kernel version is unique, so there are no conflicts with existing
kernels):<br>
<br>
$ cd /usr/src/linux<br>
$ make-kpkg clean<br>
$ fakeroot make-kpkg --initrd --append-to-version custom1 kernel_image
modules_image<br>
<br>
8. Install the new kernel-image and nvidia-kernel packages<br>
<br>
$ cd /usr/src<br>
$ sudo dpkg -i kernel-image-2.6.8.1custom1*.deb<br>
$ sudo dpkg -i nvidia-kernel-2.6.8.1custom1*.deb<br>
</p>
<p><br>
</p>
<hr style="width: 100%; height: 2px;">
<p><br>
</p>
<p><br>
</p>
<h2>weiterer Ubuntu Kram</h2>
<p>http://www.ubuntuforums.org/showthread.php?t=22646<br>
</p>
<div><b>THIS IS FOR HOARY HEDGEHOG 5.04 USERS ONLY!</b><br>
<br>
This is the first release of this script it may contain bugs. If it
blows up your system sorry <img src="icon_smile.gif" alt=""
title="Smile" class="inlineimg" border="0"> you have been warned. <br>
<br>
I have tested it 5 or 6 times and nothing has gone wrong on fresh
installations. However it should work just fine if you have been
running hoary and want to setup these things.<br>
<br>
3/28/2005 - Initial Release<br>
<br>
<b>Purpose:</b> To automate installation of the following programs
because I am lazy and hate selecting to install them manually after I
format my computer (which is often) so this script saves me alot of
time and I hope it helps you too.<br>
<br>
<br>
<div style="margin: 5px 20px 20px;">
<pre class="alt2"
style="border: 1px inset ; margin: 0px; padding: 6px; width: 690px; height: 138px; overflow: auto;"><div
style="text-align: left;" dir="ltr"><br><b>build-essential </b>- Compilers needed to build programs<br><b>beep-media-player</b> - XMMS gtk2 clone. Compatible with XMMS plugins/skins<br><b>gstreamer0.8-mad</b> - Add MP3 support for Rhythmbox<br><b>w32codecs </b>- Windows codecs for playing various files<br><b>streamtuner </b>- Online music streamer from shoutcast and a few others<br><b>xine-ui</b> - The xine video player, user interface for playing dvd's and such<br><b>totem-xine </b>- Have totem use xine so you can actually use it to play videos etc.<br><b>msttcorefonts</b> - Windows True Type Fonts<br><b>acroread</b> - Latest version of Adobe Acrobat Reader<br><b>acroread-plugin</b> - Firefox Acobat Reader Plugin<br><b>libdvdcss2</b> - DVD Library<br><b>gnomebaker</b> - The best gnome/gtk2 cd/dvd/cdrw burning software<br><b>gftp</b> - Ftp Client<br><b>flashplayer-mozilla</b> - Flash plugin for firefox<br><b>Java JRE 1.5</b> - Latest version of Java<br><b>Custom Firefox Forms </b>- Make you firefox form widgets look decent<br><b>/etc/apt/sources.list </b>- Add in universe, multiverse and misc repositories<br><b>Misc Windows Fonts</b> - Misc fonts that are missing in the msttcorefonts package<br><br></div></pre>
</div>
Lets get on to the real fun.<br>
<br>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Code:</div>
<pre class="alt2"
style="border: 1px inset ; margin: 0px; padding: 6px; width: 640px; height: 98px; overflow: auto;"><div
style="text-align: left;" dir="ltr">Open a terminal session and enter:<br>wget http://download.ubuntuforums.org/ubuntusetup/ubuntusetup.sh<br>sudo sh ubuntusetup.sh<br><br>You will be asked to select "Yes" or "No" on various things you will want to select yes on them.</div></pre>
</div>
<br>
<br>
Thats it <img src="icon_smile.gif" alt="" title="Smile"
class="inlineimg" border="0"> If it completes you are all set.</div>
Regards, ubuntu-geek<br>
Support UbuntuForums: <a href="http://ubuntuforums.org/about.php"
target="_blank">Make a Donation</a><br>
<br>
<hr style="width: 100%; height: 2px;"><br>
<h1>Apt / dpkg Kram</h1>
<a
href="http://newbiedoc.sourceforge.net/tutorials/apt-get-intro/info.html.en"> http://newbiedoc.sourceforge.net/tutorials/apt-get-intro/info.html.en</a><br>
<br>
<div class="SECT1">
<h1 class="SECT1"><a name="INFO">3. Getting information about packages</a></h1>
<div class="SECT2">
<h2 class="SECT2"><a name="FINDING">3.1. Finding packages -- <span
class="emphasis"><i class="EMPHASIS">apt-cache search</i></span></a></h2>
<p><a name="FINDING"> Whether you're online or not--</a></p>
<p><a name="FINDING"> How do you find the package that's got the
feature you're looking for? First, do </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN"># apt-get update<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="FINDING"> so your package list is up-to-date, and then try
something like </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN"> <br>% apt-cache search tunnel<br>% apt-cache search 'php.*sql'<br>% apt-cache search apache.\*perl<br>% apt-cache search elvis\|vim<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="FINDING"> That is how you tell <b class="KEYCAP">apt</b> to
search the packages you've downloaded, using REGEX (regular expression,
a pattern-matching 'language') -- if your pattern uses any keystrokes
that mean something to your command shell (e.g. <b class="COMMAND">[|?*]</b>
) you'll need to quote them so that <b class="COMMAND">apt-cache</b>
will be able to see them, instead of having the shell expand the term
to a list of file names that mean something else entirely. </a></p>
<p><a name="FINDING"> <span class="QUOTE">" NOTE -- <b class="COMMAND">apt-cache</b>
only knows about the package descriptions you've already downloaded. To
search among ALL known Debian packages just browse to <b
class="COMMAND">http://packages.debian.org/PACKAGESUBSTRING</b> to see
what's available. For example: </span></a><a
href="http://packages.debian.org/vnc" target="_top">
http://packages.debian.org/vnc</a> That would get you a listing of
packages that contain the term "vnc" somewhere in the title." </p>
</div>
<div class="SECT2">
<h2 class="SECT2"><a name="DESCRIBING">3.2. Describing packages -- <span
class="emphasis"><i class="EMPHASIS">apt-cache show</i></span></a></h2>
<p><a name="DESCRIBING"> The simplest way to see the description of a
package: </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">% apt-cache show postgresql<br>% apt-cache show iproute<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="DESCRIBING"> That displays what the package is designed to do,
version info and so forth. (Pretty simple, huh? Not everything
worthwhile needs to be complicated...) </a></p>
</div>
<div class="SECT2">
<h2 class="SECT2"><a name="LISTING">3.3. Listing packages -- <span
class="emphasis"><i class="EMPHASIS">dpkg -l</i></span></a></h2>
<p><a name="LISTING"> Which packages are installed? Do any packages
need configuring? </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">% dpkg -l <br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="LISTING"> (that's a lower-case EL, not a one.) That lists all
INSTALLED packages. </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">% dpkg -l \*<br>% dpkg -l '*'<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="LISTING"> These list all packages. (Without the star glob, <b
class="COMMAND">dpkg </b> only lists installed packages.) </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">% dpkg -l \*postgres\*<br>% dpkg -l '*postgres*'<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="LISTING"> That shows the status of packages matching that GLOB
(it's not a regular expression &lsqb;REGEX&rsqb;: a regex
interprets <b class="KEYCAP">.*</b> to mean '"." = any character, "*"
= zero or more times'; a glob interprets <b class="KEYCAP">.*</b> to
mean '"." = a dot, "*" = followed by zero or more characters'). </a></p>
<p><a name="LISTING"> NOTE: If your pattern uses fancy characters that
have a special meaning to your command shell (<b class="KEYCAP">* ? |</b>
etc.) you'll need to QUOTE them so that your command shell doesn't
interpret them -- you want <b class="COMMAND">dpkg</b> to see the
pattern, instead. Quote such characters by either enclosing them in
quotes: </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">'*like|this?or that'<br>"even[this|is]acceptable"<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="LISTING"> or precede them with the BACKSLASH: </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">this\ acts\ like\ one\ word\ cuz\ spaces\ are\ quoted<br>\[one\|two\?three\*four\]<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="LISTING"> And note that the /SLASH/ (forward slash) leans
right, in the same direction as the text you're reading, whereas the
\BACKSLASH\ leans to the left. SLASH is used to delineate components
(folders and subfolders, if you like) along a directory path (<tt
class="FILENAME">/home/will/public_html/index.html</tt> for example);
BACKSLASH is used to alter the meaning of the keystroke that follows.
Very important distinction! (And curses to the weenie who first thought
QDOS -- which became MS-DOS -- should use backslashes as path
delimiters! Bad dog!) </a></p>
</div>
<div class="SECT2">
<h2 class="SECT2"><a name="GREP-SEARCH">3.4. Combine <span
class="emphasis"><i class="EMPHASIS">dpkg</i></span> with <span
class="emphasis"><i class="EMPHASIS">grep</i></span> for some powerful
searches</a></h2>
<p><a name="GREP-SEARCH"> </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">% dpkg -l \* | grep ^pi<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="GREP-SEARCH"> finds installed packages marked to be purged. </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">% dpkg -l '*' | grep "^i[^i]"<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="GREP-SEARCH"> lists packages marked for installation, that
aren't installed yet. </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">% dpkg -l \* | grep '^[^i]i'<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="GREP-SEARCH"> shows installed packages that are marked for
anything but installation (i.e.uninstallation or purgery). See <b
class="COMMAND">man grep </b> for more info on <b class="COMMAND">grep</b>
and <b class="COMMAND">man dpkg</b> for more on the listing format. </a></p>
<p><a name="GREP-SEARCH"> On my system, to find out which <b
class="KEYCAP">apt</b> packages I have installed, I can do this: </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">% dpkg -l \*apt\* <br>Desired=Unknown/Install/Remove/Purge/Hold<br>| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed<br>|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)<br>||/ Name Version Description<br>+++-=================-=================-=============================================================<br>ii <b
class="KEYCAP">apt</b> 0.3.19 Advanced front-end for dpkg<br>ii <b
class="KEYCAP">apt</b>-move 3.0-13 Move cache of Debian packages into a mirror hierarchy<br>ii <b
class="KEYCAP">apt</b>itude 0.0.4a-4.1 Console based apt frontend<br>un lib<b
class="KEYCAP">apt</b>-pkg-dev <none> (no description available)<br>un lib<b
class="KEYCAP">apt</b>-pkg-doc <none> (no description available)<br>un lib<b
class="KEYCAP">apt</b>-pkg2.7 <none> (no description available)<br>pn task-l<b
class="KEYCAP">apt</b>op <none> (no description available)<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="GREP-SEARCH"> </a></p>
<p><a name="GREP-SEARCH"> Here, <b class="COMMAND">dpkg</b> displays
its headers, and then shows all packages that have "apt" anywhere in
the title. The three <b class="KEYCAP">libapt-*</b> packages are not
installed (I've <b class="KEYCAP">hilighted</b> the "apt" strings that
belong to non-<b class="KEYCAP">apt</b> packages, so you can see why
they showed up. Interesting, no?) </a></p>
<p><a name="GREP-SEARCH"> For a slightly different approach, how about
this: </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">% dpkg -l \* | grep apt <br>ii <b
class="KEYCAP">apt</b> 0.3.19 Advanced front-end for dpkg<br>ii <b
class="KEYCAP">apt</b>-move 3.0-13 Move cache of Debian packages into a mirror hierarchy<br>ii <b
class="KEYCAP">apt</b>itude 0.0.4a-4.1 Console based <b
class="KEYCAP">apt</b> frontend<br>un lib<b class="KEYCAP">apt</b>-pkg-dev <none> (no description available)<br>un lib<b
class="KEYCAP">apt</b>-pkg-doc <none> (no description available)<br>un lib<b
class="KEYCAP">apt</b>-pkg2.7 <none> (no description available)<br>ii libpcap0 0.4a6-3 System interface for user-level packet c<b
class="KEYCAP">apt</b>ure.<br>pn task-l<b class="KEYCAP">apt</b>op <none> (no description available)<br>%<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="GREP-SEARCH"> Here I asked to see ALL packages (<b
class="COMMAND">dpkg -l \*</b>) and thenI used <b class="COMMAND">grep</b>
to display only those lines from the output that contained "apt". The
headers disappeared, since none of them contain "apt" -- so <b
class="COMMAND">grep</b> discards them. </a></p>
</div>
<div class="SECT2">
<h2 class="SECT2"><a name="CONTENTS">3.5. Package contents -- <span
class="emphasis"><i class="EMPHASIS">dpkg -L</i></span></a></h2>
<p><a name="CONTENTS"> </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">% dpkg -L mysql<br>% dpkg -L apt<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="CONTENTS"> (with an upper-case EL) shows all the files -- with
full path names -- that are provided by the package. </a></p>
</div>
<div class="SECT2">
<h2 class="SECT2"><a name="CONTAINS">3.6. Finding which package
contains... -- <span class="emphasis"><i class="EMPHASIS">dpkg -S</i></span></a></h2>
<p><a name="CONTAINS"> How can you determine here did file XYZ come
from? Here's how to find which package contains/supplies a certain
file: </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">% dpkg -S postmaster<br>% dpkg -S 'doc/*sql' | cut -f1 -d: | sort -u<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="CONTAINS"> That searches for packages that supply files whose
paths contain the requested GLOB. See <b class="COMMAND">man cut</b>
and <b class="COMMAND">man sort</b> for info on how to use these tools
in your day-to-day fiddling. </a></p>
<p><a name="CONTAINS"> If you're using <b class="KEYCAP">unstable</b>
then you might be able to tinker with <b class="COMMAND">dlocate</b>
as well. I hear it's highly thought-of by all who've used it. (If you
know about it and want to include some info here, please let me know!) </a></p>
<p><a name="CONTAINS"> By the way -- here's a quickie command to show
what packages I've got installed that provided all of the <b
class="COMMAND">apt-*</b> files you saw above when I tried <b
class="KEYCAP"><tt class="LITERAL">apt<^D></tt> </b>: </a>
<table bgcolor="#bbddff" border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<pre class="SCREEN">% dpkg -S apt- | sort <br>apt-move: /etc/apt-move.conf<br>apt-move: /etc/cron.weekly/apt-move<br>apt-move: /usr/bin/apt-move<br>apt-move: /usr/share/doc/apt-move<br>apt-move: /usr/share/doc/apt-move/README.Debian<br>apt-move: /usr/share/doc/apt-move/README.gz<br>apt-move: /usr/share/doc/apt-move/TODO<br>apt-move: /usr/share/doc/apt-move/TODO.Debian<br>apt-move: /usr/share/doc/apt-move/changelog.Debian.gz<br>apt-move: /usr/share/doc/apt-move/changelog.gz<br>apt-move: /usr/share/doc/apt-move/copyright<br>apt-move: /usr/share/doc/apt-move/examples<br>apt-move: /usr/share/doc/apt-move/examples/SAMPLE.exclude<br>apt-move: /usr/share/man/man8/apt-move.8.gz<br>apt: /usr/bin/apt-cache<br>apt: /usr/bin/apt-cdrom<br>apt: /usr/bin/apt-config<br>apt: /usr/bin/apt-get<br>apt: /usr/lib/libapt-pkg.so.2.7<br>apt: /usr/lib/libapt-pkg.so.2.7.1<br>apt: /usr/share/man/man8/apt-cache.8.gz<br>apt: /usr/share/man/man8/apt-cdrom.8.gz<br>apt: /usr/share/man/man8/apt-config.8.gz<br>apt: /usr/share/man/man8/apt-get.8.gz<br>base-config: /usr/sbin/apt-setup<br>base-config: /usr/share/debconf/templates/apt-setup.templates<br>base-config: /usr/share/man/man8/apt-setup.8.gz<br> </pre>
</td>
</tr>
</tbody>
</table>
<a name="CONTAINS"> That shows three of the apt packages I've got
installed: <b class="KEYCAP">apt, apt-move,</b> and <b class="KEYCAP">base-config.</b>
You'll notice that <b class="KEYCAP">aptitude</b> isn't listed --
which is understandable, since it doesn't contain the "apt DASH"
string. Also, <b class="KEYCAP">base-config</b> didn't show up above
when I searched via <b class="COMMAND">dpkg -l \* | grep apt</b> since
the string "apt" doesn't appear within <b class="KEYCAP">base-config</b>.
See? </a></p>
<p><a name="CONTAINS"> As is the case with many packages, most of the
files are documentation: either <tt class="FILENAME">/usr/share/doc/*</tt>
or manpages. </a></p>
<p><a name="CONTAINS"> NOTE that if I do <b class="COMMAND">dpkg -S apt</b>
without the dash after "apt-" i get more irrelevant stuff, because many
packages contain files that have the string "apt" in them, including: </a></p>
<ul>
<li>
<p><a name="CONTAINS"><tt class="FILENAME">/usr/bin/<b
class="KEYCAP">apt</b>itude</tt> it'll be a nice APT front-end when
it's done</a></p>
</li>
<li>
<p><a name="CONTAINS"><tt class="FILENAME">/usr/share/doc/gpm/README.synaptics.gz</tt></a></p>
</li>
<li>
<p><a name="CONTAINS"><tt class="FILENAME">/usr/share/doc/postgresql-doc/postgres/libpq-chapter18164.htm</tt></a></p>
</li>
<li>
<p><a name="CONTAINS"><tt class="FILENAME">/usr/share/texmf/tex/latex/caption</tt>
</a></p>
</li>
</ul>
<a name="CONTAINS"> ...so you must learn to be careful what you search
for... you'll find it! </a></div>
</div>
<hr align="left" width="100%">
<table summary="Footer navigation table" border="0" cellpadding="0"
cellspacing="0" width="100%">
<tbody>
<tr>
<td align="left" valign="top" width="33%"><a
href="http://newbiedoc.sourceforge.net/tutorials/apt-get-intro/apt-and-install.html.en"
accesskey="P">Prev</a></td>
<td align="center" valign="top" width="34%"><a
href="http://newbiedoc.sourceforge.net/tutorials/apt-get-intro/index-apt-get-intro.html.en"
accesskey="H">Home</a></td>
<td align="right" valign="top" width="33%"><a
href="http://newbiedoc.sourceforge.net/tutorials/apt-get-intro/more.html.en"
accesskey="N">Next</a></td>
</tr>
</tbody>
</table>
<br>
<br>
<hr align="left" width="100%">
<title>Grub From the Ground Up</title>
<H1>GRUB</H1>
zu finden unter http://www.troubleshooters.com/linux/grub/grub.htm
<center>
<h2><a href="../../troubleshooters.htm">Troubleshooters.Com</a>,
<a
href="../index.htm">T.C
Linux Library</a> and <a href="index.htm">Grub Grotto</a> Present</h2>
</center>
<center><font color="#cc0000"><font size="+4">Grub From the Ground Up</font></font>
<p><a href="../../cpyright.htm">Copyright (C) 2005 by Steve Litt</a>,
All
rights reserved. Material
provided as-is, use at your own risk.
</p>
<hr width="100%"></center>
<br>
<center>
<table border="1" cellspacing="0" cellpadding="5"
bgcolor="#f0ffe7">
<tbody>
<tr nosave="">
<td nosave=""><b><i><font size="-1"><p>Steve Litt is the author of
the
<big><a href="../../utp/tcourses.htm">Universal Troubleshooting Process
Courseware</a></big>,<br>
which can be presented either by Steve or by your
own trainers.</p>
<p>He is also the author of <a
href="../../bookstore/ttech.htm">Troubleshooting Techniques of the Successful
Technologist</a>,<br>
<a href="../../bookstore/rl.htm">Rapid Learning: Secret
Weapon of the Successful Technologist</a>, and <a
href="../../bookstore/su.htm">Samba Unleashed</a>.</p></font></i></b></td>
</tr>
</tbody>
</table>
</center>
<br>
<b><big><big><big><big>Contents<br>
</big></big></big></big></b>
<b>
<ul>
<li><b><a href="#_Disclaimer">Disclaimer</a></b></li>
<li><b><a href="#_Executive_Summary">Executive Summary<br>
</a></b></li>
<li><b><a href="#_Making_a_Simple_grub_Booter_Floppy">Making a Simple
grub Booter Floppy</a></b></li>
<li><b><a href="#_What_You_Absolutely_Need_to_Know">What You
Absolutely Need to Know</a></b></li>
<li><b><a href="#_Having_Grub_Do_Your_Research_For_You">Having Grub
Do Your Research For You</a></b></li>
<li><b><a href="#_Making_a_Full_grub_Boot_Floppy">Making a Full grub
Boot Floppy</a></b></li>
<li><b><a href="#_Installing_grub_From_Floppy">Installing grub From
Floppy</a></b></li>
<li><b><a href="#_Working_With_a_Fully_Installed_grub">Working With a
Fully Installed grub</a></b></li>
</ul>
</b>
<br>
<h1><a name="_Disclaimer"></a>Disclaimer</h1>
This document contains a series of exercises accessing, and in some
cases overwriting, your boot loader. There's a significant possibility
of overwriting your existing boot loader, which can lead to lost time
and even lost data. There may be other risks.<br>
<br>
You use this document at your own risk. I am not responsible
for any damage or injury caused by your use of this document, or caused
by errors and/or omissions in this document. If that's not acceptable
to
you, you may not use this document. By using this document you are
accepting this disclaimer.<br>
<h1><a name="_Executive_Summary"></a>Executive Summary<br>
</h1>
Grub is a world-class boot loader with insufficient documentation. In
many ways it blows the doors of LILO. For instance, it's MUCH easier to
use Knoppix to rebuild a grub boot loader than to rebuild a LILO boot
loader. However, until you're comfortable with grub, it might seem just
the opposite. All too often grub dumps you at a <span
style="font-family: monospace;">grub></span> prompt with no hint of
what you should do. You might have heard that a successful reboot is
just three commands away, but which commands? The state of grub's
documentation is such that you can't figure it out unless you already
know grub.<br>
<br>
That catch 22 is the very purpose of this document. This document will
to give you enough grub expertise that you can create a grub boot
floppy on a working machine with grub installed (not necessarily as the
bootloader, just installed), and use that floppy to bust back into a
Linux machine with a blown bootloader, and then use that floppy to
actually install grub as the bootloader.<br>
<br>
This document does not discuss using grub to boot or dual boot Windows,
mach, BSD, or other non-Linux operating systems. I might write on that
subject later. But in the meantime, once you're familiar with the
principles and practices of grub, given some study of existing
documentation you'll probably be able to use grub to boot non-Linux
operating systems.<br>
<h1><a name="_Making_a_Simple_grub_Booter_Floppy"></a>Making a Simple
grub Booter Floppy</h1>
Much of this document discusses what to do at the <span
style="font-family: monospace;">grub></span> prompt, so you need to
be able to get to it. The easiest way to get to the <span
style="font-family: monospace;">grub></span> prompt is through a
simple grub boot floppy, which can be created on <span
style="font-style: italic;">any</span> machine with grub installed,
whether or not that machine actually boots with grub. The following
bash session shows exactly how to make a simple grub boot floppy:<br>
<br>
<table style="text-align: left; background-color: rgb(255, 255, 204);"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<pre><big>[root@mydesk grub]#<span style="font-weight: bold;"> cd /boot/grub</span><br
style="font-weight: bold;"><span style="font-weight: bold;"></span>[root@mydesk grub]#<span
style="font-weight: bold;"> cat stage1 stage2 > /dev/fd0u1440</span><br
style="font-weight: bold;">[root@mydesk grub]#</big><br></pre>
</td>
</tr>
</tbody>
</table>
<br>
One word of caution. In 1990 you could buy 50 floppies and more than 45
of them would be good. Today you're fortunate if half the brand new
floppies you buy are good enough to reformat and use. 1990 floppy
drives cost close to $100.00, and worked quite well for a long time.
Today's floppy drives are 1/10 that price, and it seems they work only
1/10 as long. So create several
grub boot floppies, and if you get a read error during boot, use a
different floppy.<br>
<br>
Don't actually do it yet, but one way you could get to a <span
style="font-family: monospace;">grub></span> prompt would be to
reboot the machine while the grub boot floppy is inserted, if necessary
tweak the bios to boot off the floppy, and let the reboot proceed. But
first, there is some information you absolutely need to know...<br>
<h1><a name="_What_You_Absolutely_Need_to_Know"></a>What You Absolutely
Need to Know</h1>
In order to use grub to boot a computer, you need to know the following:<br>
<ol>
<li>The partition containing the kernel</li>
<li>Within that partition, the directory path and filename of the
kernel</li>
<li>The partition containing /sbin/init</li>
</ol>
In addition, you might need the partition, path and filename of the
initrd file, but usually this is not necessary with grub.<br>
<br>
<table
style="background-color: rgb(240, 240, 240); width: 60%; text-align: left; margin-left: auto; margin-right: auto;"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<div style="text-align: center;"><big style="font-weight: bold;"><big>NOTE</big></big><br>
</div>
<br>
I have seen cases in which a kernel would kernel panic without an <span
style="font-family: monospace;">initrd</span> statement, and would
boot with it. The interesting thing is, once I got it booting, I could
remove the <span style="font-family: monospace;">initrd<span
style="font-family: monospace;"></span></span> statement, rerun grub's
setup, and it would now boot without the <span
style="font-family: monospace;">initrd</span> statement. If you get
kernel panics and it isn't obvious why, don't hesitate to insert an <span
style="font-family: monospace;">initrd</span> statement.<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
Now let's take a look at an example. Imagine a system in which <span
style="font-family: monospace;">/dev/hda1</span> is mounted as <span
style="font-family: monospace;">/boot</span>, and <span
style="font-family: monospace;">/dev/hda9</span> is mounted as <span
style="font-family: monospace;">/</span>. Within <span
style="font-family: monospace;">/boot</span> the kernel filename is <span
style="font-family: monospace;">vmlinuz-i686-up-4GB</span>. Now let's
answer the four questions:<br>
<br>
<ol>
<li><span style="color: rgb(153, 0, 0);">The partition containing the
kernel = </span><span
style="font-family: monospace; color: rgb(153, 0, 0);">/dev/hda1</span><span
style="color: rgb(153, 0, 0);">, or </span><span
style="font-family: monospace; color: rgb(153, 0, 0);">(hd0,0)</span><span
style="color: rgb(153, 0, 0);"> in grub-speak</span><br>
</li>
<li><span style="color: rgb(0, 0, 153);">Within that partition, the
directory path and filename of the kernel = </span><span
style="font-family: monospace; color: rgb(0, 0, 153);">/vmlinuz-i686-up-4GB</span><br
style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">(Remember, </span><span
style="font-family: monospace; color: rgb(0, 0, 153);">/dev/hda1</span><span
style="color: rgb(0, 0, 153);"> is mounted directly to </span><span
style="font-family: monospace; color: rgb(0, 0, 153);">/boot</span><span
style="color: rgb(0, 0, 153);">, so it contains the kernel directly)</span><br>
</li>
<li><span style="color: rgb(0, 102, 0);">The partition containing
/sbin/init is </span><span
style="font-family: monospace; color: rgb(0, 102, 0);">/dev/hda9</span><br>
</li>
</ol>
In that case, here are the grub commands you would input to boot that
system:<br>
<br>
<pre><big style="font-weight: bold;">grub> <span
style="color: rgb(153, 0, 0);">root (hd0,0)</span><br>grub> <span
style="color: rgb(0, 0, 153);">kernel /vmlinuz-i686-up-4GB</span> <span
style="color: rgb(0, 102, 0);">root=/dev/hda9</span><br>grub> boot</big><br></pre>
The preceding is usually sufficient to boot a Linux box. The standalone
<span style="font-family: monospace;">root</span> statement tells the
partition containing the kernel. The <span
style="font-family: monospace;">kernel</span> statement describes the
path and filename, <span style="font-style: italic;">within the
partition containing the kernel</span> of the kernel. The argument to
the <span style="font-family: monospace;">root=<span
style="font-family: monospace;"> </span></span>argument to the <span
style="font-family: monospace;">kernel</span> statement tells the
partition containing <span style="font-family: monospace;">/sbin/init</span>,
which of course turns out to be the root partition in the booted
system. <br>
<br>
Be careful of these duelling <span style="font-family: monospace;">root</span>
keywords. The standalone one is the root as seen from grub, and
contains the kernel. The argument to the <span
style="font-family: monospace;">kernel</span> statement is the root as
seen from the fully booted system, and contains <span
style="font-family: monospace;">/sbin/init</span>.<br>
<br>
Be careful also of where you use grub partition notation and where you
use Linux partition notation. You use grub partition notation (<span
style="font-family: monospace;">(hd0,0)</span>) everywhere except the <span
style="font-family: monospace;">root=</span> argument to the <span
style="font-family: monospace;">kernel</span> statement. In the <span
style="font-family: monospace;">root=</span> argument you use the
Linux partition notation. Note that in Linux notation, the drive starts
with <span style="font-family: monospace;">a</span> for the first IDE
port master, then <span style="font-family: monospace;">b</span> for
the first IDE port slave, then <span style="font-family: monospace;">c</span>
for the second IDE port master, and <span
style="font-family: monospace;">d</span> for the second IDE port
slave, on and on throughout your IDE ports. In Linux notation, the
partition number within the drive starts with 1.<br>
<br>
In grub partition notation, the first accessible hard drive is <span
style="font-family: monospace;">(hd0)</span>, the next accessible hard
drive (even if it's on the 3rd, 4th or higher IDE port) is <span
style="font-family: monospace;">(hd1)</span>, and so forth. In grub
partition notation, the partition number is zero based. Thus:<br>
<br>
/dev/hda1 is the same partition as (hd0,0)<br>
<br>
Occasionally you'll need to specify an <span
style="font-family: monospace;">initrd</span>, although this is rare.
If so, after the kernel statement and of course before the <span
style="font-family: monospace;">boot</span> statement, insert the
following:<br>
<pre>initrd /initrd-i686-up-4GB.img<br></pre>
It's absolutely essential that if you do use an <span
style="font-family: monospace;">initrd</span> statement, that the <span
style="font-family: monospace;">initrd</span> file you reference must
match the kernel you referenced earlier.<br>
<br>
<table
style="background-color: rgb(240, 240, 240); width: 60%; text-align: left; margin-left: auto; margin-right: auto;"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<div style="text-align: center;"><big style="font-weight: bold;"><big>NOTE</big></big><br>
</div>
<br>
I have seen cases in which a kernel would kernel panic without an <span
style="font-family: monospace;">initrd</span> statement, and would
boot with it. The interesting thing is, once I got it booting, I could
remove the <span style="font-family: monospace;">initrd<span
style="font-family: monospace;"></span></span> statement, rerun grub's
setup, and it would now boot without the <span
style="font-family: monospace;">initrd</span> statement. If you get
kernel panics and it isn't obvious why, don't hesitate to insert an <span
style="font-family: monospace;">initrd</span> statement.<br>
</td>
</tr>
</tbody>
</table>
<br>
Another documented way to boot from grub is to put the grub-root in the
kernel statement itself instead of as a separate entity:<br>
<pre><big style="font-weight: bold;">grub> <span
style="color: rgb(153, 0, 0);"></span><span
style="color: rgb(0, 0, 153);">kernel </span></big><span
style="font-weight: bold;"><span style="color: rgb(0, 0, 153);"><big
style="font-weight: bold;"><span style="color: rgb(153, 0, 0);">(hd0,0)</span></big></span></span><big
style="font-weight: bold;"><span style="color: rgb(0, 0, 153);">/vmlinuz-i686-up-4GB</span> <span
style="color: rgb(0, 102, 0);">root=/dev/hda9</span><br>grub> boot</big><br></pre>
If you do that, you'll need to also specify the grub root (<span
style="font-family: monospace;">(hd0,0)</span>) on any <span
style="font-family: monospace;">initrd</span> statement.<br>
<h2>Booting Up Foreign Distros</h2>
Let's say you're a United States English speaker using grub to bust
back into a Knoppix machine that lost its boot loader. The commands
discussed previously would put you in Knoppix just fine, but the error
messages and even the console keyboard would be German (Deutsch). If
you wanted to boot up in American English, you'd add the argument <span
style="font-family: monospace;">lang=us</span> to the kernel
statement, like this:<br>
<pre><big style="font-weight: bold; color: rgb(0, 0, 0);">grub> kernel </big><span
style="font-weight: bold; color: rgb(0, 0, 0);"><big
style="font-weight: bold;">(hd0,0)</big></span><big
style="font-weight: bold;"><span style="color: rgb(0, 0, 0);">/vmlinuz-i686-up-4GB </span><span
style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 0, 0);">root=/dev/hda9</span> <span
style="color: rgb(153, 51, 153);">lang=us<br><span
style="color: rgb(0, 0, 0);">grub> boot</span><br></span></span></big></pre>
or<br>
<pre><big style="font-weight: bold; color: rgb(0, 0, 0);">grub> root (hd0,0)<br>grub> kernel </big><span
style="font-weight: bold; color: rgb(0, 0, 0);"></span><big
style="font-weight: bold;"><span style="color: rgb(0, 0, 0);">/vmlinuz-i686-up-4GB </span><span
style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 0, 0);">root=/dev/hda9</span> <span
style="color: rgb(153, 51, 153);">lang=us</span></span></big><span
style="color: rgb(0, 0, 0);"><br><big style="font-weight: bold;">grub> boot</big></span><br></pre>
<h2>The Single Partition Configuration</h2>
The preceding example detailed a system with a dedicated <span
style="font-family: monospace;">/boot</span> partition. Especially in
these days of modern bioses that can boot past cylinder 1024, many
people don't use a separate partition for <span
style="font-family: monospace;">/boot</span>. Imagine if the root
partition were <span style="font-family: monospace;">/dev/hda1</span>,
and <span style="font-family: monospace;">/boot</span> was just
another directory on that partition. In that case, here are the
commands you'd use:<br>
<br>
<pre><big style="font-weight: bold;">grub> <span
style="color: rgb(153, 0, 0);">root (hd0,0)</span><br>grub> <span
style="color: rgb(0, 0, 153);">kernel /boot/vmlinuz-i686-up-4GB</span> <span
style="color: rgb(0, 102, 0);">root=/dev/hda1</span><br>grub> boot</big><br></pre>
The only difference is here the grub root is the same as the booted
system root.<br>
<h1><a name="_Having_Grub_Do_Your_Research_For_You"></a>Having Grub Do
Your Research For You</h1>
Often you know the partition containing the kernel, the kernel
directory and name, and which partition mounts to root after boot. In
that case booting Linux from grub is trivial.<br>
<br>
Other times you're not so lucky. Like when you accidentally messed up
LILO, or when you or someone else installed Windows, inadvertently
overwriting the boot loader on the MBR. That's when you need grub the
most, but that's also when you're least likely to know the partition
containing the kernel, the partition that will ultimately be root, and
the name of the kernel. Luckily, grub can help.<br>
<br>
Your first step is to find the partition containing the kernel and the
partition containing <span style="font-family: monospace;">/sbin/init</span>.
Now type the following at the <span style="font-family: monospace;">grub></span>
prompt:<br>
<pre>find /sbin/init<br></pre>
On a machine with three different Linux OS's installed, the answer
would come back something like this:<br>
<table style="text-align: left; background-color: rgb(255, 255, 204);"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<pre><big>grub> <span style="font-weight: bold;">find /sbin/init</span><br> (hd0,8)<br> (hd0,11)<br> (hd1,11)<br><br>grub></big><br></pre>
</td>
</tr>
</tbody>
</table>
<br>
In the preceding example, you've found three different partitions
containing <span style="font-family: monospace;">/sbin/init</span>:<br>
<br>
<table style="text-align: left; width: 100%;" border="1" cellspacing="2"
cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">Grub partition specification<br>
</td>
<td style="vertical-align: top;">Linux partition specification<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">(hd0,8)<br>
</td>
<td style="vertical-align: top;">/dev/hda9<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">(hd0,11)<br>
</td>
<td style="vertical-align: top;">/dev/hda12<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">(hd1,11)<br>
</td>
<td style="vertical-align: top;">/dev/hde12<br>
Note: I infer that hd1 maps to hde because on this particular machine
there are two hard disks, one at hda and one at hde.<br>
</td>
</tr>
</tbody>
</table>
<br>
Next, find all partitions containing the kernel. Our first attempt
assumes that at least one kernel will have filename <span
style="font-family: monospace;">vmlinuz</span>.:<br>
<br>
<table style="text-align: left; background-color: rgb(255, 255, 204);"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<pre><big>grub> <span style="font-weight: bold;">find /vmlinuz</span><br> (hd0,0)<br> (hd0,11)<br> (hd1,11)<br><br>grub></big><br></pre>
</td>
</tr>
</tbody>
</table>
<br>
Then perform the same search for <span style="font-family: monospace;">vmlinuz</span>
in a directory called <span style="font-family: monospace;">/boot</span>:<br>
<table style="text-align: left; background-color: rgb(255, 255, 204);"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<pre><big>grub> <span style="font-weight: bold;">find /boot/vmlinuz</span><br> (hd0,11)<br> (hd1,11)<br><br>grub></big><br></pre>
</td>
</tr>
</tbody>
</table>
<br>
Here we find only two of the three we found in the first attempt,
because on this machine, <span style="font-family: monospace;">(hd0,0)</span>
is mounted as <span style="font-family: monospace;">/boot</span> on
one of the OS's.<br>
<br>
Grub's <span style="font-family: monospace;">find</span> command is
limited. It can find only regular files, not directories. Usually the
entire directory path must be specified, although for some reason it
finds a couple <span style="font-family: monospace;">/boot/vmlinuz</span>
when you use find on <span style="font-family: monospace;">/vmlinuz</span>.
Don't count on that behavior.<br>
<br>
Another technique for finding info in grub is to use its file
completion feature. Let's say you know the kernel is on <span
style="font-family: monospace;">(hd0,0)</span> and the kernel file
begins with<span style="font-family: monospace;"><span
style="font-family: monospace;"> </span></span>vml. Press the tab key
after issuing this partial command:<br>
<pre>null (hd0,0)/vmlinuz<br></pre>
Grub performs file completion much like you see at a Linux command
prompt.<br>
<br>
<table style="text-align: left; background-color: rgb(255, 255, 204);"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<pre><big>grub> <span style="font-weight: bold;">null (hd0,0)/vml</span>inuz<br> Possible files are: vmlinuz vmlinuz-2.6.3-7mdk vmlinuz-2.6.3-7mdk-i686-up-4GB<br>vmlinuz-i686-up-4GB<br><br>grub></big><br></pre>
</td>
</tr>
</tbody>
</table>
<br>
In the preceding, the word <span style="font-family: monospace;">null</span>
is not a keyword, but instead a word chosen because it is not a
keyword. Instead of "null", you could have used "whatever" or "bogus"
or any other non-keyword. Once you get the list, you can complete a
little more and then press tab again, just like at a bash prompt. By
doing so you minimize the likelihood of transcription errors.<br>
<br>
Occasionally grub won't easily give you all the necessary information.
If you need more information than grub can conveniently provide, boot
Knoppix. See Troubleshooters.Com's <a href="../knoppix/index.htm">Knoppix
Knowhow</a> site for details.<br>
<h1><a name="_Making_a_Full_grub_Boot_Floppy"></a>Making a Full grub
Boot Floppy</h1>
In this document's first article you created a simple Grub boot floppy
without a filesystem. This is adequate to boot a computer, but not to
install grub on the computer. Installing grub requires a boot floppy
with grub on a filesystem. You can do that on any Linux box on which
grub is installed. The following are the steps:<br>
<br>
<pre>[root@mydesk root]# mkfs -t ext2 -c /dev/fd0u1440<br>[root@mydesk root]# umount /dev/fd0<br>[root@mydesk root]# umount /dev/fd0u1440<br>[root@mydesk root]# mkdir /mnt/test<br>[root@mydesk root]# mount /dev/fd0u1440 /mnt/test<br>[root@mydesk root]# mkdir -p /mnt/test/boot/grub<br>[root@mydesk root]# cp /boot/grub/stage1 /mnt/test/boot/grub<br>[root@mydesk root]# cp /boot/grub/stage2 /mnt/test/boot/grub<br>[root@mydesk root]# chmod a-w /mnt/test/boot/grub/stage2<br>umount /dev/fd0u1440<br>[root@mydesk root]# grub<br>grub> root (fd0)<br>grub> setup (fd0)<br>grub> quit<br><br>[root@mydesk root]#<br></pre>
You now have a bootable grub floppy with which you can boot a computer.
One more thing should go on the floppy -- an example <span
style="font-family: monospace;">menu.lst</span>. The <span
style="font-family: monospace;">menu.lst</span> file is what brings up
a "grub menu", and is vital for actually installing the grub bootloader
on another computer. On the computer you need to boot, you can edit the
<span style="font-family: monospace;">menu.lst</span> file to produce a
grub menu on boot, and to actually install grub on the system. Note
that the example <span style="font-family: monospace;">menu.lst</span>
shoud NEVER be copied to the floppy before all the steps listed above
this paragraph. Here is a typical session showing how to perform the
copy. Note that once again, a <span style="font-family: monospace;">mount</span>
and <span style="font-family: monospace;">unmount</span> must be
performed.<br>
<pre><br>[root@mydesk root]# mount /dev/fd0u1440 /mnt/test<br>[root@mydesk root]# cp -p /usr/share/doc/grub-doc-0.93/menu.lst /mnt/test/boot/grub/<br>stage1 stage2 <br>[root@mydesk root]# cp -p /usr/share/doc/grub-doc-0.93/menu.lst /mnt/test/boot/grub/menu.lst.example<br>[root@mydesk root]# umount /dev/fd0u1440<br>[root@mydesk root]#<br></pre>
<h1><a name="_Installing_grub_From_Floppy"></a>Installing grub From
Floppy</h1>
Do not perform this exercise until you've practiced the earlier
exercises. Knowledge of the operation of the grub command line
interface is vital to creating and installing a menu driven grub.<br>
<table
style="background-color: rgb(255, 204, 204); width: 60%; text-align: left; margin-left: auto; margin-right: auto;"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<div style="text-align: center;"><big><big><span
style="font-weight: bold;">WARNING</span></big></big><br>
</div>
<br>
This exercise walks you through creating a floppy based grub boot
floppy on a grub installation on computer 1, and then using that floppy
to boot and configure grub on computer 2. It WILL wipe out any existing
boot loader from computer 2. Hopefully it will replace that boot loader
with grub, but there are no guarantees. In fact, this document
addresses only Linux grub setups, so if you have Windows or BSD
installed, this document cannot help you recover.<br>
<br>
Therefore, computer 2 MUST be an experimental computer whose data and
OS you can afford to lose.<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
In the <a href="#_Making_a_Full_grub_Boot_Floppy">Making a Full grub
Boot Floppy</a> exercise you created a boot diskette with <span
style="font-family: monospace;">stage1</span>, <span
style="font-family: monospace;">stage2</span>, and an example <span
style="font-family: monospace;">menu.lst</span> named <span
style="font-family: monospace;">menu.lst.example</span>. Now it's time
to use that floppy on another system. As mentioned in the preceding
warning, that other system must be an experimental system whose boot
loader you can afford to overwrite, possibly unsuccessfully.<br>
<br>
Insert the full grub boot floppy in the experimental computer, shut the
computer down in an orderly fashion, and reboot the computer. During
BIOS boot, make sure the computer's first boot drive is the floppy.<br>
<br>
It is very likely that the the other system has grub installed. To
temporarily move its files aside, do the following:<br>
<pre>mv /boot/grub /boot/orggrub<br>mv /sbin/grub /sbin/orggrub<br>mv /sbin/grub-install /sbin/orggrub-install<br></pre>
Basically, rename directory <span style="font-family: monospace;">/boot/grub</span>,
and then rename all grub executables. In this way you're simulating a
machine that has never had grub installed, yet you can "put back" the
files with a couple more renames. However, it is not so simple to "put
back" the MBR.<br>
<br>
The basic procedure is as follows:<br>
<ol>
<li>Boot from the grub floppy</li>
<li>Copy files from the floppy to <span
style="font-family: monospace;">/boot/grub</span> on the hard disk</li>
<li>Configure <span style="font-family: monospace;">/boot/grub/menu.lst</span>
for this computer</li>
<li>Reboot from floppy, and install grub<br>
</li>
</ol>
<h2>Boot from the grub floppy</h2>
<pre><big style="font-weight: bold; color: rgb(0, 0, 0);">grub> root (hd0,0)<br>grub> kernel </big><span
style="font-weight: bold; color: rgb(0, 0, 0);"></span><big
style="font-weight: bold;"><span style="color: rgb(0, 0, 0);">/vmlinuz-i686-up-4GB </span><span
style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 0, 0);">root=/dev/hda9</span><span
style="color: rgb(153, 51, 153);"></span></span></big><span
style="color: rgb(0, 0, 0);"><br><big style="font-weight: bold;">grub> boot</big></span><br></pre>
As mentioned before, if booting to a foreign language distro, use the
appropriate <span style="font-family: monospace;">lang=</span> kernel
argument so that you can work in your native tongue. If everything went
right, your experimental system is now booted.<br>
<h2>Copy files from the floppy to <span style="font-family: monospace;">/boot/grub</span>
on the hard disk</h2>
First make sure there's no <span style="font-family: monospace;">/boot/grub</span>.
If there is, rename it, because you sure don't want to overwrite it
just to perform this exercise.<br>
<br>
Now perform the following commands:<br>
<pre>mkdir /mnt/test<br>mount /dev/fd0u1440 /mnt/test<br>cp -Rp /mnt/test/boot/grub /boot<br></pre>
<h2>Configure <span style="font-family: monospace;">/boot/grub/menu.lst</span>
for this computer</h2>
If you began this document as a grub newbie, the sample <span
style="font-family: monospace;">menu.lst</span> that ships with grub
would have been useless to you. What a difference a few exercises can
make. You now know how to boot a computer from the <span
style="font-family: monospace;">grub></span> prompt. You know the
difference between the grub root and the root directory seen by Linux
after bootup. You know how to structure a grub <span
style="font-family: monospace;">kernel</span> statement.<br>
<br>
A <span style="font-family: monospace;">menu.lst</span> file is
basically just the same list of commands you'd use at the <span
style="font-family: monospace;">grub></span> prompt, except that
the <span style="font-family: monospace;">boot</span> command is not
included. The example <span style="font-family: monospace;">menu.lst</span>
has commands for installing operating systems from mach to Windows, and
it even has an entry that installs grub on the system and another that
changes the menu colors. All of that is extraneous. What you want to do
is delete all the non-Linux stuff, and configure the Linux commands to
match your experimental machine's kernel partition, Linux root
partition, and kernel filename. The following is an example of such an
edited example file saved as <span style="font-family: monospace;">menu.lst</span>:<br>
<table
style="text-align: left; width: 100%; background-color: rgb(204, 255, 255);"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<pre><big><span style="font-weight: bold;">#</span><br
style="font-weight: bold;"><span style="font-weight: bold;"># Sample boot menu configuration file</span><br
style="font-weight: bold;"><span style="font-weight: bold;">#</span><br
style="font-weight: bold;"><br style="font-weight: bold;"><span
style="font-weight: bold;"># Boot automatically after 30 secs.</span><br
style="font-weight: bold;"><span style="font-weight: bold;">timeout 30</span><br
style="font-weight: bold;"><br style="font-weight: bold;"><span
style="font-weight: bold;"># By default, boot the first entry.</span><br
style="font-weight: bold;"><span style="font-weight: bold;">default 0</span><br
style="font-weight: bold;"><br style="font-weight: bold;"><span
style="font-weight: bold;"># Fallback to the second entry.</span><br
style="font-weight: bold;"><span style="font-weight: bold;"># fallback 1 # BE SURE TO COMMENT THIS OUT!!!!!!!!!!!!!!</span><br
style="font-weight: bold;"><br style="font-weight: bold;"><span
style="font-weight: bold;"># For booting GNU/Linux</span><br
style="font-weight: bold;"><span style="font-weight: bold;">title GNU/Linux</span><br
style="font-weight: bold;"><span style="font-weight: bold;">root (hd0,0)</span><br
style="font-weight: bold;"><span style="font-weight: bold;">kernel /boot/vmlinuz-2.6.7 root=/dev/hda1 lang=us</span></big><br></pre>
</td>
</tr>
</tbody>
</table>
<br>
A few notes are in order:<br>
<ul>
<li>BE SURE to comment out the "fallback 1", because there is no
choice 1, only a choice 0.</li>
<li>The <span style="font-family: monospace;">default 0</span>
statement simply points to which choice will run if the user makes no
choice within the timeout period.</li>
<li>The <span style="font-family: monospace;">lang=</span> is
unnecessary unless you're booting up a foreign distro and want to see
it in your native language.</li>
<li>The <span style="font-family: monospace;">root (hd0,0)</span>
needs to be adjusted to point to the partition containing the kernel.</li>
<li>The <span style="font-family: monospace;">root=/dev/hda1</span>
needs to be adjusted to point to the partition that will be mounted as
root after booting. Note that it is expressed in Linux notation, not in
grub notation.</li>
<li>The kernel statement points to the kernel <span
style="font-style: italic;">relative to the grub root<span
style="font-family: monospace;">.</span></span> In the preceding file
it points to <span style="font-family: monospace;">/boot/vmlinuz-2.6.7</span>
in the Linux root partition. If Linux used a partition just for <span
style="font-family: monospace;">/boot</span>, and that partition were <span
style="font-family: monospace;">/dev/hda1</span> as is typical of boot
partitions, then the kernel would point to <span
style="font-family: monospace;">/vmlinuz-2.6.7</span> instead of <span
style="font-family: monospace;">/boot/vmlinuz-2.6.7</span>, because
the file would be on the root of the boot partition, and would become
subservient to <span style="font-family: monospace;">/boot</span> only
after the partition is mounted by Linux.<br>
</li>
<li>Grub's default menu file is <span style="font-family: monospace;">/boot/grub/menu.lst</span>.
You can use a different file, but it would require jumping through
quite a few hoops. Use the default.</li>
<li>None of this is new to you. You already did all of this at the <span
style="font-family: monospace;">grub></span> prompt in previous
exercises.<br>
</li>
</ul>
Your <span style="font-family: monospace;">/boot/grub/menu.lst</span>
file is now complete. If you created it correctly, you can now install
grub from your floppy:<br>
<h2>Reboot from floppy, and install grub</h2>
Insert your full grub boot floppy in the experimental machine, and
reboot. The machine boots to the floppy, and you are presented with the
<span style="font-family: monospace;">grub></span> prompt. From
there, installation is easy, assuming you've done the previous steps
correctly:<br>
<br>
<table style="text-align: left; background-color: rgb(255, 255, 204);"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<pre><big><span style="font-weight: bold;">grub> root (hd0,0)</span><br
style="font-weight: bold;"><span style="font-weight: bold;">grub> setup (hd0)</span><br
style="font-weight: bold;"><span style="font-weight: bold;">grub> reboot</span></big><br></pre>
</td>
</tr>
</tbody>
</table>
<br>
The machine reboots again, and if you remove the floppy, you are
presented a 1 item grub menu. This is what it looks like:<br>
<br>
<table style="text-align: left; background-color: rgb(255, 255, 255);"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td><img src="http://www.troubleshooters.com/linux/grub/gnulinuxmenu.gif"> </td>
</tr>
</tbody>
</table>
<br>
<br>
<br>
Pressing Enter on that item boots the kernel listed in your <span
style="font-family: monospace;">menu.lst</span>. A few notes are in
order:<br>
<ul>
<li>Never remove the floppy while the floppy light is on<br>
</li>
<li>If you fail to remove the floppy before the reboot reaches the
bootloader, it will boot from floppy again. In that case, just boot
from floppy as you have in prior exercises, and then remove the floppy
and reboot the machine to get the menu.</li>
</ul>
<h2>Summary</h2>
Thats it. You created a bootable floppy with <span
style="font-family: monospace;">stage1</span>, <span
style="font-family: monospace;">stage2</span> and an example menu
file, and used that floppy to install a grub bootloader on a machine.
This is how you can take a machine with a blown bootloader and
configure it to boot with grub.<br>
<br>
However, your "grub installation" falls short. None of the grub
executables are there:<br>
<ul>
<li>grub</li>
<li>grub-floppy</li>
<li>grub-install</li>
<li>grub-md5-crypt</li>
<li>grub-reboot grub-terminfo<br>
</li>
</ul>
Also, many files normally placed in <span
style="font-family: monospace;">/boot/grub</span> are not there:<br>
<ul>
<li>device.map</li>
<li>e2fs_stage1_5</li>
<li>jfs_stage1_5</li>
<li>minix_stage1_5</li>
<li>reiserfs_stage1_5</li>
<li>xfs_stage1_5<br>
</li>
</ul>
The other thing you don't have is the documentation that usually comes
in <span style="font-family: monospace;">/usr/share/grub</span>.<br>
<br>
Once you get the machine booting in a stable manner, you'll probably
want to install grub from a package manager or by compiling the source.
Be sure to back up your existing <span style="font-family: monospace;">/boot/grub/menu.lst</span>.<br>
<h1><a name="_Working_With_a_Fully_Installed_grub"></a>Working With a
Fully Installed grub</h1>
You don't want to reboot to floppy just to get to a <span
style="font-family: monospace;">grub></span> prompt or to make
changes to the bootloader on your MBR. Once you've installed the full
grub package you don't need to. You can use <span
style="font-family: monospace;">grub-install</span> to install a newly
configured boot loader without resorting to your boot floppy. You can
use <span style="font-family: monospace;">grub</span> to view the
results of a new <span style="font-family: monospace;">menu.lst</span>.
<br>
<br>
After you've installed grub (or restored the original installation by
undoing the renames), edit your <span style="font-family: monospace;">menu.lst</span>
, insert a second entry that boots the 2.4 kernel instead of the 2.6,
name each entry for its kernel number, and restore the. Here is the
resulting file:<br>
<br>
<table style="text-align: left; background-color: rgb(204, 255, 255);"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<pre><big><span style="font-weight: bold;">#</span><br
style="font-weight: bold;"><span style="font-weight: bold;"># Sample boot menu configuration file</span><br
style="font-weight: bold;"><span style="font-weight: bold;">#</span><br
style="font-weight: bold;"><br style="font-weight: bold;"><span
style="font-weight: bold;"># Boot automatically after 30 secs.</span><br
style="font-weight: bold;"><span style="font-weight: bold;">timeout 30</span><br
style="font-weight: bold;"><br style="font-weight: bold;"><span
style="font-weight: bold;"># By default, boot the first entry.</span><br
style="font-weight: bold;"><span style="font-weight: bold;">default 0</span><br
style="font-weight: bold;"><br style="font-weight: bold;"><span
style="font-weight: bold;"># Fallback to the second entry.</span><br
style="font-weight: bold;"><span style="font-weight: bold;">fallback 1 </span><br
style="font-weight: bold;"><br style="font-weight: bold;"><span
style="font-weight: bold;"># For booting GNU/Linux</span><br
style="font-weight: bold;"><span style="font-weight: bold;">title 26</span><br
style="font-weight: bold;"><span style="font-weight: bold;">root (hd0,0)</span><br
style="font-weight: bold;"><span style="font-weight: bold;">kernel /boot/vmlinuz-2.6.7 root=/dev/hda1 lang=us</span><br
style="font-weight: bold;"><br style="font-weight: bold;"><span
style="font-weight: bold;"># For booting GNU/Linux</span><br
style="font-weight: bold;"><span style="font-weight: bold;">title 24</span><br
style="font-weight: bold;"><span style="font-weight: bold;">root (hd0,0)</span><br
style="font-weight: bold;"><span style="font-weight: bold;">kernel /boot/vmlinuz-2.4.27 root=/dev/hda1 lang=us</span></big><br></pre>
</td>
</tr>
</tbody>
</table>
<br>
The preceding file has two boot choices: One for the 2.6 kernel
(appropriately named 26) and one for the 2.4 kernel (appropriately
named 24). It defaults to 26, but if for some reason 26 won't boot it
falls back to 24.<br>
<br>
Once the file is saved, perform the following command:<br>
<pre>grub-install /dev/hda1<br></pre>
<br>
<table
style="background-color: rgb(240, 240, 240); width: 60%; text-align: left; margin-left: auto; margin-right: auto;"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<div style="text-align: center;"><big style="font-weight: bold;"><big><big>NOTE</big></big></big><br>
</div>
<br>
To get the same result, you can also run grub, either from a command
line or via a grub boot floppy, and perform the following command
sequence:<br>
<pre><big>grub> root (hd0,0)<br>grub> setup (hd0)<br></big></pre>
The preceding assumes that the kernel is located on (hd0,0), which is
otherwise known as /dev/hda1, and that you're installing it to the MBR
of the first hard disk, also known as /dev/hda1.<br>
</td>
</tr>
</tbody>
</table>
<br>
The next time you boot your computer, you'll see choices 26 and 24, and
they'll do the right thing, as follows:<br>
<br>
If you want to view the menu without rebooting, try this command:<br>
<pre>grub --config-file \(hd0,0\)/boot/grub/menu.lst<br></pre>
In the preceding, note that you need to escape the parentheses of the
grub partition because otherwise the shell will interpret those
parentheses as special characters. Perform that command and you'll see
the menu, which looks like the following:<br>
<br>
<table style="text-align: left; background-color: rgb(255, 255, 255);"
border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td><img src="http://www.troubleshooters.com/linux/grub/26and24menu.gif"> </td>
</tr>
</tbody>
</table>
<br>
<br>
However, you cannot actually boot from grub run on the
command line.<br>
<h2>Options from the grub menu</h2>
We all hope every item on the menu produces a clean boot. If not, you
can either edit individual commands in a given menu choice by pressing
the <span style="font-family: monospace;">e</span> key, or drop
down to the grub command prompt by pressing the <span
style="font-family: monospace;">c</span> key. Generally speaking, you
edit commands if you suspect the menu choice is close to a correct
configuration, and you drop directly to the grub command prompt if you
suspect the menu item to be totally wrong, or if you need the
facilities of grub's <span style="font-family: monospace;">find</span>
command or its command completion feature.<br>
<br>
<h5></h5>
<h2><a href="../../troubleshooters.htm">Back to Troubleshooters.Com</a>
* <a href="../index.htm">Back
to Linux Library</a> * <a href="index.htm">Back to Grub Grotto</a></h2>