Bug 729197 - memtest-setup doesn't understand Grub2
Summary: memtest-setup doesn't understand Grub2
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: memtest86+
Version: 16
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 734104 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-09 02:49 UTC by Andre Robatino
Modified: 2015-02-04 16:55 UTC (History)
11 users (show)

Fixed In Version: memtest86+-4.20-4.fc16
Clone Of:
Environment:
Last Closed: 2011-12-14 23:33:45 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
/etc/grub.d/23_memtest (3.40 KB, application/octet-stream)
2011-10-03 02:20 UTC, Michal Ambroz
no flags Details
/boot/grub2/grub.cfg for VirtualBox guest with non-working memtest86+ grub2 entry (3.14 KB, text/plain)
2011-12-06 02:35 UTC, Andre Robatino
no flags Details
/boot/grub2/grub.cfg for VirtualBox 4.1.6 Rawhide x86_64 guest with 2 memtest86+ entries (3.66 KB, text/plain)
2011-12-10 19:37 UTC, Andre Robatino
no flags Details

Description Andre Robatino 2011-08-09 02:49:44 UTC
Description of problem:
Fedora 16 uses Grub2 by default, but memtest-setup doesn't understand it. After a clean F16 install, and installing memtest86+, running memtest-setup gives

[root@localhost ~]# memtest-setup 
cat: /boot/grub/grub.conf: No such file or directory
sed: can't read /boot/grub/grub.conf: No such file or directory
sed: can't read /boot/grub/grub.conf: No such file or directory
Setup complete.
[root@localhost ~]#

Of course the setup could be done manually, if I understood Grub2 better.

Version-Release number of selected component (if applicable):
memtest86+-4.20-1.fc16

Comment 1 Jaroslav Škarvada 2011-08-25 13:59:40 UTC
The current support of grub legacy is hack. I am currently completely rewriting it with grub2 taken into account. It will take a while - ETA: this week.

Comment 2 Jaroslav Škarvada 2011-08-29 07:50:42 UTC
It gets a delay, because it's a bit more complicated than expected, but it is still moving.

Comment 3 Jaroslav Škarvada 2011-08-29 13:40:26 UTC
*** Bug 734104 has been marked as a duplicate of this bug. ***

Comment 4 Andre Robatino 2011-08-29 13:58:53 UTC
As I understand it, the reason memtest-setup puts the memtest entry at the beginning of the grub menu instead of the end (bug 489110) is that it uses grubby. Is it possible for the modified version to avoid this? (I'm guessing not, just thought I should ask before you did the work.)

Comment 5 Jaroslav Škarvada 2011-08-29 14:36:21 UTC
(In reply to comment #4)
No problem, my new memtest-setup is flexible. I will add the option for the insert position and make the last position the default if not specified.

I am not using grubby now, because it doesn't count with non-kernel images and the memtest installation still required helper script and sed for ugly non-portable grub conf patching. The situation went even worse with grub2. Currently the grubby cannot be easily modified. In the future I am going to create and post grubby patches that simplifies the installation of non-kernel images but it would be longer term goal.

Comment 6 Michal Ambroz 2011-10-03 02:18:54 UTC
Hi,
rather than using grubby and some post install, wouldn't it be better to use some template at the /etc/grub.d/? For example /etc/grub.d/23_memtest would move the entry to the end of the grub2 menu.

I am attaching the template script I modified from the 10_linux for the need of memtest.

New grub2 configuration is generated by:
grub2-mkconfig -o /boot/grub2/grub.cfg

Best regards
Michal Ambroz

Comment 7 Michal Ambroz 2011-10-03 02:20:08 UTC
Created attachment 525969 [details]
/etc/grub.d/23_memtest

Comment 8 Solomon Peachy 2011-11-13 15:22:10 UTC
Michal's template works great for me, just wanted to say thanks.

Comment 9 Michal Ambroz 2011-11-13 19:51:37 UTC
Appologies

Comment 10 Orion Poplawski 2011-11-30 21:09:26 UTC
Ping?  Template works for me too.

Comment 11 Jaroslav Škarvada 2011-11-30 23:04:52 UTC
Guys, sorry for delay. Michal thanks for your work.

Personally I was interested in robust grub1/2 capable script that do not force user to run grub2-mkconfig (i.e. it patch directly grub.cfg), but also generates grub2 templates to support grub2-mkconfig. Currently I am in approx. 50% of implementation (I was busy with more prio tasks).

I think we can go with the template to fix this problem quickly. Maybe I will release the script later. Again thanks.

Comment 12 Jaroslav Škarvada 2011-12-05 10:37:30 UTC
I am changing the name of the tempalte to 20_memtest according to /etc/grub.d/README.

Comment 13 Jaroslav Škarvada 2011-12-05 14:32:26 UTC
I added support to memtest-setup for the template. It should now support grub/grub2. Thanks for the template.

I will integrate my rewritten version of memtest-setup later, when finished and fully tested.

Comment 14 Fedora Update System 2011-12-05 14:33:21 UTC
memtest86+-4.20-2.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/memtest86+-4.20-2.fc16

Comment 15 Andre Robatino 2011-12-05 17:52:00 UTC
It works, just two minor issues:

1) When updating memtest86+, get the warning

Running Transaction
  Updating   : memtest86+-4.20-2.fc16.x86_64                                1/2 
  Cleanup    : memtest86+-4.20-1.fc16.x86_64                                2/2 
sed: can't read /boot/grub/grub.conf: No such file or directory

2) I have a dual-boot machine (Fedora/Vista), and the memtest86+ entry is after the Fedora entries but before the Vista entry. Is it possible to have the memtest86+ entry always be last (below all OS entries)?

