Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 97571 - Grub 0.96-r1 segfaults on setup (hd0) command
Summary: Grub 0.96-r1 segfaults on setup (hd0) command
Status: RESOLVED DUPLICATE of bug 90845
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High blocker (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-30 22:31 UTC by Jeremy Utley
Modified: 2005-07-01 03:49 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Utley 2005-06-30 22:31:13 UTC
Grub is segfaulting upon attempt to install into MBR

Reproducible: Always
Steps to Reproduce:
1. Start grub command line shell
2. Run root(hd0,x)
3. Run setup(hd0)

Actual Results:  
grub> root (hd0,1)
 Filesystem type is xfs, partition type 0x83

grub> setup (hd0)Segmentation fault


Expected Results:  
Grub should have installed into MBR of system

Fresh install of Gentoo 2005.0 from a stage 3 tarball, without a separate
partition for /boot.  Root filesystem is XFS.  CPU is P-III 550 MHz machine,
Intel chipset motherboard.  Followed instructions noted in bug 87154 (which is a
 similar problem on AMD64 arch) and compiled grub with the following command:

FEATURES="nostrip" CFLAGS="-O -ggdb" emerge grub

Running grub with gdb gives the following information in backtrace:

grub> setup (hd0)
Program received signal SIGSEGV, Segmentation fault.
0x08053d11 in next_dentry (ino=0xb7aedb40) at fsys_xfs.c:405
405     fsys_xfs.c: No such file or directory.
        in fsys_xfs.c
(gdb) backtrace
#0  0x08053d11 in next_dentry (ino=0xb7aedb40) at fsys_xfs.c:405
#1  0x080544c4 in xfs_dir (dirname=0xb7aede76 "grub") at fsys_xfs.c:594
#2  0x0804df56 in grub_open (filename=0xb7aede70 "/boot/grub")
    at disk_io.c:1644
#3  0x0805b8c4 in check_file.6 () at builtins.c:3998
#4  0x0805bf91 in setup_func (arg=0xb7a9cc66 "(hd0)", flags=1)
    at builtins.c:4145
#5  0x0805d07d in enter_cmdline (heap=0xb7a9cc60 "setup (hd0)", forever=1)
    at cmdline.c:172
#6  0x08056f0a in cmain () at stage2.c:1078
#7  0x0804c173 in init_bios_info () at common.c:336
#8  0x080498ea in doit.0 () at asmstub.c:180
#9  0x08049a3b in grub_stage2 () at asmstub.c:263
#10 0x08049698 in main (argc=1, argv=0xbffffb14) at main.c:264


emerge info output:

Portage 2.0.51.19 (default-linux/x86/2005.0, gcc-3.3.5-20050130,
glibc-2.3.4.20041102-r1, 2.6.11-gentoo-r3 i686)
=================================================================
System uname: 2.6.11-gentoo-r3 i686 Pentium III (Coppermine)
Gentoo Base System version 1.6.12
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, Jun 30 2005, 18:47:26)]
dev-lang/python:     2.3.5
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium3 -fomit-frame-pointer -pipe -s"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium3 -fomit-frame-pointer -pipe -s"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.osuosl.org/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="x86 alsa apache2 apm arts avi berkdb bitmap-fonts crypt cups curl emboss
encode expat foomaticdb fortran gd gdbm gif gmp gpm imap imlib ipv6 jpeg kde
libg++ libwww mad maildir mikmod motif mp3 mpeg ncurses nls oggvorbis opengl oss
pam pdflib perl php png python quicktime readline sdl spell ssl tcpd truetype
truetype-fonts type1-fonts vhost xml2 xmms xv zlib userland_GNU kernel_linux
elibc_glibc"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY


Further note: This is while inside the chroot enviornment - for now, have
unmasked the grub-static package and am using it as the bootloader, since it
does appear to work properly.
Comment 1 Stian Skjelstad 2005-07-01 03:33:02 UTC
Quick look at the code. If writeable strings isn't enabled, that will fail for
the "." and ".." entries, since they are stored in non-writable data area.

name[namelen] = 0;
should be moved to each place where name is set to point to new "unsafe" data.
Comment 2 Sven Wegener gentoo-dev 2005-07-01 03:35:58 UTC
Please use grub-0.96-r2, it contains a fix for this bug.
Comment 3 Stian Skjelstad 2005-07-01 03:39:51 UTC
I didn't see the -r2 ebuild (and patch) :-p Has it been notified upstream?

That bugfix should not be ~ masked.
Comment 4 Sven Wegener gentoo-dev 2005-07-01 03:47:35 UTC
Yes, patch pushed upstream and released with grub-0.97

I'll check the stable marking of 0.96-r2
Comment 5 Sven Wegener gentoo-dev 2005-07-01 03:49:12 UTC

*** This bug has been marked as a duplicate of 90845 ***