3

I am still working on this question. This new one is a different question so I thought it would be good to post a new question. Is this the proper protocol or should I have just edited the other question?

I'm running Ubuntu 10.04 with the kernel 2.6.32-22-generic on a Toshiba Satellite laptop. When I enter the GRUB menu (I have Ubuntu 9.10 installed as well), I can choose which kernel to boot. I use scroll down to the one I want and press "e" and I expect to be able to enter mem=1024m and force the kernel to use this much memory. But when I run cat /proc/meminfo or look in the process manager after booting wth this argument I still see all the RAM: ~2 GB.

Am I using this boot argument incorrectly? The boot configuration (before I add anything) looks like this:

insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set 10270f21-1c42-494b-bd3f-813c23f6d\
518
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=10270f21-1c42-494b-b\
d3f-813c23f6d518 ro quiet splash
initrd /boot/initrd.img-2.6.32-22-generic

The way I did this was that I added the mem=1024m after the last line and pressed Ctrl+X (Emacs save and boot the kernel) and the system booted.

I tried adding mem=1024m to the end and the beginning of this list and it appeared to not change the RAM allocation.

nicorellius
  • 6,815

4 Answers4

6

With Ubuntu and Debian-based installations that use Grub2, you shouldn't edit /boot/grub/grub.cfg directly. That file is configured by running the update-grub command, which happens automatically at various times (like when installing new kernel images).

Instead, you need to add kernel commandline options to the GRUB_CMDLINE_LINUX or GRUB_CMDLINE_LINUX_DEFAULT variables in /etc/default/grub:

# these options don't get added to recovery boot entry
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

# these options get added to both standard and recovery boot entries
GRUB_CMDLINE_LINUX="var1 var2 mem=1024m"

Once you've finished editing, don't forget to generate a fresh Grub menu with the changes:

sudo update-grub
quack quixote
  • 43,504
2

Apparently, the paramters go after the linux line:

linux /boot/vmlinuz-2.6.32-22-generic root=UUID=10270f21-1c42-494b-b\ d3f-813c23f6d518 ro quiet splash

So the new boot parameter line would be:

linux /boot/vmlinuz-2.6.32-22-generic root=UUID=10270f21-1c42-494b-b\ d3f-813c23f6d518 ro quiet splash mem=1024m

EDIT - I just looked over at Stack Overflow and found this post. I apologize for answering my own question. I usually ask a question when I get stumped and then keep on working on it, so sometimes I figure it out before SU does. I do not intend to do this for reputation. It just happens sometimes.

nicorellius
  • 6,815
1

Shouldn't it be either:

mem=1024M

(note the capital M? Or doesn't it matter?)

or:

mem=1024mb

Just curious as I stumbled upon this post while researching ways to control the memory.

I've been using mem=1024mb, and adding the following to /etc/default/grub:

GRUB_CMDLINE_LINUX="mem=1024mb"

Then run:

update-grub
Gareth
  • 19,080
0

These options get added to both standard and recovery boot entries:

GRUB_CMDLINE_LINUX="var1 var2 mem=1024m"

The correct usage of the above line is as follows:

GRUB_CMDLINE_LINUX="mem=1024MB"
Dominique
  • 2,373