Gentoo Forums
Gentoo Forums
Quick Search: in
Can not boot any kernel using grub with >= 4GB of memory.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on AMD64
View previous topic :: View next topic  
Author Message
drescherjm
Advocate
Advocate


Joined: 05 Jun 2004
Posts: 2722
Location: Pittsburgh, PA, USA

PostPosted: Fri Jul 15, 2005 1:22 pm    Post subject: Can not boot any kernel using grub with >= 4GB of memory. Reply with quote

With 0.96-r2 when I try to boot a kernel that worked fine with 2 GB installed I get an error stating that the kernel is to big to fit in memory. Is their a patch for this or is everyone with > 4GB of memory using lilo?
_________________
John

My gentoo overlay
Instructons for overlay
Back to top
View user's profile Send private message
pitcrawler
Apprentice
Apprentice


Joined: 09 Jan 2005
Posts: 150
Location: Oklahoma, USA

PostPosted: Fri Jul 15, 2005 1:48 pm    Post subject: Reply with quote

I found a bug report and patch for the problem here: http://savannah.gnu.org/bugs/?func=detailitem&item_id=9954
It is from 2004 though, and I would have thought GRUB would have been patched and fixed by now.

The version that bug report refers to is 0.95+cvs20040624
Back to top
View user's profile Send private message
drescherjm
Advocate
Advocate


Joined: 05 Jun 2004
Posts: 2722
Location: Pittsburgh, PA, USA

PostPosted: Fri Jul 15, 2005 2:02 pm    Post subject: Reply with quote

Thanks for the link. I will try this when I get a chance.

[EDIT]
I tried it and after a few setps I was able to get it working. The version grub that I use (0.96-r2) was newer than the patch so the patch failed but it was pretty easy to fix. I made a .patch and a new ebuild grub-0.96-r3.ebuild. I guess I could post them along with a bug report at bugs.gento.org.
[/EDIT]
_________________
John

My gentoo overlay
Instructons for overlay
Back to top
View user's profile Send private message
drescherjm
Advocate
Advocate


Joined: 05 Jun 2004
Posts: 2722
Location: Pittsburgh, PA, USA

PostPosted: Wed Nov 02, 2005 7:45 am    Post subject: Reply with quote

First here is the ebuild:
Code:

fileserver grub # cat /usr/local/portage/sys-boot/grub/grub-0.96-r3.ebuild
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-0.96-r2.ebuild,v 1.4 2005/07/04 11:35:49 swegener Exp $

inherit mount-boot eutils flag-o-matic toolchain-funcs

DESCRIPTION="GNU GRUB boot loader"
HOMEPAGE="http://www.gnu.org/software/grub/"
SRC_URI="mirror://gentoo/${P}.tar.gz
        ftp://alpha.gnu.org/gnu/${PN}/${P}.tar.gz
        mirror://gentoo/${PN}-0.95.20040823-splash.patch.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 x86"
IUSE="static netboot"

RDEPEND=">=sys-libs/ncurses-5.2-r5"
DEPEND="${RDEPEND}
        >=sys-devel/automake-1.7
        >=sys-devel/autoconf-2.5"
PROVIDE="virtual/bootloader"

pkg_setup() {
        if use amd64; then
                if ! has_m32; then
                        eerror "Your compiler seems to be unable to compile 32bit code."
                        eerror "If you are on amd64, make sure you compile gcc with:"
                        echo
                        eerror "    USE=multilib FEATURES=-sandbox"
                        die "Cannot produce 32bit objects!"
                fi

                ABI_ALLOW="x86"
                ABI="x86"
        fi
}

