Linux notes

linux and whatnot

AUR packages to try out

leave a comment »

Written by qpieus

February 28, 2010 at 8:41 am

Posted in arch, linux

Tagged with ,

Arch Linux Forums / [SOLVED] Slow “magic lamp” and “minimize” animations on KDE 4.4

leave a comment »

* Slow “magic lamp” and “minimize” animations on KDE 4.4

#1 Yesterday 09:24:16

eldarion

Member

From: Santarém – Portugal

Registered: 2006-08-01

Posts: 53

E-mail

[SOLVED] Slow “magic lamp” and “minimize” animations on KDE 4.4

So after updating to KDE 4.4 i noticed that the “magic lamp” and “minimize” animations were slower on my machine (with Nvidia GeForce 7900, proprietary module).

After searching what was going out, i found out the reason: the “fade in/fade out” title animation of the new oxygen kwin style. I searched for a way to turn it off on the configuration dialog without success.

So, what i did was to edit ~/.kde4/share/config/oxygenrc and add the line:

Code:

AnimationsDuration=0

inside the

Code:

[Windeco]

section. Now the fade effect is immediate and so it will not interfere with the “magic lamp” and “minimize” animations. Please note that it’s recommended that you change the kwin style before making the changes inside oxygenrc. Then change your windeco to “oxygen” again.

I hope this will be helpful to someone.

via Arch Linux Forums / [SOLVED] Slow “magic lamp” and “minimize” animations on KDE 4.4.

Written by qpieus

February 14, 2010 at 9:31 am

Posted in arch, kde, linux

Tagged with , ,

AUR (en) – kde-extragear-plasmoids

leave a comment »

Package Details

kde-extragear-plasmoids 4.4.0-6

via AUR (en) – kde-extragear-plasmoids.

Written by qpieus

February 14, 2010 at 9:27 am

Posted in arch, kde, linux

Tagged with , ,

Speaking UNIX: 10 great tools for any UNIX system

leave a comment »

Martin Streicher, Web developer, Pixels, Bytes, and Commas

Martin Streicher is a freelance Ruby on Rails developer and the former Editor-in-Chief of Linux Magazine. Martin holds a Masters of Science degree in computer science from Purdue University and has programmed UNIX-like systems since 1986. He collects art and toys. You can reach Martin at martin.streicher@gmail.com.

Summary: The universe of UNIX® tools changes constantly. Here are 10 tools—some you may have overlooked and some new—to tinker with.

Tags for this article: linux, sysadmin, tools, unix

Date: 12 May 2009
Level: Intermediate
PDF: A4 and Letter (114KB | 16 pages)Get Adobe® Reader®
Activity: 40954 views
Comments: 1 (View or add comments)

1 star2 stars3 stars4 stars5 stars Average rating (based on 36 votes)

//

//

Much like a vernacular, the universe of UNIX tools changes almost perpetually. New tools crop up frequently, while others are eternally modernized and adapted to suit emerging best practices. Certain tools are used commonly; others are used more infrequently. Some tools are perennial; occasionally, some are obsoleted outright. To speak UNIX fluently, you have to keep up with the “lingo.”

Table 1 lists 11 of the significant packages previously discussed in the Speaking UNIX series.
Table 1. Prominent UNIX tools

Name Purpose
Cygwin A UNIX-like shell and build environment for the Windows® operating system.
fish A highly interactive shell with automatic expansion and colored syntax for command names, options, and file names.
locate Build and search a database of all files
rename Rename large collections of files en masse
rsync Efficiently synchronize files and directories, locally and remotely
Screen Create and manage virtual, persistent consoles
Squirrel A cross-platform scripting shell
tac Print input in reverse order, last line first (tac is the reverse of cat)
type Reveal whether a command is an alias, an executable, a shell built in, or a script
wget Download files using the command line
zsh An advanced shell featuring automatic completion, advanced redirection operands, and advanced substitutions

This month, let’s look at 10 more utilities and applications that expand or improve on an existing or better-known UNIX package. The list runs a wide gamut, from a universal archive translator to a high-speed Web server.

In some cases, depending on your flavor of UNIX, you will have to install a new software package. You can build from source as instructed, or you can save time and effort if your package-management software provides an equivalent binary bundle. For example, if you use a Debian flavor of Linux®, many of the utilities mentioned this month can be installed directly using apt-get.


Back to top

Find a command with apropos

UNIX has so many commands, it is easy to forget the name of a utility—especially if you do not use the tool frequently. If you find yourself scratching your head trying to recall a name, run apropos (or the equivalent man -k). For example, if you’re hunting for a calculator, simply type apropos calculator:

$ apropos calculator
bc (1)        - An arbitrary precision calculator language
dc (1)        - An arbitrary precision calculator

Both bc and dc are command-line calculators.

Each UNIX manual page has a short description, and apropos searches the corpus of descriptions for instances of the specified keyword. The keyword can be a literal, such as calculator, or a regular expression, such as calc*. If you use the latter form, be sure to wrap the expression in quotation marks ("") to prevent the shell from interpreting special characters:

$ apropos "calcu*"
allcm (1)     - force the most important Computer-Modern-fonts to be calculated
allec (1)     - force the most important Computer-Modern-fonts to be calculated
allneeded (1) - force the calculation of all fonts now needed
bc (1)        - An arbitrary precision calculator language
dc (1)        - An arbitrary precision calculator

Back to top

Run a calculation on the command line

As shown above, dc is a capable calculator found on every UNIX system. If you run dc without arguments, you enter Interactive mode, where you can write and evaluate Reverse Polish Notation (RPN) expressions:

$ dc
5
6 
* 
10
/ 
p
3

However, you can do all that work right on the command line. Specify the -e option and provide an expression to evaluate. Again, wrap the expression in quotation marks to prevent interpolation by the shell:

$ dc -e "5 6 * 10 /"
3

Back to top

Find processes with pgrep

How many times have you hunted for a process with ps aux | grep .... Countless times, probably. Sure, it works, but there is a much more effective way to search for processes. Try pgrep.

As an example, this command finds all instantiations of strike‘s login shell, (where strike is the name of a user):

$ pgrep -l -u strike zsh 
10331 zsh
10966 zsh

The pgrep command provides options to filter processes by user name (the -u shown), process group, group, and more. A companion utility, pkill, takes all the options of pgrep and accepts a signal to send to all processes that match the given criteria.

For instance, the command pkill -9 -u strike zsh is the equivalent of pgrep -u strike zsh | xargs kill -9.


Back to top

Generate secure passwords with pwgen

Virtually every important subsystem in UNIX requires its own password. To wit, e-mail, remote login, and superuser privileges all require a password—preferably disparate and each difficult to guess or derive using an automated attack. Moreover, if you want to develop scripts to generate accounts, you want a reliable source of random, secure passwords.

The pwgen utility is a small utility to generate gobs of passwords. You can tailor the passwords to be memorable or secure, and you can specify whether to include numbers, symbols, vowels, and capital letters.

Many UNIX systems have pwgen. If not, it is simple to build:

$ # As of March 2009, the latest version is 2.06
$ wget http://voxel.dl.sourceforge.net/sourceforge/\
  pwgen/pwgen-2.06.tar.gz
$ tar xzf pwgen-2.06.tar.gz
$ cd pwgen-2.06
$ ./configure && make && sudo make install

