Boot - Ubuntu: Questions and Answers (2014)

Ubuntu: Questions and Answers (2014)

Boot

Skip to questions, Wiki by user jorge-castro

Consider using the boot info script when asking your question:

· How do I investigate boot and partition issues?


Questions

Q: Enabling Nvidia driver messes up splash screen

Tags: boot (Next Q), nvidia (Next Q)

When you boot from live CD, or doing the first boot after installing Ubuntu, splash screen looks awesome. But as soon as you enable nvidia-current driver, installed with apt-get, splash screen goes all crazy.

With crazy I mean that resolution is very low, font(I assume) is very weird and it all looks like it's been broken.

This happened with 10.04 and now again with 10.10.

How do I fix splash screen after enabling nvidia drivers?

Tags: boot (Next Q), nvidia (Next Q)

User: neziric


Answer by user3243

That is easy. First of all:

sudo apt-get install v86d hwinfo

sudo hwinfo --framebuffer

This will show you your supported resolutions. Take note.

Then:

gksudo gedit /etc/default/grub

Search for - GRUB_GFXMODE=

below this you need to type: GRUB_GFXPAYLOAD_LINUX=1024x768 <- your-resolution-here

Save the file and then:

echo FRAMEBUFFER=y | sudo tee /etc/initramfs-tools/conf.d/splash

sudo update-grub2

sudo update-initramfs -u


Tags: boot (Next Q), nvidia (Next Q)


Q: How do I free up more space in /boot?

Tags: boot (Next Q), disk-usage (Next Q)

My /boot partition is nearly full and I get a warning every time I reboot my system. I already deleted old kernel packages (linux-headers...), actually I did that to install a newer kernel version that came with the automatic updates. After installing that new version, the partition is nearly full again. So what else can I delete? Are there some other files associated to the old kernel images?

Here is a list of files that are on my /boot partition:

Skip code block

:~$ ls /boot/

abi-2.6.31-21-generic lost+found

abi-2.6.32-25-generic memtest86+.bin

abi-2.6.38-10-generic memtest86+_multiboot.bin

abi-2.6.38-11-generic System.map-2.6.31-21-generic

abi-2.6.38-12-generic System.map-2.6.32-25-generic

abi-2.6.38-8-generic System.map-2.6.38-10-generic

abi-3.0.0-12-generic System.map-2.6.38-11-generic

abi-3.0.0-13-generic System.map-2.6.38-12-generic

abi-3.0.0-14-generic System.map-2.6.38-8-generic

boot System.map-3.0.0-12-generic

config-2.6.31-21-generic System.map-3.0.0-13-generic

config-2.6.32-25-generic System.map-3.0.0-14-generic

config-2.6.38-10-generic vmcoreinfo-2.6.31-21-generic

config-2.6.38-11-generic vmcoreinfo-2.6.32-25-generic

config-2.6.38-12-generic vmcoreinfo-2.6.38-10-generic

config-2.6.38-8-generic vmcoreinfo-2.6.38-11-generic

config-3.0.0-12-generic vmcoreinfo-2.6.38-12-generic

config-3.0.0-13-generic vmcoreinfo-2.6.38-8-generic

config-3.0.0-14-generic vmcoreinfo-3.0.0-12-generic

extlinux vmcoreinfo-3.0.0-13-generic

grub vmcoreinfo-3.0.0-14-generic

initrd.img-2.6.31-21-generic vmlinuz-2.6.31-21-generic

initrd.img-2.6.32-25-generic vmlinuz-2.6.32-25-generic

initrd.img-2.6.38-10-generic vmlinuz-2.6.38-10-generic

initrd.img-2.6.38-11-generic vmlinuz-2.6.38-11-generic

initrd.img-2.6.38-12-generic vmlinuz-2.6.38-12-generic

initrd.img-2.6.38-8-generic vmlinuz-2.6.38-8-generic

initrd.img-3.0.0-12-generic vmlinuz-3.0.0-12-generic

initrd.img-3.0.0-13-generic vmlinuz-3.0.0-13-generic

initrd.img-3.0.0-14-generic vmlinuz-3.0.0-14-generic

Currently, I'm using the 3.0.0-14-generic kernel.

Tags: boot (Next Q), disk-usage (Next Q)

User: user6722


Answer by lekensteyn

You've a lot unused kernels. Remove all but the last kernels with:

sudo apt-get purge linux-image-{3.0.0-12,2.6.3{1-21,2-25,8-{1[012],8}}}

This is shorthand for:

