[SOLVED] Grub shell does not work like a shell at all
FedoraThis forum is for the discussion of the Fedora Project.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
The problem I'm having is referred to as "broken grub tab completion". Looking for solutions I've come across a lot of complaints about this but no solutions.
I am using Fedora 11, and have experienced this problem on Fedora 10 as well.
I am referring to GRUB launched from an interactive login shell, not in its native environment when it boots up.
I open the GNOME Terminal (bash)
Launch grub
Press [TAB] - A list of commands should display but does not, the cursor simply goes left
Type root (hd0,0)
Press [UP] - GRUB should return me to the previous command "root (hd0,0)" but does not, instead it types "^[[A", apparently the literal interpretation of the [UP] key
So here is the general problem. GRUB is supposed to act like a shell and handle the [TAB] completion and [UP]/[DOWN] keystrokes properly, but does not, and handles them LITERALLY.
On Ubuntu, this is not a problem. GRUB works as expected.
What is going on?
Thanks for your help.
Last edited by maxkukartsev; 07-22-2009 at 05:34 PM.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub>
Here is my grub prompt in new fed11 lxde
as user
and as root
Code:
[bz@Fedora-11 ~]$ grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> quit
quit
[bz@Fedora-11 ~]$ su
Password:
su: incorrect password
[bz@Fedora-11 ~]$ su
Password:
[root@Fedora-11 bz]# grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub>
GRUB on Fedora displays the same text as you posted:
Code:
[liveuser@localhost ~]$ grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> quit
quit
[liveuser@localhost ~]$ su
[root@localhost liveuser]# grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> quit
quit
[root@localhost liveuser]#
The problem was apparently lack of the NCurses library.
I decided to rebuild GRUB-0.97, so I downloaded grub-0.97.tar.gz from ftp://alpha.gnu.org/gnu/grub/, and while executing the ./configure script I had the messages:
Code:
checking for wgetch in -lncurses... no
checking ncurses/curses.h usability... no
checking ncurses/curses.h presence... no
checking for ncurses/curses.h... no
checking ncurses.h usability... no
checking ncurses.h presence... no
checking for ncurses.h... no
checking curses.h usability... no
checking curses.h presence... no
checking for curses.h... no
But this did not give me errors. The ./configure script must've left the ncurses library out of the build process. When compiled I launched GRUB, I experienced the same broken shell behavior.
I installed package ncurses-devel and ran ./configure again, and it found the ncurses header files. After compiling and running GRUB, it worked like it is supposed to!
So, I think that on Fedora 11 32-bit, the installed GRUB-0.97 was compiled without ncurses
thanks maxkukartsev, that enables tab completion in a grub shell for me too, I wonder why they disable it in the default build?
Strangely, it works fine if you run a grub command prompt at boot time.
Otherwise I would have suggested that they needed to reduce the size of the grub binary due to the static linking requirement (grub must be linked against glibc-static since no dynamic libs are available at boot time)
Perhaps there should be a separate grub-shell command, which is dynamically linked against all the libs.
Strangely, it works fine if you run a grub command prompt at boot time.
Yeah, so basically this means that native GRUB and Linux GRUB are independent from each other. I think that because the native GRUB doesn't have the benefits of Linux' shell framework, it implements I/O a little differently, and may be the cause of the different behaviors.
Quote:
Originally Posted by Escher
Perhaps there should be a separate grub-shell command, which is dynamically linked against all the libs.
Maybe the developers chose to have only a static Linux GRUB program because they wanted to keep it similar to the native GRUB program?
Quote:
Originally Posted by Escher
I wonder why they disable it in the default build?
Yeah, I'm dumbfounded at why NCurses was not statically linked into Fedora 11/10 from the start, as it is on other distributions such as Ubuntu.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.