Bug 620846

Summary: x86_64: memtest86+ grub entry fails to boot
Product: [Fedora] Fedora Reporter: Edouard Bourguignon <madko>
Component: memtest86+Assignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: anton, b.bellec, ejsheldrake, grinnz, kyryl.bilokurov, macieksitarz+redhatbugzilla, moondrake, nicolas.mailhot, robatino, ss, uckelman
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-19 13:14:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
.spec file patch to use '-z max-page-size=0x1000' on x86_64 links of the ELF image none

Description Edouard Bourguignon 2010-08-03 15:59:33 UTC
Description of problem:
memtest-setup add an entry for memtest86+ in grub.conf but this entry fails to boot:
Error 13: Invalid of unsupported executable format


Version-Release number of selected component (if applicable):
memtest86+-4.10-2.fc13

How reproducible:
static

Steps to Reproduce:
1. su -c yum install memtest86+
2. su -c memtest-setup
3. reboot on Memtest grub entry
  
Actual results:
Fails to boot with error 13.

Expected results:
Should boot memtest86+

Additional info:
Seems RHEL6 has same problem, see bug #607006

Comment 1 Anton Arapov 2010-08-04 06:30:10 UTC
  Edouard, this is known issue. The problem is in the loader of memtest and the way to fix it is to rewrite the loader. And there are zero volunteers to do it.
  The workaround is to change: 
     kernel --type=netbsd /elf-memtest86+-4.00 to kernel /memtest86+-4.00
in grub.conf. It's not by default because the majority of the systems works just well with current config.

Comment 2 Anton Arapov 2010-08-10 17:01:42 UTC
*** Bug 622666 has been marked as a duplicate of this bug. ***

Comment 3 Anton Arapov 2010-08-10 17:01:51 UTC
*** Bug 622667 has been marked as a duplicate of this bug. ***

Comment 4 Edward Sheldrake 2010-08-20 18:44:25 UTC
*** Bug 625860 has been marked as a duplicate of this bug. ***

Comment 5 Edward Sheldrake 2010-08-20 18:54:08 UTC
Sorry for yet another dupe, however I do have a possible solution (see #625860) for my initial analysis.

I noticed Fedora 13's x86_64 binutils produce a different elf-memtest than Fedora 12's binutils did, and it no longer works. I then later managed to get Fedora 13 to produce a working elf-memtest by doing:

make LD="ld -z max-page-size=0x1000"

A simpler solution may be to just distribute the .i686.rpm, since there's nothing x86_64 in the .x86_64.rpm anyway.

Comment 6 Andre Robatino 2010-08-23 18:31:19 UTC
I can confirm that the problem started for me in F13.  Prior to that I ran 64-bit F10, F11, and F12 on the same hardware without ever seeing it.

Comment 7 Dan Book 2010-12-04 07:36:04 UTC
Same problem, and using the non-ELF version doesn't work because I get the error that it doesn't fit into memory. (which is the point of the ELF version from what I understand)

Comment 8 Fedora Admin XMLRPC Client 2010-12-17 08:49:16 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 9 Edward Sheldrake 2010-12-17 09:32:51 UTC
There are 2 different causes of this bug here:

1. The memtest86+ loader needs a re-write.
2. On Fedora 13+, the elf-memtest built on x86_64 ends up about 1MB too big due to a change in binutils - http://sourceware.org/ml/binutils/2009-08/msg00563.html

elf-memtest86+-4.10 is always a 32bit executable, there is no 64bit version.

From "readelf -l" on elf-memtest86+-4.10 from the .i686.rpm
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x00100000 0x00100000 0x27ad8 0x27ad8 RW  0x1000

And from "readelf -l" on elf-memtest86+-4.10 from the .x86_64.rpm
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000000 0x00000000 0x00000000 0x127ad8 0x127ad8 RW  0x200000

Comment 10 Jack Perdue 2011-01-07 19:28:42 UTC
As Edward also noted (Comment #5), there's a linker flag that can be used to reduce the overall size.

Adding this bit to the %prep section of the .spec file:

%ifarch x86_64
sed -i -e's,$(LD) -s -T memtest.lds,$(LD) -s -T memtest.lds -z max-page-size=0x1000,' Makefile
%endif

(adding the '-z max-page-size=0x1000' on x86_64 links of the ELF image)

returns a "readelf -l" image like this:

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x00100000 0x00100000 0x26ad8 0x26ad8 RW  0x1000

which is closer to the File/MemSize of the 32-bit version and works when the x86_64 RPM is installed.

So, in this particular case, the workaround is either drop the i686 build in the x86_64 repo (which is probably a nasty hack repo-management-wise) or add the max-page-size option that Edward suggested on the link for the x86_64 ELF image.

FWIW, given that memtest86+ is one of the boot options on the LiveCD, it would be nice if it would work again.

Comment 11 Jack Perdue 2011-01-07 19:31:29 UTC
[oops... I appeared to have missed the top part of my post when copying/pasting... here is the first part to the previous comment]

I received the same Error 13 here with Fedora 14 on a Compaq Presario R3000 laptop with 768MB RAM and AMD Athlon(tm) 64 Processor 3000+.

Anton's (Comment #1), which seems to come from https://bugzilla.redhat.com/show_bug.cgi?id=578966 doesn't help (causes instant reboot).

As Edward noted, it is a 32-bit build anyway and using the i686 RPM on my x86_64 system is one workaround (slightly complicated by the fact that the .i686.rpm is not in the x86_64 repo, but other than that it just worked).

... (see previous comment) ...

Comment 12 Jack Perdue 2011-01-07 20:03:55 UTC
Created attachment 472291 [details]
.spec file patch to use '-z max-page-size=0x1000' on x86_64 links of the ELF image

Comment 13 moondrake 2011-01-11 13:32:07 UTC
Jack: Patch works fine for me, thanks

Anton: the x86_64 size bug seems a different problem than the one you refer to. And is a problem on all three my x86_64 machines (laptops and desktops). This seems to affect a large percentage of users. A bugfix release for F13 and F14 may be a good idea.

About the loader problem, why not make memtest-setup create 2 alternate grub entries and solve it for everybody (instead of assuming it works for a majority).

Comment 14 Jaroslav Škarvada 2011-01-11 15:18:43 UTC
I am new maintainer. 

Thanks, patch seems to work.

Comment 15 Fedora Update System 2011-01-19 15:20:32 UTC
memtest86+-4.10-3.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/memtest86+-4.10-3.fc14

Comment 16 Fedora Update System 2011-01-19 15:30:18 UTC
memtest86+-4.10-3.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/memtest86+-4.10-3.fc13

Comment 17 Fedora Update System 2011-02-19 01:23:37 UTC
memtest86+-4.10-3.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 18 Fedora Update System 2011-02-19 01:26:23 UTC
memtest86+-4.10-3.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.