Ubuntu 21.04 image problems with `test -x` and `which`

Bug #1928218 reported by Georges Racinet (Octobus)
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-images
Expired
Undecided
Unassigned

Bug Description

Hi, I'm seeing strange behavior with the `ubuntu:21.04` as taken from docker.io.

Would not bet it is a problem with the image itself. In any case, help or pointers would be appreciated.

Here's the image:

    $ sudo docker pull ubuntu:21.04
    21.04: Pulling from library/ubuntu
    Digest: sha256:be154cc2b1211a9f98f4d708f4266650c9129784d0485d4507d9b0fa05d928b6
    Status: Image is up to date for ubuntu:21.04

bash seems to be the default command

    root@3a2a5ccc0c52:/# ps $$
       PID TTY STAT TIME COMMAND
         1 pts/0 Ss 0:00 /bin/bash

yet `test` doesn't find it to be executable:

    root@25d25a15e719:/# test -e /bin/bash && echo ok || echo fail
    ok
    root@3a2a5ccc0c52:/# test -x /bin/bash && echo ok || echo fail
    fail

Trying to rule out problems due to symlinks:

    root@3a2a5ccc0c52:/# test -x /usr/bin/bash && echo ok || echo fail
    fail

But that seems to be an issue with the shell builtin only:

    root@25d25a15e719:/# /bin/test -x /bin/bash && echo ok || echo fail
    ok

Even `which` also behaves strangely:

    root@41c4627ba642:/# which bash
    root@41c4627ba642:/#

apt fails because it doesn't find gpg (although it is installed):

    root@25d25a15e719:/# apt update
    Get:1 http://archive.ubuntu.com/ubuntu hirsute InRelease [269 kB]
    Get:2 http://security.ubuntu.com/ubuntu hirsute-security InRelease [101 kB]
    Get:3 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease [109 kB]
    Get:4 http://archive.ubuntu.com/ubuntu hirsute-backports InRelease [90.7 kB]
    Err:1 http://archive.ubuntu.com/ubuntu hirsute InRelease
       gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
    Err:2 http://security.ubuntu.com/ubuntu hirsute-security InRelease
      gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
    Err:3 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease
      gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
    Err:4 http://archive.ubuntu.com/ubuntu hirsute-backports InRelease
      gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
    Reading package lists... Done
    W: GPG error: http://archive.ubuntu.com/ubuntu hirsute InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
    E: The repository 'http://archive.ubuntu.com/ubuntu hirsute InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: GPG error: http://security.ubuntu.com/ubuntu hirsute-security InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
    E: The repository 'http://security.ubuntu.com/ubuntu hirsute-security InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: GPG error: http://archive.ubuntu.com/ubuntu hirsute-updates InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
    E: The repository 'http://archive.ubuntu.com/ubuntu hirsute-updates InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: GPG error: http://archive.ubuntu.com/ubuntu hirsute-backports InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
    E: The repository 'http://archive.ubuntu.com/ubuntu hirsute-backports InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.

No such behavior occurs on the same host with the 20.04 or 20.10 images.

Could it be a Docker version problem? The host is a Debian 10 with Debian's Docker version:

    $ apt policy docker.io
    docker.io:
      Installed: 18.09.1+dfsg1-7.1+deb10u3
      Candidate: 18.09.1+dfsg1-7.1+deb10u3
      Version table:
     *** 18.09.1+dfsg1-7.1+deb10u3 500
            500 http://security.debian.org/debian-security buster/updates/main amd64 Packages
            100 /var/lib/dpkg/status
         18.09.1+dfsg1-7.1+deb10u2 500
            500 http://mirrors.online.net/debian buster/main amd64 Packages

    $ sudo docker version
    Client:
     Version: 18.09.1
     API version: 1.39
     Go version: go1.11.6
     Git commit: 4c52b90
     Built: Sun, 21 Feb 2021 18:18:35 +0100
     OS/Arch: linux/amd64
     Experimental: false

    Server:
     Engine:
      Version: 18.09.1
      API version: 1.39 (minimum version 1.12)
      Go version: go1.11.6
      Git commit: 4c52b90
      Built: Sun Jun 14 20:12:29 2020
      OS/Arch: linux/amd64
      Experimental: false

Tags: docker
Revision history for this message
Joshua Powers (powersj) wrote :

Hi,

What command are you using to create the container?

I took a look and was unable to run across those same issues as you. It looks like I was even using the same version of the docker image as you:

