Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions content/learning-paths/laptops-and-desktops/chrome-os-lxc/_index.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
---
title: Install Ubuntu on ChromeOS Crostini as an LXC Container

draft: true
cascade:
draft: true
title: Install Ubuntu on ChromeOS Crostini as an LXC container

minutes_to_complete: 60

who_is_this_for: This Learning Path is for software developers who want to install Ubuntu and other Linux distributions on their Arm-based Chromebook with ChromeOS file sharing and GUI support.

learning_objectives:
- Create an Ubuntu 24.04 container on ChromeOS Crostini using the Termina shell and LXC.
- Set up ChromeOS integration for file sharing and GUI applications.
- Manage LXC containers on ChromeOS.
- Create and run an Ubuntu 24.04 container on ChromeOS Crostini using LXC and Termina shell
- Set up ChromeOS integration for file sharing and GUI applications
- Manage LXC containers on ChromeOS
- Enable file sharing between ChromeOS and Ubuntu containers
- Run Linux GUI applications on your Chromebook with Sommelier integration

prerequisites:
- A ChromeOS device with the Linux development environment enabled. The Lenovo Chromebook Plus 14 is recommended.
- Basic knowledge of the Linux command line.
- Basic knowledge of the Linux command line

author: Jason Andrews

### Tags
skilllevels: Introductory
subjects: Containers and Virtualization
armips:
- Cortex-A
- Cortex-A
operatingsystems:
- ChromeOS
- ChromeOS
tools_software_languages:
- Ubuntu
- Ubuntu

further_reading:
- resource:
title: Official ChromeOS Linux Support
link: https://chromeos.dev/en/linux
type: documentation
- resource:
title: Linux Containers
link: https://linuxcontainers.org/
type: website
- resource:
title: Official ChromeOS Linux Support
link: https://chromeos.dev/en/linux
type: documentation
- resource:
title: Linux Containers
link: https://linuxcontainers.org/
type: website

### FIXED, DO NOT MODIFY
# ================================================================================
Expand Down
55 changes: 32 additions & 23 deletions content/learning-paths/laptops-and-desktops/chrome-os-lxc/page-1.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
---
title: "Create an Ubuntu container"
title: "Create an Ubuntu 24.04 container on ChromeOS"
weight: 2
layout: "learningpathall"
---

