Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save baldrailers/09ba52a17219ca1e8fbf233dc8a4b375 to your computer and use it in GitHub Desktop.
Save baldrailers/09ba52a17219ca1e8fbf233dc8a4b375 to your computer and use it in GitHub Desktop.
Arch Linux ARM on Crostini

Arch Linux ARM on Crostini

Screenshot

I got Arch Linux ARM installed on a Lenovo Chromebook Duet! I mostly used the instructions from the Arch Wiki as reference.

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

1. Installing the image

(ctrl-alt-t)
# ^ Opens the crosh shell
#
# › crosh>

vmc start termina
vsh termina
# ^ Enters the Linux VM ("termina"). From this VM, we
#   will create an LXC container from the Arch Linux image.
#
# › (termina) chronos@localhost ~ $

lxc remote add images-uk https://uk.images.linuxcontainers.org --protocol simplestreams --auth-type tls
lxc remote list
# ^ Optional: adds a UK mirror if that's closer to you.
#   This can be skipped; use `images:` rather than `images-uk:`
#   in the next step.
#
# > |      NAME       |                    URL                |   PROTOCOL    |  AUTH TYPE  | PUBLIC | STATIC |
#   | images          | https://images.linuxcontainers.org    | simplestreams | none        | YES    | NO     |
#   | images-uk       | https://uk.images.linuxcontainers.org | simplestreams | none        | YES    | NO     |

lxc launch images-uk:archlinux/current arch
# ^ Creates the LXC container with Arch Linux.
#   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 |
#   | arch           | RUNNING |      |      | PERSISTENT | 0         |
#   | penguin        | STOPPED |      |      | PERSISTENT | 0         |

lxc exec arch bash
# ^ Enter the container.
#   If you see the prompt below, you're now in Arch!
#
# > [root@arch ~]#

2. Set up the user

There's already a default user (alarm). I renamed that to my own preferred name.

grep 1000:1000 /etc/passwd
# ^ Shows the default user. It's usually `alarm` for
#   the ARM build, but I haven't tried it elsewhere.
#
# > alarm

groupmod -n rsc alarm
usermod -d /home/rsc -l rsc -m -c rsc alarm
# ^ Rename that user. I name mine `rsc`. This should
#   be the same username that was used to set up the
#   default Debian environment.

passwd rsc
# ^ Change passwd

visudo
# ^ Uncomment the line that says:
#   %wheel ALL=(ALL) NOPASSWD ALL

usermod -aG wheel rsc
# ^ Gives sudo rights to user

3. Setting up networking

Networking doesn't work by default (try pinging out), and this was what I did to turn it on.

# ^ We should still be in the root shell inside Arch
#   [root@arch ~]#

ip -4 a show dev eth0
# ^ See if there's a network connection.
#   non-empty output = good (skip)
#   empty output     = proceed below

dhcpcd eth0
ping 8.8.8.8
# ^ Connects to the internet. It if works, ping should
#   start giving some results.
#
# > dhcpcd-9.4.0 starting
#   ...
#   forked in background, child pid 122
#
# > 64 bytes from 8.8.8.8: icmp_seq=1 ttl=53 time=27.6ms
#   ...

pacman -Syu dhclient
systemctl enable --now dhclient@eth0
# ^ use dhclient to auto-connect eth0 on startup

4. Log in as user

Now that there's a user (rsc), I logged on directly with it and did the first system update (pacman -Syu).

exit
# ^ Go back to termina if you're still inside Arch
# > (termina) chronos@localhost ~ $

lxc exec arch su - rsc
# ^ Log in as the user
#
# > [rsc@arch ~]$

sudo nano /etc/pacman.d/mirrorlist
# ^ Optional: Use a closer mirror. Eg, change
#   mirror.archlinuxarm.org => au.mirror.archlinuxarm.org
#
#   A full list of mirrors are in this page:
#   https://archlinuxarm.org/about/mirrors

