Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
if you need to know how to add a command-line argument to your boot menu, that's appropriate for a separate question (although this is very likely a duplicate). keep the memory troubleshooting stuff on your earlier question -- if you try something and it doesn't work, update that question, not this one. –  quack quixote Jun 15 '10 at 21:05

3 Answers 3

up vote 3 down vote accepted

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
share|improve this answer
1  
see superuser.com/questions/111302/aesthetically-editing-grub-cfg for more on how Debian/Ubuntu Grub configuration works. –  quack quixote Jun 15 '10 at 20:59
    
Thanks, quack quixote, for the helpful info. –  nicorellius Jun 15 '10 at 21:08

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.

share|improve this answer
    
if you change the linux commandline in your /boot/grub/grub.cfg directly, it will work, but your changes will be overwritten the next time you update your kernel, or your grub installation, or install anything else that triggers update-grub. –  quack quixote Jun 15 '10 at 21:01

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.