# Ptrace doesn't work in Docker in Xenial and Bionic

**URL:** https://travis-ci.community/t/ptrace-doesnt-work-in-docker-in-xenial-and-bionic/5953
**Category:** Linux
**Tags:** build-env
**Created:** [November 15, 2019, 3:12am UTC](https://travis-ci.community/t/ptrace-doesnt-work-in-docker-in-xenial-and-bionic/5953 "2019-11-15T03:12:34Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![XVilka](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/xvilka/32/1115_2.png) [@XVilka](https://travis-ci.community/u/XVilka)
#### Post date: [November 15, 2019, 3:12am UTC](https://travis-ci.community/t/ptrace-doesnt-work-in-docker-in-xenial-and-bionic/5953/1 "2019-11-15T03:12:34Z")

</div>

We can’t migrate from Trusty to Xenial or Bionic because our (radare2 disassembler and debugger) tests require running debugging tests (to test debugging features obviously) that often require PTRACE. Older environments (Trusty) allowed this. But switching to anything newer doesn’t work, neither with `sudo: required` nor with `sudo: true`. Any recommendations how to enable them?

See [https://github.com/radareorg/radare2/pull/15460](https://github.com/radareorg/radare2/pull/15460) and [resulting travis.yml](https://github.com/radareorg/radare2/blob/3039a6949bb0863693d8eff24d1f9ed245fbe19e/.travis.yml)

The example log of the failing debugging test is here: [https://travis-ci.com/radareorg/radare2/jobs/256842198#L1956](https://travis-ci.com/radareorg/radare2/jobs/256842198#L1956)

---

<div class="post-metadata">

### Author: ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)
#### Post date: [November 16, 2019, 5:09pm UTC](https://travis-ci.community/t/ptrace-doesnt-work-in-docker-in-xenial-and-bionic/5953/2 "2019-11-16T17:09:56Z")

</div>

> [@Setsockopt behaves strangely, process\_vm\_readv and ptrace don't work in Docker](https://travis-ci.community/t/setsockopt-behaves-strangely-process-vm-readv-and-ptrace-dont-work-in-docker/5075):
>
> Nix’s Linux builds ([https://www.github.com/nix-rust/nix](https://www.github.com/nix-rust/nix)) have recently begun failing. The last successful build finished on Sep 5, 2019 19:42:37 and the first failing build finished on Sep 6, 2019 4:41:11 (I don’t know what timezone; I can’t find it in Travis’s logs). We’re seeing the exact same failures in both the Trusty and Bionic images. The failures are: Calling setsockopt on an AF\_ALG socket returns ENOPROTOOPT Calling setsockopt on an AF\_INET socket to set TCP\_CONGESTION returns ENO…

Long story short, in Trusty, Docker’s default seccomp profile is not enabled as it should – that’s why it happens to work. In later distributions where that’s fixed, you need to explicitly give the container any additional privileges that it requires.

---

<div class="post-metadata">

### Author: ![asomers](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/asomers/32/4503_2.png) [@asomers](https://travis-ci.community/u/asomers)
#### Post date: [November 16, 2019, 6:01pm UTC](https://travis-ci.community/t/ptrace-doesnt-work-in-docker-in-xenial-and-bionic/5953/3 "2019-11-16T18:01:30Z")

</div>

Thanks for the tip. Do you know what those privileges are, and how to assign them?

---

<div class="post-metadata">

### Author: ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)
#### Post date: [November 16, 2019, 7:38pm UTC](https://travis-ci.community/t/ptrace-doesnt-work-in-docker-in-xenial-and-bionic/5953/4 "2019-11-16T19:38:25Z")

</div>

> **[Seccomp security profiles for Docker](https://docs.docker.com/engine/security/seccomp/)**
>
> Secure computing mode (seccomp) is a Linux kernel feature. You can use it to restrict the actions available within the container. The seccomp() system call operates on the seccomp state...

---

<div class="post-metadata">

### Author: ![XVilka](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/xvilka/32/1115_2.png) [@XVilka](https://travis-ci.community/u/XVilka)
#### Post date: [November 18, 2019, 4:01am UTC](https://travis-ci.community/t/ptrace-doesnt-work-in-docker-in-xenial-and-bionic/5953/5 "2019-11-18T04:01:03Z")

</div>

OK, but how to unblock the ptrace in the .travis.yml? I found no mention of it anywere.

---

<div class="post-metadata">

### Author: ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)
#### Post date: [November 18, 2019, 11:33am UTC](https://travis-ci.community/t/ptrace-doesnt-work-in-docker-in-xenial-and-bionic/5953/6 "2019-11-18T11:33:30Z")

</div>

> **[| Docker Documentation](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities)**
>
> Docker run reference Docker runs processes in isolated containers. A container is a process which runs on a host. The host may be local or remote. When an operator executes...

---

<div class="post-metadata">

### Author: ![asomers](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/asomers/32/4503_2.png) [@asomers](https://travis-ci.community/u/asomers)
#### Post date: [May 2, 2020, 8:22pm UTC](https://travis-ci.community/t/ptrace-doesnt-work-in-docker-in-xenial-and-bionic/5953/7 "2020-05-02T20:22:21Z")

</div>

This is still an issue, and @native-api’s answer doesn’t resolve it. The question is, how can we disable Seccomp for Travis builds?

---

<div class="post-metadata">

### Author: ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)
#### Post date: [May 2, 2020, 9:10pm UTC](https://travis-ci.community/t/ptrace-doesnt-work-in-docker-in-xenial-and-bionic/5953/8 "2020-05-02T21:10:09Z")

</div>

> **[Seccomp security profiles for Docker](https://docs.docker.com/engine/security/seccomp/#run-without-the-default-seccomp-profile)**
>
> Secure computing mode (seccomp) is a Linux kernel feature. You can use it to restrict the actions available within the container. The seccomp() system call operates on the seccomp state...

---

<div class="post-metadata">

### Author: ![asomers](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/asomers/32/4503_2.png) [@asomers](https://travis-ci.community/u/asomers)
#### Post date: [May 2, 2020, 9:12pm UTC](https://travis-ci.community/t/ptrace-doesnt-work-in-docker-in-xenial-and-bionic/5953/9 "2020-05-02T21:12:20Z")

</div>

As @XVilka said, that’s not an answer. The Travis-using community needs an answer specific to Travis, not to Docker in general.

---

<div class="post-metadata">

### Author: ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)
#### Post date: [May 3, 2020, 9:28am UTC](https://travis-ci.community/t/ptrace-doesnt-work-in-docker-in-xenial-and-bionic/5953/10 "2020-05-03T09:28:36Z")

</div>

Travis has a stock Docker installed (I don’t know from which package in particular but that can be checked), so any “answer specific to Docker in general” should apply.  
Unless you can somehow show that it doesn’t and the problem is at Travis side rather than with your project, the argument is over nothing.