Comment 16 Fedora Update System 2011-12-06 01:00:53 UTC
Package memtest86+-4.20-2.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing memtest86+-4.20-2.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-16801/memtest86+-4.20-2.fc16
then log in and leave karma (feedback).

Comment 17 Andre Robatino 2011-12-06 02:35:04 UTC
Created attachment 541145 [details]
/boot/grub2/grub.cfg for VirtualBox guest with non-working memtest86+ grub2 entry

But doesn't work in my VirtualBox 4.1.6 F16 x86_64 guest with updates-testing enabled. I just get the message

Loading Fedora Memtest ...Loading memtest86+-4.20  ...
    [Linux-zImage, setup=0x800, size=0x2a878]

and it hangs there. Corresponding grub.cfg attached.

Comment 18 Andre Robatino 2011-12-06 16:32:59 UTC
Works for me in my VirtualBox 4.1.6 Rawhide x86_64 guest with updates-testing enabled, though. Weird.

Comment 19 Jaroslav Škarvada 2011-12-07 13:28:38 UTC
(In reply to comment #15)
> It works, just two minor issues:
> 
> 1) When updating memtest86+, get the warning
> 
It seems to be caused by %preun of the old memtest that has hardcoded grub1.
New version has conditional. I guess it would require some triggers magic to
kill this, but the added complexity woulnd't be probably worth to fix such
harmless warning that appears only once.

> 2) I have a dual-boot machine (Fedora/Vista), and the memtest86+ entry is after
> the Fedora entries but before the Vista entry. Is it possible to have the
> memtest86+ entry always be last (below all OS entries)?
>
I will check this.