sudo nano /etc/pacman.conf
# ^ Optional: Update pacman config. I prefer to:
#   - uncomment #Color
#   - uncomment #VerbosePkgLists
#   - uncomment #ParallelDownloads = 5

sudo pacman -Syu base-devel git curl make neovim wl-clipboard fish
# ^ Installs some packages

5. Install yay

# This step requires `base-devel`, which was installed
# in a previous step. If there are errors about
# fakeroot, try: sudo pacman -Syu base-devel

git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

6. Install cros-container-guest-tools

cros-container-guest-tools allows X apps to work. It can be installed using yay.

yay -S cros-container-guest-tools-git

cp -r /etc/skel/.config/pulse ~/.config/pulse
# ^ As directed by the post-install message. This will
#   enable audio to wor.

yay -S xorg-xwayland
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: rsc
#   password:
#   [rsc@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

Screenshot of Mousepad

7. Make it the default

The default image is Debian (penguin), but we can move that away and make Arch the default. To do this, we'll rename the LXC image to penguin.

# ^ Start in termina
#   (termina) chronos@localhost ~ $

lxc list
lxc stop arch
lxc stop penguin
# ^ Stop all LXC containers that are `RUNNING`

lxc rename penguin google
lxc rename arch 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
@bdmorin
Copy link

bdmorin commented Jul 18, 2022

What steps did you perform?
Have you removed your original arch install, and started over?

We should probably stop polluting baldrailers gist.

@ngencokamin
Copy link

ngencokamin commented Jul 19, 2022

What steps did you perform? Have you removed your original arch install, and started over?

We should probably stop polluting baldrailers gist.

Ok so I'm now on beta 104.0.5112.36. Wiped my linux setup and re-enabled it. Here are the steps I ran:

  1. vmc start termina
  2. lxc launch images:archlinux/current arch
  3. lxc stop penguin
  4. lxc list # penguin is stopped, arch is running
  5. lxc exec arch bash
  6. groupmod -n nix alarm
  7. usermod -d /home/nix -l nix -m -c nix alarm
  8. passwd nix
  9. visudo # uncommented %wheel ALL=(ALL:ALL) ALL
  10. usermod -aG wheel nix
  11. ip -4 a show dev eth0 # there was output, following steps skipped
  12. exit
  13. lxc exec arch su - nix
  14. sudo pacman -Syu base-devel git curl make vim wl-clipboard zsh
  15. yay -S cros-container-guest-tools-git
  16. cp -r /etc/skel/.config/pulse ~/.config/pulse
  17. yay -S xorg-xwayland wayland mousepad
  18. exit
  19. lxc console arch # login with user
  20. systemctl enable --now --user sommelier{,-x}@{0,1}.service
  21. mousepad # window opened as expected
  22. vsh into termina again
  23. lxc list # arch and penguin show up
  24. lxc stop arch
  25. lxc stop penguin # already stopped but I did it to be safe
  26. lxc rename penguin google
  27. lxc rename arch penguin
  28. lxc list # shows penguin and google as expected
  29. exit
  30. vmc list # only shows termina
  31. vmc stop termina

Result (same before and after reboot):
Screen recording 2022-07-19

Edit:
Still works perfectly consolling in through crosh, it's just broken in the terminal app
image

Second edit: ok so now it almost works. It'll open in terminal if I console in through crosh and then open a new terminal tab, but starting through the terminal app itself results in errors until I do it in crosh

@bdmorin
Copy link

bdmorin commented Jul 19, 2022

When you started default penguin/bullseye was your username nix?

@ngencokamin
Copy link

yeah it was

@bdmorin
Copy link

bdmorin commented Jul 20, 2022

it looks like you did everything correctly. I'm also on a Duet5, and it's working great here. I'm sorry, I wish I had more advice for you.

@oukemi
Copy link

oukemi commented Oct 31, 2022

Same issue here

@luceerose
Copy link

luceerose commented Apr 11, 2024

Everything seemed to work, up until I tried to run mousepad & got a gtk error.
I'm on Dev ChromeOS.

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