CQuirke’s Long View

Long lead times need long forward planning

Ubuntu grub 2 Boot Menu – Extra Wrinkle

Posted by cquirke on 22 May 2010

Ubuntu 9.10 and later (as of writing this, 10.04 LTS) use grub 2 as the boot manager, which differs substantially from the original grub used previously. You may have heard that Linux uses editable text rather than inscrutible binary files to configure the system; in this respect, grub 2 is a step backwards.

In the original grub, you’d edit the menu.lst file and grub would respect this; in grub 2, grub will build its own configuration file (overwriting your settings) and all you can do is shake the table via an editable file called grub, and hope grub 2 will build your “control” into the actual control file it spawns.

This previous post covers those differences and how to work with each, but misses one detail; the need for yet another setting so that what you thought GRUB_DEFAULT=saved would do, actually works. Without this setting, you have to explicitly set the default boot entry you want to be “saved”; with this setting, it will take your previously booted choice as the current default.

So, if you want to display the boot menu for 20 seconds and default to what you’d selected previously, then this is how your grub settings should look:

GRUB_SAVEDEFAULT=true
GRUB_DEFAULT=saved
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT=”20

Background: GRUB_DEFAULT can take one of three types of parameter; the ordinal number of the boot menu entry, a full and exactly matching text string for that entry, or the keyword “saved”, as used above.

Whenever grub 2 detects relevant changes to the system, it rebuilds the boot menu, padding it out from the top. Linux comes first (of course) so all your other OSs trail at the end, and as the menu gets longer, so the ordinal number gets bumped up.

So trying to set (say) Windows 7 as the default entry via explicit ordinal number, is inherently doomed; that’s why the “saved” value becomes so important. But unless you add the GRUB_SAVEDEFAULT=true setting, it’s as useless as an explicit selection, because the ordinal number used by the grub-set-default command will point to the wrong entry after grub 2 rebuilds the boot menu.

That can happen sooner than you think; Ubuntu 10.04 has just been released, yet already there are over 70M of updates, including a new kernel that spawns two new boot menu entries after the updates are applied.

The pages I found that document all of this, are here, here and here.

Technorati : , ,
Del.icio.us : , ,

Posted in Linux | Tagged: , , | 1 Comment »

Edit grub Menu In Ubuntu 9.10 and Older

Posted by cquirke on 20 November 2009

Technorati tags: , ,

Windows users who install Ubuntu as a dual boot installation to try it out, will usually want their PCs to boot into Windows by default.  Ubuntu makes this possible, but not easy; it’s a major “paper cut” to address.

Ubuntu 9.04 and older

Before Ubuntu 9.10, you would start a Terminal session and do this:

cd /boot/grub
sudo chmod 666 menu.lst
gedit menu.lst
sudo chmod 644 menu.lst

You can set an explicit default boot entry, but I prefer to leave grub to boot the first entry as it does by default, but make that first entry the one I want.

So, when editing the menu.lst file, I usually cut the entry at the end of the file that launches Windows, and paste it into the top of the section that defines the boot menu entries.  I then rename the displayed text from something horrible like “Microsoft Operating System” to what I want, e.g. “Windows 7 Pro 64”.  Then I page down and delete the redundant do-nothing “Other Operating Systems” entry at the end.

Ubuntu 9.10 with grub 2

Ubuntu 9.10 uses a newer version of grub that works differently; do this:

cd /etc/default
sudo chmod 666 grub
gedit grub
sudo chmod 644 grub
sudo update-grub

You can’t edit the menu text that will be displayed in the boot menu anymore, because the new grub version doesn’t use your setting file directly.  Instead, it builds a new internal “don’t edit this” settings file that combines your settings with what it detects – and the menu entry text is built from what it detects, not your settings.  The update-grub command is needed to force a new build of the internal settings file.

When I edit the grub file, I don’t try to specify which boot menu entry to use by default, nor re-arrange the order of these entries with my choice at the top.  Because update-grub spawns a new menu that may differ from what is in effect as I edit the grub file, the first approach could misfire, and the second approach won’t work.

Instead, I use a new “saved” value for the “default” setting, which has the happy effect of defaulting to whatever the user chose last time.

But by default, the grub boot menu is not displayed, so I change entry to force it to be displayed, and set the timeout value after which the default kicks in:

GRUB_DEFAULT=saved
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT="20"

Alert!