The [Lenovo Chromebook Plus 14](https://www.bestbuy.com/site/lenovo-chromebook-plus-14-oled-2k-touchscreen-laptop-mediatek-kompanio-ultra-16gb-memory-256gb-ufs-seashell/6630493.p?skuId=6630493&intl=nosplash) is is powered by the MediaTek Kompanio Ultra processor, featuring an Arm-based MediaTek Kompanio Ultra processor, offers software developers a powerful and energy-efficient platform for Linux development. Its compatibility with containerized environments and support for ChromeOS Linux (Crostini) make it an excellent choice for coding, testing, and running modern development workflows on the go.
## Overview

This Learning Path will walk you through setting up an Ubuntu 24.04 container on your Arm-based Chromebook using ChromeOS's built-in Linux development environment. You'll learn how to create and manage containers, install essential development tools, and integrate your Ubuntu environment with ChromeOS features like file sharing and GUI application support. By the end, you'll have a flexible and powerful Arm Linux development environment.
The [Lenovo Chromebook Plus 14](https://www.bestbuy.com/site/lenovo-chromebook-plus-14-oled-2k-touchscreen-laptop-mediatek-kompanio-ultra-16gb-memory-256gb-ufs-seashell/6630493.p?skuId=6630493&intl=nosplash) is powered by the Arm-based MediaTek Kompanio Ultra processor. It provides a powerful and energy-efficient platform for Linux development, with strong compatibility for containerized environments and ChromeOS Linux (Crostini). This makes it an excellent choice for coding, testing, and running modern development workflows on the go.

This Learning Path walks you through setting up an Ubuntu 24.04 container on your Arm-based Chromebook using ChromeOS's built-in Linux development environment. You'll learn how to create and manage containers, install essential development tools, and integrate your Ubuntu environment with ChromeOS features like file sharing and GUI application support. By the end, you'll have a flexible and powerful Arm Linux development environment.

## Access the ChromeOS terminal

The first step to creating an Ubuntu container on ChromeOS is to open the ChromeOS shell.

Open the Chrome browser and press **Ctrl + Alt + T** to open crosh, the ChromeOS shell, crosh.
Open the Chrome browser and press **Ctrl + Alt + T** to open crosh, the ChromeOS shell.

![ChromeOS shell #center](_images/chromeos-shell.png)
![ChromeOS shell #center](_images/chromeos-shell.png "ChromeOS shell")

Run the command below to start the Termina shell.
Run the command below to start the Termina shell:

```console
vsh termina
Expand All @@ -26,13 +28,13 @@ You are now in the Termina environment where you can manage containers.

The `lxc` command is used to manage containers on ChromeOS.

You can list the running containers.
List the running containers:

```console
lxc list
```

If you have the default Debian container running you see output similar to:
If you have the default Debian container running, the output looks like:

```output
+---------+---------+-----------------------+------+-----------+-----------+
Expand All @@ -42,30 +44,30 @@ If you have the default Debian container running you see output similar to:
+---------+---------+-----------------------+------+-----------+-----------+
```

The name of the Debian container is penguin. When you enable the Linux subsystem on ChromeOS the Debian container named penguin is created, but you can create additional containers with different Linux distributions and different names.
The name of the Debian container is `penguin`. When you enable the Linux subsystem on ChromeOS, the Debian container is created automatically, but you can create additional containers with different Linux distributions and different names.

## Create a Ubuntu 24.04 container
## Create an Ubuntu 24.04 container

This command creates and starts a new Ubuntu 24.04 container named `u1`.
This command creates and starts a new Ubuntu 24.04 container named `u1`:

```bash
lxc launch ubuntu:24.04 u1
```

The output is:
Expected output:

```output
Creating u1
Starting u1
```

Check the status of the new container and confirm the status is RUNNING.
Check the status of the new container and confirm the status is `RUNNING`:

```bash
lxc list
```

Now there are 2 containers running.
Now there are two containers running:

```output
+---------+---------+-----------------------+------+-----------+-----------+
Expand All @@ -77,35 +79,40 @@ Now there are 2 containers running.
+---------+---------+-----------------------+------+-----------+-----------+
```

Create a new shell in the Ubuntu container.
Open a shell in the Ubuntu container:

```bash
lxc exec u1 -- bash
```

## Complete the Ubuntu setup
## Set up Ubuntu for development

Once inside the Ubuntu container, you need to perform some initial setup tasks.
Once inside the Ubuntu container, perform initial setup tasks.

Update the package lists and upgrade installed packages to the latest versions.
Update package lists and upgrade installed packages:

```bash
apt update && apt upgrade -y
```

Install essential packages for development and system management. You can select your favorite software packages, these are examples.
Install essential packages for development and system management.

{{% notice Note %}}
You can select your favorite software packages, these are examples.
{{% /notice %}}


```bash
apt install -y net-tools gcc
```

Creating a non-root user is a crucial security best practice and ensures that applications don't have unnecessary administrative privileges. The username `ubuntu` is already available in the container. You are free to use `ubuntu` as your non-root user or create a new user.
Creating a non-root user is a crucial security best practice and ensures that applications don't have unnecessary administrative privileges. The username `ubuntu` is already available, but you can create another user.

{{% notice Note %}}
The following commands use `user1` as a new username. You can replace it with your actual desired username in all subsequent steps.
The following commands use `user1` as the username. Replace it with your own choice in subsequent steps.
{{% /notice %}}

Create a new user account. Skip if you want to use the `ubuntu` user.
Create a new user account (skip if you want to use the `ubuntu` user):

```bash
adduser user1
Expand All @@ -123,10 +130,12 @@ Switch to your new user account to continue the setup.
su - user1
```

If you didn't creat a new user switch to `ubuntu` as the non-root user.
If you didn’t create a new user, switch to the default `ubuntu` user:

```bash
su - ubuntu
```

## Next steps

Continue to learn how to integrate the new Ubuntu container with ChromeOS features like file sharing.
56 changes: 26 additions & 30 deletions content/learning-paths/laptops-and-desktops/chrome-os-lxc/page-2.md
Original file line number Diff line number Diff line change
@@ -1,97 +1,93 @@
---
title: ChromeOS integration
title: Integrate ChromeOS with Linux containers
weight: 3
layout: "learningpathall"
---

## File sharing between ChromeOS and Linux
## File sharing between ChromeOS and Linux containers

Chromebooks with Linux offer convenient file sharing capabilities between the main ChromeOS environment and the Linux subsystem.

Key Features:
Key features:

- Selective Folder Sharing: ChromeOS allows you to share specific folders (not individual files) from the native files app with the Linux container. This is done by right-clicking a folder and selecting "Share with Linux." Once shared, these directories become accessible to Linux apps and the command line within the Linux environment.

- Two-Way Access: Files and folders created within the Linux container appear in the "Linux files" section of the ChromeOS Files app, enabling seamless movement of data between environments.

- Sandboxed Security: The Linux environment is sandboxed for security, meaning it doesn't have access to the full ChromeOS file system by default. Only the folders explicitly shared by the you are visible in Linux, ensuring protected data separation.

- Easy Integration: Shared folders can be navigated from Linux at paths such as /mnt/chromeos/MyFiles/. Applications and command-line tools within Linux can read and write to these shared folders.

- Management Tools: You can manage and revoke shared folder access through the ChromeOS Files app, allowing for flexible control over what is accessible to Linux.
- **Selective folder sharing**: ChromeOS allows you to share specific folders (not individual files) from the native Files app with the Linux container. This is done by right-clicking a folder and selecting **Share with Linux**. Once shared, these directories become accessible to Linux apps and the command line within the Linux environment.
- **Two-way access**: Files and folders created within the Linux container appear in the **Linux files** section of the ChromeOS Files app, enabling seamless movement of data between environments.
- **Sandboxed security**: The Linux environment is sandboxed for security, meaning it doesn't have access to the full ChromeOS file system by default. Only the folders explicitly shared by you are visible in Linux, ensuring protected data separation.
- **Easy integration**: Shared folders can be navigated from Linux at paths such as `/mnt/chromeos/MyFiles/`. Applications and command-line tools within Linux can read and write to these shared folders.
- **Management tools**: You can manage and revoke shared folder access through the ChromeOS Files app, allowing for flexible control over what is accessible to Linux.

These features make it simple to move files between ChromeOS and Linux applications while maintaining security and user control.

## Configure File System Integration
## Configure ChromeOS file system integration

### Share ChromeOS directories

To access your ChromeOS files from within the Ubuntu container, you need to configure shared directories.
To access your ChromeOS files from within the Ubuntu container, you need to configure shared directories.

You can share directories using the ChromeOS File application. Right click on any directory and select **Share with Linux**.
You can share directories using the ChromeOS Files application. Right-click on any directory and select **Share with Linux**.

If you share a ChromeOS directory it appears in `/mnt/chromeos/MyFiles/` in your Ubuntu container. For example, share your Downloads directory in ChromeOS and it is visible in Ubuntu.
If you share a ChromeOS directory, it appears in `/mnt/chromeos/MyFiles/` in your Ubuntu container. For example, share your Downloads directory in ChromeOS and it is visible in Ubuntu:

```bash
ls /mnt/chromeos/MyFiles/Downloads/
```

### Share Google Drive directories

You can also share Google Drive directories using the ChromeOS Files application. Use the same right click and select **Share with Linux**.
You can also share Google Drive directories using the ChromeOS Files application. Use the same right-click and select **Share with Linux**.

If you share a Google Drive folder it appears in `/mnt/chromeos/GoogleDrive/MyDrive/` in your Ubuntu container. For example, share your `AndroidAssets` directory in Google Drive it is visible in Ubuntu.
If you share a Google Drive folder, it appears in `/mnt/chromeos/GoogleDrive/MyDrive/` in your Ubuntu container. For example, share your `AndroidAssets` directory in Google Drive and it is visible in Ubuntu:

```bash
ls /mnt/chromeos/GoogleDrive/MyDrive/AndroidAssets
```

Your shared folders appear in the **Linux Settings** under **Manage shared folders** as shown below:
Your shared folders appear in the **Linux settings** under **Manage shared folders** as shown below:

![Shared folders #center](_images/shared-folders.png)
![Shared folders #center](_images/shared-folders.png "Shared folders")

### Share a folder using the command line
### Share folders using the command line

You can use the commands below from the Termina shell.
You can also share folders using the Termina shell.

Mount the entire ChromeOS file system to /mnt/chromeos in the container.
Mount the entire ChromeOS file system to `/mnt/chromeos` in the container:

```bash
lxc config device add ubuntu-main shared-chromeos disk source=/mnt/chromeos path=/mnt/chromeos
```

Share your ChromeOS Downloads folder with the container
Share your ChromeOS Downloads folder with the container:

```bash
lxc config device add ubuntu-main downloads disk source=/mnt/chromeos/MyFiles/Downloads path=/home/username/Downloads
```

Share your ChromeOS Documents folder with the container.
Share your ChromeOS Documents folder with the container:

```bash
lxc config device add ubuntu-main documents disk source=/mnt/chromeos/MyFiles/Documents path=/home/username/Documents
```

## File Operations
## Copy files with LXC commands

You can use the `lxc file` command to copy files to and from a container from the Termina shell.

As an example create a file named file1
As an example, create a file named `file1`:

```bash
echo "test file 1" >> /mnt/shared/MyFiles/Downloads/file1
```

Copy the file from your ChromeOS Downloads folder to the tmp directory in the container.
Copy the file from your ChromeOS Downloads folder to the `/tmp` directory in the container:

```bash
lxc file push file1 u1/tmp/file1
```

Copy the same file back to the Downloads directory with a new name.
Copy the same file back to the Downloads directory with a new name:

```bash
lxc file pull u1/tmp/file1 file2
```

You now have the file in your Downloads directory with a new name.
You now have the file in your Downloads directory with a new name.
Loading