Skip to content

Instantly share code, notes, and snippets.

@tgirke
Last active August 30, 2024 19:37
Show Gist options
  • Save tgirke/be26f29b0b52ee621ec02f2bcbca0b93 to your computer and use it in GitHub Desktop.
Save tgirke/be26f29b0b52ee621ec02f2bcbca0b93 to your computer and use it in GitHub Desktop.
Crouton

Crouton Install and Management


Table of Content

  1. Manuals
  2. Installation
    1. Chrome OS Channel
    2. Developer Mode
    3. Chrome Extension
    4. Install Crouton
    5. Useful Helper Commands
  3. Usage
    1. Start Crouton
    2. Switch between Chroot and Chrome OS
    3. Shutdown Chroot
    4. Update Chroot
    5. Delete Options
    6. Backup Chroot
    7. Software Installs
  4. Troubleshooting
    1. Problem with apt (or apt-get)

1. Manuals

2. Installation

i. Check Chrome OS channel

What Chrome OS channel is running on a Chromebook is not essentail for the Crouton install. However, it can become important later since things may be less stable if the developer channel is running. The Chrome OS channel can be checked and changed as follows: go to settings under Chrome OS (bottom right corner of main screen) -> select menu in the top left corner -> about Chrome OS -> detailed build information -> change channel. The resulting change channel window shows which channel is currently active. For more details see here.

ii. Enable developer mode

Note this will erase all local data. So back things up first. Instructions for enabling developer mode are here, and the details for specific Chromebooks are given here.

iii. Install Chrome extension

For better integraton with Chrome OS install Crouton Integraton extension. It is needed to run crouton within a Chrome OS session rather than in parallel.

iv. Install Crouton

  1. Download latest Crouton release from here https://goo.gl/fd3zc which comes form developer's repository here. For simplicity leave downloaded crouton file in Downloads folder. Note, as of April 2019 there may be changes to this approach due to security updates in Chrome. Here are some updates.

  2. Open in Chrome browser crosh shell with CTRL + ALT + T and then type

    shell
  3. Now install crouton for the proper linux release specified under -r argument (xenial is the Ubuntu 16.04) along with proper targets. The latter are selected under the -t argument. The names and other details about Ubuntu releases can be looked up on this Ubuntu site. The chroot name can be specified with the -n option (default is name of chosen release, e.g. xenial). If the -e argument is added then the chroot will be encrypted.

    sudo sh ~/Downloads/crouton -r xenial -t x11,chrome,xorg,xiwi,keyboard,touch,unity,xfce -e # These are your most current targets; in the past you used unity,xfce,xiwi,keyboard,touch

v. Useful helper commands

Enter chroot from crosh shell

sudo enter-chroot

List targets installed in a chroot

sudo edit-chroot -al # Execute in Chrome OS after Ctrl+alt+t and then shell

List available linux releases

sh ~/Downloads/crouton -r list

List all available targets

sh ~/Downloads/crouton -t help

Add target to an existing chroot with -u option

sudo sh ~/Downloads/crouton -t xiwi -u -n xenial

Location of chroots

ls -al /usr/local/chroots/

3. Usage

i. Start Crouton

Run chroot in same Chrome OS session. This requires the Crouton Integraton extension (see above) along with the xiwi target.

sudo startxfce4 -X xiwi

or run in parallel mode

sudo startxfce4 or startunity # shortcuts for enter-chroot startxfce4

ii. Switch between Chroot and Chrome OS

To switch between chroot and ChromeOS use Ctrl+Alt+Shift+Back and Ctrl+Alt+Shift+Forward; or Alt+Tab when in same session.

iii. Shutdown Chroot

To shutdown choot, log out or shut down on the Ubuntu side as usual or issue Ctrl+c in crosh tab where you started chroot session.

iv. Update chroot

Check if there is a newer crouton version, run on Ubuntu side:

croutonversion -u -c # list installed and latest available version

Then shutdown Ubuntu and run in crosh shell the following command. This will update/upgrade all installed targets.

sudo sh ~/Downloads/crouton -u -n xenial 

v. Delete options

Currently, it is not easily possible to delete targets due to complicated interdendencies/histories of packages across targets!!!

To remove a chroot, one can use the following command(s).

sudo delete-chroot <my_chroot>
# sudo edit-chroot -d <my_choot> # Does the same; delete-chroot is just a shortcut 

vi. Backup chroot

Back up your chroot to a timestamped tarball in the current directory.

sudo edit-chroot -b xenial

Restore chroot from the most recent timestamped tarball. One can explicitly specify the tarball with -f.

sudo edit-chroot -r chrootname 

If your machine is new or powerwashed, one can use the crouton installer to restore a chroot and relevant scripts.

sudo sh ~/Downloads/crouton -f mybackup.tar.gz

