Skip to content

(CIF000) Fixing Crouton Using Chromebrew

CroutonIsFun edited this page May 26, 2024 · 2 revisions

These instructions replace the ones found in this github profile, which are out-of-date.

Disclaimer: It is believed that the following hacks will make Crouton easy to use once again. However, since ChromeOS is in constant development, the very next update could render this approach obsolete. There are no guarantees!

Preliminaries: This approach requires a clean slate. Before proceeding, please get your Chromebook ready by performing the following steps (assuming you have Crouton installed). From VT-2, execute the following commands:

sudo delete-chroot -a

sudo rm -r /mnt/stateful_partition/crouton

sudo rm -r /usr/local/*

Create New Aliases: Copy and paste the following lines of code into ~/.bashrc using vi. The lines need to be added following # Put your fun stuff here. That is to say, from the crosh shell, type this command:

vi ~/.bashrc

And then paste these lines into the file following # Put your fun stuff here.

alias ChromebrewInstall='bash <(curl -L git.io/vddgY) && . /.bashrc'
alias MkWrSec='sudo mount -o remount,rw /sys/kernel/security/'
alias NewCrouton='sudo CROUTON_BRANCH=silence /usr/local/bin/crouton'
#

(Note: Unfortunately, teaching you how to use vi is beyond the scope of this how to. vi is a simple editor, it just takes a little getting used to.)

Install some stuff:

Log out of the crosh shell with ctrl-d. Then type shell again (or press up arrow) and return to the crosh shell. Now, at this point, we will have to visit VT-2 and login as chronos. The aliases you created are now active, so from VT-2, type ChromebrewInstall and press Enter (note: you can use auto-complete after typing this first 3 or 4 letters).

If you did not properly clear out /usr/local, Chromebrew will ask if you wish to do this: answer Yes by choosing the appropriate option. Wait for Chromebrew to install, then exit VT-2 with ctrl-d.

Now jump back to the crosh shell with ctrl-alt-f1. At the command line, install crew_sudo:

crew install crew_sudo

After the package is installed, flip back over to VT-2, and login as chronos. You will see that a daemon is automatically launched: this daemon allow you to use sudo in the crosh. You can log out of VT-2 for now!

Every time you reboot, you need to visit VT-2 and log in as chronos in order to auto-launch the daemon, then logout with ctrl-d. From now on, you'll be spending most of your time in the crosh shell. Remember, the crosh shell is accessed with ctrl-alt-t and typing shell and pressing Enter.

Start using Crouton

Download the crouton script by going to Crouton at GitHub. After downloading Crouton, you need to make it executable with the standard command,

sudo install -Dt /usr/local/bin -m 755 ~/Downloads/crouton

Personally, I recommend installing the Crouton extension, found at crouton extension

Install a Linux desktop: First, we need to make the security folder writable, thanks to a recent update by the ChromeOS devs. Type this command, and press Enter:

MkWrSec

The command stands for, "Make writable the security folder". Every time you reboot, you need to open the crosh shell, and execute this command. Otherwise, you will not be able to install or launch a desktop. At least, you don't have to type the entire command line. The command creates no output. As long as you execute the command, you'll be able to use crouton.

Finally, we will use the redefined Crouton command, NewCrouton. What the command does, is finesse the audio problem which arose when we lost the Makefile which was used to compile cras. Here is what I do:

NewCrouton -r focal -t core,audio,cli-extra,x11,gtk-extra,xorg,keyboard,extension,xfce

Note: it is not necessary to use sudo above, as the sudo command is built-in to the alias definition.

When the install completes, type in your username and password.

(Note: I recommend using focal instead of xenial. It works quite well in Crouton, and contains updated packages.)

Drum roll: It's time for the big moment. In the crosh shell, type in

sudo startxfce4 and press Enter.

And you should now be in the first time setup for XFCE. If you wish to fork the command into the background, use

sudo startxfce4 -b

instead, but the first time, you may wish to go "straight" so as to see any error messages. When using crouton nowadays, you will always receive a security warning, but there is not a fix for it, and it doesn't seem to hurt anything.

Automating nearly everything: Instead of having to execute the MkWrSec alias every time you reboot, you can also include the command in your .bashrc as

sudo mount -o remount,rw /sys/kernel/security/

so that every time you open the crosh shell, the command gets executed. So the order of operations would be:

  1. Log into your Google account
  2. Jump over to VT-2 and login as chronos, which starts the crew_sudo daemon (after which you can safely logout and jump back to ChromeOS with ctrl-alt-f1)
  3. Open a crosh shell with ctrl-alt-t, type shell (or up arrow), and press Enter
  4. Start your desktop, e.g., sudo startxfce4 -b

How do I get sound: For advanced users, if you want sound, you need to purchase a USB audio adapter from Amazon or somewhere else for about $10. Once the device is installed, inside your chroot you need to take the following actions:

sudo adduser foo hwaudio

(To update your settings, you need to logout of your chroot and log back in.)

Note that foo is your username. Then, you need to create a sound configuration file. If you're using the Sabrent audio adapter, or similar, the config looks like this:

pcm.!default {
    type hw
    card Device
}

ctl.!default {
    type hw
    card Device
}

The name of the file must be .asoundrc

So after using this command, inside your chroot, sudo apt install nano, you can go

nano .asoundrc

and paste the above lines into the file and save it.

Next, install alsa-utils with sudo apt install alsa-utils

Finally, you can tweak the volume settings with alsamixer. Note that you will need to plug the audio cable into the USB audio adapter, not your Chromebook. Sorry, but bluetooth is not possible without the cras.

Clone this wiki locally