sudo apt-get purge linux-image-3.0.0-12 linux-image-2.6.31-21 linux-image-2.6.32-25 linux-image-2.6.38-10 linux-image-2.6.38-11 linux-image-2.6.38-12 linux-image-2.6.38-8

Removing the linux-image-x.x.x-x package will also remove linux-image-x.x.x-x-generic.

The headers are installed into /usr/src and are used when building out-tree kernel modules (like the proprietary nvidia driver and virtualbox). Most users should remove these header packages if the matching kernel package (linux-image-*) is not installed.

To list all installed kernels, run:

dpkg -l linux-image-\* | grep ^ii

One command to show all kernels and headers that can be removed, excluding the current running kernel:

kernelver=$(uname -r | sed -r 's/-[a-z]+//')

dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver

It selects all packages named starting with linux-headers-<some number> or linux-image-<some number>, prints the package names for installed packages and then excludes the current loaded/running kernel (not necessarily the latest kernel!). This fits in the recommendation of testing a newer kernel before removing older, known-to-work kernels.

So, after upgrading kernels and rebooting to test it, you can remove all other kernels with:

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")


Answer by dward

Your boot partition is full. Since this is a kernel update, these files will be copied to the boot partition so you need to clean in out. Here is a blog post that will show you how to clear the old kernel images with one command. I'll give a basic synopsis of the method. Use this command to print out the current version of your kernel:

uname -r

Then use this command to print out all the kernels you have installed that aren't your newest kernel:

dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9]

Make sure your current kernel isn't on that list. Notice how this is the majority of the final command (down below). To uninstall and delete these old kernels you will want to pipe these arguments to:

sudo apt-get -y purge

Now we can do everything we want by combining these last two commands into this unholy mess:

dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge

And that one command will take care of everything for you. I will confirm that this does work perfectly but never trust anybody on the internet. :) For more info, the blog post gives a very good explanation of what each part of the command does so read through it so you are satisfied that it does what you want it to do.


Answer by omni

Thank you for your detailed post of your problem, this got me going in the right direction. Although it is useful to keep previous kernel files you can remove all of them in one go, check this post:
How to Remove All Unused Linux Kernel Headers, Images and Modules

Done via command line. If you are doing this via remote use something like WINSCP to open a terminal session and just paste it in, works very well.

Here it is copied from article link, I suggest you read the full article:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge


Tags: boot (Next Q), disk-usage (Next Q)


Q: How do I change the GRUB boot order?

Tags: boot (Next Q), grub2 (Next Q)

I have both Windows 7 and Ubuntu installed on a shared machine. Because a lot of the non-developers use Windows, I'd like to change the boot order to make it easier for them.

Currently the boot order looks like the following:

· Ubuntu 11.10 kernelgeneric *86

· Ubuntu 11.10 kernelgeneric *86 (safe boot)

· Memory test

· Memory test

· Windows 7 on /dev/sda6

How do I change the default order so that Windows 7 is at the top of the list?

· Windows 7 on /dev/sda6

· Ubuntu 11.10 kernelgeneric *86

· Ubuntu 11.10 kernelgeneric *86 (safe boot)

· Memory test

· Memory test

Tags: boot (Next Q), grub2 (Next Q)

User: chrisjlee


Answer by nitstorm

You can use an easy-to-use the GUI application called Grub Customizer to make your life a little bit easier. As the name suggests, you can do much more than just reordering GRUB menu entries with it.

You can install it by:

sudo add-apt-repository ppa:danielrichter2007/grub-customizer

sudo apt-get update

sudo apt-get install grub-customizer

