I have installed Ubuntu in my chromebook but it only boots into chrome OS. My goal is to have my Chromebook booting into Ubuntu.
Once you have installed Ubuntu, if you reboot your Chromebook, by default it will continue to boot into Chrome OS, which lives on in its own dedicated partition.
If you'd like ChrUbuntu to be the default, open up the Terminal in ChrUbuntu (or the Developer Console command prompt in Chrome OS) and enter sudo cgpt add -i 6 -P 5 -S 1 /dev/sda to change the default boot partition. Changing it back to Chrome OS is as easy as disabling developer mode when you boot the Chromebook, or entering sudo cgpt add -i 6 -P 0 -S 1 /dev/sda at the terminal.
Set boot priority
At this point we should have the following situation:
- Image-A is an official Google Chrome OS which can boot either in normal mode or dev-mode.
- Image-B is (or will be after the first autoupdate) another official Google Chrome OS which can boot either in normal mode or dev-mode.
- Image-C is Chrome OS kernel with a modified command line and an Ubuntu rootfs, which can only boot in dev-mode.
Next, we adjust the priority among the images so we can try out our Ubuntu image. The image priority is an attribute of its kernel partition. Run
cgpt show /dev/sda, to see the kernel priorities:
localhost ~ # cgpt show /dev/sda
4096 32768 2 Label: "KERN-A" Type: ChromeOS kernel UUID: D176DC60-81F1-654E-8953-E3D28019738C Attr: priority=3 tries=0 successful=1
36864 32768 4 Label: "KERN-B" Type: ChromeOS kernel UUID: F1A2C65C-CC22-FF4A-A8BC-67BA233F3D40 Attr: priority=0 tries=15 successful=0
12369920 32768 6 Label: "KERN-C" Type: ChromeOS kernel UUID: B6954485-4295-9749-956A-C315B01FB684 Attr: priority=0 tries=15 successful=0
The priority determines the order in which the BIOS tries to find a valid kernel (bigger is higher, zero means don't even try). The tries field is decremented each time the BIOS tries to boot it, and if it's zero, the kernel is considered invalid (this lets us boot new images without looping forever if they don't work). The successful field overrides the tries field, but is only set by the OS once it's up and running.
Let's change the priority of KERN-C to 5:
cgpt add -i 6 -P 5 -T 1 -S 0 /dev/sda
This makes KERN-C the highest priority, but only gives us one chance to boot it. That way if it doesn't work, we're not completely stuck.
If you reboot now, you should come up in Ubuntu! Note that Computer Science Standard Answer #1 applies: It Works For Me™
If something went wrong and Ubuntu crashes or you powered off, the tries field for KERN-C will have been decremented to 0 and you'll fall back to booting Chrome OS.
Assuming that Ubuntu booted and you could log in, go to Applications->Accessories->Terminal to get a shell, and run
sudo cgpt add -i 6 -P 5 -S 1 /dev/sda
This will mark the Ubuntu kernel as valid, so it will continue to boot next time.
Now you can switch back and forth between the official Chrome OS release and Ubuntu just by flipping the dev-mode switch. Going from dev-mode to normal mode erases STATE (/dev/sda1), but much more quickly. Going from normal to dev-mode again would normally do a slow erase of /dev/sda1, but since we're booting Ubuntu that doesn't happen.
This works because although KERN-C has the highest priority, it isn't signed by Google. In dev-mode that's okay, but in normal mode it will be rejected by the BIOS. Since we've set the successful flag to 1, the BIOS won't mark it invalid but will just skip it each time. This makes the normal-mode boot time slightly longer, but only by a second or two.
Of course you could also switch between images from within dev-mode just by manually setting the priorities with cgpt before rebooting.
Note that if the normal image autoupdates, it will probably change the kernel priorities so that Image-C is no longer the highest and the next time you switch to dev mode, you will a) have a long wait, b) still be running Chrome OS, and c) have to use cgpt to raise the KERN-C priority again.
But, because autoupdate only switches between Image-A and Image-B, the Ubuntu kernel and rootfs shouldn't be affected.
I don't have enough reputation to comment on the above post unfortunately, and my post is too long for a comment, so I'll clarify the problem with your console, Brian.
Your problem is that you're not even in the console. That's why you get "Unknown command: sudo" and "Unknown command: cgpt". You're not in a full Linux shell.
How to fix: After going into the console with ctrl+alt+T, type "shell" without quotation marks. Then you'll be able to execute the commands helpfully provided by Hans.
P.S. I tried your method, Hans, and there's a slight problem. I don't have a kernel C. However, the console accepted the
cgpt add -i 6 -P 5 -T 1 -S 0 /dev/sda command without an error. When I rebooted, the screen turned on but stayed black, then off, then flashed black again, then gave me the "OS verification is OFF" message. I pressed ctrl+D, and, after a couple more flashes of black between quick power-offs of the monitor, it booted successfully... into ChromeOS. Do I need to apt-get headers or something? I know KERN-C is supposed to be on the
cgpt show /dev/sda list. My laptop is an Acer C710 if that helps. I realize this problem is mainly occurring on Acers.