Loading Fedora On A Samsung Chromebook

Overview And Goals

The goal is to describe how to boot and run Fedora Linux on a Samsung Chromebook. Lots of thanks go to Chris Hewitt for laying the foundation for this page.

Equipment & Software

Hardware: Samsung Chromebook XE303C12 (ARM Exynos 5 processor)
Storage: Sandisk 32G card, which identifies as /dev/mmcblk0 (substitute your own drive's device in the instructions below)
Fedora Image: The generic hardware floating point image from here (or click here to download the image now).

Preparing The Disk

The first thing to do is to prepare the SD card. What we want to do is create two partitions for the kernel images and a partition for holding the root filesystem for Fedora.

You don't need a lot of space for the kernel images, so two 15MB partitions are find. You can either leave the remaining space for the root file system. Or, if you want to keep /home separate to protect it in case you have to redo the rootfs, you can create a fourth partition for the home file system. The latter is how I do things.

Partition The Drive

To partition the drive, first create the GPT partition table:

sudo gdisk /dev/mmcblk0
(parted) mktable gpt
(parted) w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/mmcblk0.
The operation has completed successfully.



Next you need to create the individual partitions. As Chris did, I'll just post what you need to type to create the partitions since it can be VERY verbose otherwise. Here we configure the geometry for the disk:

sudo gdisk /dev/mmcblk0

x # go into extra functionality/expert mode
l # set the sector alignment value
8192 # 8192 bytes
m # return to the main menu



Now we create the partitions. We'll create two 16MB partitions to hold the kernels from the Chromebook, a 15G partition for the root file system and use the remaining space for a home filesystem. If you don't want to have a separate home filesystem, then follow the instructions inline:

n # creates a new partition
1 # partition 1
(ENTER) # accept the default starting sector
+16M # make partition 1 16MB
7f00 # make the partition type "ChromeOS kernel"

n # creates a new partition
2 # partition 1
(ENTER) # accept the default starting sector
+16M # make partition 1 16MB
7f00 # make the partition type "ChromeOS kernel"

If you want the root filesystem to use the rest of the disk, then do this:

n # another partition
3 # partition 3
(ENTER) # accept the default starting sector
(ENTER) # go to the end of the free space
(ENTER) # use the default file system type

What I did was this:

n # another partition
3 # partition 3
(ENTER) # accept the default starting sector
+15G # make the root filesystem 16G
(ENTER) # use the default file system type

n # another partition
4 # partition 4
(ENTER) # accept the default starting sector
(ENTER) # go to the end of the free space
(ENTER) # use the default file system type

When it's all done, you need to update the disk:
w # writes the changes to disk

Format Root And Home

Now format the filesystems. Again, if you didn't create a home filesystem, then don't format it. And BE CAREFUL when specifying the device to format!

For me /dev/mmcblk0p3 is the root file system, while /dev/mmcblk0p4 is the home file system.

sudo mkfs -t ext4 /dev/mmcblk0p3
sudo mkfs -t ext4 /dev/mmcblk0p4

Extracting The Fedora Image

Now that you have a prepared disk, you need to first mount the file system and then extract the Fedora root filesystem onto it.

First thing is to mount the root filesystem:

sudo mount /dev/mmcblk1p3 /mnt


Now extract the file containing the image that you downloaded from Fedora:

sudo tar Jxvf Fedora-18-armhfp-rootfs.tar.xz -C /mnt

Fixing /etc/fstab In The Image

You'll want to now update the /etc/fstab file in the new image, comment out the existing entries and add a single one:

/dev/mmcblk1p3 / ext4 defaults 1 1

Using UUIDs Instead Of Device IDs

Thanks to Steve Falco for this.

To use the UUIDs, use the following command line:

dumpe2fs /dev/sdf3 | grep UUID

and then replace the UUIDs for each partition in /etc/fstabs with thes shown.

Installing The Chromebook Kernel

There is work being done to get a Fedora kernel to install on the Chromebook. But, for now, you have to work with the one that came with the Chromebook itself. To do this, you need to boot up your Chromebook into developer mode. To do this, hold down both the Escape and Refresh keys and press the Power button. When the system reboots it will say "To turn OS verification OFF, press ENTER".

Do this.

The system will then tell you that OS verification is off. This puts your Chromebook into developer mode. Don't get worried when it says your local data is being cleared, this is normal. You'll be able to dual boot your system, booting either Fedora from the SD card or ChromeOS from the SSD. It will take about 15 minutes or so to wipe the data, so be patient.

Once the system has finished clearing your data and restarting, it will reboot and show you a screen that says, "OS verification is OFF". Press Ctrl+D to boot the system at this point.

Log into the system (you will need to recreate your account). Once into the system, type Ctrl+Alt+T to launch a crosh box. Then type:

crosh> shell

Then type:

chronos@localhost / $ sudo -s 

Now lets create some bootable images!

To create a bootable image, which we'll copy to our two boot partitions, type the following:

 cd /tmp 

echo "console=tty1 debug verbose root=/dev/mmcblk1p3 rootwait rw lsm.module_locking=0" > /tmp/config vbutil_kernel --pack /tmp/newkern --keyblock /usr/share/vboot/devkeys/kernel.keyblock --version 1 --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --config=/tmp/config --vmlinuz /boot/vmlinuz-3.4.0 --arch arm  

 Now we need to copy that image onto our two boot partitions and enable booting from it. To do that, type the following:

dd if=/tmp/newkern of=/dev/mmcblk1p1 

dd if=/tmp/newkern of=/dev/mmcblk1p2 

crossystem dev_boot_usb=1

It's okay if you see the message "Unable to open FDT property nonvolatile-context-storage". Apparently this happens to everybody and is not a sign that something's gone wrong.

To mark the partitions as bootable, type:

cgpt add -i 1 -S 1 -T 5 -P 10 -l KERN-A /dev/mmcblk1 

cgpt add -i 2 -S 1 -T 5 -P 5 -l KERN-B /dev/mmcblk1

Copy the kernel firmware and libraries onto the new root filesystem.

Notice that I'm using "External Drive 3" here. That's because I'm using a separate filesystem for /home. If you went with just a single filesystem then you'll use "External Drive 2" here.

Again thanks to Steve Falco for pointing out that, in some cases, these drive letters might be reversed or different. Be sure, us ls to check both External Drive mounts to see which contains the actual root file system for Fedora.

After copying the files, you'll remount the partition and chroot it to isolate our new Fedora root filesystem:

cp -rf /lib/modules/* /media/removable/External\ Drive\ 3/lib/modules/ 

cp -rf /lib/firmware/* /media/removable/External\ Drive\ 3/lib/firmware/ 

mount -o remount,suid,exec /media/removable/External\ Drive\ 3/ 

chroot /media/removable/External\ Drive\ 3/

Next we will set a password for root, and then create the GUEST account. Don't try to create a normal user account at this point:

passwd adduser guest 

exit 

umount /media/removable/External\ Drive\ 3/

Now you're ready to boot your Chromebook into Fedora!

Booting Your Chromebook Into Fedora

Reboot the Chromebook. On the screen where it says OS verification is turned off, now you will type Ctrl+U to boot from the SD card. You should see the standard Fedora booting output which means you've successfully install Fedora. Once the system has booted, if you created a separate file system for /home, you can log in as guest, su to root, add the file system by UUID, then create a proper user account. Any feedback on these instructions, about how to fix problems that come up or how to make them more efficient, please send them to me or post them below as comments.

Comments

  1. I believe there is an extra line-break in your vbutil_kernel command.

    In other words, /boot/vmlinuz-3.4.0 rather than /vmlinuz-3.4.0 beginning on a new line.

    Here is the command with the extra line-break removed:

    vbutil_kernel --pack /tmp/newkern --keyblock /usr/share/vboot/devkeys/kernel.keyblock --version 1 --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --config=/tmp/config --vmlinuz /boot/vmlinuz-3.4.0 --arch arm

    Have you done anything yet with the sound subsystem? I've been hesitant to put fedora on my Chromebook for fear of melting the speakers.

    ReplyDelete
    Replies
    1. Fixed, thanks for catching that.

      No, I've not done anything with the sound system yet but am keeping an ear out for any such update.

      Delete
  2. I've followed the process, and have Fedora 18 booted on my Chromebook 3. Thanks for the post!

    A few comments:

    1) I used my desktop to prepare the SDHC card, so I was using an external card reader. Therefore, instead of /dev/mmcblk0, my SDHC showed up as /dev/sdf.

    2) I did set up a separate /home, but for me, the rootfs drive showed up as
    /media/removable/External\ Drive\ 2. So, folks should do an "ls" on the various drives under /media/removable, and copy modules and firmware to the one that looks right, rather than assuming a specific number.

    3) I decided to mount via UUID rather than by /dev/mmcblk1p3. So I used dumpe2fs /dev/sdf3 | grep UUID to find the UUID to use. Ditto for /home.

    4) You might want to add a "w" command at the end of the gdisk partitioning, so folks know to write out the results before moving on to creating filesystems. Should be obvious, but you never know. :-)

    Thanks again for the instructions!

    ReplyDelete
  3. You might specify which download you need to grab from the Fedora Remixes page. Specifically I think the one you want is called:

    Generic Root Filesystem armhfp

    ReplyDelete
    Replies
    1. I had thought the description would have been sufficient, but will amend it with your suggestion. Thanks. :)

      Delete
  4. I have it booted on my chromebook but it appears network is not working, always says "No network devices available", and lsmod gives me nothing, any ideas how to solve it? Thanks a lot.

    ReplyDelete
    Replies
    1. Be sure you correctly copied the firmware and modules from the Chromebook onto your SD card. Double check that you copied them to the correct device and into the right directories. The first time I did this that was the mistake I made and had the same result as you.

      Delete
    2. Strangely, I've tried following many instructions (they're mostly the same) and checked many times. But if you say you've got the same result as mine before, I guess I know where to check for next time. Thanks~

      Delete
  5. By the way
    "sudo gdisk /dev/mmcblk0
    (parted) mktable gpt
    (parted) w"

    That gdisk should be parted isn't it?

    ReplyDelete
    Replies
    1. No, gdisk is correct there. I may have been thinking the same as you when transcribing the output to the screen, but it's definitely gdisk.

      Delete
  6. Still not working, it never loads modules successfully, I give up.

    ReplyDelete
    Replies
    1. Don't give up. Be sure you followed each step to the letter. Don't change anything outlined and you'll be fine.

      Delete
    2. fwiw, I had same issue initially, but it was not copying firmware/modules that was the problem. Something went wrong at the vbutil_kernel step.. maybe ended up with wrong bootargs? not sure if by default chromeos kernel is checking for signed kernel modules or something like that?

      Delete
    3. no network for me either. modules in the right place, but lsmod lists none.
      dmesg has a bunch of
      "Chromium OS LSM: init_module old-api-denied module=" lines in it.
      I went back and repeated the vbutil_kernel and dd steps
      (and also installed the developer firmware within ChromeOS - I hadn't seen that prompt before)
      and ta-da, I have modules loaded and network up and working!

      Delete
  7. The developer firmware upgrade command was:
    chromeos-firmwareupdate --mode=todev

    ReplyDelete
  8. this wont work on a samsung chromebook 550 with intel cpu right? because the rootfs is for arm not for intel right? there is a way to get a fedora rootfs for intel chromebooks?

    ReplyDelete
    Replies
    1. Correct, this is for the Chromebook model XE303C12 with the ARM Exynos 5 Dual processor. The Fedora image file pointed to won't work on an Intel processor, such as the Intel Celeron_867 Processor 1.3GHz in your 550.

      Delete

Post a Comment