Here are some sample uses:

  • Print a collection of easy-to-recall passwords:
    $ pwgen -C
    ue2Ahnga Soom0Lu0 Hie8aiph gei9mooD eiXeex7N 
    Wid4Ueng taShee3v Ja3shii8 iNg0viSh iegh5ouF 
    ...
    zoo8Ahzu Iefev0ch MoVu4Pae goh1Ak6m EiJup5ei 
    
  • Generate a single, secure password:
    $ pwgen -s -1
    oYvy9WWa
    
  • Generate a single, secure password with no ambiguous, or easily confused, characters and at least one non-alphanumeric character:
    $ ./pwgen -s -B -1 -y
    7gEqT_V[
    

To see all the available options, type pwgen --help.


Back to top

Watch many files with multitail

Whether you’re a developer debugging new code or a systems administrator monitoring a system, you often have to keep an eye on many things at once. If you’re a developer, you might watch a debug log and stdout to track down a bug; if you’re an administrator, you might want to police activity to intercede as necessary. Usually, both tasks require oodles of windows tiled on screen to keep a watchful eye—perhaps tail in one window, less in another window, and a command prompt in yet another.

If you have to monitor several files at once, consider multitail. As its name implies, this utility divides a console window into multiple sections, one section per log file. Even better, multitail can colorize well-known formats (and you can define custom color schemes, too) and can merge multiple files into a single stream.

To build multitail, download the source, unpack it, and run make. (The options in the distribution’s generic makefile should suffice for most UNIX systems. If the make fails, look in the topmost directory for a makefile specific to your system.)

# As this article was written, the latest version of multitail was 5.2.2
$ wget http://www.vanheusden.com/multitail/multitail-5.2.2.tgz
$ tar xzf multitail-5.2.2.tgz
$ cd multitail-5.2.2
$ make
$ sudo make install

Here are some uses of multitail to consider:

  • To watch a list of log files in the same window, launch the utility with a list of file names, as in multitail /var/log/apache2/{access,error}.log.
  • To watch a pair of files in the same window and buffer everything that’s read, use the -I option to merge the named file into another, as in multitail -M 0 /var/log/apache/access.log -I /var/log/apache/error.log. Here, the Apache error log and access log are interlineated. -M 0 records all incoming data; you can see the buffer at any time by pressing the B key.
  • You can also mix and match commands and files. To watch a log file and monitor the output of ping, try multitail logfile -l "ping 192.168.1.3". This creates two views in the same console: One view shows the contents of logfile, while the other shows the ongoing output of ping 192.168.1.3.

In addition to command-line options, multitail provides a collection of interactive commands to affect the current state of the display. For instance, press the A key in the display to add a new log file. The B key displays the save buffer. The Q key quits multitail. See the man page for multitail for the complete list of commands.


Back to top

Compress and extract almost anything with 7zip

Between Windows and UNIX alone, there are dozens of popular archive formats. Windows has long had .zip and .cab, for instance, while UNIX has had .tar, .cpio, and .gzip. UNIX and its variants also employ .rpm, .deb, and .dmg. All these formats are commonly found online, making for something of a Babel of bits.

To save or extract data in any particular format, you could install a bevy of specialized utilities, or you can install 7zip, a kind of universal translator that can compress and extract virtually any archive. Further, 7zip also proffers its own format, featuring a higher compression ratio than any other scheme, gigantic capacity reaching into terabytes, and strong data encryption.

To build 7zip, download the source for p7zip, a port of 7zip to UNIX, from its project page on SourceForge (see Resources). Unpack the tarball, change to the source directory, and run make. (Like multitail, the generic makefile should suffice; if not, choose from one of the specialized makefiles provided.)

$ wget http://voxel.dl.sourceforge.net/sourceforge/p7zip/\   
  p7zip_4.65_src_all.tar.bz2
$ tar xjf p7zip_4.65_src_all.tar.bz2
$ cd p7zip_4.65
$ make
$ sudo make install

The build produces and installs the utility 7za. Type 7za with no arguments to see a list of available commands and options. Each command is a letter—akin to tar—such as a to add a file to the archive and x to extract.

To try the utility, create an archive of the p7zip source itself in a variety of formats, and extract each archive with 7za:

$ zip -r p7.zip p7zip_4.65
$ 7za -ozip x p7.zip
$ tar cvf p7.tar p7zip_4.65
$ 7za -otar x p7.tar 
$ bzip2 p7.tar
$ 7za -so x p7.tar.bz2 | tar tf -

In order from top to bottom, 7za extracted a .zip, .tar, and .bz2 archive. In the last command, 7za extracted the .bz2 archive and wrote the output to stdout, where tar decompressed and cataloged the files. Like tar, 7za can be the source or destination of a pipe (|), making it easy to combine with other utilities.


Back to top

View compressed files with zcat

Per-disk capacity now exceeds a terabyte, but a disk can nonetheless fill up quickly with large data files, lengthy log files, images, and media files such as movies. To conserve space, many files can be compressed to a fraction of their original size. For example, an Apache log file, which is simply text, can shrink to one-tenth of its original size.

Although compression saves disk space, it can add effort. If you need to analyze a compressed Apache log file, for instance, you must decompress it, process the data, then re-compress it. If you have a great number of log files, which is typical if you keep records to establish trends, the overhead can become excessive.

Luckily, the gzip suite includes a number of utilities to process compressed files in situ. The utilities zcat, zgrep, zless, and zdiff, among others, serve the same purpose as cat, grep, less, and diff, respectively, but operate on compressed files.

Here, two source files are compressed with gzip and compared with zdiff:

$ cat old
This
is 
Monday.
$ cat new
This
is 
Tuesday.
$ gzip old new
$ zdiff -c old.gz new.gz
*** -	2009-03-30 22:26:34.518217647 +0000
--- /tmp/new.10874	2009-03-30 22:26:34.000000000 +0000
***************
*** 1,3 ****
  This
  is 
! Monday.
--- 1,3 ----
  This
  is 
! Tuesday.

Back to top

Surf the Web, conquer the Internet, make world peace with cURL

A prior Speaking UNIX column recommended wget to download files directly from the command-line. Ideal for shell scripts, wget is great for those times where you do not have ready access to a Web browser. For example, if you are trying to install new software on a remote server, wget can be a real life-saver.

If you like wget, then you’ll love cURL. Like wget, cURL can download files, but it can also post data to a Web page form, upload a file via the File Transfer Protocol (FTP), act as a proxy, set Hypertext Transfer Protocol (HTTP) headers, and a whole lot more. In many ways, cURL is a command-line surrogate for the browser and other clients. Thus, it has many potential applications.

The cURL utility is readily built using the tried-and-true ./configure && make && sudo make install process. Download, extract, and proceed:

$ wget http://curl.haxx.se/download/curl-7.19.4.tar.gz
$ tar xzf curl-7.19.4.tar.gz
$ cd curl-7.19.4
$ ./configure && make && sudo make install

The cURL utility has so many options, it’s best to read over its lengthy man page. Here are some common cURL uses:

  • To download a file—say, the cURL tarball itself—use:
    $ curl -o curl.tgz http://curl.haxx.se/download/curl-7.19.4.tar.gz
    

    Unlike wget, cURL emits what it downloads to stdout. Use the -o option to save the download to a named file.

  • To download a number of files, you can provide a sequence, a set, or both. A sequence is a range of numbers in brackets ([]); a set is a comma-delimited list in braces ({}). For example, the following command would download all files named parta.html, partb.html, and partc.html from the directories named archive1996/vol1 through archive1999/vol4, inclusive, for a total of 48 files.
    $ curl http://any.org/archive[1996-1999]/vol[1-4]/part{a,b,c}.html \
      -o "archive#1_vol#2_part#3.html"
    

    When a sequence or set is specified, you can provide the -o option with a template, where #1 is replaced with the current value of the first sequence or set, #2 is a placeholder for the second, and so on. As an alternative you can also provide -O to keep each file name intact.

  • To upload a suite of images to a server, use the -T option:
    $ curl -T "img[1-1000].png" ftp://ftp.example.com/upload/
    

    Here, the glob img[1-1000].png is captured in quotation marks to prevent the shell from interpreting the pattern. This command uploads img1.png through img1000.png to the named server and path.

  • You can even use cURL to look up words in the dictionary:
     $ curl dict://dict.org/d:stalwart
    220 miranda.org dictd 1.9.15/rf on Linux 2.6.26-bpo.1-686 
        <auth.mime> <400549.18119.1238445667@miranda.org>
    250 ok
    150 1 definitions retrieved
    151 "Stalwart" gcide "The Collaborative International Dictionary of English v.0.48"
    Stalwart \Stal"wart\ (st[o^]l"w[~e]rt or st[add]l"-; 277),
    Stalworth \Stal"worth\ (-w[~e]rth), a. [OE. stalworth, AS.
       staelwyr[eth] serviceable, probably originally, good at
       stealing, or worth stealing or taking, and afterwards
       extended to other causes of estimation. See {Steal}, v. t.,
       {Worth}, a.]
       Brave; bold; strong; redoubted; daring; vehement; violent. "A
       stalwart tiller of the soil." --Prof. Wilson.
       [1913 Webster]
    
             Fair man he was and wise, stalworth and bold. --R. of
                                                      Brunne.
       [1913 Webster]
    
       Note: Stalworth is now disused, or but little used, stalwart
             having taken its place.
             [1913 Webster]
    .
    250 ok [d/m/c = 1/0/20; 0.000r 0.000u 0.000s]
    221 bye [d/m/c = 0/0/0; 0.000r 0.000u 0.000s]
    

    Replace the word stalwart with the word you’d like to define.

In addition to its command-line personality, all of cURL’s capabilities are available from a library aptly named libcurl. Many programming languages include interfaces to libcurl to automate tasks such as transmitting a file via FTP. For example, this PHP snippet uses libcurl to deposit a file uploaded via a form to an FTP server:

<?php
  ...
  $ch = curl_init();
  $localfile = $_FILES['upload']['tmp_name'];
  $fp = fopen($localfile, 'r');
  curl_setopt($ch, CURLOPT_URL, 
      'ftp://ftp_login:password@ftp.domain.com/'.$_FILES['upload']['name']);
  curl_setopt($ch, CURLOPT_UPLOAD, 1);
  curl_setopt($ch, CURLOPT_INFILE, $fp);
  curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));
  curl_exec ($ch);
  $error_no = curl_errno($ch);
  curl_close ($ch);
  ...
?>

If you have to automate any sort of Web access, consider cURL.


Back to top

SQLite: A database for most occasions

UNIX offers a slew of databases—many of them open source, some for general application, and some highly specialized. Most databases, though, tend to be large, independent applications—MySQL, for example, requires a separate installation, some configuration, and its own daemon—and may be overkill for a large class of software. Consider an address book accessory for the desktop: Is it appropriate to deploy MySQL to persist names and phone numbers? Probably not.

And what if the application is intended to run on a very small device or on a modest computer? Such hardware may not be suited to multiprocessing, a large memory footprint, or significant demands on physical storage. Certainly, an embedded database is an alternative. Typically, an embedded database is packaged as a library and is linked directly to application code. Such a solution makes the application independent of an external service, albeit at a cost: Queries aren’t typically expressed in Structured Query Language (SQL).

SQLite combines the best of all worlds: The software is tiny, you can embed it in virtually any application, and you can query your data with vanilla SQL. PHP and Ruby on Rails use SQLite as the default storage engine, as does the Apple iPhone.

To build SQLite, download the source amalgamation (a single file combining all the source) from the SQLite download page, extract it, and run ./configure && make && sudo make install.

$ # As of March 2009, the latest version was 3.6.11. 
$ wget http://www.sqlite.org/sqlite-amalgamation-3.6.11.tar.gz
$ tar xzf sqlite-amalgamation-3.6.11.tar.gz
$ cd sqlite-3.6.11
$ ./configure && make 
$ sudo make install

The build produces a library and associated application programming interface (API) header files as well as a stand-alone command-line utility named sqlite3 that’s useful for exploring features. To create a database, launch sqlite3 with the name of the database. You can even place SQL right on the command line, which is great for scripting:

$ sqlite3 comics.db "CREATE TABLE issues \
  (issue INT PRIMARY KEY, \
  title TEXT NOT_NULL)" 
$ sqlite3 comics.db "INSERT INTO issues (issue, title) \
  VALUES ('1', 'Amazing Adventures')"
$ sqlite3 comics.db "SELECT * FROM issues"
1|Amazing Adventures

The first command creates the database (if it does not exist already) as well as a table with two columns, an issue number, and a title. The middle command inserts a row, and the final command shows the contents of the table.

SQLite offers triggers, logging, and sequences. SQLite is also typeless, unless you specify a type. For example, the issues table declared works fine without types:

$ sqlite3 comics.db "create table issues (issue primary key, title)"
$ sqlite3 comics.db "INSERT INTO issues (issue, title) \
  VALUES (1, 'Amazing Adventures')"
$ sqlite3 comics.db "SELECT * FROM issues"1|Amazing Adventures

Lack of type is considered a feature, not a bug, and has many applications.


Back to top

Grab XAMPP, an off-the-shelf Web stack

If you want to use your UNIX machine as a Web server, you have oodles of choices to compose a Web stack. Of course, there’s the Apache HTTP Server, MySQL, Perl, PHP, Python, and Ruby on Rails, and this article recommends some components you may not have heard of previously, including SQLite and lighttpd.

But building a stack from scratch isn’t everyone’s cup of tea. Configuring Apache and other software packages to interoperate can be maddening at times, and you may not want the onus of maintaining the source yourself, recompiling each time a new patch is issued. For those good reasons, you might opt for an off-the-shelf stack. Just install and go!

XAMPP is one of many pre-packaged Web stacks you can find online. It includes Apache and compatible builds of MySQL, PHP, and Perl. A version of XAMPP is available for Linux, Sun Solaris, Windows, and Mac OS X. You download XAMPP, extract it, and start:

# The latest version for Linux was 1.7
$ wget http://www.apachefriends.org/download.php?xampp-linux-1.7.tar.gz
$ sudo tar xzf xampp-linux-1.7.tar.gz -C /opt
$ sudo /opt/lampp/lampp start
Starting XAMPP 1.7...
LAMPP: Starting Apache...
LAMPP: Starting MySQL...
LAMPP started.