src_unpack() {
        unpack ${A}
        cd "${S}"

        epatch "${WORKDIR}"/${PN}-0.95.20040823-splash.patch

        # PIC patch by psm & kevin f. quinn #80693
        epatch "${FILESDIR}"/${P}-PIC.patch

        # disable testing of FFS and UFS2 images that always fail (bug #71811)
        epatch "${FILESDIR}"/${P}-bounced-checks.patch

        # i2o RAID support #76143
        epatch "${FILESDIR}"/${P}-i2o-raid.patch

        # -fwritable-strings is deprecated; testing to see if we need it any more
        epatch "${FILESDIR}"/${PN}-0.95.20040823-warnings.patch

        # should fix NX segfaulting on amd64 and x86_64 by Peter Jones
        # http://lists.gnu.org/archive/html/bug-grub/2005-03/msg00011.html
        epatch "${FILESDIR}"/${P}-nxstack.patch

        # Remove writable-string code from xfs support code (#90845)
        epatch "${FILESDIR}"/${P}-xfs-writable-string.patch

        # gcc4 patches; bug #85016
        epatch "${FILESDIR}"/${P}-r1-gcc4.patch

        # fix PIC issues in netboot code #85566
        epatch "${FILESDIR}"/${P}-netboot-pic.patch

        # fix > 2gb memory bug
        epatch "${FILESDIR}"/${P}-2g_limit.patch

        # a bunch of patches apply to raw autotool files
        autoconf || die "autoconf failed"
        aclocal || die "aclocal failed"
        automake || die "automake failed"
}

src_compile() {
        unset BLOCK_SIZE #73499

        ### i686-specific code in the boot loader is a bad idea; disabling to ensure
        ### at least some compatibility if the hard drive is moved to an older or
        ### incompatible system.

        # grub-0.95 added -fno-stack-protector detection, to disable ssp for stage2,
        # but the objcopy's (faulty) test fails if -fstack-protector is default.
        # create a cache telling configure that objcopy is ok, and add -C to econf
        # to make use of the cache.
        #
        # CFLAGS has to be undefined running econf, else -fno-stack-protector detection fails.
        # STAGE2_CFLAGS is not allowed to be used on emake command-line, it overwrites
        # -fno-stack-protector detected by configure, removed from netboot's emake.
        unset CFLAGS

        export grub_cv_prog_objcopy_absolute=yes #79734
        use static && append-ldflags -static

        # build the net-bootable grub first, but only if "netboot" is set
        if use netboot ; then
                econf \
                --libdir=/lib \
                --datadir=/usr/lib/grub \
                --exec-prefix=/ \
                --disable-auto-linux-mem-opt \
                --enable-diskless \
                --enable-{3c{5{03,07,09,29,95},90x},cs89x0,davicom,depca,eepro{,100}} \
                --enable-{epic100,exos205,ni5210,lance,ne2100,ni{50,65}10,natsemi} \
                --enable-{ne,ns8390,wd,otulip,rtl8139,sis900,sk-g16,smc9000,tiara} \
                --enable-{tulip,via-rhine,w89c840} || die "netboot econf failed"

                emake w89c840_o_CFLAGS="-O" || die "making netboot stuff"

                mv -f stage2/{nbgrub,pxegrub} "${S}"/
                mv -f stage2/stage2 stage2/stage2.netboot

                make clean || die "make clean failed"
        fi

        # Now build the regular grub
        # Note that FFS and UFS2 support are broken for now - stage1_5 files too big
        econf \
                --libdir=/lib \
                --datadir=/usr/lib/grub \
                --exec-prefix=/ \
                --disable-auto-linux-mem-opt || die "econf failed"
        emake || die "making regular stuff"
}

src_test() {
        # non-default block size also give false pass/fails.
        unset BLOCK_SIZE
        make check || die "make check failed"
}

src_install() {
        make DESTDIR="${D}" install || die
        exeinto /usr/lib/grub
        use netboot && doexe nbgrub pxegrub stage2/stage2.netboot

        insinto /boot/grub
        doins "${FILESDIR}"/splash.xpm.gz
        newins docs/menu.lst grub.conf.sample

        dodoc AUTHORS BUGS COPYING ChangeLog NEWS README THANKS TODO
        newdoc docs/menu.lst grub.conf.sample
}

pkg_postinst() {
        [[ ${ROOT} != "/" ]] && return 0

        # change menu.lst to grub.conf
        if [[ ! -e /boot/grub/grub.conf && -e /boot/grub/menu.lst ]] ; then
                mv -f /boot/grub/menu.lst /boot/grub/grub.conf
                ewarn
                ewarn "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
                ewarn
        fi
        einfo "Linking from new grub.conf name to menu.lst"
        [[ ! -e /boot/grub/menu.lst ]] && ln -snf grub.conf /boot/grub/menu.lst

        [[ -e /boot/grub/stage2 ]] && mv /boot/grub/stage2{,.old}

        einfo "Copying files from /lib/grub and /usr/lib/grub to /boot"
        for x in /lib/grub/*/* /usr/lib/grub/*/* ; do
                [[ -f ${x} ]] && cp -p ${x} /boot/grub
        done

        [[ -e /boot/grub/grub.conf ]] \
                && /sbin/grub \
                        --batch \
                        --device-map=/boot/grub/device.map \
                        < /boot/grub/grub.conf > /dev/null 2>&1
}


Next here is the patch:
Code:
fileserver grub # cat /usr/local/portage/sys-boot/grub/files/grub-0.96-2g_limit.patch
diff -Nurd grub-0.96-r2/work/grub-0.96/stage2/char_io.c grub-0.96-r4/work/grub-0.96/stage2/char_io.c
--- grub-0.96-r2/work/grub-0.96/stage2/char_io.c        2005-07-15 19:51:23.000000000 -0400
+++ grub-0.96-r4/work/grub-0.96/stage2/char_io.c        2005-07-15 20:01:11.000000000 -0400
@@ -1214,7 +1214,7 @@
 # endif
 #endif
 int