If you dual-boot Ubuntu (or similar, using grub) and Windows, have multiple Windows-visible partitions, and use WAIK or OPK imaging tools (WinPE, ImageX) then there’s a serious bum-biting trap waiting for you – not so much a bug, as a natural consequence of how grub works.

Posted in Linux | 2 Comments »

Edit grub Menu In Ubuntu 9.10 and Older

Posted by cquirke on 20 November 2009

Technorati tags: , ,

Windows users who install Ubuntu as a dual boot installation to try it out, will usually want their PCs to boot into Windows by default.  Ubuntu makes this possible, but not easy; it’s a major “paper cut” to address.

Ubuntu 9.04 and older

Before Ubuntu 9.10, you would start a Terminal session and do this:

cd /boot/grub
sudo chmod 666 menu.lst
gedit menu.lst
sudo chmod 644 menu.lst

You can set an explicit default boot entry, but I prefer to leave grub to boot the first entry as it does by default, but make that first entry the one I want.

So, when editing the menu.lst file, I usually cut the entry at the end of the file that launches Windows, and paste it into the top of the section that defines the boot menu entries.  I then rename the displayed text from something horrible like “Microsoft Operating System” to what I want, e.g. “Windows 7 Pro 64”.  Then I page down and delete the redundant do-nothing “Other Operating Systems” entry at the end.

Ubuntu 9.10 with grub 2

Ubuntu 9.10 uses a newer version of grub that works differently; do this:

cd /etc/default
sudo chmod 666 grub
gedit grub
sudo chmod 644 grub
sudo update-grub

You can’t edit the menu text that will be displayed in the boot menu anymore, because the new grub version doesn’t use your setting file directly.  Instead, it builds a new internal “don’t edit this” settings file that combines your settings with what it detects – and the menu entry text is built from what it detects, not your settings.  The update-grub command is needed to force a new build of the internal settings file.

When I edit the grub file, I don’t try to specify which boot menu entry to use by default, nor re-arrange the order of these entries with my choice at the top.  Because update-grub spawns a new menu that may differ from what is in effect as I edit the grub file, the first approach could misfire, and the second approach won’t work.

Instead, I use a new “saved” value for the “default” setting, which has the happy effect of defaulting to whatever the user chose last time.

But by default, the grub boot menu is not displayed, so I change entry to force it to be displayed, and set the timeout value after which the default kicks in:

GRUB_DEFAULT=saved
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT="20"

Alert!

If you dual-boot Ubuntu (or similar, using grub) and Windows, have multiple Windows-visible partitions, and use WAIK or OPK imaging tools (WinPE, ImageX) then there’s a serious bum-biting trap waiting for you – not so much a bug, as a natural consequence of how grub works.

Posted in Linux | 4 Comments »

IE 8 Beta 2 Impressions

Posted by cquirke on 11 September 2008

Technorati tags: , ,

Internet Explorer 8 beta 2 came out just before Google Chrome, and both have several features in common.  However, Chrome is still built on a known-exploitable code base that even Apple had already patched in Safari, so I can’t take that seriously as a safe edge-facing product.  I also don’t like vendors who silently push updates without user control, who who are slow to tell you what their new code does.

Features

Beta 2 feels a lot more new-featured than beta 1, partly because it is, and partly because the new UI is catching up with what is inside the code.  There’s enough difference and improvement over IE 7 to be worth a look, even if you aren’t interested in the beta testing and feedback process – but it is in beta, so take care if testing it your “real” computer.

I enjoyed the safer address bar URL display in beta 1, but there’s more URL-handling goodness in beta 2, especially when it comes to revisiting where you’ve been, keeping track of which tabs were opened from where, and so on.  There’s also the InPrivate mode if you don’t want your history retained.  And I love the new search entry area’s drop-down set of search engine icons, so I can change engine on the fly for each search instead of having to set and change this.

A subtle but significant joy is improvement of Standards vs. IE 7 modes.  In beta 1, one had to exit the entire browser to “change gears”, which seemed odd as each tab runs in its own process, including a mix of tabs in Protected and non-Protected modes.  In beta 2, you can not only mix Standards and IE 7 modes across a tab set, but have the browser remember and automatically apply the correct mode for a given site or domain.

