Skip to content

Commit 52f82ac

Browse files
committed
btrfs: depend on kernel UAPI instead of libbtrfs
See containerd/btrfs PR 40 and moby/moby PR 44761. (Thanks to [@]neersighted.) The containerd/btrfs library now requires headers from kernel 4.12 or newer: - https://github.com/torvalds/linux/blob/master/include/uapi/linux/btrfs.h - https://github.com/torvalds/linux/blob/master/include/uapi/linux/btrfs_tree.h These files are licensed under the GPL-2.0 WITH Linux-syscall-note, so it should be compatible with the Apache License 2.0. https://spdx.org/licenses/Linux-syscall-note.html The dependency on the kernel headers only affects users building from source. Users on older kernels may opt to not compile this library (`BUILDTAGS=no_btfs`), or to provide headers from a newer kernel. Signed-off-by: Akihiro Suda <[email protected]>
1 parent 26509fa commit 52f82ac

102 files changed

Lines changed: 2574 additions & 170 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ jobs:
3434
os: [ubuntu-20.04, macos-12, windows-2019]
3535

3636
steps:
37-
- name: Install dependencies
38-
if: matrix.os == 'ubuntu-20.04'
39-
run: |
40-
sudo apt-get update
41-
sudo apt-get install -y libbtrfs-dev
42-
4337
- uses: actions/setup-go@v3
4438
with:
4539
go-version: ${{ env.GO_VERSION }}
@@ -165,7 +159,7 @@ jobs:
165159
- run: |
166160
set -e -x
167161
168-
packages="libbtrfs-dev"
162+
packages=""
169163
platform="${{matrix.goos}}/${{matrix.goarch}}"
170164
if [ -n "${{matrix.goarm}}" ]; then
171165
platform+="/v${{matrix.goarm}}"
@@ -214,12 +208,6 @@ jobs:
214208
os: [ubuntu-20.04, macos-12, windows-2019, windows-2022]
215209
go-version: ["1.19.5", "1.18.10"]
216210
steps:
217-
- name: Install dependencies
218-
if: matrix.os == 'ubuntu-20.04'
219-
run: |
220-
sudo apt-get update
221-
sudo apt-get install -y libbtrfs-dev
222-
223211
- uses: actions/setup-go@v3
224212
with:
225213
go-version: ${{ matrix.go-version }}
@@ -437,7 +425,7 @@ jobs:
437425
RUNC_FLAVOR: ${{ matrix.runc }}
438426
run: |
439427
sudo apt-get update
440-
sudo apt-get install -y gperf libbtrfs-dev
428+
sudo apt-get install -y gperf
441429
script/setup/install-seccomp
442430
script/setup/install-runc
443431
script/setup/install-cni $(grep containernetworking/plugins go.mod | awk '{print $2}')

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
# languages: go, javascript, csharp, python, cpp, java
4444

4545
- run: |
46-
sudo apt-get install -y libseccomp-dev libbtrfs-dev
46+
sudo apt-get install -y libseccomp-dev
4747
make
4848
4949
- name: Perform CodeQL Analysis

.github/workflows/nightly.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,7 @@ jobs:
6262
libseccomp-dev:arm64 \
6363
libseccomp-dev:s390x \
6464
libseccomp-dev:ppc64el \
65-
libseccomp-dev:riscv64 \
66-
libbtrfs-dev:amd64 \
67-
libbtrfs-dev:arm64 \
68-
libbtrfs-dev:s390x \
69-
libbtrfs-dev:ppc64el \
70-
libbtrfs-dev:riscv64
65+
libseccomp-dev:riscv64
7166
7267
- name: Build amd64
7368
env:

.github/workflows/release/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ RUN apt-get update && \
2828
apt-get install -y dpkg-dev git make pkg-config
2929
ARG TARGETPLATFORM
3030
RUN xx-apt-get install -y libseccomp-dev btrfs-progs gcc
31-
RUN if grep -qE 'UBUNTU_CODENAME=(focal|jammy)' /etc/os-release; then xx-apt-get install -y libbtrfs-dev; fi
3231
ENV PATH=/usr/local/go/bin:$PATH
3332
ENV GOPATH=/go
3433
ENV CGO_ENABLED=1

BUILDING.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ wget -c https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/pr
3737
sudo unzip protoc-3.11.4-linux-x86_64.zip -d /usr/local
3838
```
3939

40-
`containerd` uses [Btrfs](https://en.wikipedia.org/wiki/Btrfs) it means that you
41-
need to satisfy these dependencies in your system:
40+
To enable optional [Btrfs](https://en.wikipedia.org/wiki/Btrfs) snapshotter, you should have the headers from the Linux kernel 4.12 or later.
41+
The dependency on the kernel headers only affects users building containerd from source.
42+
Users on older kernels may opt to not compile the btrfs support (see `BUILDTAGS=no_btrfs` below),
43+
or to provide headers from a newer kernel.
4244

43-
* CentOS 7 / Fedora: `yum install btrfs-progs-devel`
44-
* Note with CentOS 9: [Btrfs has been deprecated](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/ch-btrfs) in RHEL / CentOS 7.4, and removed in RHEL/CentOS 9 .
45-
Please see the [release notes](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.4_release_notes/chap-red_hat_enterprise_linux-7.4_release_notes-deprecated_functionality_in_rhel7#idm139789147351408) for additional information on deprecated features.
46-
* Debian/Ubuntu: `apt-get install btrfs-progs libbtrfs-dev`
47-
* Debian(before Buster)/Ubuntu(before 19.10): `apt-get install btrfs-tools`
48-
* For unsupported [Btrfs](https://en.wikipedia.org/wiki/Btrfs) system:
49-
* Use the `no_btrfs` build tag to build without btrfs support.
45+
> **Note**
46+
> The dependency on the Linux kernel headers 4.12 was introduced in containerd 1.7.0-beta.4.
47+
>
48+
> containerd 1.6 has different set of dependencies for enabling btrfs.
49+
> containerd 1.6 users should refer to https://github.com/containerd/containerd/blob/release/1.6/BUILDING.md#build-the-development-environment
5050
5151
At this point you are ready to build `containerd` yourself!
5252

@@ -145,9 +145,6 @@ You can build an image from this `Dockerfile`:
145145

146146
```dockerfile
147147
FROM golang
148-
149-
RUN apt-get update && \
150-
apt-get install -y libbtrfs-dev
151148
```
152149

153150
Let's suppose that you built an image called `containerd/build`. From the
@@ -184,7 +181,7 @@ We can build an image from this `Dockerfile`:
184181
FROM golang
185182

186183
RUN apt-get update && \
187-
apt-get install -y libbtrfs-dev libseccomp-dev
184+
apt-get install -y libseccomp-dev
188185
```
189186

