Skip to content

Commit d3cea5d

Browse files
committed
docs: update quickstart
Changes in dependencies cause firecracker-containerd to not build properly with Go < 1.11.4 (the go.sum digest algorithm changed slightly in that version). Changes in Firecracker's seccomp enforcement and hard dependency on musl caused seccomp violations when built against glibc. This change moves our quickstart guide to Debian, which has musl libc and an updated Go 1.11 >= 1.11.4 available in its repositories. Fixes firecracker-microvm#127 Signed-off-by: Samuel Karp <[email protected]>
1 parent a455aa5 commit d3cea5d

File tree

1 file changed

+47
-50
lines changed

1 file changed

+47
-50
lines changed

docs/quickstart.md

Lines changed: 47 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -12,74 +12,68 @@ files into `/usr/local/bin`.
1212
1. Get an AWS account (see
1313
[this article](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/)
1414
if you need help creating one)
15-
2. Launch an i3.metal instance running Amazon Linux 2 (you can find it in the
16-
EC2 console Quickstart wizard, or by running
17-
`aws ssm get-parameters --names /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2`
18-
in your chosen region). If you need help launching an EC2 instance, see the
15+
2. Launch an i3.metal instance running Debian Stretch (you can find it in the
16+
[AWS marketplace](http://deb.li/awsmp) or on [this
17+
page](https://wiki.debian.org/Cloud/AmazonEC2Image/Stretch). If you need
18+
help launching an EC2 instance, see the
1919
[EC2 getting started guide](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html).
20-
3. If you have an older kernel, update the kernel to
21-
`kernel-4.14.88-88.76.amzn2` (there's a bugfix in this that we need) and
22-
reboot. The latest AMIs for Amazon Linux 2 (which you can discover from the
23-
instructions above) already have a new-enough kernel.
24-
<details><summary>Click here for instructions on updating your kernel</summary>
25-
```bash
26-
if [[ $(rpm --eval "%{lua: print(rpm.vercmp('$(uname -r)', '4.14.88-88.76.amzn2.x86_64'))}") -lt 0 ]]; then
27-
echo "You need to install a kernel >= 4.14.88-88.76.amzn2. You can do so by running the following commands:"
28-
echo "sudo yum -y upgrade kernel && sudo reboot"
29-
else
30-
echo 'You are already up to date!'
31-
fi
32-
```
33-
</details>
3420
3. Run the script below to download and install all the required components.
3521
This script expects to be run from your `$HOME` directory.
3622

3723
```bash
3824
#!/bin/bash
3925

40-
if [[ $(rpm --eval "%{lua: print(rpm.vercmp('$(uname -r)', '4.14.88-88.76.amzn2.x86_64'))}") -lt 0 ]]; then
41-
echo "You need to install a kernel >= 4.14.88-88.76.amzn2. You can do so by running the following commands:"
42-
echo "sudo yum -y upgrade kernel && sudo reboot"
43-
fi
44-
4526
cd ~
4627

47-
# Install git
48-
sudo yum install -y git
49-
50-
# Install Rust and Go 1.11
51-
sudo amazon-linux-extras install -y rust1
52-
sudo amazon-linux-extras install -y golang1.11
53-
54-
# Check out Firecracker and build it from the v0.12.0 tag
28+
# Install git, Go 1.11, make, curl
29+
sudo mkdir -p /etc/apt/sources.list.d
30+
echo "deb http://ftp.debian.org/debian stretch-backports main" | \
31+
sudo tee /etc/apt/sources.list.d/stretch-backports.list
32+
sudo DEBIAN_FRONTEND=noninteractive apt-get update
33+
sudo DEBIAN_FRONTEND=noninteractive apt-get \
34+
--target-release stretch-backports \
35+
install --yes \
36+
golang-go \
37+
make \
38+
git \
39+
curl \
40+
e2fsprogs \
41+
musl-tools \
42+
util-linux
43+
44+
# Install Rust
45+
curl https://sh.rustup.rs -sSf | sh -s -- --verbose -y --default-toolchain 1.32.0
46+
source $HOME/.cargo/env
47+
rustup target add x86_64-unknown-linux-musl
48+
49+
# Check out Firecracker and build it from the v0.15.2 tag
5550
git clone https://github.com/firecracker-microvm/firecracker.git
5651
cd firecracker
57-
git checkout v0.12.0
58-
cargo build --release --features vsock --target x86_64-unknown-linux-gnu
59-
sudo cp target/x86_64-unknown-linux-gnu/release/{firecracker,jailer} /usr/local/bin
52+
git checkout v0.15.2
53+
cargo build --release --features vsock --target x86_64-unknown-linux-musl
54+
sudo cp target/x86_64-unknown-linux-musl/release/{firecracker,jailer} /usr/local/bin
6055

6156
cd ~
6257

63-
# Check out containerd and build it from the v1.2.1 tag
58+
# Check out containerd and build it from the v1.2.4 tag
6459
mkdir -p ~/go/src/github.com/containerd/containerd
6560
git clone https://github.com/containerd/containerd.git ~/go/src/github.com/containerd/containerd
6661
cd ~/go/src/github.com/containerd/containerd
67-
git checkout v1.2.1
68-
sudo yum install -y libseccomp-devel btrfs-progs-devel
62+
git checkout v1.2.4
63+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libseccomp-dev btrfs-progs
6964
make
7065
sudo cp bin/* /usr/local/bin
7166

7267
cd ~
7368

74-
# Check out runc and build it from the 96ec2177ae841256168fcf76954f7177af9446eb
69+
# Check out runc and build it from the 6635b4f0c6af3810594d2770f662f34ddc15b40d
7570
# commit. Note that this is the version described in
76-
# https://github.com/containerd/containerd/blob/v1.2.1/RUNC.md and
77-
# https://github.com/containerd/containerd/blob/v1.2.1/vendor.conf#L23
71+
# https://github.com/containerd/containerd/blob/v1.2.4/RUNC.md and
72+
# https://github.com/containerd/containerd/blob/v1.2.4/vendor.conf#L23
7873
mkdir -p ~/go/src/github.com/opencontainers/runc
7974
git clone https://github.com/opencontainers/runc ~/go/src/github.com/opencontainers/runc
8075
cd ~/go/src/github.com/opencontainers/runc
81-
git checkout 96ec2177ae841256168fcf76954f7177af9446eb
82-
sudo yum install -y libseccomp-static glibc-static
76+
git checkout 6635b4f0c6af3810594d2770f662f34ddc15b40d
8377
make static BUILDTAGS='seccomp'
8478
sudo make BINDIR='/usr/local/bin' install
8579

@@ -88,7 +82,7 @@ cd ~
8882
# Check out firecracker-containerd and build it
8983
git clone https://github.com/firecracker-microvm/firecracker-containerd.git
9084
cd firecracker-containerd
91-
sudo yum install -y device-mapper
85+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y dmsetup
9286
make STATIC_AGENT='true'
9387
sudo cp runtime/containerd-shim-aws-firecracker snapshotter/cmd/{devmapper/devmapper_snapshotter,naive/naive_snapshotter} /usr/local/bin
9488

@@ -114,8 +108,8 @@ cd /container
114108
EOF
115109
chmod +x fc-agent.start
116110
truncate --size=+50M hello-rootfs.ext4
117-
e2fsck -f hello-rootfs.ext4
118-
resize2fs hello-rootfs.ext4
111+
/sbin/e2fsck -f hello-rootfs.ext4
112+
/sbin/resize2fs hello-rootfs.ext4
119113
sudo mount hello-rootfs.ext4 /tmp/mnt
120114
sudo cp $(which runc) firecracker-containerd/agent/agent /tmp/mnt/usr/local/bin
121115
sudo cp fc-agent.start /tmp/mnt/etc/local.d
@@ -156,14 +150,17 @@ sudo tee -a /etc/containerd/firecracker-runtime.json <<EOF
156150
"metrics_fifo": "/tmp/fc-metrics.fifo"
157151
}
158152
EOF
153+
154+
# Enable vhost-vsock
155+
sudo modprobe vhost-vsock
159156
```
160157

161158
4. Open a new terminal and start the `naive_snapshotter` program in the
162159
foreground
163160

164161
```bash
165162
sudo mkdir -p /var/run/firecracker-containerd /var/lib/firecracker-containerd/naive
166-
sudo /usr/local/bin/naive_snapshotter \
163+
sudo naive_snapshotter \
167164
-address /var/run/firecracker-containerd/naive-snapshotter.sock \
168165
-path /var/lib/firecracker-containerd/naive \
169166
-debug
@@ -172,16 +169,16 @@ sudo /usr/local/bin/naive_snapshotter \
172169
5. Open a new terminal and start `containerd` in the foreground
173170

174171
```bash
175-
sudo PATH=$PATH /usr/local/bin/containerd
172+
sudo containerd
176173
```
177174

178175
6. Open a new terminal, pull an image, and run a container!
179176

180177
```bash
181-
sudo /usr/local/bin/ctr image pull \
178+
sudo ctr image pull \
182179
--snapshotter firecracker-naive \
183180
docker.io/library/debian:latest
184-
sudo /usr/local/bin/ctr run \
181+
sudo ctr run \
185182
--snapshotter firecracker-naive \
186183
--runtime aws.firecracker \
187184
--tty \
@@ -190,4 +187,4 @@ sudo /usr/local/bin/ctr run \
190187
```
191188

192189
When you're done, you can stop or terminate your i3.metal EC2 instance to avoid
193-
incurring additional charges from EC2.
190+
incurring additional charges from EC2.

0 commit comments

Comments
 (0)