It’s a bit strange to still have no “advanced” download support, i.e. the same ability to resume interrupted downloads that we had in the 386 era’s BBSs transfer protocols.  After all, ftp does as last embrace such things, as well as the ability to download from multiple points in the same file for speed.  Why should we still need tacky and often spyware-riddled add-on tools to do this?

Stability

On stability, it’s a bit of a mixed bag, compared to beta 1.  It now handles the Trend SysClean engine download link a bit better; it still shows the Windows executable code content within the misnamed .COM file as a web page, but no longer crashes and can Save As correctly.  Some other sites that didn’t work in beta 1, such as on-page UI buttons to send comments from some blogs, now work correctly in beta 2.

On the downside, IE still struggles to close when there are many tabs open (typically I have 20-30 open per window at a time), and can fall into a doomed loop of retrying the same page that crashed it.  I’ve also seen the whole browser become terminally unresponsive, and not always when trying to close down multiple tabs.  That can cause a storm of crash dialogs etc. if it tries to recover all the tabs that were open.

When the browser becomes unresponsive, I either see System and IExplore pegged at 50% CPU each, or (more often) > 90% of CPU time correctly in the idle loop, while IE still behaves as if it’s being hogged.

All of this testing has been on XP SP3 with IE8 running in Standards Mode, and set to prompt on active content.  That can lead to multiple tabs stalling on such prompts at the same time, which may bulge resource use or lead to some sort of race condition.  I suppress 3rd-party enhancements via the IE 6 era Tools, Options, Advanced setting, so there shouldn’t be any BHOs or toolbar code.

I’m certainly enjoying beta 2, but wonder whether there will be more builds to test between now and RTM.  IMO, there need to be, if only to pin down and fix the stability issues that remain.

Posted in IE8 | 2 Comments »

IE Needs True "Blank" Page

Posted by cquirke on 19 May 2008

Technorati tags: , , , ,

In a malware-aware 21st century, IE really needs a true “NO home page” option, and not load an infectable .HTM file from a known filespec.

After all, if one wants to load a local .HTM as “home page”, perhaps to effect some scripting at the start of a browser session, then one can point to such a file as “home page”.  That is far clearer (“principle of least surprise”) than creating the impression of a “blank” home page that is not certain to be “blank”.

In other words, the “blank home page” option in IE8 should show nothing, and not load any file as the “home page”.  If IE8’s code requires something to chew on, then IE8 could spawn a fresh blank .HTM of random name from boilerplate code, and load that.

Please not let’s hear a lot of “mitigation noise” such as “an attacker would have to…” or “blah blah permissions” this, or “blah blah reduced user rights” that.  Non-existence trumps “security”!

Posted in IE8 | Leave a Comment »

IE8: Summary and Launch Pad

Posted by cquirke on 12 April 2008

Technorati tags: , , , ,

I’ve been testing Internet Explorer 8 beta 1, and so far it looks like IE7, but with more goodly oomph under the hood.  It’s a relatively early beta, so I expect the look to change; at present, the UI is a mix of standard-looking IE7 with very new-look dialogs here and there,

This post will be retro-edited to serve as a launch point for bugs and suggestions for IE8, much as I did for Vista here.

Posted in IE8 | Leave a Comment »

Name This Blog

Posted by cquirke on 11 April 2008

Technorati tags:

At the risk of sounding like a self-important vendor spending millions on announcing a changed product name, this post is a muse about where to take this blog.

The “problem” is that this blog hosting service has the feature set I want to use, and I want to do more than write about Linux.

I like the symmetry of “blog“, Vista Curve” and “Linux Curve“, and it’s not obvious as to how this third blog will be differentiated with the others.  I was thinking of calling it “The Long View”, to include ideas for Windows 7, IE 8 (before that gets feature-frozen, if it hasn’t already), Linux, and the still-neglected area of maintenance OSs. 

But I also want to use the web site structure offered by WordPress to cover timeless “how do I…” issues definitively, e.g. how to defend against USB infectors.  The things I’d have done on my old web sites in the old days, and as these are not particularly forward-looking, they don’t fit “The Long View”.

Perhaps it depends on how well WordPress can offer alternate faces for web and blog content.  If it’s good at that, I’ll use that to separate the gritty reality of the site from the more futuristic blog.  Or maybe I can shell the “Linux Curve” within the “Long View” blog, much as my old Win9x site was shelled under a new parent site as I turned attention towards XP.