190187
In our Docker container we will build `runc` build, which includes

contrib/Dockerfile.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ RUN ./install-runc
4949

5050
FROM golang AS build-env
5151
RUN apt-get update && apt-get install -y --no-install-recommends \
52-
libbtrfs-dev \
5352
btrfs-progs \
5453
libseccomp-dev \
5554
xfsprogs \

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/Microsoft/hcsshim v0.10.0-rc.5
1010
github.com/container-orchestrated-devices/container-device-interface v0.5.1
1111
github.com/containerd/aufs v1.0.0
12-
github.com/containerd/btrfs v1.0.0
12+
github.com/containerd/btrfs/v2 v2.0.0
1313
github.com/containerd/cgroups/v3 v3.0.0
1414
github.com/containerd/console v1.0.3
1515
github.com/containerd/continuity v0.3.0
@@ -68,7 +68,7 @@ require (
6868
go.opentelemetry.io/otel/sdk v1.12.0
6969
go.opentelemetry.io/otel/trace v1.12.0
7070
golang.org/x/sync v0.1.0
71-
golang.org/x/sys v0.4.0
71+
golang.org/x/sys v0.5.0
7272
google.golang.org/genproto v0.0.0-20230131230820-1c016267d619
7373
google.golang.org/grpc v1.52.3
7474
google.golang.org/protobuf v1.28.1

go.sum

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,9 @@ github.com/containerd/aufs v1.0.0 h1:2oeJiwX5HstO7shSrPZjrohJZLzK36wvpdmzDRkL/LY
185185
github.com/containerd/aufs v1.0.0/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU=
186186
github.com/containerd/btrfs v0.0.0-20201111183144-404b9149801e/go.mod h1:jg2QkJcsabfHugurUvvPhS3E08Oxiuh5W/g1ybB4e0E=
187187
github.com/containerd/btrfs v0.0.0-20210316141732-918d888fb676/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss=
188-
github.com/containerd/btrfs v1.0.0 h1:osn1exbzdub9L5SouXO5swW4ea/xVdJZ3wokxN5GrnA=
189188
github.com/containerd/btrfs v1.0.0/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss=
189+
github.com/containerd/btrfs/v2 v2.0.0 h1:FN4wsx7KQrYoLXN7uLP0vBV4oVWHOIKDRQ1G2Z0oL5M=
190+
github.com/containerd/btrfs/v2 v2.0.0/go.mod h1:swkD/7j9HApWpzl8OHfrHNxppPd9l44DFZdF94BUj9k=
190191
github.com/containerd/cgroups v0.0.0-20190717030353-c4b9ac5c7601/go.mod h1:X9rLEHIqSf/wfK8NsPqxJmeZgW4pcfzdXITDrUSJ6uI=
191192
github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko=
192193
github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59/go.mod h1:pA0z1pT8KYB3TCXK/ocprsh7MAkoW8bZVzPdih9snmM=
@@ -1290,8 +1291,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
12901291
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12911292
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12921293
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1293-
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
1294-
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1294+
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
1295+
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12951296
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
12961297
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
12971298
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=

integration/client/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/stretchr/testify v1.8.1
1919
go.opentelemetry.io/otel v1.12.0
2020
go.opentelemetry.io/otel/sdk v1.12.0
21-
golang.org/x/sys v0.4.0
21+
golang.org/x/sys v0.5.0
2222
)
2323

2424
require (

integration/client/go.sum

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoC
495495
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
496496
github.com/container-orchestrated-devices/container-device-interface v0.5.1/go.mod h1:ZToWfSyUH5l9Rk7/bjkUUkNLz4b1mE+CVUVafuikDPY=
497497
github.com/containerd/aufs v1.0.0/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU=
498-
github.com/containerd/btrfs v1.0.0/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss=
498+
github.com/containerd/btrfs/v2 v2.0.0/go.mod h1:swkD/7j9HApWpzl8OHfrHNxppPd9l44DFZdF94BUj9k=
499499
github.com/containerd/cgroups v0.0.0-20200824123100-0b889c03f102/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo=
500500
github.com/containerd/cgroups v1.0.1/go.mod h1:0SJrPIenamHDcZhEcJMNBB85rHcUsw4f25ZfBiPYRkU=
501501
github.com/containerd/cgroups v1.0.3/go.mod h1:/ofk34relqNjSGyqPrmEULrO4Sc8LJhvJmWbUCUKqj8=
@@ -1537,8 +1537,9 @@ golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBc
15371537
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
15381538
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
15391539
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1540-
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
15411540
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1541+
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
1542+
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
15421543
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
15431544
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
15441545
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=

0 commit comments

Comments
 (0)