The second command extracts the XAMPP distribution and places it directly in /opt (thus the need to preface the command with sudo. If you want to locate XAMPP elsewhere, change the argument to -C. The last command launches Apache and MySQL, the two daemons required to serve a Web site. To test the installation, simply point your browser to http://localhost. You should see something like Figure 1.
Figure 1. The XAMPP stack start page
The XAMPP stack start page

Click Status to see how things are operating. XAMPP provides phpMyAdmin and webalizer to create and manage MySQL databases on the server and measure Web traffic, respectively.

By the way, XAMPP also provides the entire source code to the stack, so you can apply customizations or add to the stack if you need to. If nothing else, the XAMPP source code reveals how to build a stack, if you want to eventually tackle or customize the process yourself.


Back to top

Go small with the lighttpd server

XAMPP and many bundles like it package the Apache HTTP Server. Apache is certainly capable—by most measures, it still powers the majority of sites worldwide—and an enormous number of extensions is available to add wholesale subsystems and integrate tightly with programming languages.

But Apache isn’t the only Web server available, and in some cases, it isn’t preferable. A complex Apache instance can require an immense memory footprint, which limits throughput. Further, even a small Apache instance may be excessive compared to the return.

“Security, speed, compliance, and flexibility” describe lighttpd (pronounced “lighty”), a small and very efficient alternative to Apache. Better yet, the lighttpd configuration file isn’t the morass that Apache’s is.

Building lighttpd from scratch is a little more involved, because it depends on other libraries. At a minimum, you need the development version (the version that includes the header files) of the Perl Compatible Regular Expression (PCRE) library and the Zlib compression library. After you’ve installed those libraries (or built the libraries from scratch), compiling lighttpd is straightforward:

$ # Lighttpd requires libpcre3-dev and zlib1g-dev
$ wget http://www.lighttpd.net/download/lighttpd-1.4.22.tar.gz
$ tar xzf lighttpd-1.4.22.tar.gz
$ cd lighttpd-1.4.22
$ ./configure && make && sudo make install

Next, you must create a configuration. The most minimal configuration possible sets the document root, server port, a few Multipurpose Internet Mail Extension (MIME) types, and the default user and group for the daemon:

server.document-root = "/var/www/lighttpd/host1"
server.groupname = "www" 
server.port = 3000
server.username = "www" 

mimetype.assign = (
  ".html" => "text/html", 
  ".txt" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png" 
)

static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html" )

Assuming that you saved the text to a file named /opt/etc/lighttpd.conf, you start lighttpd with lighttpd -D -f /opt/etc/lighttpd.conf.

Like Apache, lighttpd can serve virtual hosts. All it takes is three lines, using a conditional:

$HTTP["host"] == "www2.example.org" {
  server.document-root = "/var/www/lighttpd/host2
}

Here, if the host is named www2.example.org, an alternate document root is used.

Lighttpd is especially adept at managing large numbers of parallel requests. You can readily mix lighttpd with Rails, PHP, and more.


Back to top

Better, smarter, faster

Yet another “Speaking UNIX” draws to a close. Break out those keyboards, fire up the Wi-Fi, and start downloading!

Resources

Learn

  • Speaking UNIX: Check out other parts in this series.
  • UNIX shells: Learn more about UNIX shells.
  • AIX and UNIX: Visit the developerWorks AIX and UNIX zone provides a wealth of information relating to all aspects of AIX systems administration and expanding your UNIX skills.
  • New to AIX and UNIX? Visit the New to AIX and UNIX page to learn more.
  • Technology bookstore: Browse for books on this and other technical topics.

Get products and technologies

  • pwgen: Download the source code for pwgen.
  • multitail: Download the source code for multitail.
  • p7zip: Download the source code for p7zip, the port of 7zip to UNIX.
  • cURL: Download the code for cURL.
  • SQLite: You can download the source code for SQLite from its project page.
  • XAMPP: Download XAMPP from the Apache Friends.
  • Lighttpd: Download the source code for lighttpd.

Discuss

Written by qpieus

February 14, 2010 at 9:14 am

Posted in linux

Tagged with

Grub 2 Guide

leave a comment »

The Grub 2 Guide
(formerly Grub 2 Basics)

http://ubuntuforums.org/showthread.php?t=1195275

https://help.ubuntu.com/community/Grub2

Important Note to Wubi (Windows Ubuntu) Users:
Recent January 2010 updates are triggering a bug in the ntfs module, causing Wubi boot failures. The solution to this boot problem was posted by Agostino Russo and is found in this Lucid Lynx LaunchPad Bug Report #477169, Post 210. The module causing the errors has been fixed and replacing the “wubildr” file in Windows permanently solves this problem. See the bug report for details.

Note: Most of this information has been incorporated, with a few graphics, into a page in the Ubuntu Help site. I will try to keep this post up-to-date and users are free to continue to post comments here. The help page is located here: https://help.ubuntu.com/community/Grub2

  1. Introduction
  2. First Look Differences
  3. Improvements
  4. Booting Grub
  5. Grub 2 Files & Options
  6. Adding Entries to Grub 2
  7. Removing Entries from Grub 2
  8. Grub 2 Splash Images & Theming
  9. Changing Menu Resolution
  10. Password Protection
  11. Booting to Recovery Mode w/o Menu Option
  12. Uninstalling GRUB 2 > GRUB
  13. Reinstalling GRUB 2 from the LiveCD
  14. Booting to LiveCD ISO
  15. Booting from the Rescue Mode
  16. Restoring GRUB2 / XP / Vista / Win 7 Bootloaders
  17. Selected Problems & Bugs
  18. Links

  1. Introduction
    I’ve written this guide to present some basic information about Grub 2. It is meant for users who may be familiar with basic editing of the original Grub (Grub Legacy) menu.lst and wonder how it carries over to Grub 2. I will not cover how to install or uninstall Grub 2 or whether you should convert to Grub 2. The actual version of Grub 2 used in Ubuntu 9.10, Karmic Koala, is 1.97~beta4. In keeping with Ubuntu’s “stable release” philosophy, 1.97~beta4 will remain the official version in Ubuntu until Ubuntu 10.4, Lucid Lynx, is introduced this spring. In this guide, any reference to Grub 2 will refer to the current stable release version.

    Grub 2 will be the default in Ubuntu 9.10, Karmic Koala but the plan is not to convert over previous Grub legacy installations to Grub 2.
    Official Announcement / Story

    StartUp-Manager supports Grub 2, but not all options are available. The two most-used items, however, are: setting the default kernel/OS and setting the menu timeout delay. There are plans for a StartUp-Manager 2 that works only for Grub 2 but it is still under development according to its creator. To view a guide on installing and running StartUpManager, view the StartUpManager community doc or the forum post on which it was based: http://ubuntuforums.org/showthread.php?t=818177

    Also note that Grub 2 is still in development. Official documentation at this point is limited and still being created. That is partly the reason for this post. More comprehensive and complete documentation will hopefully be forthcoming from the developers and volunteers. Of the existing documentation, I have have provided several links to the better sources at the end of this post.

    First, before proceeding, confirm the version of Grub you are using. Running this command should provide the version:

    Code:
    grub-install -v

    Which should produce something like this:

    Quote:
    drs305@mycomputer:~$ grub-install -v
    grub-install (GNU GRUB 1.97~beta4)
  2. First Look Differences: GRUB vs GRUB 2
    At first boot, there will not be much difference in what the user sees on the boot menu. The one exception is a clean install of Ubuntu 9.10 with no other installed operating system. In this case, GRUB 2 will boot directly to the login prompt or Desktop without displaying a menu. Other major differences:

    • No ”/boot/grub/menu.lst”. It has been replaced by ”/boot/grub/grub.cfg”.
    • Hold down SHIFT to display the hidden menu during boot (formerly ESC is GRUB legacy).
    • There is no “find /boot/grub/stage1” at the grub prompt. Stage 1.5 has also been eliminated.
    • The main menu file, ”/boot/grub/grub.cfg” is not meant to be edited, even by ‘root’.
    • ”grub.cfg” is overwritten anytime there is a update, a kernel is added/removed or the user runs `update-grub` *
    • The user can use a custom file, ”/etc/grub.d/40_custom”, in which the user can place his own entries. This file will ”not” be overwritten.
    • The primary configuration file for changing menu display settings is ”/etc/default/grub”.
    • There are multiple files for configuring the the menu – ”/etc/default/grub” mentioned above, and all the files in ”/etc/grub.d/” folder.
    • Other operating systems, such as Windows, should automatically be recognized and added to the menu.
    • No changes made in the configuration files will take effect until the `update-grub` command is also run.

    * To update the GRUB 2 menu, the command sudo update-grub will be used throughout this guide. update-grub actually runs the command “grub-mkconfig -o /boot/grub/grub.cfg” This runs several scripts and incorporates the results into /boot/grub/grub.cfg which detemines what is seen on the screen during boot. Since the GRUB 2 developers do not intend to remove the update-grub ‘stub’, it will be used for simplicity and ease of use.

  3. Improvements
    GRUB 2’s major improvements over the original GRUB include:

    • New configuration file structure
    • Scripting support including conditional statements and functions
    • Dynamic module loading
    • Rescue mode
    • Themes
    • Graphical boot menu support and improved splash capability
    • Easily boot LiveCD ISO images directly from hard drive
    • Non-X86 platform support (such as PowerPC)
    • Universal support for UUIDs (not just Ubuntu)
    • Improved internationalization, including support for non-ASCII characters
    • Note: openSUSE & Fedora have not yet adopted GRUB 2
  4. Booting Grub
    Grub 2 loads before the operating system. It’s modular components are loaded on an as-needed basis. Menu display behavior is generally determined by settings in /etc/default/grub. Review the “Grub 2 Files & Options” section for specific entry and formatting guidance.

    The main options for displaying the menu are:

    • Initial Default
      • Grub 2 will boot straight into the default operating system if no other operating system is detected. No menu will be displayed. If another operating system is detected, the Grub 2 menu will display.
    • Timed display.
      • The default delay is 10 seconds. If no user input is made Grub 2 boots to the default entry.
      • The countdown can be stopped by pressing any key. The user must then make a selection manually.
      • The booted entry is determined by the DEFAULT= setting in /etc/default/grub, The first “menuentry” is 0.
    • Hidden
      • The user can interrupt the boot process and display the menu by holding down the SHIFT key until the menu displays. Grub 2 searches for a depressed SHIFT key signal during boot. If the key is pressed or Grub 2 cannot determine the status of the key, the menu is displayed.
      • The time the screen remains blank but available for display is determined by a setting in /etc/default/grub.
      • To provide visual feedback during while the countdown continues, a countdown display can be shown on the screen.
      • At the end of the timeout, the default entry determined in /etc/default/grub will be selected.
    • Saved
      • If the default option is set to “saved”, the last kernel/system successfully booted will be selected and run if no input is made.
      • Unlike GRUB, GRUB 2 stores the “saved” entry as a string, not as a menu position number. In GRUB 2, the result is applied more consistently. Example: If the first entry (kernel -15) becomes the second entry due to a kernel update, it will still be the “saved” entry even though it’s position on the menu has changed.
  5. Grub 2 Files & Options
    Many of the files in /boot/grub will not be recognizable by users of Grub Legacy. Especially noticeable are the multitude of *.mod files. Grub 2 is modular and these files are loaded as necessary by the grub bootloader.

    The Grub 2 user-configurable settings are contained mainly in /etc/default/grub and the files in /etc/grub.d. When update-grub is executed the results are input into the /boot/grub/grub.cfg file.

    • /boot/grub/grub.cfg
      • This is the main Grub 2 file. It “replaces” Grub Legacy’s /boot/grub/menu.lst This file contains the Grub menu information but unlike Grub Legacy’s menu.lst file, grub.cfg is not meant to be edited.
        • grub.cfg is automatcially generated when “update-grub” is executed:
        • Each section (### BEGIN) is clearly delineated and references the file in the /etc/grub.d folder from which the information was generated.
        • grub.cfg is updated by running the “update-grub2” or “update-grub” command as root.
        • By default, and whenever the “update-grub2” command is executed, this file is made “read-only”. This is in keeping with the intent that the file should not be edited manually. If you must edit this file, instructions are provided in Section 2.
      • Sample grub.cfg including Windows and one manual entry (41_srcd):
        Code:
        #
        # DO NOT EDIT THIS FILE
        #
        # It is automatically generated by /usr/sbin/grub-mkconfig using templates
        # from /etc/grub.d and settings from /etc/default/grub
        #
        
        ### BEGIN /etc/grub.d/00_header ###
        load_env
        set default="0"
        if [ ${prev_saved_entry} ]; then
          saved_entry=${prev_saved_entry}
          save_env saved_entry
          prev_saved_entry=
          save_env prev_saved_entry
        fi
        insmod ext2
        set root=(hd0,1)
        search --no-floppy --fs-uuid --set 7ebcfe33-6914-42ec-9d2e-0859f7396925
        if loadfont /usr/share/grub/unicode.pf2 ; then
          set gfxmode=640x480
          insmod gfxterm
          insmod vbe
          if terminal_output gfxterm ; then true ; else
            # For backward compatibility with versions of terminal.mod that don't
            # understand terminal_output
            terminal gfxterm
          fi
        fi
        if [ ${recordfail} = 1 ]; then
          set timeout=-1
        else
          set timeout=10
        fi
        ### END /etc/grub.d/00_header ###
        
        ### BEGIN /etc/grub.d/10_linux ###
        menuentry "Ubuntu, Linux 2.6.31-12-generic" {
                recordfail=1
                save_env recordfail
            set quiet=1
            insmod ext2
            set root=(hd0,1)
            search --no-floppy --fs-uuid --set 7ebcfe33-6914-42ec-9d2e-0859f7396933
            linux    /boot/vmlinuz-2.6.31-12-generic root=UUID=7ebcfe33-6914-42ec-9d2e-0859f7396933 ro   quiet splash
            initrd    /boot/initrd.img-2.6.31-12-generic
        }
        menuentry "Ubuntu, Linux 2.6.31-12-generic (recovery mode)" {
                recordfail=1
                save_env recordfail
            insmod ext2
            set root=(hd0,1)
            search --no-floppy --fs-uuid --set 7ebcfe33-6914-42ec-9d2e-0859f7396933
            linux    /boot/vmlinuz-2.6.31-12-generic root=UUID=7ebcfe33-6914-42ec-9d2e-0859f7396933 ro single
            initrd    /boot/initrd.img-2.6.31-12-generic
        }
        menuentry "Ubuntu, Linux 2.6.31-11-generic" {
                recordfail=1
                save_env recordfail
            set quiet=1
            insmod ext2
            set root=(hd0,1)
            search --no-floppy --fs-uuid --set 7ebcfe33-6914-42ec-9d2e-0859f7396933
            linux    /boot/vmlinuz-2.6.31-11-generic root=UUID=7ebcfe33-6914-42ec-9d2e-0859f7396933 ro   quiet splash
            initrd    /boot/initrd.img-2.6.31-11-generic
        }
        menuentry "Ubuntu, Linux 2.6.31-11-generic (recovery mode)" {
                recordfail=1
                save_env recordfail
            insmod ext2
            set root=(hd0,1)
            search --no-floppy --fs-uuid --set 7ebcfe33-6914-42ec-9d2e-0859f7396933
            linux    /boot/vmlinuz-2.6.31-11-generic root=UUID=7ebcfe33-6914-42ec-9d2e-0859f7396933 ro single
            initrd    /boot/initrd.img-2.6.31-11-generic
        }
        ### END /etc/grub.d/10_linux ###
        
        ### END /etc/grub.d/20_memtest86+ ###
        
        ### BEGIN /etc/grub.d/30_os-prober ###
        menuentry "Microsoft Windows XP Home Edition (on /dev/sda1)" {
            set root=(hd0,1)
            chainloader +1
        }
        ### END /etc/grub.d/30_os-prober ###
        
        ### BEGIN /etc/grub.d/40_custom ###
        menuentry "Jaunty 2.6.28-15-custom" {
            saved_entry=${chosen}
            save_env saved_entry
            set root=(hd0,8)
            linux    /boot/vmlinuz-2.6.28-15-custom root=UUID=48e03255-22b3-488b-ae7e-9dbe4e2beac7 ro  quiet splash
            initrd    /boot/initrd.img-2.6.28-15-custom
        }
        menuentry "SystemRescue" {
            saved_entry=${chosen}
            save_env saved_entry
                set root=(hd0,6)
                linux   /sysrcd/rescuecd subdir=sysrcd setkmap=us
                initrd  /sysrcd/initram.igz
        }
        ### END /etc/grub.d/40_custom ###
    • /etc/default/grub
      • This file contains information formerly contained in the upper section of Grub Legacy’s menu.lst and items contained on the end of the kernel line. The items in this file can be edited by a user with administrator (root) privileges.
        Quote:
        # If you change this file, run ‘update-grub’ afterwards to update
        # /boot/grub/grub.cfg.

        GRUB_DEFAULT=0
        #GRUB_HIDDEN_TIMEOUT=0
        GRUB_HIDDEN_TIMEOUT_QUIET=true
        GRUB_TIMEOUT=”3″
        GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
        GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
        GRUB_CMDLINE_LINUX=””

        # Uncomment to disable graphical terminal (grub-pc only)
        #GRUB_TERMINAL=console

        # The resolution used on graphical terminal
        # note that you can use only modes which your graphic card supports via VBE
        # you can see them in real GRUB with the command `vbeinfo’
        #GRUB_GFXMODE=640×480

        # Uncomment if you don’t want GRUB to pass “root=UUID=xxx” parameter to Linux
        #GRUB_DISABLE_LINUX_UUID=true

        # Uncomment to disable generation of recovery mode menu entrys

      • A few bugs still exist in the hidden menu feature. Hiding the menu, even with the correct “TIMEOUT” settings in /etc/default/grub may not work as described.
      • GRUB_DEFAULT – Sets the default menu entry. Entries may be numeric or “saved”
        • GRUB_DEFAULT=0 – Sets the default menu entry by menu position. As Grub Legacy, the first “menuentry” in grub.cfg is 0, the second is 1, etc.
        • GRUB_DEFAULT=saved – Sets the default menu entry with whatever was selected last. If the menu is displayed during boot, the last entry selected will be highlighted. If no action is taken, this selection will be booted at the end of the timeout or if the menu is hidden.
          • grub-set-default is enabled when this value is set to saved. You can quickly change the default OS/kernel with this command.
            • The format is “sudo grub-set-default X, with X being the menuentry position (starting with 0 as the first entry) or the exact menu string. Examples: sudo grub-set-default 3 or sudo grub-set-default “Ubuntu, Linux 2.6.31-14-generic”
            • To obtain the existing menuentry choice number (starting from 0) or the menuentry “string”, run “grep menuentry /boot/grub/grub.cfg”
        • GRUB_DEFAULT=”xxxx” – An exact menu entry, including the quotation symbols, may also be used. In this case, location in the menu will not matter. Example: GRUB_DEFAULT=”Ubuntu, Linux 2.6.31-9-generic”
        • One time boot – If you wish to boot to a specific entry for only the next boot, run grub-reboot “desired-menuentry as root. An accurate method of getting the menuentry correct is to copy it from the /boot/grub/grub.cfg file.
        • For an example of how to enable the “saved” option with a custom menu, see the “Custom User Entries” section.
      • GRUB_TIMEOUT=5 – No change from Grub Legacy. This is the number of seconds before the default entry is automatically booted.
        • Setting this value to -1 will cause the menu to display until the user makes a selection.
        • To display the menu on each boot use a value of 1 or higher.
        • This command defers to the GRUB_HIDDEN_TIMEOUT command. If the hidden display is interrupted by a key press, the GRUB_TIMEOUT counter begins its countdown.
        • Caution: Holding down the “SHIFT” key will not display the menu if “GRUB_TIMEOUT=” is set to “0” . To always have this interrupt capability, the keystatus check in /etc/grub.d/30_os-prober can be copied to /etc/grub.d/40_custom or to another script in the same folder. The keystatus check introduces a short timeout interruptible by the ESC key if the key status cannot be determined.
        • In addition to editing the file as root, you can also run the following commands the check and change the default timeout value. The first checks the existing timeout, the second replaces the value. Replace T with the new value.
          Code:
          cat /etc/default/grub | grep 'GRUB_TIMEOUT='   # Checks current TIMEOUT value.
          sudo sed 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=T/g' -i /etc/default/grub  # Change TIMEOUT value. Replace T with new value.
      • GRUB_HIDDEN_TIMEOUT=0
        • The menu will be hidden unless a # symbol is present at the beginning of this line. ( # GRUB_HIDDEN_TIMEOUT=0 )
        • The setting may depend on the presence of other operating systems.
          • Another OS Detected: The menu will be displayed. ( The line will begin with a # symbol. )
            According to some of the GRUB 2 developers, in Ubuntu the menu will not be hidden any time there are other OSs found by os-prober, regardless of this setting. This is in keeping with the Ubuntu Team’s goal towards booting: https://wiki.ubuntu.com/DesktopExper…pec#Bootloader
          • No other OS Detected: The menu will be hidden.
        • For integers greater than 0, the system will pause, but not display the menu, for the entered number of seconds.
        • 0 The menu will not be displayed. There will be no delay. When this entry is set to 0:
          • The user may force displaying the menu as the computer boots by holding down the SHIFT key.
          • During boot, the system will check the SHIFT key status. If it cannot determine the key status, a short delay will enable the user to display the menu by pressing the ESC key.
        • If enabled, the splash screen designated in 05_debian_theme will be displayed. This setting hides the menu only.
      • GRUB_HIDDEN_TIMEOUT_QUIET=true
        • true – No countdown is displayed. The screen will be blank.
        • false – A counter will display on a blank screen for the duration of the GRUB_HIDDEN_TIMEOUT value.
      • GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
        • Determines the descriptive name in the menu entry. (Ubuntu, Xubuntu, Debian, etc.)
      • GRUB_CMDLINE_LINUX
        If it exists, this line imports any entries to the end of the ‘linux’ command line (Grub Legacy’s “kernel” line) for both normal and recovery modes. This is similar to the “altoptions” line in menu.lst
      • GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
        This line imports any entries to the end of the ‘linux’ line (Grub Legacy’s “kernel” line). The entries are appended to the end of the normal mode only. This is similar to the “defoptions” line in menu.lst. For a black screen with boot processes displayed in text, remove “quiet splash”. To see the grub splash image plus a condensed text output, use “splash”. This line is where other instructions, such as “acpi=off” are placed.
      • #GRUB_TERMINAL=console
        Uncomment to disable graphical terminal (grub-pc only). This can be useful if the user plans on spending a lot of time in the GRUB 2 command line mode. Scrolling and screen responsiveness will be greatly speeded up.
      • #GRUB_DISABLE_LINUX_UUID=true
        Uncomment if you don’t want GRUB to pass “root=UUID=xxx” parameter to Linux
      • #GRUB_GFXMODE=640×480
        You can add this line and remove the # symbol to make it active. This entry sets the resolution of the graphical menu (the menu text size). It provides resolutions supported by the user’s graphics card (e.g. 640×480, 800×600, 1280×1024, etc). The setting applies only to the boot menu text.
      • From the GRUB 2 menu you can display available resolutions by typing “c” and then at the “grub>” prompt type “vbeinfo”
      • GRUB_DISABLE_LINUX_RECOVERY=true
        Add or uncomment this line to prevent “Recovery” mode kernel options from appearing in the menu. If you want a “Recovery” option for only one kernel, make a special entry in /etc/grub/40_custom.
      • GRUB_DISABLE_OS_PROBER=”true” – Enables/disables the os-prober check of other partitions for operating systems, including Windows, Linux, OSX and Hurd.
    • /etc/grub.d/
      • The files in this folder are read during execution of “update-grub” or “update-grub2” commands. The contents are imported into /boot/grub/grub.cfgThe order of the entries in the grub menu is based on the order of the file names. File named with a starting numeral are run before those beginning with a letter. The order the files are run determines the menu order in grub.cfg.
        Custom entries can be added to the “40_custom” file or in a newly created file.

        Any file created must be executable in order to be included in the grub.cfg file during the “update-grub2” command.

        • 00_header
        • 05_debian_theme: Set background and text colors, themes
        • 10_hurd Locates Hurd kernels
        • 10_linux Locates Linux kernels based on results of the “lsb_release” command.
        • 20_memtest86+: If the file /boot/memtest86+.bin exists, it is included as a menu item.
        • 30_os-prober: Searches for Linux and OS’s on other partitions and includes them in the menu.
        • 40_custom: A template for adding custom menu entries which will be inserted into grub.cfg upon execution of the “update-grub2” command. This and any other custom file must be made executable to allow importation into grub.cfg.
  6. Adding Entries to Grub 2
    Menu entries can be added to grub.cfg automatically or manually.

    • Automatically.
      • When “update-grub” or “update-grub2” is executed, Grub 2 will search for linux kernels and other Operating Systems. What and where is looks is based on the files contained in /etc/grub.d folder.
        • 10_linux searches for installed linux kernels on the same partition.
        • 30_os-prober searches for other operating systems.
    • Custom User Entries (/etc/grub.d/40_custom).
      • Entries to grub.cfg can be manually inserted by creating a file in the /etc/grub.d folder.
        • The name of the file determines the order in the menu. 30_os-prober entries will be placed before 40_custom entries, which will be placed before 50_my-sample entries.
        • Any created file must be made executable. This can be done as root by running “sudo chmod +x /etc/grub.d/filename“.
        • The files in the /etc/grub.d folder will be read and the contents included in grub.cfg when the “update-grub2” command is executed as root.
      • A sample entry. This file creates a menu item for running the SystemRescueCD (previously installed) from a partition created on sda10. Folders and files must have been copied to the correct location in accordance with the SystemRescueCD if you wish to actually use this entry.
        • Quote:
          #!/bin/sh
          exec tail -n +3 $0
          # This file provides an easy way to add custom menu entries. Simply type the
          # menu entries you want to add after this comment. Be careful not to change
          # the ‘exec tail’ line above.

          echo “Adding SystemRescueCD” >&2
          menuentry “System Rescue CD” {
          set root=(hd0,10)
          linux /sysrcd/rescuecd subdir=sysrcd setkmap=us
          initrd /sysrcd/initram.igz
          }

        • Note the new partition naming convention. Devices start counting from “0” as done previously. sda is designated as “hd0”, sdb is “hd1”, etc. However the first partition is now designated as sda1. Counting partitions does not start with “0”. sda5 is “5”.
        • The line ‘echo “Adding SystemRescueCD” >&2‘ is not required. Including it in the file allows this line to be seen in the terminal when “update-grub2” is executed. It provides visual feedback that the entry has been found and entered. The entry, if in the correct format, will be inserted in grug.cfg whether or not this line is included in the file.
      • Tip: If you want to have your custom entries at the top of the menu (say you want custom titles), create a new file and name it “07_xxxx”. Since the files in /etc/grub.d/ are read sequentially, those in “07_custom” will be placed before those of “10_linux”. I recommend not naming a custom menu file lower than 06 so that any theme run from 05_debian_theme is allowed to run before any custom menu is created. After creating the file, run sudo update-grub and then check the value of “DEFAULT” in /etc/default/grub. If it doesn’t point to the correct menuentry, change the value of DEFAULT to the correct menuentry value.
      • Omitting memtest86+: To prevent “memtest86+” entries in your Grub 2 menu, remove the “executable” bit from /etc/grub.d/20_memtest86+. You can do this via a file browser by selecting “Properties (right click), Permissions”, or via the command line:
        Code:
        sudo chmod -x /etc/grub.d/20_memtest86+
      • Omitting Recovery Mode entries: The file /etc/grub.d/10_linux was recently updated to include a check for recovery mode options. Edit /etc/default/grub and add or change this line:
        Quote:
        GRUB_DISABLE_LINUX_RECOVERY=true

        If you have an older version of /etc/grub.d/10_linux and the above does not work after updating grub, you can prevent “Recovery mode” entries in your Grub 2 menu, by editing /etc/grub.d/10_linux. If there are no conditional “if” statements concerning the recovery mode, place a comment symbol (#) in front of the following lines (at approximately line 146) of the old file:

        Quote:
        # linux_entry “${OS}, Linux ${version} (recovery mode)” \
        # “single ${GRUB_CMDLINE_LINUX}”

        If you wish to retain one “Recovery mode” entry for insurance, you can add an entry to /etc/grub.d/40_custom which will appear at the bottom of your grub menu.

      • Building a Totally Customized Menu: Ok, admit you are a control freak and you want to see only what you build yourself – customized titles, no “memtest86+” and no extra kernels. Here is how you do it:
        • Run sudo update-grub to get the current available kernels.
        • Copy the desired “menuentry” listings from /boot/grub/grub.cfg to /etc/grub.d/40_custom The entry begins with the line starting with “menuentry” and ends with a line containing “}”.
        • Add any other “menuentry” items you wish to see on the boot menu.
        • Edit the titles of the “menuentry” line if desired (between the quotation symbols). Do not change the lines following the “menuentry” line. Each entry should start with a “menuentry” line and end with a “}” on the last line.
        • Remove the executable bit from /etc/grub.d/10_linux, /etc/grub.d/20_memtest86+ and /etc/grub.d/30_os-prober
          Removing the executable bit from any file in /etc/grub.d will exclude the file from being included in grub updates.

          Code:
          sudo chmod -x /etc/grub.d/10_linux /etc/grub.d/20_memtest86+ /etc/grub.d/30_os-prober
        • Run “sudo update-grub”
        • The updated /boot/grub/grub.cfg file should now contain only sections for “00_header”, “05_debian_theme” and “40_custom”.
        • The grub.cfg file will not be updated with the addition of a new kernel. To add a new kernel, make “10_linux” executable, run “sudo update-grub” to refresh the available kernels, and repeat these instructions.
      • Incorporating the DEFAULT=save Option: In order to enable the “saved default” option with which Grub 2 preselects the last successfully-used option at boot, the “DEFAULT=save” option must be entered in /etc/default/grub and the 40_custom file must be modified. An example of a 40_custom file follows:
        • Quote:
          #! /bin/sh -e

          prefix=/usr
          exec_prefix=${prefix}
          libdir=${exec_prefix}/lib
          . ${libdir}/grub/grub-mkconfig_lib
          echo “Adding SystemRescueCD & Custom Kernel” >&2

          menuentry “Jaunty 2.6.28-15-custom” {
          save_default_entry | sed -e “s/^/\t/”
          set root=(hd0,7)
          linux /boot/vmlinuz-2.6.28-15-custom root=UUID=12c55255-27b3-488b-hje7e-9dbe4e2esfg5 ro quiet splash
          initrd /boot/initrd.img-2.6.28-15-custom
          }

          menuentry “SystemRescue” {
          save_default_entry | sed -e “s/^/\t/”
          set root=(hd0,6)
          linux /sysrcd/rescuecd subdir=sysrcd setkmap=us
          initrd /sysrcd/initram.igz
          }

        • Manual Windows Entry (with /etc/grub.d/30_os-prober made unexecutable)
          Quote:
          #! /bin/sh -e

          echo “Adding Windows 43_custom” >&2
          menuentry “Windows Vista 43_custom” {
          insmod chain
          insmod ntfs
          search –fs-uuid –set CFFCFF9EECFF7F49
          chainloader +1
          }

      • Don’t forget to run “sudo update-grub” after making any changes to your /etc/grub.d files.
    • Manual Editing of grub.cfg (Not encouraged)
      Manual editing of /boot/grub/grub.cfg is not encouraged. Think of grub.cfg as a result, not as an initiator. The files that should be edited are contained in the /etc/grub.d folders and the /etc/default/grub file.

      In order to discourage its editing, grub.cfg is read-only. Even attempting to open, edit and save this file using root privileges cannot be done until the ‘read-only’ status is changed. If you must edit this file:

      Code:
      sudo chmod +w /boot/grub/grub.cfg
      gksudo gedit /boot/grub/grub.cfg

      Note: This file is returned to ‘read-only’ status anytime the update-grub command is run.

  7. Removing Entries from Grub 2
    Entries should be removed by editing or removing files in the /etc/grub.d folder. The /boot/grub/grub.cfg file is read-only and should not normally require editing.

    • Automatically.
      • Too Many Kernels? Kernels removed via Synaptic or with “apt-get remove” will automatically update grub.cfg and no user action is required.
        • In Synaptic, type the kernel number in the search window at the upper right (for example – 2.6.28-11).
        • Find the “linux-image” and “linux-headers” files for the applicable kernel (example – linux-image-2.6.26-11 or “linux-image-2.6.26-11-generic).
        • Right click and select “Mark for Complete Removal” and then press the Apply main menu button.
        • The kernels will be removed from your system and from the Grub menu.
        • If you are not sure of the kernel you are currently using, in a terminal type “uname -r”.
        • Many users keep one previous kernel on the machine which previously ran without problems.
      • Other Operating Systems which have been removed from the computer will also be removed from the menu once “update-grub2” is run as root.
      • To prevent one of the /etc/init.d files from running, remove the “executable” bit.
        • Example: If you don’t want to see the “Memtest86+” entries, run this command:
          Code:
          sudo chmod -x /etc/grub.d/20_memtest86+
        • Run the update-grub command to allow the changes to be incorporated in grub.cfg

      User-Created Entries.

      • To remove a user-created menu entry, remove the applicable file from the /etc/grub.d folder.
      • If a custom file contains multiple entries, individual items may be removed and others retained.
      • Once the file has been removed or edited, run “update-grub2” to update grub.cfg.
  8. Grub 2 Splash Images & Theming
    Why reinvent the wheel? Visit this site for an excellent presentation on creating Grub 2 images:
    http://members.iinet.net/~herman546/p20/GRUB2%20Splashimages.html

    However, if encrypted disks are not an issue, here are the basics:

    • Manually copy grub splash images into the /usr/share/images/grub folder or install the default grub2 splash images via Synaptic or:
      Code:
      sudo apt-get install grub2-splashimages
    • The grub2’s splash images are controlled by /etc/grub.d/05_debian_theme. Open this file for editing:
      Code:
      gksudo gedit /etc/grub.d/05_debian_theme
      • Grub 1.97~beta4
        Find the following line and edit the highlighted area, replacing it with the grub splash image you wish to use (and located in /usr/share/images/grub):

        Quote:
        for i in {/boot/grub,/usr/share/images/grub}/moreblue-orbit-grub.{png,tga} ; do

        Note: There is a period ( . ) following the filename.

        • At one point Grub 2 splash images were downloaded and stored in /usr/share/images/desktop.base If this is where your grub images are stored, change the address in the previous command accordingly ( … /usr/share/images/desktop-base} … ).
      • Grub 1.97 (non-beta) & later)
        It’s a little easier to understand in Grub 1.97 (non-beta) and later versions of Grub. Find the following line and edit the highlighted area, replacing it with the path and grub splash image you wish to use:

        Quote:
        WALLPAPER=”/<path-to-image>/<your-image-name-here-including-extension>”

        Example: WALLPAPER=”/home/my_username/grub_images/my_grubimage.png”

        • At one point Grub 2 splash images were downloaded and stored in /usr/share/images/desktop.base If this is where your grub images are stored, change the address in the previous command accordingly ( … /usr/share/images/desktop-base} … ).
    • Save the file, then update grub2:
      Code:
      sudo update-grub2

    A Note About Grub 2 Theming
    Theming is still under development in Grub 2. There are several different approaches being taken and users of Lucid have had success incorporating theming into their bootlaoder menus. For those interested in trying out the experimental theming possibilities, here are some references:
    GRUB2 theming for lucid? This thread has an excellent discussion about the state of theming in in bootloaders, as well as instructions on how to set it up as you get further into the thread. Both BURG and Grub 2 experimental are discussed.
    Grub 2 Experimental:
    http://grub.gibibit.com/ One method of introducing theming, when combined with this Launcpad PPA for Grub 2 experimental, Felix Zielcke’s PPA
    BURG:
    https://help.ubuntu.com/community/Burg and https://help.ubuntu.com/community/Burg

  9. Changing Menu Resolutions
    If the user wishes to change the resolution of the GRUB 2 screen while using a splash image follow these steps:

    1. Set the desired resolution in /etc/default/grub
      • Change the value of GRUB_GFXMODE= (Example: GRUB_GFXMODE=800×600)
        • If unsure of what resolutions are available to GRUB 2 they can be displayed by typing vbeinfo in the GRUB 2 command line. The command line is accessed by typing “c” when the main GRUB 2 menu screen is displayed.
    2. Select an image of the same size and make the change in /etc/grub.d/05_debian_theme
      • The image name is located in the line beginning with ” for i in {/boot”
      • If an image of the correct size is not used, the menu will not be positioned correctly.
      • Use the image editor of your choice to create/resize an image to the correct size.
      • The user may be able to view the image size via Properties in a file browser (check the Properties Image tab in Nautilus).
    3. Run update-grub as root to add the new settings to /boot/grub/grub.cfg
  10. Basic Password Protection Note: To reduce the size of this entry, a separate post with information on establishing Grub 2 password protection is located on the Ubuntu forums at: Grub 2 Password Protection and in the links at the bottom of this post.Grub 2 currently supports unencrypted password protection. Encrypted password protection using PBKDF2, as well as password scripting, is currently under development.

    Some of the major points regarding Grub 2 password protection:

    • Grub 2 has the ability to set password protection on individual menuentries and/or for specific users. Examples: Password protect Windows Recovery; prevent user2 from opening the Recovery mode.
    • If password protection is enabled, the superuser username and password are required to gain access to the Grub 2 command line and menu editing modes.
    • The username and/or password do not have to be the same as the Ubuntu logon name/password.
    • This is basic password security. The name/password are unencrypted; anyone having physical access to the machine and more than an elementary knowledge of how Linux works will be able to access the configuration files and bypass this feature.
    • Grub 2 password protection is still being developed. Encryption is available in experimental versions only. If password protection is used, recheck your scripts for changes whenever a new Grub 2 update is released. In 1.97~beta4, passwords must be assigned to each desired menu item. In Lucid Lynx, expect Grub 1.97 to password protect the entire Grub 2 menu if a superuser is designated.
  11. How to Boot to the Recovery Mode w/o a Menu Option
    1. If you have Grub 2 set to boot without displaying the menu at all, hold the SHIFT key down until the menu displays. (In Grub it was the ESC key.)
    2. Press any key once the menu is displayed to ‘freeze’ it. Then arrow to the kernel you want to boot.
    3. Press “e”
    4. Scroll to the end of the “linux /boot/vmlinuz….” line. If displayed, remove “quiet” and/or “splash”. Add the word “single” to the end of the line.
    5. Press CTRL-X to boot to the Recovery menu.
  12. Uninstalling GRUB 2
    The command line produces a cleaner uninstall and reinstallation. While adding and removing the packages can be accomplished with Synaptic, certain steps must be accomplished in a terminal.

    • Open a terminal: Applications, Accessories, Terminal.
    • Make backup copies of the main GRUB 2 folders & files
      • Code:
        sudo cp /etc/default/grub /etc/default/grub.old
        sudo cp -R /etc/grub.d /etc/grub.d.old
        sudo cp -R /boot/grub /boot/grub.old
    • Remove GRUB 2
      • Code:
        sudo apt-get purge grub2 grub-pc
      • The user will be warned the system will be unbootable without installing another bootloader.
      • Once the packages are removed, many files will still remain in ‘/boot/grub’
    • Install GRUB 0.97
      • Code:
        sudo apt-get install grub
      • With ”grub” installed, the user must still create the ”menu.lst” and ”stage1/stage2” files.
      • Code:
        sudo update-grub
        • Generates ”menu.lst” Tab to “Yes” when prompted.
      • Code:
        sudo grub-install /dev/sdX
        • Choose the correct device (sda, sdb, etc), normally the one on which Ubuntu is installed.
        • Creates the ”stage1” & ”stage2” files in ”/boot/grub” and writes to the MBR.
    • Reboot
  13. Reinstalling GRUB 2 from LiveCD
    If you cannot boot from GRUB 2 and need to reinstall it, here is the simple method. For more details or for advanced options, refer to the Ubuntu community documentation here: Grub2 – Reinstalling GRUB 2:

    • Boot the 9.10 Karmic LiveCD to the Desktop.
    • Open a terminal – Applications, Accessories, Terminal.
    • Determine your normal system partition – `sudo fdisk -l` (That is a lowercase L)
    • If you aren’t sure, run `df -Th`. Look for the correct disk size and ext3 or ext4 format.
    • Mount your normal system partition:
      Code:
      sudo mount /dev/sdXY /mnt
      • Example: sudo mount /dev/sda1 /mnt
      • Note: The partition to mount is normally the partition on which Ubuntu was installed: sda1, sdb5, etc. If you have a separate /boot partition, use the device on which the /boot partition is located. Grub 2 works best when installed in the MBR of the drive to which BIOS boots. Also remember that you mount the partition (including the number) in this step, but you do not include the partition number when you run the “sudo grub-install” command later.
      • Note: GRUB 2 counts the first drive (X) as “0”, but the first partition (Y) as “1”
    • Only if you have a separate boot partition:
      • Code:
        sudo mount /dev/sdXY /mnt/boot

        with sdXY being your /boot partition designation.

    • Reinstall GRUB 2:
      Code:
      sudo grub-install --root-directory=/mnt /dev/sdX
      • Example: sudo grub-install –root-directory=/mnt /dev/sda
      • Note: Substitute the device on which Ubuntu was installed – sda, sdb, etc. Do not specify a partition number.
    • Unmount the partition:
      Code:
      sudo umount /mnt
    • Reboot.
  14. Booting from a LiveCD ISO
    This section is under construction. Although I have been able to successfully mount the 64-bit Karmic desktop ISO the results among the other releases is not consistent enough to post.
  15. Booting from the Rescue Mode
    At the grub rescue> prompt, accomplish the following actions to attempt to boot to the latest kernel:

    • ls This will display the known devices and partitions. From this information, the user must determine the device and partition on which the system is installed.
    • set Check the current settings. Note the prefix listing. If it is not pointing to the correct location:
      • set prefix=(hdX,Y)/boot/grub Examples: sda1 is (hd0,1), sdb5 is (hd1,5)
    • set root=(hdX,Y) X is the device/drive, starting with 0. Y is the partition, starting with 1. (Example: (hd0,1) is sda1. (hd3,5) is sdc5.
      • For Wubi installs, use: set root=(loop0)
    • ls /boot Inspect the contents. The user should see varioius kernels, initrd images and the grub folder. If not, use the ls command to inspect the device and attempt to find these files and folders. If necessary, set another device as root.
    • insmod /boot/grub/linux.mod Load the linux module. Without this module loaded, the user will receive an “Unknown command linux” message when trying to load the kernel.
    • linux /vmlinuz root=/dev/sdXY ro Load the linux kernel, substituting the correct designations for “X” and “Y” (example: sda1). The user will see a message showing the kernel has been loaded. (See graphic above)
      • Note: For Wubi installs within Windows, use this code: linux /vmlinuz root=/dev/sdXY loop=/ubuntu/disks/root.disk ro
    • initrd /initrd.img Load the initrd image. When pressing enter, the user may or may not see a message in the terminal. (See highlighted graphic above)
    • boot

    More command line recovery options are available in the “Command Line & Rescue Mode” section of the Ubuntu Grub 2 community doc.

  16. Restoring GRUB2 / XP / Vista / Win 7 Bootloaders
    talsemgeest has written an excellent guide on how to restore the bootloaders of various operating systems following the installation of another one. Make sure you reference the section for “9.10 and Beyond”, which is for GRUB 2.

    Rather than duplicate his efforts in this post, here is the link to the original:
    http://ubuntuforums.org/showthread.php?t=1014708

    Restoring Windows MBR without a Windows CD
    If you want to boot directly to Windows but Grub has overwritten the MBR, the normal procdeure is to use the Windows CD to restore things. If you do not have access to the Windows CD, the following commands will rewrite the MBR, removing Grub and allowing the system to boot directly into Windows.

    Boot the Ubuntu LiveCD, open a terminal (Applications, Accessories, Terminal) and enter the following commands. Make sure you correctly identify the Windows device (normally sda):

    Code:
    sudo apt-get install lilo
    sudo lilo -M /dev/sda mbr
  17. Selected Problems & Bugs meierfra has been busily building pages which detail how to solve many of the common problems users are experiencing with Grub 2. His SourceForge web page should be one of the first stops for those seeking answers to Grub 2 issues.No Menu On Initial Boot
    If you are already on the Ubuntu Desktop, run “sudo update-grub”. This may detect additional operating systems, which may allow the Grub menu to be displayed on the next boot. Otherwise:
    Open /etc/default/grub:

    Code:
    gksu /etc/default/grub

    Disable the “GRUB_HIDDEN_TIMEOUT=” line by placing a # symbol at the beginning of the line.
    Set “GRUB_TIMEOUT=” to a positive integer (number of seconds to display the menu before automatic selection) or “-1” to wait for the user to press ENTER (no timeout). The entry will look like this:

    Quote:
    #GRUB_HIDDEN_TIMEOUT=0
    GRUB_HIDDEN_TIMEOUT_QUIET=true
    GRUB_TIMEOUT=”10

    Save the file, update grub (“sudo update-grub”) and reboot.

    External Drive Installs – Bug bug/496435
    Installs of Ubuntu on external drives can cause problems as grub-install uses device names (e.g. sda, sdb) rather than UUIDs in certain circumstances. If connected to another machine when an update of grub-pc is made, the upgrade may be written to the incorrect device and make the computer unbootable.

    A workaround is posted on the bug link above.

    External Drive Installs and MBR – Bug bug/414996
    When installing Ubuntu to a USB drive, the potential exists for GRUB 2 to write to the hard drive’s MBR or split the installation between the hard drive and the USB drive (rather than completely on the USB device). This can render the main drive unbootable.

    Workaround: During the final stages of the install there is an “Advanced” button which allows the user to select the install location.

    HP Machines Fails to Load Grub after Using Windows – Bug [URL=”https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/441941″%5Dbug/441941/URL%5D
    After installing Grub 2 on a HP machine, the system boots normally until the first time it’s booted into Windows. On the next boot, the system hangs at “Grub loading”.

    Workaround: HP protection tools are rewriting to the MBR when Windows is run. The protecttools app must be removed/disabled. Refer to post #10 in the Bug Report.

    VGA Deprecated” Message on Boot
    Symptom: A blank screen appears with a message concerning VGA being deprecated after the menu item is selected (manually or by default). The message will be a variation of: “VGA=792 is deprecated. Use set GFX payload=1024x768x24, 1024×768 using the linux command instead.”

    The message probably is informing the user that there is a vga entry on either the “GRUB_CMDLINE_LINUX_DEFAULT=” or “GRUB_CMDLINE_LINUX=” line of /etc/default/grub. “Deprecated” means that there is a newer, preferred way to convey this instruction in GRUB 2. (Note the “vga=” method will still work, despite the message. It is advisory only.)

    In the example above, the line would probably look something like:

    Quote:
    GRUB_CMDLINE_LINUX_DEFAULT=quiet splash vga=792″
    GRUB_CMDLINE_LINUX=””

    To conform to the desired format and eliminate the message, change the above lines in /etc/default/grub to look like the following, using the “vga” value, and translated value, found in your current default file:

    Quote:
    GRUB_GFXMODE=1024×768
    GRUB_CMDLINE_LINUX_DEFAULT=quiet splash”
    GRUB_CMDLINE_LINUX=””

    Save the file and run “sudo update-grub” for the changes to be incorporated in the menu.
    There is a vga conversion table located at: http://wiki.archlinux.org/index.php/Gensplash From the GRUB 2 command line, you can run “vbeinfo” to see resolutions supported by your system.

    File Not Found (From a Grub 2 prompt)
    Not to be confused with the Grub Legacy “File Not Found – Error 15” (See next).
    When this message appears in Grub 2, it means that G2 cannot find one or more of the files required to accomplish the task. If this occurs, the user can use the “ls” command to find out what drives/partitions G2 sees. The output normally is something like (hd0) (hd0,1) (hd0,2) (hd0,5) (hd1) (hd0,1), etc. Remember the first drive (X) is “0”, the first partition (Y) is “1”. You can then inspect the contents, checking for the proper files with /boot, with “ls (hdX,Y)/boot”, for instance.

    Often in this case the user must reset “root” and/or “prefix”. You can see the current settings from the G2 command line with the command “set”. If you know the device/partition you want to boot, from the Grub 2 terminal run the following. You will get no feedback if there isn’t an error. You can check the results by running “set” again.

    Code:
    set root=(hdX,Y)                    # Example:  set root=(hd0,5)
    set prefix=(hdX,Y)/boot/grub        # Example for a normal Ubuntu install on sda1: set prefix=(hd0,1)/boot/grub

    error: no such device: 86d32ee3-aec6-490b-8dab-e5cfff9c7af9
    This error is the result of a failure of the GRUB 2 search function. There are various bugs associated with the search function. To boot into your system, highlight the OS you want to boot. Press “e” to edit the menuentry. Delete the entire “search …” line, then CTRL-x to boot.

    Once you have booted into the system, you will modify the /usr/lib/grub/grub-mkconfig_lib file in accordance with this link:
    Boot Problems:search

    File Not Found (Error 15)
    This error is the result of a GRUB 2 installation to /boot but a Master Boot Record ( MBR ) which still contains Grub legacy. This can happen if you don’t select your drive when running sudo update-from-grub-legacy. Shortly after starting this command the user will be asked to select the device (sda, sdb, etc). Highlight the drive and press the space bar to select it when presented with this screen. Failure to select a drive will result in an Error 15.

    To recover from this error, GRUB 2 must be reinstalled. Go to the community documentation File Not Found (Error 15) for instructions.

    If you find you need to remove the following lines manually to get Grub to boot properly:

    Quote:
    recordfail=1
    save_env recordfail

    Open /etc/grub.d/10_linux with admin rights:

    Code:
    gksu gedit /etc/grub.d/10_linux

    Look for this section and comment the lines in bold;

    Quote:
    linux_entry ()
    {
    menuentry “$1” {
    recordfail=1
    save_env recordfail

    Change it to:

    Quote:
    – linux_entry ()
    {
    menuentry “$1” {
    # recordfail=1
    # save_env recordfail

    Save the file, then run

    Code:
    sudo update-grub

    The two lines should no longer appear when you press E to view the selection in the Grub 2 menu. You will see a “save_env save_entry” line but this should not cause the failure if you successfully booted the previous time.

    Grub 2 Hangs 10-30 Seconds between Grub 2 Loading and Menu Display.
    This is a known bug that can be caused by GRUB 2 and /boot being loaded on different partitions. To fix the problem, run

    Code:
    sudo dpkg-reconfigure grub-pc

    Select to load Grub 2 on the same device as the /boot partition. In your system BIOS, change the drive to boot from first to the drive with the /boot partition.

    Wubi Installs within Windows Won’t Boot.
    This bug has been fixed in Ubuntu 10.04. For prior versions, the user is greeted with “Try (hd0,0) : NTFS5: ” This is a known bug as well as others that may cause Wubi boot failures. Refer to meierfra’s Boot_Problems:Wubi_9.10 page.

    Grub “error: out of disk” or “failed to boot default entries”.
    This error message is sometimes generated when Grub 2 cannot properly write to the file /boot/grub/grubenv. Refer to meierfra’s Boot_Problems:Write page.

  18. Links
    Grub2 (help.ubuntu.com)
    Grub 2 Title Tweaks
    GRUB 2 – 5 Common Tasks
    Grub 2 Introduction
    Grub 2: A Guide for Users (from Kubuntu
    Forums)

    https://wiki.ubuntu.com/KernelTeam/Grub2Testing
    GNU Grub 2 Manual Links
    GNU Grub 2 Manual (in development)
    Grub 2 Wiki
    Herman’s Grub 2 Site Comprehensive.
    Herman’s Grub 2 Scripts Useful scripts for many Grub 2 tasks.
    http://ubuntuforums.org/showthread.php?t=1014708
    http://grub.gibibit.com/ Grub 2 Theming (currently for Ubuntu G2 experimental)
    How to restore the Ubuntu/XP/Vista/7 bootloader
    http://sourceforge.net/apps/mediawik…itle=Main_Page meierfra’s Grub 2 Solutions Page
    How-to Install 9.10 karmic on fakeraid by gilson585
    How to create a Grub 2 Floppy See post 283 of this thread. Thank you peter b

__________________
GRUB2 : G2-Tweaks G2-Basics
G2-Tasks DiskSpace
G2-PW SUM

Written by qpieus

February 14, 2010 at 8:14 am

Posted in linux

Tagged with

Using Google Public DNS in conjunction with DD-WRT/DNSMasq

leave a comment »

There has been a lot of buzz regarding Google Public DNS herafter called GPD.  Google’s instructions are designed for end users modifying their own computers.  I think GPD can be very useful if used in conjunction with a forwarding cache on a router. This is the mechanism I used on my Linksys WRT54GL running DD-WRT
v24 to combine using DNSMasq and use GPD’s provided IP addresses 8.8.8.8 and 8.8.4.4 as the upstream DNS.

I assume that you have enabled SSH access to the router so you can login via SSH and take backups of the old values of the upstream DNS

  1. SSH into your router and run cat /tmp/resolv.dnsmasq . Save the IP addresses listed somewhere in case you want to revert back
  2. Go to the Commands tab under Administration.
  3. In the Commands box paste the following:
  4. echo "nameserver 8.8.8.8
    nameserver 8.8.4.4" > /tmp/resolv.dnsmasq
    sleep 1
    killall -HUP dnsmasq
  5. Click Save Firewall (note: your WAN interface will be restarted)

Now, you can take advantage of the DNS caching on your router and misses on the routers DNS cache are sent to GPD for resolution. Note that websites which use CDN will now determine the closest node based on where the anycasted GPD addresses 8.8.8.8 and 8.8.4.4  resolve to relative to your network.

In a future post, I’ll write about how GPD can be integrated as an upstream forwarder using dnscache and why PowerDNS recursor doesn’t support using an open resolver as an upstream forwarder at present.

http://blog.goolamabbas.org/2009/12/05/using-google-public-dns-in-conjunction-with-dd-wrtdnsmasq/

Written by qpieus

February 14, 2010 at 8:07 am

Posted in linux

Tagged with

KDE 4.3: Boom baby!

leave a comment »

KDE 4.3: Boom baby!

I’ve blogged about KDE 4 before, gradually noticing the improvement, but ultimately always running back to Openbox for various reasons. These reasons include:

  • Stability: My earliest posts complained about issues with the nVidia driver, crashing plasmoids, KDE simply failing to start,  Kwin effects leaving artefacts, and systray icons that look horrible.
  • Configuration: It’s a well known fact that, while KDE 3.5 was loved for it’s ability to configure the crap out of it, KDE 4 was somewhat lacking in this regard, especially when it came to the panel. A personal pet-peeve is that KDE 4 left out the ShowDesktop keyboard shortcut, although it supports the function. The only workaround here was to add a plasmoid and assign a shortcut to it, cluttering the panel needlessly.
  • Looks: This might seem strange, since I’ve been raving about the way KDE 4 looks since the very beginning.  To clarify, I have no problem whatsoever with Plasma, which looks gorgeous. However, the novelty of the Oxygen window borders quickly wore off, especially when comparing it to Windows 7 or Snow Leopard. Next to those OSes, KDE’s window borders suddenly look dull and drab. The real issue here however, is that there simply weren’t any serious alternatives available.
  • Qt applications: Yeah, I’m beating the old horse again. To sum things up: I think the available selection of QT software is limited, and lacking in quality.

But when I tested Chakra Alpha 3, I also ended up with KDE 4.3.2, so why not have a look if things have improved?

Stability has gradually improved to the point where I no longer have any problems at all. KDE boots fast and without issue. Applications don’t crash, except for the printer applet after one update, which was immediately remedied in the next. Kwin effects are fast and leave no artifacts. KDE 4 is stable.

chakra: Alt-Tab KWin effectchakra: Alt-Tab KWin effect

Configuration-wise, things have improved too. Config options have treacled back into KDE 4, and while it still might not be up to the standard set by its predecessor, it’s getting there.
There still isn’t a “Hide all Windows and show the Desktop” keyboard shortcut option, but this post should give you an idea how to implement it yourself. It worked for me.
What’s important too, is that the old layout for the System Settings is available too. Personally, I prefer the Icon View, but at least we have the choice now.

Chakra: Tree View in System SettingsChakra: Tree View in System Settings

When it comes to looks, KDE has improved even further. The old Oxygen Plasma theme looked very good, but the new Air theme tops it in every way. It’s light, fresh, modern, and altogether beautiful. In contrast, it makes the Oxygen window borders look even worse. Luckily, there’s progress in that area too, with the new Aurorae theme engine. To quote: “It was created with the idea of making KWin decorations as themeable as the Plasma desktop shell.” A truly excellent (and needed) idea, and it’s one I really wish the KDE devs had implemented from the start. The selection of window decoration themes is small but growing. One of the best I think is Glowglass.

Chakra: The Glowglass windows decoration themeChakra: The Glowglass windows decoration theme

Finally, the Qt applications thing…I’m sorry to say that in my opinion it hasn’t improved. In some cases it’s a matter of personal preference, in others the Qt apps simply don’t work as well as their GTK counterparts. To deal with the situation, I used whatever application I thought worked best, and installed QtCurve to make sure things looked decent. In fact, they look more than decent: QtCurve is a beautiful, professional looking theme, and is actually a step up from the default Oxygen theme.
However, while QtCurve can make your applications look good, it can’t make them better. For chat, I still prefer Emesene with it’s clean layout over the cluttered Kmess or Kopete. Both Qt options work very well, I just don’t like the looks of the Contact List or the Chat Window.

Chakra: EmeseneChakra: Emesene

It’s the same with browsers. You can use Konqueror of course, and Chakra also provides Arora as an alternative. I quickly uninstalled it, because if I’ll use a Webkit browser, it’s going to be Chrome. It’s fast, configurable, supports extensions these days, has a lot of available themes (I chose the Porsche one), and is perfectly usable in Linux.

Chakra: Chrome with the Porsche themeChakra: Chrome with the Porsche theme

The real sore point in this area is still the music manager. If you want Qt, it’s Amarok, Juk, and maybe Cuberok. That’s it. I still detest Amarok’s playlist based layout, which means that Cuberok is out too (and Exaile and Listen on the GTK side, for that matter). In my mind, music managers have to scan my music collection, play music, and stop bothering me. Amarok doesn’t do that. Besides, upon scanning my collection it stopped at 53% every time. No Amarok for me, and Juk is so old it can’t handle a decent collection without a crash. On the GTK side I still have to try Banshee. I won’t try Rhythmbox because it’s too tied to GNOME. The last time I tried that half of the functions and icons were missing.
In the end, I installed the same music manager I also used in Openbox, which is Goggles MM. It uses the FOX toolkit, which means that QtCurve can’t do anything about the looks, but it does have an Oxygen colour scheme which makes it look a bit better. The next major version will have *gasp* gradients, which should improve things even more.
But here, the looks don’t matter. It has my favourite, Rhythmbox-like layout. It’s lightning fast, scanning my 6000+ music collection in less than 30 seconds. It can edit tags. It has album art. It uses the xine-engine, which means it plays more internetradios than both Rhythmbox and Amarok. Really, the only thing I’m missing is a song queue, but that’s it.

Chakra: Goggles Music ManagerChakra: Goggles Music Manager

To add insult to injury, I even replaced Konsole with XFCE’s Terminal. It supports transparency just as well, but is much much faster. Konsole booted slow and performed quite badly. Whenever I tried to create a package from the Arch AUR, text scrolled by at a slow, jittering pace. It took me a couple of days to find out that the problem wasn’t Chakra or yaourt, but Konsole itself. Using Terminal immediately solved the problem.

Chakra: XFCE's TerminalChakra: XFCE’s Terminal

I’ll admit, one of the reasons I wanted to try KDE again is because I was jealous of Jen’s fantastic looking Windows 7 laptop. She had rotating backgrounds of beautiful English landscapes, folders with previews of the pictures inside, nice window effects, a great looking Aero theme, that panel/dock crossover…I wanted that! Well, without installing Windows, obviously. I’d never do that.
In the end, I think I succeeded. Apart from the dock/panel thing I have everything she has, using far less space on my hard drive, with all the benefits of (Arch) Linux included. It’s fast, it’s beautiful, and I like it so much I’m keeping it, even though Dolphin, Krusader and Kaffeine are the only Qt applications I use.

KDE has arrived, baby.

San

Written by qpieus

February 13, 2010 at 9:06 pm

Posted in kde, linux

Tagged with ,

2009 Chicago-Mackinac Results Beneteau 36.7

leave a comment »

Beneteau 36.7
Sail Yacht ORR Owners/Charterers City, State Finish Time Elapsed Time Corrected
USA 52500 Tried & True 0.885 Robert K Foley Glencoe, IL Tuesday – 10:22:47 69:42:47 61:41:45 1
USA 52051 Free Radical 0.885 Robert Nelson & Anthony Bowker Lemont, IL Tuesday – 10:24:25 69:44:25 61:43:12 2
USA 55367 Karma 0.885 Lou Sandoval, Martin Sandoval, Jack Buoscio Chicago, IL Tuesday – 10:26:43 69:46:43 61:45:14 3
USA 262 Maggie Mae 0.885 Peter & Dan Wright Hinsdale, IL Tuesday – 12:45:20 72:05:20 63:47:55 4
USA 25524 Grizzly 0.885 Charles M. Bayer, Jr. Grosse Pointe Farms, MI Tuesday – 12:46:17 72:06:17 63:48:45 5
USA 250 Stingray 0.885 Steve Pelke Chicago, IL Tuesday – 13:49:46 73:09:46 64:44:56 6
USA 52081 Padawan2 0.885 Christopher and Autumn Lamb Traverse City, MI Tuesday – 13:52:04 73:12:04 64:46:58 7
USA 82 Split Decision 0.885 Mark D Norris Wilmette, IL Tuesday – 13:52:21 73:12:21 64:47:13 8
USA 93165 Northern Light 0.885 Thomas L Orlow Levering, MI Tuesday – 14:09:27 73:29:27 65:02:21 9
USA 602 Misty 0.885 Thomas Mc Intosh Long Grove, IL Tuesday – 14:09:55 73:29:55 65:02:46 10
USA 60367 As You Wish 0.885 Sue Hogan & John Heaton Chicago, IL Tuesday – 14:15:50 73:35:50 65:08:00 11
USA 119 Joie De Vie 0.885 Marty and Donna Hastings Mount Prospect, IL Tuesday – 14:22:07 73:42:07 65:13:34 12
USA 52169 Bella Luna 0.885 Joe Hyla Chicago, IL Tuesday – 14:27:17 73:47:17 65:18:08 13
USA 52293 Rally 0.885 Paul Stscherban Mishawaka, IN Tuesday – 14:36:24 73:56:24 65:26:12 14
USA 52626 Wishes 0.885 George A. Quinlan IV Elmhurst, IL Tuesday – 15:04:37 74:24:37 65:51:11 15
USA 26219 Fog 0.885 Charlie Wurtzebach, Mike Bird Chicago, IL Tuesday – 15:29:52 74:49:52 66:13:31 16
USA 52934 Veloce 0.885 Mike Stills Elk Grove , IL Tuesday – 15:42:57 75:02:57 66:25:06 17
USA 251 Endeavor 0.885 Skip Schink and Rob Miller Oakbrook, IL Retired
USA 101 Erizo De Mar 0.885 Antoni Czupryna Marengo, IL Retired
USA 52037 Idyllwild 0.885 Jon Beeler Lake Forest, IL Retired

Crew List

Eric Christman

Antonio Sanpere
George Kalhouri
Martin Hastings Mt. Prospect, IL
Randy Hastings Green Bay, WI
Lee Rondonet Elgin, IL
Ben Komar Joilet, IL
Angela Henderson

Written by qpieus

February 13, 2010 at 8:32 pm

Posted in Uncategorized

Tagged with

2009 Verve Cup Offshore Regatta Beneteau 36.7

leave a comment »

Beneteau First 36.7
1. 52500 Tried & True Robert Foley Glencoe, IL, USA 1 2 2 4 1 3 5/RDG 3/RDG 21.0
2. USA 262 Maggie Mae Peter & Dan Wright Hinsdale, IL, USA 7 8 1 1 2 1 1 2 23.0
3. USA 250 Stingray Steve Pelke Chicago, IL, USA 2 3 5 7 3 8 5 6 39.0
4. USA 60367 As You Wish Hogan/Heaton/Tsiang Chicago, IL, USA 8 4 6 5 8 7 3 3 44.0
5. USA 52169 Bella Luna Joe Hyla Chicago, IL, USA 3 1 8 2 5 9 8 9 45.0
6. USA 119 Joie De Vie Marty Hastings Mt. Prospect, IL, USA 6 10 7 10 12 10 6 4 65.0
7. USA 26219 FOG Wurtzebach/ Bird Chicago, IL, USA 12 7 9 8 7 4 2 17/DNF 66.0
8. USA 52626 Wishes George Quinlan Elmhurst, IL, USA 16 9 11 9 4 6 9 5 69.0
9. USA 209 Agitator Manuel Cordero Chicago, IL, USA 4 12 16 6 11 5 7 10 71.0
10. USA 82 Split Decision Mark Norris Wilmette, IL, USA 15 15 3 12 6 11 4 8 74.0
11. USA 101 Erizo de Mar Antoni Czupryna Marengo, IL, USA 5 6 14 3 9 14 13 11 75.0
12. USA 602 Misty Tom McIntosh Long Grove, IL, USA 10 11 10 13 15 12 11 1/RDG 83.0
13. USA 51787 Raptor Jim Anderson Barrington, IL, USA 11 5 12 14 14 2 12 13 83.0
14. USA 55367 Karma Sandoval/Buoscio Karma Sailing Group Chicago, IL, USA 9 13 4 15 13 17/DSQ 17/DSQ 7 95.0
15. USA 52307 Nemesis Gordon Julius Holland, MI, USA 13 14 13 11 10 15 14/DSQ 12 102.0
16. 52249 Sail Monkey McGuinn/Duhon Chicago, IL, USA 14 16 15 16 16 13 10 12/RDG 112.0



Crew Info

Headsail Trimmer – Eric Christman – Cat 1
USA

Helmsman – Jim Clauser – Cat 1
USA

Tactician – Will Hannsman – Cat 1
USA

Skipper – Marty Hastings – Cat 1
Mt. Prospect, IL, USA
Anchorage

Bowman – Ron Hyatt – Cat 1
USA

John Macal – Cat 1
USA

Bowman – Lee Rondenet – Cat 1
USA

Pitman – Elizabeth Shansky – Cat 1
USA

Headsail Trimmer – Jim Wood – Cat 1
USA

Written by qpieus

February 13, 2010 at 8:26 pm

Posted in Uncategorized

Tagged with

2009 Chicago NOOD Regatta Final Results

leave a comment »

Beneteau 36.7 back to top
Place # Boat Name Owner Race 1 Race 2 Race 3 Race 4 Race 5 Race 6 Total
1 52500 Tried & True Robert Foley 11 1 3 6 2 1 24
2 262 Maggie Mae Peter and Dan Wright 6 2 1 1 7 9 26
3 250 Stingray Steve Pelke 1 11 2 2 9 4 29
4 1313 Program Warren Levins 3 5 6 3 11 3 31
5 82 Split Decision Mark Norris 12 4 4 4 8 5 37
6 52169 Bella Luna Joe Hyla 4 10 10 7 1 10 42
7 119 Joie de Vie Donna Hastings 8 8 12 10 4 2 44
8 26219 FOG Charlie Wurtzebach/Mike Bird 9 7 8 9 6 8 47
9 60367 As You Wish Susan Hogan, John Heaton, Grace Tsiang 2 6 5 16 15 6 50
10 52293 Rally Paul Stscherban 5 3 7 12 13 11 51
11 55367 Karma Lou Sandoval 10 12 13 8 5 12 60
12 51787 Raptor Jim Anderson 7 9 15 13 14 7 65
13 52626 Wishes George Quinlan 13 14 11 5 12 13 68
14 52249 Sail Monkey Bill McGuinn/ Chris Duhon 15 15 14 14 3 14 75
15 101 Erizo de Mar Antoni Czupryna 14 13 9 15 10 15 76
16 251 Endeavor Julian “Skip” Schink 17 dnc 17 dnc 16 11 16 16 93



Written by qpieus

February 13, 2010 at 8:16 pm

Posted in Uncategorized

Tagged with