You may think it’s odd that an MVP has a blog dedicated to Linux, but IMO, any “long view” (5+ years) has to count in alternatives to Windows, and to PCs for that matter.  Microsoft’s research labs would be doing the same, and they aren’t just cooking up new versions of MS Office and Windows.  But as users, we don’t have the same ability to design our futures – we’d have to choose from off-the-peg solutions that could be so different that today’s judgement of acceptability cannot be assumed to hold.

Posted in Blogging | Leave a Comment »

Editing menu.lst Revisited

Posted by cquirke on 24 March 2008

Technorati tags: , ,

In response to this entry, Cenk Kulacoglu asks why I spawned a new CLI session rather than just run a terminal instance from the appropriate menu.  The reason is simple; I didn’t think of that  :-)

In addition, one doesn’t have to use the vi text editor.  In fact, you can at least initiate most of this via the GUI’s menus, though the lack of an equivalent to Vista’s right-click, “run as admin” makes you more CLI-bound than should be necessary.

The easier way I now use is as follows; start a command line window from the appropriate menu, navigate to /boot/grub, sudo to chmod the menu.lst file for editing, then sudo gedit menu.lst to edit the file in a more familiar style of text editor.  After saving the edits, chmod the menu.lst back to protect it, and you’re done.

The stumbling block was having to “smell” that the nice text editor seen via the GUI menu, is named gedit, so that one can invoke it from the CLI.  It’s necessary to invoke it from the CLI rather than the GUI menu, because the GUI menu lacks a “run as admin” (i.e. with root access) facility.

Posted in Linux | Leave a Comment »

Linux File Attributes

Posted by cquirke on 5 October 2007

Technorati tags:

The chmod command operates on the Linux equivalent to “attributes” in DOS, but the syntax differs from the DOS attrib command.

These attributes (or “modes”?) are conceptually similar, being a bitmapped value with each bit specifying an attribute of the file.  When you do an ls -g to see more details for a directory listing, they are displayed something like this:

-rwxrwxrwx

Each group of “rwx” corresponds to a single octal digit, i.e. values 4 + 2 + 1.  If the bit is set, the flag is shown; if it is zero, then – is shown instead.  So rwx = 7 and means reading, writing and execution permissions are allowed, whereas r– mean only reading is allowed. 

These permission bits are then repeated for different contexts; from left to right, these are for owner, group and user, according to this syntax reference.

I see there is support for syntax closer to the “Attrib -r -s -h” familiar to DOS users, but I used octal values when I needed to chmod something, e.g…

chmod 0777 menu.lst

chmod 0644 menu.lst

…that result in…

-rwxrwxrwx

-rw-r–r–

…respectively.

Posted in Linux | 4 Comments »

Ubuntu: Editing grub’s menu.lst

Posted by cquirke on 5 October 2007

Technorati tags: , ,

If you’ve just set up a dual-boot between Windows and Ubuntu (in this case, 7.04) to try out the latter, then you will probably want to edit the settings file that controls the grub system-level boot manager.  You may want Windows to boot by default, and more menu time to override that default.

As seen from Ubuntu, the file you are after is in the /boot/grub directory, and is called menu.lst (where “l” is lower-case L, not the digit 1).  But because this is outside your home subtree, you will need root privileges to edit it. 

I didn’t find a way to do this in the GUI (e.g. an equivalent to Vista’s right-click, “Run as administrator”) so I pressed Ctl+Alt+F1 to get to a bash shell (a Linux equivalent to Command.com or Cmd.exe).  From here it is easy; precede any command needing root access with the sudo command, and after passing a root password prompt, that works.

After logging in to my user account, I entered the following commands to get to where the file was, list it to see what permissions were in effect, then change these to facilitate my changes:

cd /boot/grub

ls -g

sudo chmod 0777 menu.lst

ls -g

This took the safety catch off menu.lst so I could save changes to it.  Then I used vi to edit the file, changing the order of boot entries so that Windows came first (I could have left it where it was and specified it by number as the new default), and then changing the timeout statement to “timeout sec    20” for 20 seconds (the word “sec” is required). 

I’ll leave the gory details of editing in vi as an exercise for the reader, but basically it’s a to add text, Esc to go back to command mode, and :wq to save and exit.

Thereafter I restored safer attribute flags via this command…

sudo chmod 0644 menu.lst

…pressed Ctl+Alt+F7 to switch back to the GUI, and was done.  Whew!

Posted in Linux | 1 Comment »