-memcheck (int addr, int len)
+memcheck (unsigned long addr, unsigned long len)
 {
 #ifdef GRUB_UTIL
 # ifdef __PIC__
@@ -1226,9 +1226,9 @@
     return ! errnum;
 #  endif
 # else /* __PIC__ */
-  auto int start_addr(void);
+  auto unsigned long start_addr(void);

-  auto int start_addr (void)
+  auto unsigned long start_addr (void)
     {
       int ret;
 #  if defined(HAVE_START_SYMBOL)
@@ -1241,9 +1241,9 @@
       return ret;
     }

-  auto int end_addr(void);
+  auto unsigned long end_addr(void);

-  auto int end_addr (void)
+  auto unsigned long end_addr (void)
     {
       int ret;
 #  if defined(HAVE_END_SYMBOL)
diff -Nurd grub-0.96-r2/work/grub-0.96/stage2/shared.h grub-0.96-r4/work/grub-0.96/stage2/shared.h
--- grub-0.96-r2/work/grub-0.96/stage2/shared.h 2005-07-15 19:51:23.000000000 -0400
+++ grub-0.96-r4/work/grub-0.96/stage2/shared.h 2005-07-15 20:01:17.000000000 -0400
@@ -912,7 +912,7 @@
 int nul_terminate (char *str);
 int get_based_digit (int c, int base);
 int safe_parse_maxint (char **str_ptr, int *myint_ptr);
-int memcheck (int start, int len);
+int memcheck (unsigned long start, unsigned long len);
 void grub_putstr (const char *str);

 #ifndef NO_DECOMPRESSION


To install. Make sure you have your PORTDIR_OVERLAY setup in /etc/make.conf
Code:
cat /etc/make.conf | grep OVERLAY
PORTDIR_OVERLAY="/usr/local/portage"


Then enter the following commands:
Code:
mkdir -p /usr/local/portage/sys-boot/grub
cp -r /usr/portage/sys-boot/grub/files /usr/local/portage/sys-boot/grub/
cd /usr/local/portage/sys-boot/grub/


Then copy and paste the two files above and then run the following command:
Code:
ebuild grub-0.96-r3.ebuild digest


Then setup your keywords for the emerge so that in the future grub does not accidently be overwritten by a new version without the patch:
Code:
mkdir -p /etc/portage
echo "=grub-0.96-r3 ~x86 ~amd64" >> /etc/portage/package.keywords
echo ">grub-0.96-r3" >> /etc/portage/package.mask


Then you can emerge grub:
Code:
emerge =grub-0.96-r3

_________________
John

My gentoo overlay
Instructons for overlay
Back to top
View user's profile Send private message
mudrii
l33t
l33t


Joined: 26 Jun 2003
Posts: 789
Location: Singapore

PostPosted: Wed Nov 02, 2005 12:21 pm    Post subject: Reply with quote

Thx for nfo Just think upgrade mo ram :-)
_________________
www.gentoo.ro
Back to top
View user's profile Send private message
rwalker
n00b
n00b


Joined: 15 Apr 2005
Posts: 5

PostPosted: Thu Nov 03, 2005 4:24 am    Post subject: That is an AMAZINGLY simple fix!!! Reply with quote

How that is not in grub-0.97 is beyond me! Can we get a 0.97-r1 with that patch in it. I realize there are not a ton of users with over 2gb of ram, but there has to be enough out there to have people running into this? If you don't have time, I can submit the ebuild and patch to get a 0.97-r1 release.
Back to top
View user's profile Send private message
drescherjm
Advocate
Advocate


Joined: 05 Jun 2004
Posts: 2722
Location: Pittsburgh, PA, USA

PostPosted: Fri Nov 04, 2005 5:56 pm    Post subject: Reply with quote

Please patch and file bug report for 0.97-r1 if you can. I am a little busy now and since both machines that have 4GB are in use 24/7 I really should not be doing any testing that could result in any downtime...
_________________
John

My gentoo overlay
Instructons for overlay
Back to top
View user's profile Send private message
mejiro
n00b
n00b


Joined: 05 Nov 2005
Posts: 5

PostPosted: Sat Nov 05, 2005 10:07 pm    Post subject: Reply with quote

Thanks, guys, I was having the same problem, and this fixes it. I've created a patch and ebuild which I've posted to bugzilla:

http://bugs.gentoo.org/show_bug.cgi?id=111634

For the record, the grub error this fixes is

Error 28: "selected item cannot fit into memory".

Jon
Back to top
View user's profile Send private message
drescherjm
Advocate
Advocate


Joined: 05 Jun 2004
Posts: 2722
Location: Pittsburgh, PA, USA

PostPosted: Wed Nov 09, 2005 2:20 pm    Post subject: Reply with quote

I am glad to see there is now an ebuild with the patch for this in portage (0.97-r1), although I have not tested it.
_________________
John

My gentoo overlay
Instructons for overlay
Back to top
View user's profile Send private message
stay
n00b
n00b


Joined: 21 Dec 2005
Posts: 16

PostPosted: Fri Dec 30, 2005 4:18 pm    Post subject: Reply with quote

I am attempting to install version .97-r1. After I run the emerge =grub-0.97-r1, I get the following.

--- Invalid atom in /etc/portage/package.keywords: =grub-0.97-r1
Calculating dependicies
!!! All ebuilds that could satisfy "=grub-0.97-r1" have been masked.
!!! One of the following masked packages is required to complete your request:
- sys-boot/grub-0.97-r1 (masked by: ~amd64 keyword)

Any ideas?

Contents of /ets/portage/package.keywords:
=grub-0.97-r1 ~amd64

Thanks.
Back to top
View user's profile Send private message
Maedhros
Bodhisattva
Bodhisattva


Joined: 14 Apr 2004
Posts: 5511
Location: Durham, UK

PostPosted: Fri Dec 30, 2005 4:37 pm    Post subject: Reply with quote

The "invalid atom" line says it all - it should be =sys-boot/grub-0.97-r1 ~amd64 in /etc/portage/package.keywords: :wink:
_________________
No-one's more important than the earthworm.


Last edited by Maedhros on Fri Dec 30, 2005 4:40 pm; edited 1 time in total
Back to top
View user's profile Send private message
wazoo42
Tux's lil' helper
Tux's lil' helper


Joined: 13 Apr 2004
Posts: 144

PostPosted: Fri Dec 30, 2005 4:40 pm    Post subject: Reply with quote

I'm glad to see this getting resolved, it is quite annoying as I have 5 boxes with 4+ GB of ram. I ended up emerging grub-static instead of grub as a work around.
Back to top
View user's profile Send private message
stay
n00b
n00b


Joined: 21 Dec 2005
Posts: 16

PostPosted: Fri Dec 30, 2005 6:00 pm    Post subject: Reply with quote

That did it, thank you.
Back to top
View user's profile Send private message
dracula1985
Apprentice
Apprentice


Joined: 13 May 2005
Posts: 294
Location: Vicenza (Italy)

PostPosted: Fri Mar 31, 2006 12:11 pm    Post subject: Reply with quote

So with grub-static does it works?
Or have I to add
Code:
=sys-boot/grub-0.97-r2 ~amd64
to /etc/portage/package.keywords ?
_________________
Marco

"Man is least himself when he talks in his own person. Give him a mask, and he will tell you the truth." --Oscar Wilde.
Back to top
View user's profile Send private message
wazoo42
Tux's lil' helper
Tux's lil' helper


Joined: 13 Apr 2004
Posts: 144

PostPosted: Fri Mar 31, 2006 11:03 pm    Post subject: Reply with quote

I'd try 0.97-r2 and see if it works. If you load grub-static you then have to use grub-install which can be a pain if you don't put the gentoo grub into the mbr.
Back to top
View user's profile Send private message
isolti
n00b
n00b


Joined: 29 Apr 2003
Posts: 10

PostPosted: Fri Apr 28, 2006 4:28 pm    Post subject: 4 GB RAM issue is 2 years old !!!!! Reply with quote

I ran into this today. It is a two years old Grub problem and it is not fixed in the source of Grub, yet!
Imre

Added new Info:
OK. So you do not need the patching magic mentioned above. We should close this thread. The solution is in portage tree grub-0.97-r2. You need to unmask and do a couple things. See this thread:
http://forums.gentoo.org/viewtopic-t-421919-highlight-selected+item.html

This is from that thread and solves the problem:
(1)
ACCEPT_KEYWORDS="~x86 ~amd64" emerge -f =grub-0.97-r2

(2)
cd /usr/portage/sys-boot/grub
ebuild grub-0.97-r2.ebuild digest

(3)
echo "=sys-boot/grub-0.97-r2 ~x86 ~amd64" >> /etc/portage/package.keywords

(4)
emerge grub
Back to top
View user's profile Send private message
jbolle
n00b
n00b


Joined: 06 Sep 2006
Posts: 1

PostPosted: Wed Sep 06, 2006 2:23 pm    Post subject: Reply with quote

I just tried to install Gentoo onto my new Dell PowerEdge 2950 with 16GB of RAM and I believe I have run into this problem. Seeing as I am having network connectivity issues from the new machine as well, does anyone have any suggesstions as to how to load GRUB onto the machine so I can boot it? Thanks.
Back to top
View user's profile Send private message
dstutz97
Tux's lil' helper
Tux's lil' helper


Joined: 14 Apr 2003
Posts: 80

PostPosted: Mon Apr 23, 2007 9:12 pm    Post subject: Reply with quote

jbolle wrote:
I just tried to install Gentoo onto my new Dell PowerEdge 2950 with 16GB of RAM and I believe I have run into this problem. Seeing as I am having network connectivity issues from the new machine as well, does anyone have any suggesstions as to how to load GRUB onto the machine so I can boot it? Thanks.


Just letting you guys know this isn't an issue with Grub version 0.97-r3. I ran into this error installing off the 2006.1 cd which installed grub 0.96, after upgrading everything is fine. This was on a Dell PowerEdge 2950 with 4GB RAM.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on AMD64 All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum