DEV Community

Michael Sanford
Michael Sanford

Posted on • Updated on

How to get Kali tools and Snap on a Chromebook

Introduction

Google has shipped (let's call it reasonable) support for Linux inside a container - official documentation.

I'll walk through how to set up Linux, add the Kali aptitude repo as well as Snap. This will get you up and running with your favourite tools.

You will not have a Kali desktop UI at the end of this tutorial, just access to the CLI tools, and Snap-based UI applications.

Enable Linux

Installing

Hit Search and type "Terminal".

Image description

This will bring up the "Set up linux development environment" wizard, which is also accessible through Settings.

Image description

Choose a username.

You can safely go with the recommended size of 10 GB, which can be easily resized later if you need more - or less - space.

Hit Next and wait a couple of minutes.

This will prepare a Debian Buster system in a virtualized container.

It will then open the Terminal app. Right-click it and Pin it to your taskbar for easy access, which you'll need later.

Customising your System

If you don't like the default hostname "penguin" you can change it. My Chromebook is silver in colour, and I'm French-speaking, so I decided to call mine "argent".

Modify the /etc/hostname file, replacing penguin with your preferred hostname.

Then, modify the first line of /etc/hosts to match, and leave the rest as they are. In my case:

127.0.1.1       argent
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
Enter fullscreen mode Exit fullscreen mode

Now, instead of rebooting, right-click the Terminal in the taskbar and choose Shut down Linux. Then again to start it.

shutdown and reboot do not work as expected in this Linux subsystem; don't use them.

Adding Kali Aptitude Repos

Next, we'll add the Kali apt repos and the public GPG key:

echo "deb http://http.kali.org/kali kali-rolling main contrib non-free" | sudo tee /etc/apt/sources.list.d/kali.list

wget -q -O - https://archive.kali.org/archive-key.asc | sudo tee /etc/apt/trusted.gpg.d/kali-rolling-repo.asc
Enter fullscreen mode Exit fullscreen mode

Note: You may see references elsewhere to apt-key add. This feature was deprecated yesterday, the above method is preferred.

Update your local aptitude cache:

sudo apt update

Get:1 http://kali.download/kali kali-rolling InRelease [30.6 kB]
Get:2 http://kali.download/kali kali-rolling/main amd64 Packages [18.0 MB]                  
Ign:3 https://storage.googleapis.com/cros-packages/99 bullseye InRelease
Hit:4 https://storage.googleapis.com/cros-packages/99 bullseye Release
Get:6 http://kali.download/kali kali-rolling/contrib amd64 Packages [113 kB]
Get:7 http://kali.download/kali kali-rolling/non-free amd64 Packages [194 kB]
Fetched 18.3 MB in 3s (5,779 kB/s)                       
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done

347 packages can be upgraded. Run 'apt list --upgradable' to see them.
Enter fullscreen mode Exit fullscreen mode

And update everything, clean and remove redundancies:

sudo apt update && sudo apt dist-upgrade -y && sudo apt autoremove -y && sudo apt autoclean -y
Enter fullscreen mode Exit fullscreen mode

This took around 4 minutes on my N6000.

Restart the Linux system by right-clicking Terminal and choosing Shut down Linux. Click to start it again.

Snap

What is Snap?

Snaps are app packages for desktop, cloud and IoT that are easy to install, secure, cross‐platform and dependency‐free. Snaps are discoverable and installable from the Snap Store.

You can snap-in lots of great applications with a single command, like JetBrains IDEs, VS Code, Firefox, LibreOffice, and heck, even PowerShell!

Installing Snap

You need to install a few dependencies, notably the SquashFS and FUSE, and Snap itself:

sudo apt install libsquashfuse0 squashfuse fuse snapd
Enter fullscreen mode Exit fullscreen mode

If you try to install Snap without Fuse, you'll get this error:

error: system does not fully support snapd: cannot mount squashfs image using "squashfs": mount:

By default snapd will not start automatically when the Linux system is restarted; trying to run snap will fail with the following error:

error: cannot communicate with server: Post http://localhost/v2/snaps/hello-world: dial unix /run/snapd.socket: connect: no such file or directory

The permanent fix is to enable the service at startup:

sudo systemctl enable --now snapd apparmor
Enter fullscreen mode Exit fullscreen mode

Installing Snaps

Find some snaps from https://snapcraft.io/store and follow the instructions to install them.

Running Snaps

To run the snap for VS Code, for example:

snap run code
Enter fullscreen mode Exit fullscreen mode

Note that the first time you run a snap it may take a long time to initialize. Subsequent runs will be quick.

SSH Keys

Might as well generate an SSH key while we're at it. ECDSA with key size of 521 bits is the currently-recommended standard but be warned it is not widely adopted:

ssh-keygen -t ecdsa -b 521
Enter fullscreen mode Exit fullscreen mode

Hat-tips:

Discussion (0)