Well, all went well until I also attempted to add the Xubuntu-Desktop package, so I could better run around and do things in there. A quick update for an nVidia graphics driver froze the computer directly after login, and all the stuff I found in the forums didn't really help that much, except for possibly uninstalling all the packages that xubuntu-desktop stuck in there. Since there wasn't a lot on there (except for maybe the neat desktop backgrounds that seem to change with every version of any Ubuntu release), I figured a fresh install would be best.
After reinstalling the OS, I did a repository update, which screwed up my screen resolution. My monitor can handle 1280x1024, but the update had changed it to 640x480.
Note: This is Ubuntu Server 10.04.
How do you change screen resolution within a pure terminal interface? GRUB2.
Around version 9.04, Ubuntu upgraded the bootloader from GRUB to GRUB2. This is way more confusing, but can still be figured out.
For the sake of simplicity, there is no longer /boot/grub/menu.lst. It's just not there, nor will it be used if you create it. Instead, all the configurable options are now moved into /boot/grub/grub.cfg
The problem is though, with the command $ sudo update-grub or on a kernel update, this file is overwritten. Therefore, this file should not be editted.
But where does GRUB pull all this information when it DOES do an update?
All the config options are actually stored in the /etc/grub.d folder. This folder are 7 sub-files:
- 00_header
- 05_debian_theme
- 10_hurd
- 10_linux
- 20_memtest86+
- 30_os-prober
- 40_custom
On grub-update, all of these files are executed and mashed together and copied into grub.cfg. But these files don't change ever. Therefore, you can change them yourself, adding entries and such.
I don't know all the details, but the process for adding more operating systems is much more complicated than before. They've decided to use some C-style function for each menu entry, rather than the old way of a simple list with tabbed sub-values.
You can see the way menu items are placed by looking directly at the /boot/grub/grub.cfg file and scrolling down to the 10_linux section.
In mine, a single final entry appears like the following:
menuentry 'Ubuntu, with Linux 2.6.32.32-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os { recordfail insmod ext2 set root='(hd0,1)' search --no-floppy --fs-uuid --set 0689cdb7-786d-4a68-b14b-634b85c9961b linux /boot/vmlinuz-2.6.32-32-generic-pae root=UUID=UUID=0689cdb7-786d-4a68-b14b-634b85c9961b ro quiet initrd /boot/initrd.img-2.6.32-32-generic-pae}
All this is somehow scripted into the 10_linux file. You won't see this exact entry anywhere in the file, but instead they've created a way for it to execute a 'find all options and translate them into this format' when you do sudo update-grub.
But anyway, back to the issue at hand. My screen resolution is messed up. I said GRUB2 was the solution to fix this. The options for screen resolutions are stored in /etc/grub.d/00_header.
Open the file in an editor, and scroll down until you see the if statement:
if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=640x480 ; fi
Simply change 640x480 to whatever your desired (and of course, possible) screen resolution is, save, update-grub and reboot.
Oh, and if it matters, a read through the Official Ubuntu GRUB2 Docs might help.
I just now decided to read further into that help file right there...apparently you can also change screen resolution in the /etc/default/grub file, as well as turn on countdowns and things to make sure that you can actually use the menu.
In /etc/default/grub:
GRUB_GFXMODE=640x480 - Change to something your screen can handle and that you want. Maximum is usually okay if you're good on small text. They say in the documentation, that you can comma-separate values also, in case one doesn't work. Just put them in a DESCENDING preferred order, usually high to low.
Also make sure you uncomment the line by removing the # symbol at the beginning of it.
The vbeinfo command in the shell should give you your valid resolutions.
Also, if you find that there is no menu displayed, you can turn on timeouts in this file.
if GRUB_HIDDEN_TIMEOUT is set to something above 0, a message will be displayed on bootup saying something like, "Press any key for the menu..", unless of course, the GRUB_HIDDEN_TIMEOUT_QUIET is set to true. Then you will see a black screen for that amount of time.
If GRUB_HIDDEN_TIMEOUT is empty (GRUB_HIDDEN_TIMEOUT=), GRUB_TIMEOUT will be used instead, and if this is a number greater than 0, the menu will be fully displayed every time you boot up.
Just remember to run sudo update-grub after editing.
No comments:
Post a Comment
Comment loud, comment often. But comment on the content!
All comments are filtered through to my email, so your spam will never make it. Unless, of course, you wanted to try injection attacks into my email, which would probably not happen since Blogger just tells me that a comment is awaiting moderation and doesn't bother to tell me what it says. I trust Blogger like that..