❯ docker --version
Docker version 20.10.2, build 20.10.2-0ubuntu2
~
❯ docker pull ubuntu:21.04
21.04: Pulling from library/ubuntu
c830499a6a92: Pull complete
b38f134463e2: Pull complete
2fd6a415fd8e: Pull complete
Digest: sha256:be154cc2b1211a9f98f4d708f4266650c9129784d0485d4507d9b0fa05d928b6
Status: Downloaded newer image for ubuntu:21.04
docker.io/library/ubuntu:21.04
~ took 6s
❯ docker run --rm -it ubuntu:21.04
root@57adb6029615:/# echo $SHELL
/bin/bash
root@57adb6029615:/# ls -l /bin/bash
-rwxr-xr-x 1 root root 1404744 Mar 19 16:02 /bin/bash
root@57adb6029615:/# test -e /bin/bash && echo ok || echo fail
ok
root@57adb6029615:/# test -x /bin/bash && echo ok || echo fail
ok
root@57adb6029615:/# which bash
/usr/bin/bash
root@57adb6029615:/# apt update
Get:1 http://security.ubuntu.com/ubuntu hirsute-security InRelease [101 kB]
Get:2 http://archive.ubuntu.com/ubuntu hirsute InRelease [269 kB]
Get:3 http://security.ubuntu.com/ubuntu hirsute-security/restricted amd64 Packages [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease [109 kB]
Get:5 http://security.ubuntu.com/ubuntu hirsute-security/main amd64 Packages [97.5 kB]
Get:6 http://security.ubuntu.com/ubuntu hirsute-security/multiverse amd64 Packages [1725 B]
Get:7 http://security.ubuntu.com/ubuntu hirsute-security/universe amd64 Packages [208 kB]
Get:8 http://archive.ubuntu.com/ubuntu hirsute-backports InRelease [90.7 kB]
Get:9 http://archive.ubuntu.com/ubuntu hirsute/restricted amd64 Packages [111 kB]
Get:10 http://archive.ubuntu.com/ubuntu hirsute/main amd64 Packages [1791 kB]
Get:11 http://archive.ubuntu.com/ubuntu hirsute/universe amd64 Packages [16.8 MB]
Get:12 http://archive.ubuntu.com/ubuntu hirsute/multiverse amd64 Packages [252 kB]
Get:13 http://archive.ubuntu.com/ubuntu hirsute-updates/main amd64 Packages [117 kB]
Get:14 http://archive.ubuntu.com/ubuntu hirsute-updates/multiverse amd64 Packages [1725 B]
Get:15 http://archive.ubuntu.com/ubuntu hirsute-updates/universe amd64 Packages [220 kB]
Get:16 http://archive.ubuntu.com/ubuntu hirsute-updates/restricted amd64 Packages [114 kB]
Fetched 20.4 MB in 4s (4960 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@57adb6029615:/# exit
exit

Marking incomplete for now until we have more steps to reproduce. Thanks!

Changed in cloud-images:
status: New → Incomplete
Revision history for this message
Georges Racinet (Octobus) (gracinet-octobus) wrote :

Hi, thanks for the quick reply.

I see I skipped the copy-paste of the docker command. It's a plain simple

  sudo docker run --rm -it ubuntu:21.04

There's nothing surprising in configuration either:

  cat /etc/docker/daemon.json
  {
    "data-root": "/srv/docker"
  }

and /srv is a basic ext4 partition by the way.

I'll experiment with different versions of the container engine, as it really looks like a low level mismatch to me.

Revision history for this message
Georges Racinet (Octobus) (gracinet-octobus) wrote :

It seems that upgrading to Docker 20.10 fixes the problem. I suppose the most that has to be done is perhaps just point it out somewhere (and I might well have missed a message myself).

Tested with Docker packaged in Debian 11:

$ apt policy docker.io
docker.io:
  Installed: 20.10.5+dfsg1-1+b1
  Candidate: 20.10.5+dfsg1-1+b1
  Version table:
 *** 20.10.5+dfsg1-1+b1 500
        500 http://ftp.fr.debian.org/debian bullseye/main amd64 Packages
        100 /var/lib/dpkg/status

or the one from download.docker.com for Debian 10:

$ cat /etc/debian_version
10.9
$ uname -vr
4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19)
$ apt policy docker-ce | head
docker-ce:
  Installed: 5:20.10.6~3-0~debian-buster
  Candidate: 5:20.10.6~3-0~debian-buster
  Version table:
 *** 5:20.10.6~3-0~debian-buster 500
        500 https://download.docker.com/linux/debian buster/stable amd64 Packages
        100 /var/lib/dpkg/status
     5:20.10.5~3-0~debian-buster 500
        500 https://download.docker.com/linux/debian buster/stable amd64 Packages
     5:20.10.4~3-0~debian-buster 500

(that latter host is running btrfs)

Finally, it worked also for me on a Ubuntu 20.04 VM I had around, again with the docker.com package.

$ cat /etc/issue
Ubuntu 20.04.2 LTS \n \l
$ uname -vr
5.4.0-72-generic #80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021
$ apt policy docker-ce | head
docker-ce:
  Installed: 5:20.10.6~3-0~ubuntu-focal
  Candidate: 5:20.10.6~3-0~ubuntu-focal
  Version table:
 *** 5:20.10.6~3-0~ubuntu-focal 500
        500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
        100 /var/lib/dpkg/status
     5:20.10.5~3-0~ubuntu-focal 500
        500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
     5:20.10.4~3-0~ubuntu-focal 500

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for cloud-images because there has been no activity for 60 days.]

Changed in cloud-images:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.