this gist is out of date and remains here only for reference
This is just a modification of this reddit to minimize copying and pasting, make it less interactive, and to allow creation of a username of your choice instead of the default google email address.
# #How to run Ubuntu with full Chrome OS Integration
# Here's a post that shows in detail how to make the default penguin container run Ubuntu instead of Debian:
# [Introduction to Crostini - Part 3: Using Ubuntu by default](https://linuxiumcomau.blogspot.com/2018/08/introduction-to-crostini-part-3-using.html)
# ## Cheat Sheet
# The above post describes how to set up Ubuntu from another computer, and how to run a full desktop environment under Ubuntu. If you just want to run Ubuntu as your default container on Crostini, with full Chrome OS integration including files and launcher icons, this section is for you.
# This "cheat sheet" contains the relevant info from the above post for installing Ubuntu 18.04 as the default container (penguin) directly on a Chrome OS device which already has Crostini enabled. The steps are divided into logically related blocks which can be copied and pasted into a terminal window (paste into a terminal window by right-clicking in the window). After pasting, you may have to press the **enter** key to run the last command in a block.
# ### Create the Ubuntu container
# Start by entering the Chrome shell (crosh) by pressing CTRL+ALT+T, then enter the default termina VM:
vmc start termina
set -e
# Rename the default penguin container:
lxc stop penguin --force
lxc rename penguin debian
# Create a new Ubuntu container named penguin:
lxc launch ubuntu:21.10 penguin
# Enter the new container (as root):
lxc exec penguin -- bash
set -e
# ### Capture group membership for default **ubuntu** user, then delete user
# Create a little script which we will use later to add your username to all the default Ubuntu groups, then delete the default **ubuntu** user:
groups ubuntu >update-groups
sed -i 'y/ /,/; s/ubuntu,:,ubuntu,/usermod -aG /; s/$/ \$NEW_USER/' update-groups
killall -u ubuntu || 2>&1 echo "killall: no processes killed"
userdel -r ubuntu
sed -i '/^ubuntu/d' /etc/sudoers.d/90-cloud-init-users
# ### Install Crostini packages
# Prepare for installing Google's Crostini specific packages. First bring Ubuntu up to date:
apt-get update
apt-get -y upgrade < /dev/null
# Now add the Crostini package repository to **apt**. This repository provides the Linux integration with Chrome OS:
echo "deb https://storage.googleapis.com/cros-packages bullseye main" > /etc/apt/sources.list.d/cros.list
if [ -f /dev/.cros_milestone ]; then sudo sed -i "s?packages?packages/$(cat /dev/.cros_milestone)?" /etc/apt/sources.list.d/cros.list; fi
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551
apt-get update
# A work-around is needed for a **cros-ui-config** package installation conflict. First, install binutils to get the **ar** command:
apt-get -y install binutils < /dev/null
# Then create the **cros-ui-config** work-around package:
apt-get -y download cros-ui-config < /dev/null # ignore any warning messages
ar x cros-ui-config_0.12_all.deb data.tar.gz
gunzip data.tar.gz
tar f data.tar --delete ./etc/gtk-3.0/settings.ini
gzip data.tar
ar r cros-ui-config_0.12_all.deb data.tar.gz
rm -rf data.tar.gz
# Now install the Crostini packages and the "work-around" package, ignoring any warning messages. This will take awhile:
apt-get -y install cros-guest-tools ./cros-ui-config_0.12_all.deb < /dev/null
# Delete the "work-around" package:
rm cros-ui-config_0.12_all.deb
# ### Finishing up
# Install the **adwaita-icon-theme-full** package. Without this package, GUI Linux apps may have a very small cursor:
apt-get -y install adwaita-icon-theme-full < /dev/null
# Now, shut down the container:
shutdown -h now
Reboot Chrome OS and start the Terminal application from the launcher. If it fails to start the first time, try again and it should work. Once it launches, the default username (your gmail or g suite account name) will be created.
Now we need to change the name to our (presumably) shorter desired username.
vmc start termina
lxc start penguin
lxc exec penguin -- bash
First set the variable NEW_USER
to the username you'd like
set -e
NEW_USER=${NEW_USER:-aadid}
OLD_USER=$(getent passwd 1000 | cut -d: -f1)
mv /home/$OLD_USER /home/$NEW_USER
pkill -u $OLD_USER
usermod -l $NEW_USER -d /home/$NEW_USER $OLD_USER
groupmod -n $NEW_USER $OLD_USER
source update-groups
rm update-groups
# we need the old user to exist on the system or terminal won't start.
useradd -m $OLD_USER
usermod -aG chronos-access,android-everybody $OLD_USER
shutdown -h now
Now start a terminal again
# Now **touch** a file using the name of the OS. This can be a reminder of which container you are in if you work with more than one container:
touch ubuntu-18.04
# Launch the **Files** Chrome OS app and look under Linux Files. You should see the file you touched above.
# ### Keeping the Crostini packages up to date
# Google's Crostini packages are tied to Chrome OS major versions. When Chrome OS updates to a major new version number, for example from CrOS 73 to CrOS 74, you should run these commands to update the Crostini packages too. First, update the version number in the **cros.list** package file (after editing, save with ctrl-s and exit with ctrl-x):
sudo nano /etc/apt/sources.list.d/cros.list # update the version number, then save with ctrl-s and exit with ctrl-x
# Then update the Crostini packages:
sudo apt update
sudo apt upgrade
# ### Other releases
# These instructions have been tested to work for Ubuntu 18.10 and 19.04. Just replace 18.04 with 18.10 or 19.04 in the instructions above.
# That's it! Many many thanks to [linuxiumcomau](https://linuxiumcomau.blogspot.com), whose awesome [blog post](https://linuxiumcomau.blogspot.com/2018/08/introduction-to-crostini-part-3-using.html) is the basis for this wiki article.