Skip to content

Instantly share code, notes, and snippets.

@tonybenoy
Last active December 17, 2023 23:34
Show Gist options
  • Save tonybenoy/7695bb29f902e6687fe7466ade04844a to your computer and use it in GitHub Desktop.
Save tonybenoy/7695bb29f902e6687fe7466ade04844a to your computer and use it in GitHub Desktop.
# Gentoo ARM on Crostini
I got Gentoo ARM installed on a Lenovo Chromebook Duet!
## 0. Before we begin
- Enable **Linux development environment** in Chrome OS's settings
- Get it running
This comes with Debian by default, but this guide will install Arch Linux alongside that.
![Screenshot](https://user-images.githubusercontent.com/74385/134513580-e6ecbb92-9b6f-42e9-8848-f0eff9a8d5f7.png)
## 1. Installing the image
```sh
(ctrl-alt-t)
# ^ Opens the crosh shell
#
# › crosh>
vmc start termina
# ^ Enters the Linux VM ("termina"). From this VM, we
# will create an LXC container from the gentoo image.
#
# › (termina) chronos@localhost ~ $
lxc launch images:gentoo/systemd gentoo
# ^ Creates the LXC container with gentoo systemd(Systemd is required for cros-container-guest-tools to work).
# This will take a LONG time.
#
# › Creating arch
# Starting arch
lxc list
# ^ It should now be started and in this list after that.
#
# > | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
# | gentoo | RUNNING | | | PERSISTENT | 0 |
# | penguin | STOPPED | | | PERSISTENT | 0 |
lxc exec arch bash
# ^ Enter the container.
# If you see the prompt below, you're now in gentoo!
#
# > gentoo ~ #
```
## 2. Set up the user
```sh
useradd -m -G users,wheel,audio -s /bin/bash larry
passwd tony
# ^ Change passwd
visudo
# ^ Uncomment the line that says:
# %wheel ALL=(ALL) NOPASSWD ALL
## 3. Log in as user
Now that there's a user (`tony`), I logged on directly with it and did the rest with the user.
```sh
exit
# ^ Go back to termina if you're still inside Arch
# > (termina) chronos@localhost ~ $
lxc exec gentoo su - tony
# ^ Log in as the user
#
# > tony@gentoo ~ $
### 6. Install cros-container-guest-tools
```sh
sudo emerge dev-vcs/git
echo "=dev-util/bazel-6.2.0 **" | sudo tee /etc/portage/package.accept_keywords/bazel
sudo emerge dev-util/bazel
WIP below
git clone https://chromium.googlesource.com/chromiumos/containers/cros-container-guest-tools
cd cros-container-guest-tools
bazel build //cros-debs:debs
sudo emerge x11-base/xwayland
sudo emerge dev-libs/wayland
yay -S xorg-xwayland wayland
yay -S mousepad
# ^ Install a basic text editor so we can test it out
exit
# ^ Go back to termina
# (termina) chronos@localhost ~ $
lxc console arch
# ^ Log in via tty. This has no colours, but it
# will be necessary to start/enable user services.
#
# > To detach from the console, press: <ctrl>+a q
# arch login: tony
# password:
# [tony@arch ~]$
systemctl enable --now --user sommelier{,-x}@{0,1}.service
# ^ Starts and enables X11 and Wayland bridges
#
# > Created symlink /home/rsc/.config/systemd/user/default.target.wants/sommelier@0.service -> /usr/lib/systemd/user/sommelier@.service.
# Created symlink /home/rsc/.config/systemd/user/default.target.wants/sommelier-x@0.service -> /usr/lib/systemd/user/sommelier-x@.service.
# Created symlink /home/rsc/.config/systemd/user/default.target.wants/sommelier@1.service -> /usr/lib/systemd/user/sommelier@.service.
# Created symlink /home/rsc/.config/systemd/user/default.target.wants/sommelier-x@1.service -> /usr/lib/systemd/user/sommelier-x@.service.
mousepad
# ^ If it worked, this will open up a mousepad window
```
## 7. Make it the default
The default image is Debian (`penguin`), but we can move that away and make gentoo the default. To do this, we'll rename the LXC image to `penguin`.
```sh
# ^ Start in termina
# (termina) chronos@localhost ~ $
lxc list
lxc stop gentoo
lxc stop penguin
# ^ Stop all LXC containers that are `RUNNING`
lxc rename penguin google
lxc rename gentoo penguin
# ^ Swap out the names
exit
# ^ Go back to crosh
# > crosh>
vmc list
vmc stop termina
vmc stop dev
# ^ Stop all VMs
# ... after this, run the Terminal and it should boot
# up with your user
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment