All of lore.kernel.org
 help / color / mirror / Atom feed
* grub-setup Segmentation fault
@ 2007-08-04  2:37 Magnus Granberg
  2007-08-04  9:56 ` Robert Millan
  0 siblings, 1 reply; 8+ messages in thread
From: Magnus Granberg @ 2007-08-04  2:37 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 2474 bytes --]

Hi
I'am geting segmentation fault wen i try to run 
grub-setup --directory=/boot/grub --device-map=/boot/grub/device.map 
/dev/md0
on a Raid5 -> Lvm setup.
Grub with the latest cvs on a gentoo 2007.0 amd64 multilib system.
Raid5 setup 3x250Gb
mdadm -D /dev/md0
/dev/md0:
        Version : 01.00.03
  Creation Time : Thu Aug  2 16:35:06 2007
     Raid Level : raid5
     Array Size : 19534848 (18.63 GiB 20.00 GB)
  Used Dev Size : 19534848 (9.31 GiB 10.00 GB)
   Raid Devices : 3
  Total Devices : 3
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Sat Aug  4 04:11:19 2007
          State : clean
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 64K

           Name : 0
           UUID : 32287a37:5051c044:750bc197:0802540a
         Events : 2

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
       3       8       33        2      active sync   /dev/sdc1
Device.map
livecd ~ # cat /boot/grub/device.map
(hd0)   /dev/md0
(hd1)   /dev/md0
(hd2)   /dev/md0
(hd3)   /dev/sdd

livecd ~ # gdb --args 
grub-setup --directory=/boot/grub --device-map=/boot/grub/device.map 
/dev/md0
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: 
/sbin/grub-setup --directory=/boot/grub --device-map=/boot/grub/device.map 
/dev/md0

Program received signal SIGSEGV, Segmentation fault.
grub_device_open (name=0x0) at kern/device.c:38
38            if (*name == '\0')
(gdb) bt
#0  grub_device_open (name=0x0) at kern/device.c:38
#1  0x08049385 in setup (prefix=0x80670b0 "(md0)(vg-boot)/grub", 
dir=0x8067008 "/boot/grub",
    boot_file=<value optimized out>, core_file=0x805cb2a "core.img", 
root=0x8067050 "vg-boot", dest=0x0, must_embed=1)
    at util/i386/pc/grub-setup.c:223
#2  0x0804a0bc in main (argc=Cannot access memory at address 0xb
) at util/i386/pc/grub-setup.c:733
(gdb)

for trace lock in the logfile

/Magnus

[-- Attachment #2: strace grub-setup.log --]
[-- Type: application/octet-stream, Size: 5930 bytes --]

livecd ~ # cat /root/grub-setup.log
execve("/sbin/grub-setup", ["grub-setup", "--directory=/boot/grub", "--device-map=/boot/grub/device.m"..., "/dev/md0"], [/  * 38 vars */]) = 0
brk(0)                                  = 0x8067000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xfffffffff7f9e000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(0x3, 0xffc72ffc)                = 0
mmap2(NULL, 16837, PROT_READ, MAP_PRIVATE, 3, 0) = 0xfffffffff7f99000
close(3)                                = 0
open("/lib32/libc.so.6", O_RDONLY)      = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200Y\1"..., 512) = 512
fstat64(0x3, 0xffc7307c)                = 0
mmap2(NULL, 1201596, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xfffffffff7e73000
mmap2(0xf7f93000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x120) = 0xfffffffff7f93000
mmap2(0xf7f96000, 9660, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xfffffffff7f96000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xfffffffff7e72000
set_thread_area(0xffc7355c)             = 0
mprotect(0xf7f93000, 8192, PROT_READ)   = 0
mprotect(0xf7fb9000, 4096, PROT_READ)   = 0
munmap(0xf7f99000, 16837)               = 0
brk(0)                                  = 0x8067000
brk(0x8088000)                          = 0x8088000
open("/boot/grub/device.map", O_RDONLY|O_LARGEFILE) = 3
fstat64(0x3, 0xffc732d8)                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0x1000) = 0xfffffffff7f9d000
read(3, "(hd0)\t/dev/md0\n(hd1)\t/dev/md0\n(h"..., 1024) = 61
lstat64(0x80671a0, 0xffc733bc)          = 0
lstat64(0x80671a0, 0xffc733bc)          = 0
readlink("/dev/md0", "md/0", 4096)      = 4
lstat64(0x80671a0, 0xffc733bc)          = 0
lstat64(0x80671a0, 0xffc733bc)          = 0
lstat64(0x80681a8, 0xffc733bc)          = 0
lstat64(0x80681a8, 0xffc733bc)          = 0
readlink("/dev/md0", "md/0", 4096)      = 4
lstat64(0x80681a8, 0xffc733bc)          = 0
lstat64(0x80681a8, 0xffc733bc)          = 0
lstat64(0x80691b0, 0xffc733bc)          = 0
lstat64(0x80691b0, 0xffc733bc)          = 0
readlink("/dev/md0", "md/0", 4096)      = 4
lstat64(0x80691b0, 0xffc733bc)          = 0
lstat64(0x80691b0, 0xffc733bc)          = 0
lstat64(0x806a1b8, 0xffc733bc)          = 0
lstat64(0x806a1b8, 0xffc733bc)          = 0
read(3, "", 1024)                       = 0
close(3)                                = 0
munmap(0xf7f9d000, 4096)                = 0
getcwd("/root", 10)                     = 6
chdir("/boot/grub")                     = 0
getcwd(0x8067060, 10)                   = -1 ERANGE (Numerical result out of range)
getcwd("/boot/grub", 20)                = 11
stat64(0x805d964, 0xffc73730)           = 0
chdir("..")                             = 0
stat64(0x805d964, 0xffc73730)           = 0
getcwd("/boot", 10)                     = 6
chdir("..")                             = 0
stat64(0x805d964, 0xffc73730)           = 0
chdir("/root")                          = 0
stat64(0x8067008, 0xffc73790)           = 0
open("/dev/mapper", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
fstat64(0x3, 0xffc736dc)                = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
getcwd("/root", 10)                     = 6
chdir("/dev/mapper")                    = 0
getdents(3, /* 1 entries */, 4096)      = 244
lstat64(0x806b207, 0xffc736e0)          = 0
lstat64(0x806b21f, 0xffc736e0)          = 0
lstat64(0x806b233, 0xffc736e0)          = 0
lstat64(0x806b24b, 0xffc736e0)          = 0
lstat64(0x806b263, 0xffc736e0)          = 0
lstat64(0x806b277, 0xffc736e0)          = 0
lstat64(0x806b28b, 0xffc736e0)          = 0
lstat64(0x806b29f, 0xffc736e0)          = 0
lstat64(0x806b2b3, 0xffc736e0)          = 0
getcwd(0x8067060, 10)                   = -1 ERANGE (Numerical result out of range)
getcwd("/dev/mapper", 20)               = 12
chdir("/root")                          = 0
close(3)                                = 0
stat64(0x8067060, 0xffc73790)           = 0
open("/dev/md0", O_RDONLY)              = 3
ioctl(3, 0x800c0910, 0xffc73860)        = 0
ioctl(3, 0x80480911, 0xffc73804)        = 0
ioctl(3, 0x80140912, 0xffc7384c)        = 0
ioctl(3, 0x80140912, 0xffc7384c)        = 0
ioctl(3, 0x80140912, 0xffc7384c)        = 0
stat64(0x80670e0, 0xffc737f0)           = 0
lstat64(0x806b1c0, 0xffc7375c)          = 0
lstat64(0x806b1c0, 0xffc7375c)          = 0
stat64(0x805cdc0, 0xffc73768)           = -1 ENOENT (No such file or directory)
stat64(0x8067078, 0xffc73754)           = 0
stat64(0x8067078, 0xffc73724)           = 0
open("/boot/grub/boot.img", O_RDONLY|O_LARGEFILE) = 4
fstat64(0x4, 0xffc735d8)                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0x1000) = 0xfffffffff7f9d000
_llseek(4, 0, [0], SEEK_SET)            = 0
read(4, "\353K\220\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 512
close(4)                                = 0
munmap(0xf7f9d000, 4096)                = 0
stat64(0x8067110, 0xffc73754)           = 0
stat64(0x8067110, 0xffc73724)           = 0
open("/boot/grub/core.img", O_RDONLY|O_LARGEFILE) = 4
fstat64(0x4, 0xffc735d8)                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0x1000) = 0xfffffffff7f9d000
_llseek(4, 0, [0], SEEK_SET)            = 0
read(4, "RV\276\33\201\350@\1^\277\364\201f\213-\203}\10\0\17\204"..., 30720) = 30720
read(4, "\335\2n|\1!i \310%Mk\316|\2A*A%\16kJ\1\275\1\233%\r9\277"..., 1024) = 949
close(4)                                = 0
munmap(0xf7f9d000, 4096)                = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
livecd ~ #

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: grub-setup Segmentation fault
  2007-08-04  2:37 Magnus Granberg
@ 2007-08-04  9:56 ` Robert Millan
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Millan @ 2007-08-04  9:56 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 957 bytes --]