vii. Install software within Chroot

Within a Chroot one should update and install software packages via apt or apt-get, see example below. Detailed instructions for using apt or apt-get are available on Ubuntu's AptGet/Howto. Installing software via Ubuntu's Software manager should be avoided since it creates often problems. The GDebi Package installer seems to work fine as an alternative.

sudo apt update && sudo apt install <my_software>

4. Troubleshooting

i. Problem with apt or apt-get

If apt update and/or apt install are not working then try the follwing troubleshooting steps. Additional help on this topic can be found here.

The autoclean command might fix the problem. Sometimes it may only work in a freshly started chroot session. So try restarting it if it fails, or start temporarily a chroot from crosh shell within a chrome browser tab with sudo enter-chroot, and then run update/install from there.

sudo apt clean && sudo apt autoclean # This might fix things
sudo apt update # or with && sudo apt upgrade

After running update also try this

sudo apt -f install 

Another reason could be a broken dpkg system. To fix this, run the following commands.

sudo dpkg --configure -a
sudo apt upgrade
sudo apt update

Reinstalling libcurl3-gnutls has also been reported to help.

sudo apt --reinstall install libcurl3-gnutls 

There are also reports that using more RAM on the Chrome OS side might help. For this just open a few data/process intensive tabs in Chrome. Also check if there are any broken PPAs in /etc/apt/sources.list.d.

@newtontriumphant
Copy link

Is there any way to do it without switching to developer mode 😩 ?

-Newton Triumphant

@tgirke
Copy link
Author

tgirke commented Dec 28, 2020 via email

@CABLE353
Copy link

Crouton won't install the chroot properly. It's about 98% there and it gives the dredded "Permission Denied" error for 2 directories it tries to make/use:

Installing mount-chroot into the host...
Installing unmount-chroot into the host...
Installing crash_reporter_wrapper into the host...
/tmp/crouton-installer-cache/crouton.nIZ/host-bin/crash_reporter_wrapper: /var/run/crw/crw: /bin/sh: bad interpreter: Permission denied
/tmp/crouton-installer-cache/crouton.nIZ/host-bin/crash_reporter_wrapper: line 119: /var/run/crw/crw: Success
WARNING: Unable to register core dump handler.
cp: cannot create directory '/var/run/crouton/mnt/stateful_partition/crouton/chroots/xenial/var/run/drm': Permission denied
Unmounting /mnt/stateful_partition/crouton/chroots/xenial...

When I try to "sudo enter-chroot it gives me this:

chronos@localhost / $ sudo enter-chroot
Password:
Enter encryption passphrase for xenial:
Entering /mnt/stateful_partition/crouton/chroots/xenial...
/usr/local/bin/crash_reporter_wrapper: /var/run/crw/crw: /bin/sh: bad interpreter: Permission denied
/usr/local/bin/crash_reporter_wrapper: line 119: /var/run/crw/crw: Success
WARNING: Unable to register core dump handler.
A chroot setup script still exists inside the chroot.
The chroot may not be fully set up.
Would you like to finish the setup? [Y/n/d] n
Skipping setup. You will be prompted again next time.
/mnt/stateful_partition/crouton/chroots/xenial doesn't appear to be a valid chroot.
Unmounting /mnt/stateful_partition/crouton/chroots/xenial...

If I choose yes, it tries to re-run the setup script that was found, but then it fails with the exact same Permissions error, & then deletes the script rendering the chroot invalid/useless/broken/ect; options n & d just skip the retry attempt & delete the "leftover" script file. I have Chromebrew installed which just allows me to sudo in the crosh shell(not VT2), I've deleted & reinstalled crouton many times, I've also disconnected the battery from the board to disable firmware write protection, & installed the crouton integration chrome extension to no avail. I'm currently on the dev channel & have dev mode enabled. I'm on a Lenovo 100e Chromebook with 32gb of NAND disk space 4gb of RAM & an Intel Celeron CPU. My chrome Os version info is:

Google Chrome 129.0.6668.18 (Official Build) dev (64-bit)
Revision 2ff0f2510c7a962b63e8fbf3a3a42da735affd80-refs/branch-heads/6668@{#400}
Platform 16002.10.0 (Official Build) dev-channel coral
Firmware Version Google_Coral.10068.92.0
Customization ID ROBO
ARC SDK Version: Unknown
JavaScript V8 12.9.202.5
User Agent Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36

I'm not sure what else I need to do to get this crap working. Please help!

@tgirke
Copy link
Author

tgirke commented Aug 30, 2024

Since Linux Apps became available (https://support.google.com/chromebook/answer/9145439?hl=en), I am not using Crouton anymore. Much more stable, and I don't need to run my ChromeOS devices in developer mode. Of all Linux variants I am using across different devices, Linux Apps the most stable one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment