Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Autostart crouton chroot at ChromeOS startup

DennisL edited this page Feb 8, 2015 · 42 revisions

Method and scripts to invoke a crouton chroot session at ChromeOS startup.


In order to do this, please note that -

1. You first need to REMOVE rootfs verification and reboot to make the rootfs read-writable.
Check out this script 'rw-rootfs' for one method of doing that.

  • PLEASE USE THIS SCRIPT WITH CAUTION - AND AT YOUR OWN RISK, 'make_dev_ssd.sh'
    HAS BEEN KNOWN TO CAUSE RESETS AND WIPE DATA ON SOME CHROMEBOXES !
  • To obtain the file rw-rootfs, in a cros shell (crosh) do:
curl -Lk --connect-timeout 60 -m 300 --retry 2 "https://gist.github.com/DennisLfromGA/6690677/download" | tar -xzO > ~/Downloads/rw-rootfs
  • Then do: sudo sh ~/Downloads/rw-rootfs

2. Then, you have to place one or possibly two custom config scripts in the /etc/init folder.
The first script, 'crouton.conf', is the one that will kick-off a crouton chroot without having to open a shell manually at ChromeOS startup.
The second script, 'mnt-crouton.conf', is only needed if you are using @drinkcat's 'separate-partition branch' to mount the CROUTON partition at /var/crouton.

  • To obtain the file crouton.conf, in a cros shell (crosh) do:
curl -Lk --connect-timeout 60 -m 300 --retry 2 "https://gist.github.com/DennisLfromGA/6443733/download" | tar -xzO > ~/Downloads/crouton.conf
  • To obtain the file mnt-crouton.conf, in a cros shell (crosh) do:
curl -Lk --connect-timeout 60 -m 300 --retry 2 "https://gist.github.com/DennisLfromGA/11072037/download" | tar -xzO > ~/Downloads/mnt-crouton.conf

3. Next, you can optionally place a file named 'crouton.init' in your ~/Downloads folder or the chroot parent folder for external control.
If you choose not to use the external control file 'crouton.init', then you may need to edit the CHROOT and START_DE variables in /etc/init/crouton.conf.

  • To obtain the file crouton.init, in a cros shell (crosh) do:
curl -Lk --connect-timeout 60 -m 300 --retry 2 "https://gist.github.com/DennisLfromGA/aa1c92ebe77c3df4ca84/download" | tar -xzO > ~/Downloads/crouton.init

4. Finally, reboot to implement the changes and you're good to go...


## Additional notes and information

The 'crouton.conf' file, installed in /etc/init, allows you to start a crouton chroot session at one of four different points in the boot/startup process as shown below:

#start on starting ui          # 1st - starts when the user interface begins
                               #     + only 1 chroot will run in this mode
                               #     + must use XMETHOD: 'xorg' or 'xephyr'
 
#start on started ui           # 2nd - starts when the user interface appears
                               #     + only 1 chroot will run in this mode
                               #     + must use XMETHOD: 'xorg' or 'xephyr'
 
#start on login-prompt-visible # 3rd - starts when the login screen appears
                               #     + only 1 chroot will run in this mode
                               #     + must use XMETHOD: 'xorg' or 'xephyr'
 
 start on start-user-session   # 4th - starts when the user logs in - DEFAULT
                               #     + multiple chroots could run in this mode
                               #     + can use any XMETHOD: 'xiwi','xorg' or 'xephyr'
                               #     + ensures user ~/Downloads is available

You'll note that the last or 4th option is the default since it will start after you're logged in so that you can use your ~/Downloads folder in both your chroot and in ChromeOS like you normally would in crouton, it also allows you to use any XMETHOD: 'xiwi', 'xorg' or 'xephyr'.

If you want to start your crouton chroot earlier in the boot/startup process, just remove the remark character '#' in the first column.
NOTE: use only one startup point, prepend the others with the remark character: #

There are five parameters that are set by default but can be edited or changed by the external control file 'crouton.init'. These parameters are:

 1) DELAY=10  
 2) CHROOT=precise  
 3) START_DE=startxfce4 
 4) XMETHOD=default  
 5) RUN_STATE=y 

The optional 'crouton.init' file, placed either in the ~/Downloads folder or the chroot's parent folder, allows you to adjust the same four variables without changing the above mentioned config file each time. The parameters are:

 1) DELAY - in seconds, default is '30'
 2) CHROOT - installed chroot name, default is 'trusty'
 3) START_DE - crouton start* script, default is 'startkde' 
 4) XMETHOD - Override the default XMETHOD, default is 'xiwi'
 4) RUN_STATE - use 'n' for No, default is 'y' for Yes

Note that these values are slightly different than those found in the 'crouton.conf' file, I've adjusted them for my use but they can be edited to suit your needs.

Please make sure you adhere to the format currently used in the 'crouton.init' file, comments are okay but the variables have to start in the first column.


**Caveats to this approach:

  1. These changes need to be done outside your chroot in Crosh.
  2. Each time you get a new ChromeOS update, you have to again remove rootfs verification and place a copy of the 'crouton.conf' and, optionally, the 'mnt-crouton.conf' file in /etc/init.
  3. This will not work on encrypted chroots since they require a password to be entered.**

Clone this wiki locally