On Sat, Aug 04, 2007 at 04:37:03AM +0200, Magnus Granberg wrote:
> Starting program: 
> /sbin/grub-setup --directory=/boot/grub --device-map=/boot/grub/device.map 
> /dev/md0
> 
> Program received signal SIGSEGV, Segmentation fault.
> grub_device_open (name=0x0) at kern/device.c:38
> 38            if (*name == '\0')
> (gdb) bt
> #0  grub_device_open (name=0x0) at kern/device.c:38
> #1  0x08049385 in setup (prefix=0x80670b0 "(md0)(vg-boot)/grub", 
> dir=0x8067008 "/boot/grub",
>    boot_file=<value optimized out>, core_file=0x805cb2a "core.img", 
> root=0x8067050 "vg-boot", dest=0x0, must_embed=1)
>    at util/i386/pc/grub-setup.c:223
> #2  0x0804a0bc in main (argc=Cannot access memory at address 0xb
> ) at util/i386/pc/grub-setup.c:733
> (gdb)

Could you try the attached patch?

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.

[-- Attachment #2: test.diff --]
[-- Type: text/x-diff, Size: 593 bytes --]

diff -ur grub2/util/i386/pc/grub-setup.c grub2.test/util/i386/pc/grub-setup.c
--- grub2/util/i386/pc/grub-setup.c	2007-08-02 22:42:19.000000000 +0200
+++ grub2.test/util/i386/pc/grub-setup.c	2007-08-04 11:55:14.000000000 +0200
@@ -685,6 +685,8 @@
     {
       char *tmp = get_device_name (root_dev);
 
+      grub_util_info ("1 root_dev = %s", root_dev);
+
       if (! tmp)
 	grub_util_error ("Invalid root device `%s'", root_dev);
       
@@ -703,6 +705,8 @@
 	}
     }
 
