Ref: http://www.linuxandubuntu.com/home/how-to-change-boot-order-set-default-boot-os-in-ubuntu-14-10-15-04-linux-mint-or-other-derivatives
Brief of command line:
1. Find out the entry ID list.
qyang@lubuntu-laptop:~$ grep menuentry /boot/grub/grub.cfg
2. Change the default boot id.
qyang@lubuntu-laptop:~$ sudo vi /etc/default/grub
3. Upgrade grub.cfg via 'update-grub'.
qyang@lubuntu-laptop:~$ sudo update-grub
Details in command line:
qyang@lubuntu-laptop:~$ grep menuentry /boot/grub/grub.cfg
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
menuentry_id_option=""
export menuentry_id_option
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-73-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-73-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-73-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-73-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-69-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-69-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-69-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-69-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-56-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-56-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-56-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-56-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-51-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-51-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-51-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-51-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-37-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-37-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-37-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-37-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-33-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-33-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-33-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-33-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-32-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-32-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-32-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-32-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-31-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-31-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-31-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-31-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-30-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-30-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-30-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-30-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Memory test (memtest86+)' {
menuentry 'Memory test (memtest86+, serial console 115200)' {
menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-7E980FF3980FA8AB' {
menuentry 'Windows 7 (loader) (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-chain-48D0359CD0359164' {
menuentry 'Windows Recovery Environment (loader) (on /dev/sda3)' --class windows --class os $menuentry_id_option 'osprober-chain-4A765B93765B7F1F' {
qyang@lubuntu-laptop:~$ sudo update-grub
[sudo] password for qyang:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.19.0-73-generic
Found initrd image: /boot/initrd.img-3.19.0-73-generic
Found linux image: /boot/vmlinuz-3.19.0-69-generic
Found initrd image: /boot/initrd.img-3.19.0-69-generic
Found linux image: /boot/vmlinuz-3.19.0-56-generic
Found initrd image: /boot/initrd.img-3.19.0-56-generic
Found linux image: /boot/vmlinuz-3.19.0-51-generic
Found initrd image: /boot/initrd.img-3.19.0-51-generic
Found linux image: /boot/vmlinuz-3.19.0-37-generic
Found initrd image: /boot/initrd.img-3.19.0-37-generic
Found linux image: /boot/vmlinuz-3.19.0-33-generic
Found initrd image: /boot/initrd.img-3.19.0-33-generic
Found linux image: /boot/vmlinuz-3.19.0-32-generic
Found initrd image: /boot/initrd.img-3.19.0-32-generic
Found linux image: /boot/vmlinuz-3.19.0-31-generic
Found initrd image: /boot/initrd.img-3.19.0-31-generic
Found linux image: /boot/vmlinuz-3.19.0-30-generic
Found initrd image: /boot/initrd.img-3.19.0-30-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
Found Windows 7 (loader) on /dev/sda2
Found Windows Recovery Environment (loader) on /dev/sda4
done
qyang@lubuntu-laptop:~$ sudo fdisk -l
[sudo] password for qyang:
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1cb42612
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 3074047 3072000 1.5G 27 Hidden NTFS WinRE
/dev/sda2 3074048 207874047 204800000 97.7G 7 HPFS/NTFS/exFAT
/dev/sda3 207874048 952238079 744364032 355G 5 Extended
/dev/sda4 952238080 976773119 24535040 11.7G 17 Hidden HPFS/NTFS
/dev/sda5 207876096 576516095 368640000 175.8G 7 HPFS/NTFS/exFAT
/dev/sda6 584908800 952238079 367329280 175.2G 83 Linux
/dev/sda7 576518144 584906751 8388608 4G 82 Linux swap / Solaris
Partition table entries are not in disk order.