(See Ask Ubuntu question Are PPA's safe to add to my system and what are some red flags to watch out for?.)

There is an How-To Geek article about it, How to Configure the Linux GRUB 2 Boot Menu the Easy Way. Take a look at it if you're interested. Also, there is a solved thread on the Ubuntu Forums, Change boot order in GRUB 2 that mentions this tool.

Here are some screenshots:

screen_1

screen_2

screen_3


Answer by marve

You can also change the grub default boot entry from the command line without having to install any additional tool. This won't change the order in the list but it will allow a different OS to boot by default, which sounds like what you may want anyway.

First, make a backup copy of /etc/default/grub. In case something goes wrong, you can easily revert to the known-good copy.

sudo cp /etc/default/grub /etc/default/grub.bak

Then edit the file using vim or the text editor of your choice.

sudo vim /etc/default/grub

Find the line that contains GRUB_DEFAULT=0 and set it to GRUB_DEFAULT=x where x is the index of grub menu item to which you would like to boot to by default. Note that the menu items are zero-indexed. That means that the first item in the list is 0 and that the sixth item is actually 5. So to boot to the sixth item in the list, the line would read GRUB_DEFAULT=5.

Additionally, if you want to use a kernel in the "Previous Linux Versions" menu, you'll want to change GRUB_DEFAULT=0 to GRUB_DEFAULT="2>x" (make sure to include the quotations), where x is the placement of the old kernel on the sub-list (assuming the "Previous Linux Versions" is third on the main list). Remember that the list always begins counting at 0.

Then build the updated grub menu.

sudo update-grub


Answer by silentk

From the tombuntu site (article by Tom):

GRUB can be configured using the /etc/default/grub file. Before you make any changes to it, it may be a good idea to back it up by creating a copy:

sudo cp /etc/default/grub /etc/default/grub.bak

You can restore the copying the backup over the original:

sudo cp /etc/default/grub.bak /etc/default/grub

Open the file using the text editor with root privileges:

gksu gedit /etc/default/grub

The line GRUB_DEFAULT=0 means that GRUB will select the first menu item to boot. Change this to GRUB_DEFAULT=saved. This change will make it easier to change the default item later.

Save and close the file. Run this command to apply your changes to GRUBs configuration:

sudo update-grub

The configuration change we made allows the grub-set-default and grub-reboot commands to be used at any time. These allow you to change the default boot item permanently or only for the next boot, respectively.

Run grub-set-default or grub-reboot (with sudo) with the number of the menu item to boot (the first item is 0). This command will change the default to the second item:

sudo grub-set-default 1


Tags: boot (Next Q), grub2 (Next Q)


Q: How do I set the grub timeout and the grub default boot entry?

Tags: boot grub2 (Next Q)

In Ubuntu 12.04, how do I set the GRUB time and the default OS (that I see at boot time) as I'm dual-booting Windows 7 and Ubuntu 12.04?

Tags: boot grub2 (Next Q)

User: meteors


Answer by izx

· Press Alt+F2, type gksudo gedit /etc/default/grub press Enter and enter your password.

· You will see the following contents:

· GRUB_DEFAULT=0

· GRUB_HIDDEN_TIMEOUT=0

· GRUB_HIDDEN_TIMEOUT_QUIET=true

· GRUB_TIMEOUT=10

· GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

· GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

· GRUB_CMDLINE_LINUX=""

· You can change the default from 0 to any number, corresponding to the entry in the Grub bootup menu (first entry is 0, second is 1, etc.)

· You can change the "hidden timeout" (no menu); and also display the countdown (TIMEOUT_QUIET=false)

· You can force the grub menu to show by commenting out the two GRUB_HIDDEN lines with a # at the beginning of the line

· And set the grub menu timeout (default is 10 seconds)

· Make your changes, press Ctrl-S to save and Ctrl-Q to exit.

· Important: Open a terminal with Ctrl-Alt-T and type sudo update-grub to apply the changes you just made.

· Reboot and you should see your timeout/default entry change.


Linked Question:

· How do I set Windows to boot as the default in the boot loader?


Answer by sean

If you read the file that you are editing in the example above (/etc/default/grub), you will notice that the very first couple lines instruct you to run update-grub after making changes in order to update the actual file that grub reads to "get its instructions" (/boot/grub/grub.cfg). Note that you must actually run it with the sudocommand first as you need root privileges to actually run the command (which is why the poster above said to type sudo update-grub). This will cause the changes you made to be written to /boot/grub/grub.cfg. The very next couple lines tell you that you can read the full documentation of options in that file (again, /etc/default/grub) by typing info -f grub -n 'Simple configuration'.

That said, set GRUB_TIMEOUT to -1 if you want to set the "grub time" to be indefinite. In other words, it will never automatically boot. You will have to make a selection.

Finally, to answer your question, here are the descriptions of those "grub hidden lines" straight from the above-referenced documentation:

GRUB_HIDDEN_TIMEOUT

Wait this many seconds for a key to be pressed before displaying

the menu. If no key is pressed during that time, boot

immediately. Unset by default.

GRUB_HIDDEN_TIMEOUT_QUIET

In conjunction with `GRUB_HIDDEN_TIMEOUT', set this to `true' to

suppress the verbose countdown while waiting for a key to be

pressed before displaying the menu. Unset by default.

I hope this helps!


Tags: boot grub2 (Next Q)


Q: Enabling Nvidia driver messes up splash screen


Q: How do I disable X at boot time so that the system boots in text mode?


Q: How do I free up more space in /boot?


Q: How do I change the GRUB boot order?


Q: How do I set the grub timeout and the grub default boot entry?