+  grub_util_info ("2 root_dev = %s", root_dev);
+
 #ifdef __linux__
   if (grub_util_lvm_isvolume (root_dev))
     {

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: grub-setup Segmentation fault
@ 2007-08-04 18:13 Magnus Granberg
  2007-08-05 10:00 ` Robert Millan
  0 siblings, 1 reply; 8+ messages in thread
From: Magnus Granberg @ 2007-08-04 18:13 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]

>>    boot_file=<value optimized out>, core_file=0x805cb2a "core.img", 
>> root=0x8067050 "vg-boot", dest=0x0, must_embed=1)
>>    at util/i386/pc/grub-setup.c:223
>> #2  0x0804a0bc in main (argc=Cannot access memory at address 0xb
>> ) at util/i386/pc/grub-setup.c:733
>> (gdb)
>
>Could you try the attached patch?
>
>-- 
>Robert Millan
>
It did't fix the Segmentation fault :(

/Magnus

[-- Attachment #2: Type: text/html, Size: 1092 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: grub-setup Segmentation fault
  2007-08-04 18:13 Magnus Granberg
@ 2007-08-05 10:00 ` Robert Millan
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Millan @ 2007-08-05 10:00 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Aug 04, 2007 at 08:13:21PM +0200, Magnus Granberg wrote:
> >>    boot_file=<value optimized out>, core_file=0x805cb2a "core.img", 
> >> root=0x8067050 "vg-boot", dest=0x0, must_embed=1)
> >>    at util/i386/pc/grub-setup.c:223
> >> #2  0x0804a0bc in main (argc=Cannot access memory at address 0xb
> >> ) at util/i386/pc/grub-setup.c:733
> >> (gdb)
> >
> >Could you try the attached patch?
> >
> >-- 
> >Robert Millan
> >
> It did't fix the Segmentation fault :(

It wasn't supposed to.  Did you see what the patch is doing?

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: grub-setup Segmentation fault
@ 2007-08-05 12:14 Magnus Granberg
  2007-08-06 16:44 ` Robert Millan
  0 siblings, 1 reply; 8+ messages in thread
From: Magnus Granberg @ 2007-08-05 12:14 UTC (permalink / raw)
  To: grub-devel

>> >Could you try the attached patch?
>> >
>> >-- 
>> >Robert Millan
>> >
>> It did't fix the Segmentation fault :(
>
>It wasn't supposed to.  Did you see what the patch is doing?
>
>-- 
>Robert Millan

grub-setup: info: prefix = /grub
grub-setup: info: changing current directory to /dev/mapper
grub-setup: info: 2 root_dev = vg-boot
grub-setup: info: getting the size of /boot/grub/boot.img
grub-setup: info: reading /boot/grub/boot.img
grub-setup: info: getting the size of /boot/grub/boot.img
grub-setup: info: getting the size of /boot/grub/core.img
grub-setup: info: reading /boot/grub/core.img
grub-setup: info: getting the size of /boot/grub/core.img
Segmentation fault

/Magnus




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: grub-setup Segmentation fault
  2007-08-05 12:14 Magnus Granberg
@ 2007-08-06 16:44 ` Robert Millan
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Millan @ 2007-08-06 16:44 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Aug 05, 2007 at 02:14:28PM +0200, Magnus Granberg wrote:
> >>>Could you try the attached patch?
> >>>
> >>>-- 
> >>>Robert Millan
> >>>
> >>It did't fix the Segmentation fault :(
> >
> >It wasn't supposed to.  Did you see what the patch is doing?
> >
> >-- 
> >Robert Millan
> 
> grub-setup: info: prefix = /grub
> grub-setup: info: changing current directory to /dev/mapper
> grub-setup: info: 2 root_dev = vg-boot
> grub-setup: info: getting the size of /boot/grub/boot.img
> grub-setup: info: reading /boot/grub/boot.img
> grub-setup: info: getting the size of /boot/grub/boot.img
> grub-setup: info: getting the size of /boot/grub/core.img
> grub-setup: info: reading /boot/grub/core.img
> grub-setup: info: getting the size of /boot/grub/core.img
> Segmentation fault

Sounds like I made the wrong guess, then.  You need to figure out where's
that null pointer coming from.  Doesn't seem to be root_dev..

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: grub-setup Segmentation fault
@ 2007-08-08  3:08 Magnus Granberg
  2007-08-12 14:39 ` Robert Millan
  0 siblings, 1 reply; 8+ messages in thread
From: Magnus Granberg @ 2007-08-08  3:08 UTC (permalink / raw)
  To: grub-devel

>Sounds like I made the wrong guess, then.  You need to figure out where's
>that null pointer coming from.  Doesn't seem to be root_dev..

#1  0x08049385 in setup (prefix=0x80670b0 "(md0)(vg-boot)/grub",
dir=0x8067008 "/boot/grub",
    boot_file=<value optimized out>, core_file=0x805cb2a "core.img",
root=0x8067050 "vg-boot", dest=0x0, must_embed=1)
    at util/i386/pc/grub-setup.c:223

Has somthing to do with dest=0x0 ?
If i run on only lvm no raid a get somting like dis
setup (prefix=0x8067070 "(vg-boot)/grub", dir=0x8067008 "/boot/grub", 
boot_file=0x805cb87 "boot.img",
    core_file=0x805cb7e "core.img", root=0x8067060 "vg-boot", dest=0x8067038 
"hd0", must_embed=1)

/Magnus




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: grub-setup Segmentation fault
  2007-08-08  3:08 grub-setup Segmentation fault Magnus Granberg
@ 2007-08-12 14:39 ` Robert Millan
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Millan @ 2007-08-12 14:39 UTC (permalink / raw)
  To: The development of GRUB 2

On Wed, Aug 08, 2007 at 05:08:18AM +0200, Magnus Granberg wrote:
> >Sounds like I made the wrong guess, then.  You need to figure out where's
> >that null pointer coming from.  Doesn't seem to be root_dev..
> 
> #1  0x08049385 in setup (prefix=0x80670b0 "(md0)(vg-boot)/grub",
> dir=0x8067008 "/boot/grub",
>    boot_file=<value optimized out>, core_file=0x805cb2a "core.img",
> root=0x8067050 "vg-boot", dest=0x0, must_embed=1)
>    at util/i386/pc/grub-setup.c:223
> 
> Has somthing to do with dest=0x0 ?

Yes, that null pointer looks suspicious.  I'm not very familiar with the
RAID/LVM stuff though.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-08-12 14:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-08  3:08 grub-setup Segmentation fault Magnus Granberg
2007-08-12 14:39 ` Robert Millan
  -- strict thread matches above, loose matches on Subject: below --
2007-08-05 12:14 Magnus Granberg
2007-08-06 16:44 ` Robert Millan
2007-08-04 18:13 Magnus Granberg
2007-08-05 10:00 ` Robert Millan
2007-08-04  2:37 Magnus Granberg
2007-08-04  9:56 ` Robert Millan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.