Bug 195835 - sysutils/grub2 10_kfreebsd fails to identify kernel and zpool.cache proper location
Summary: sysutils/grub2 10_kfreebsd fails to identify kernel and zpool.cache proper lo...
Status: Closed Feedback Timeout
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-09 22:49 UTC by bergerkos
Modified: 2017-03-04 14:30 UTC (History)
1 user (show)

See Also:


Attachments
patch to 10_kfreebsd file. (1.90 KB, patch)
2014-12-09 22:49 UTC, Bugzilla Automation
no flags Details | Diff
new patch file (1.96 KB, patch)
2015-03-06 13:33 UTC, bergerkos
no flags Details | Diff
patch for --search sting to work properly (654 bytes, patch)
2015-03-06 16:21 UTC, bergerkos
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description bergerkos 2014-12-09 22:49:52 UTC
Created attachment 150413 [details]
patch to 10_kfreebsd file.

On my system, which is amd64, zfs root, the 10_kfreebsd template found under /usr/local/etc/grub.d causes grub-mkconfig script to erroneously define kernel as /boot/kernel instead of /boot/kernel/kernel, while also looking for zfs/zpool.cache under /boot/kernel, while it usually resides under /boot. Logical, too, because /boot/kernel is subject to being moved with a new kernel installation, which mustn't concern zpool.cache file.

Another problem I see is needless repetition of the string "search --no-floppy --fs-uuid --set=root $UUID" every now and then in the created grub.cfg, while it is properly belongs only once, at the top of a menu entry, where "root" is defined.

This I was able to correct, see the attached patch. It also deals with \t meant for <tab>, which has been reported elsewhere. The result is a clean and correct grub.cfg file, which can be used.
Comment 1 John Marino freebsd_committer freebsd_triage 2015-02-06 16:49:12 UTC
Two points: 

1) incredibly, this port is unmaintained
2) you provided a patch to the source whereas you should have provided a part to the port (e.g. a patch that creates a patch in files/ directory).

Since there is no maintainer, I'll promote this anyway.
Comment 2 bergerkos 2015-02-09 20:02:20 UTC
Oh, sorry. Didn't know all these details.
Comment 3 John Marino freebsd_committer freebsd_triage 2015-03-01 22:40:12 UTC
This isn't even a patch to the source.

I just extracted the tarball, I think you were probably thinking of ${WRKSRC}/util/grub.d/10_kfreebsd.in.

You provided a patch to the installed product rather than the template.  



Can you submit a new attachment that is a proper patch to the source?

in other words,
> make clean ; make extract
> cd <work>/grub-2.00/util/grub.d/
> cp -a 10_kfreebsd.in 10_kfreebsd.in.orig

modify 10_kfreebsd.in

> cd /usr/ports/sysutils/grub
> make makepatch

you should have a good patch in files directory.
Comment 4 bergerkos 2015-03-03 10:26:44 UTC
OK thanks. Now that you've explained what to do I'll see into it.
Comment 5 bergerkos 2015-03-03 10:28:38 UTC
(In reply to John Marino from comment #3)
thanks a lot!! The more I learn about FreeBSD build system, the more I love it.
Comment 6 bergerkos 2015-03-06 13:33:01 UTC
Created attachment 153897 [details]
new patch file

Here is the patch to the source
Comment 7 bergerkos 2015-03-06 16:21:42 UTC
Created attachment 153914 [details]
patch for --search sting to work properly

Here is another patch linked to the one above. Without it the "--search ..." string produced by grub-mkconfig doesn't work properly.
Comment 8 bergerkos 2015-03-07 01:06:43 UTC
OK, here are some updates upon these patches. 

1. The one to correct the detection of zpool.cache is not needed for the current GIT version of GRUB. However, it IS needed for the current version of sysutils/grub2 port and the source it is based upon.

2. Other patches are meant to trim up the looks of the resulting grub.cfg.

However, GRUB maintainers upstream claim that the existing script deals with the possibility of different modules being on different partitions/disks. While this makes little sense to me from the practical vewpoint, this capacity should be preserved. Although such customized setups will still need manual configuration...

In which case these patches must be removed in order to keep that capacity of grub-mkconfig. 

CONCLUSION: I will test all this as soon as possible and then submit the resulting patch that will only correct the detection of /boot/zfs/zpool.cache for the existing port version -- if the resulting grub.cfg will be useful for booting the system.