Skip to content

Commit 76b70f9

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 76b70f9

File tree

1 file changed

+47
-49
lines changed

1 file changed

+47
-49
lines changed

docs/quickstart.md

Lines changed: 47 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,74 +12,69 @@ 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
77+
#sudo yum install -y libseccomp-static glibc-static
8378
make static BUILDTAGS='seccomp'
8479
sudo make BINDIR='/usr/local/bin' install
8580

@@ -88,7 +83,7 @@ cd ~
8883
# Check out firecracker-containerd and build it
8984
git clone https://github.com/firecracker-microvm/firecracker-containerd.git
9085
cd firecracker-containerd
91-
sudo yum install -y device-mapper
86+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y dmsetup
9287
make STATIC_AGENT='true'
9388
sudo cp runtime/containerd-shim-aws-firecracker snapshotter/cmd/{devmapper/devmapper_snapshotter,naive/naive_snapshotter} /usr/local/bin
9489

@@ -114,8 +109,8 @@ cd /container
114109
EOF
115110
chmod +x fc-agent.start
116111
truncate --size=+50M hello-rootfs.ext4
117-
e2fsck -f hello-rootfs.ext4
118-
resize2fs hello-rootfs.ext4
112+
/sbin/e2fsck -f hello-rootfs.ext4
113+
/sbin/resize2fs hello-rootfs.ext4
119114
sudo mount hello-rootfs.ext4 /tmp/mnt
120115
sudo cp $(which runc) firecracker-containerd/agent/agent /tmp/mnt/usr/local/bin
121116
sudo cp fc-agent.start /tmp/mnt/etc/local.d
@@ -156,14 +151,17 @@ sudo tee -a /etc/containerd/firecracker-runtime.json <<EOF
156151
"metrics_fifo": "/tmp/fc-metrics.fifo"
157152
}
158153
EOF
154+
155+
# Enable vhost-vsock
156+
sudo modprobe vhost-vsock
159157
```
160158

161159
4. Open a new terminal and start the `naive_snapshotter` program in the
162160
foreground
163161

164162
```bash
165163
sudo mkdir -p /var/run/firecracker-containerd /var/lib/firecracker-containerd/naive
166-
sudo /usr/local/bin/naive_snapshotter \
164+
sudo naive_snapshotter \
167165
-address /var/run/firecracker-containerd/naive-snapshotter.sock \
168166
-path /var/lib/firecracker-containerd/naive \
169167
-debug
@@ -172,16 +170,16 @@ sudo /usr/local/bin/naive_snapshotter \
172170
5. Open a new terminal and start `containerd` in the foreground
173171

174172
```bash
175-
sudo PATH=$PATH /usr/local/bin/containerd
173+
sudo containerd
176174
```
177175

178176
6. Open a new terminal, pull an image, and run a container!
179177

180178
```bash
181-
sudo /usr/local/bin/ctr image pull \
179+
sudo ctr image pull \
182180
--snapshotter firecracker-naive \
183181
docker.io/library/debian:latest
184-
sudo /usr/local/bin/ctr run \
182+
sudo ctr run \
185183
--snapshotter firecracker-naive \
186184
--runtime aws.firecracker \
187185
--tty \

0 commit comments

Comments
 (0)