Comment 20 Jaroslav Škarvada 2011-12-07 13:35:21 UTC
(In reply to comment #18)
> Works for me in my VirtualBox 4.1.6 Rawhide x86_64 guest with updates-testing
> enabled, though. Weird.

It blows down my VirtualBox-4.1.6_74713 x86_64, but it probably doesn't mean anything (I have similar opinion with some F16 kernels :). There was no code change and it seems to work OK on my real testing HW.

Comment 21 Jaroslav Škarvada 2011-12-07 14:42:30 UTC
I spotted typo in memtest86+ spec file, that caused the 20_memtest not to be removed from your /etc/grub.d/ upon package uninstall. I fixed this in memtest86+-4.20-3. I also renamed the 20_memtest to 20_memtest86+ to be in sync with upstream docs.

Comment 22 Jaroslav Škarvada 2011-12-07 14:46:26 UTC
(In reply to comment #15)
> 2) I have a dual-boot machine (Fedora/Vista), and the memtest86+ entry is after
> the Fedora entries but before the Vista entry. Is it possible to have the
> memtest86+ entry always be last (below all OS entries)?
>
If you install your second OS (Vista) by 30_os-prober or by 40_custom or $prefix/custom.cfg scripts, they appeared after the memtest in the bootmenu, because memtest uses prefix 20_*. This number seems to be reserved by grub2 upstream, according to their docs:
20_*: Third party apps (e.g. memtest86+)

You can rename the 20_memtest86+ to e.g. 50_memtest86+ to be the last in the menu, but you will have to also remove it by hand if you uninstall the memtest86+ package later. I think we should use the 20_* for compatibility.

Comment 23 Fedora Update System 2011-12-07 15:15:15 UTC
memtest86+-4.20-3.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/memtest86+-4.20-3.fc16

Comment 24 Edward Sheldrake 2011-12-07 20:41:39 UTC
Does it matter that it's not using the elf-memtest image anymore? That one can be booted with:
knetbsd	/elf-memtest86+-4.20

Comment 25 Jaroslav Škarvada 2011-12-07 22:17:12 UTC
(In reply to comment #24)
> Does it matter that it's not using the elf-memtest image anymore? That one can
> be booted with:
> knetbsd /elf-memtest86+-4.20

AFAIK probably better not to change this. I will revert this in memtest86+-4.20-4.fc16, thanks.

Comment 26 Fedora Update System 2011-12-07 23:10:26 UTC
memtest86+-4.20-4.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/memtest86+-4.20-4.fc16

Comment 27 Andre Robatino 2011-12-10 19:37:57 UTC
Created attachment 544966 [details]
/boot/grub2/grub.cfg for VirtualBox 4.1.6 Rawhide x86_64 guest with 2 memtest86+ entries

After updating my Rawhide guest to memtest86+-4.20-4.fc17.x86_64, running memtest-setup and then grub2-mkconfig, I now have 2 memtest86+ entries. grub.cfg attached.

Comment 28 Andre Robatino 2011-12-10 19:46:31 UTC
Same behavior with the F16 version of 4.20-4. Here is the output when running grub2-mkconfig after memtest-setup:

[root@compaq-pc RPMS]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.1.4-1.fc16.x86_64
Found initrd image: /boot/initramfs-3.1.4-1.fc16.x86_64.img
Found linux image: /boot/vmlinuz-3.1.2-1.fc16.x86_64
Found initrd image: /boot/initramfs-3.1.2-1.fc16.x86_64.img
Found linux image: /boot/vmlinuz-3.1.1-2.fc16.x86_64
Found initrd image: /boot/initramfs-3.1.1-2.fc16.x86_64.img
Found memtest image: /boot/memtest86+-4.20
Found memtest image: /boot/elf-memtest86+-4.20
Found Windows Vista (loader) on /dev/sda1
done
[root@compaq-pc RPMS]#

Comment 29 Andre Robatino 2011-12-10 19:52:36 UTC
I downgraded my F16 version to 4.20-2, ran memtest-setup and grub2-mkconfig again, and now have only one memtest entry again. Note, though, that when running memtest-setup it doesn't tell me to run grub2-mkconfig, so it would have been easy to forget.

[root@compaq-pc RPMS]# memtest-setup 
grub2 detected, installing template...
grub2 template is already installed. Exiting...
[root@compaq-pc RPMS]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.1.4-1.fc16.x86_64
Found initrd image: /boot/initramfs-3.1.4-1.fc16.x86_64.img
Found linux image: /boot/vmlinuz-3.1.2-1.fc16.x86_64
Found initrd image: /boot/initramfs-3.1.2-1.fc16.x86_64.img
Found linux image: /boot/vmlinuz-3.1.1-2.fc16.x86_64
Found initrd image: /boot/initramfs-3.1.1-2.fc16.x86_64.img
Found memtest image: /boot/memtest86+-4.20
Found Windows Vista (loader) on /dev/sda1
done
[root@compaq-pc RPMS]#

Comment 30 Jaroslav Škarvada 2011-12-11 12:46:20 UTC
(In reply to comment #29)
Thanks for testing.

The two memtest86+ entries are caused by bug introduced by typo in 4.20-2 - it doesn't remove its template and it is leftover. It gets fixed in 4.20-3. You need to remove the leftover 4.20-2 template by hand:
# rm /etc/grub.d/20-memtest

I am not sure if it is worth to add hack for this, because the 4.20-2 didn't left updates-testing and was there only for short time.

> Note, though, that when
> running memtest-setup it doesn't tell me to run grub2-mkconfig, so it would
> have been easy to forget.
> 
> [root@compaq-pc RPMS]# memtest-setup 
> grub2 detected, installing template...
> grub2 template is already installed. Exiting...
>
If the grub template is already there (the leftover template in this case) I guess it doesn't need to tell you to run grub2-mkconfig, because there was done no change to your grub2 config.

Comment 31 Jaroslav Škarvada 2011-12-11 12:51:10 UTC
(In reply to comment #29)
Upgrade path 4.20-1 to 4.20-4 should work without the leftover file. Also the leftover file is only present if you install 4.20-2 and then run memtest-setup, otherwise it is not created.

Comment 32 Andre Robatino 2011-12-11 17:17:11 UTC
Confirmed that the old file /etc/grub.d/20_memtest is not owned by any package, and removed it. Running grub2-mkconfig then gives me one memtest entry. This entry also works both in my F16 and Rawhide guests.

Comment 33 Fedora Update System 2011-12-14 23:33:45 UTC
memtest86+-4.20-4.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 34 Brownout 2012-01-18 17:15:04 UTC
A call to memtest-setup followed by grub2-mkconfig in post-install would be nice, otherwise you're still without a menu entry (no /etc/grub.d/20_memtest86+ and no update to grub.cfg).


Note You need to log in before you can comment on or make changes to this bug.