Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Ubuntu LTS and latest non-LTS images #483

Merged
merged 1 commit into from
Jun 8, 2023

Conversation

Jmennius
Copy link
Collaborator

@Jmennius Jmennius commented Jun 27, 2020

This adds Ubuntu 16.04, 18.04, 20.04, 21.10 and 22.04 images that play well with toolbox:
password-less sudo, able to resolve its own hostname (so that sudo does not complain), SELinux is masked off, etc.
Since 18.04 Ubuntu images on the Docker Hub are 'minimized', so we have to undo that.
Pushed images to https://hub.docker.com/r/jmennius/ubuntu-toolbox for the time being.

Users may want to generate their locale after toolbox creation with sudo sed -i "/${LANG}/s/^# //g" /etc/locale.gen && sudo locale-gen (assuming that you have LANG set) to avoid perl and others complain about it.

I've been using an 18.04 image for several months 1.5yrs now with great success.

Some things I'd like to resolve or discuss at least (need help/guidance/decisionmaking/PRs):

I'd be grateful for any testing and feedback on their use-case and environment.

Alternative-to: #298

@softwarefactory-project-zuul
Copy link

Build failed.

@Jmennius
Copy link
Collaborator Author

Jmennius commented Jul 7, 2020

I'd really appreciate some feedback ;) @debarshiray ?

@HarryMichal
Copy link
Member

I'd really appreciate some feedback ;) @debarshiray ?

I'd love to give this a spin but I'm currently working on something else.. :(

@HarryMichal HarryMichal added the 2. Images Images for creating toolbox containers label Jul 8, 2020
@Jmennius
Copy link
Collaborator Author

Jmennius commented Jul 8, 2020

@HarryMichal no problem :)

What do you think about sharing extra-packages and READMEs? Any nice way to do it?
Maybe we can drop READMEs from images themselves?

@HarryMichal
Copy link
Member

In my opinion, sharing of those files mainly depends on the way the images will be built. fedora-toolbox images are built in Fedora's build system and their definitions are maintained there (meaning the definitions in this repository could be called a mirror - or is it the other way @debarshiray?). If the container definitions are tracked in a got repository where every version is in a separate branch than it's not really possible to share. If they are in a single branch but separated in their own directories, than a single file shared by all definitions could be placed in the root directory. But that approach may be dangerous a bit if the package is renamed in some of those version (though in some cases very unlikely).

I myself never worked with Docker Hub and other tools so I can't really help much with this.

Dropping READMEs seems okay-ish to me. But on the other hand having some kind of file that holds some info about the image/tool is nice. Maybe some specialized file that will be defined once, will be shorter than the project's README that will not require to be updated with every tweak to the project's README?

@mfocko
Copy link

mfocko commented Feb 7, 2021

used the Dockerfile for 20.10, seems to be running OK 👍

@mtalexan
Copy link

Probably out-of-scope for the intended changes here, but support for ubuntu as a distribution under the (-d|--distribution) and the related releases under the (-r|--release) options would require updating the src/pkg/utils/utils.go supportedDistros map to add a Distro structure (and the related functions to fill it) for an ubuntu key. Otherwise the results of these builds are limited to use of the --image option.

@Jmennius Jmennius force-pushed the introduce-ubuntu-lts-images branch from cd5eacc to 475a1dd Compare March 21, 2021 17:56
@Jmennius
Copy link
Collaborator Author

cc @debarshiray

@softwarefactory-project-zuul
Copy link

Build succeeded.

@Jmennius
Copy link
Collaborator Author

I now get WARNING: libcap needs an update (cap=40 should have a name). when entering a 20.04 toolbox.
This is likely because I am using Linux 5.10 (Fedora 33) but Ubuntu 20.04 userspace ships with libcap2 2.32 which is not aware of CAP_CHECKPOINT_RESTORE (40).
Everyhting works fine though.

Base automatically changed from master to main March 25, 2021 22:25
@runfalk
Copy link

runfalk commented May 19, 2021

I too would really like to see Ubuntu support being included one way or another. My use case is doing firmware development on Fedora when the rest of the team uses Ubuntu. They have set up install scripts and debs for installing the all the required cross compilation targets.

I tried the image in this project using:

$ toolbox create --image registry.hub.docker.com/jmennius/ubuntu-toolbox:20.04 firmaredev

The /README.md talks about using systemctl for managing services, but it doesn't seem like systemd is actually running in the container:

$ systemctl
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

This seems to be documented in another issue as well: #176.

Other than some dbus errors (probably because systemd isn't running) and the libpcap error I don't see any other problems with these containers. I tried both 20.04 and 18.04.

I shouldn't hijack this MR, but is there a way of running services like SSH in the container?

@Jmennius
Copy link
Collaborator Author

Guys, any updates or feedback?

@Jmennius
Copy link
Collaborator Author

Probably out-of-scope for the intended changes here, but support for ubuntu as a distribution under the (-d|--distribution) and the related releases under the (-r|--release) options would require updating the src/pkg/utils/utils.go supportedDistros map to add a Distro structure (and the related functions to fill it) for an ubuntu key. Otherwise the results of these builds are limited to use of the --image option.

I've implemented this when I ported it to Go (back in April).

@Jmennius
Copy link
Collaborator Author

The /README.md talks about using systemctl for managing services, but it doesn't seem like systemd is actually running in the container:

$ systemctl
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

This seems to be documented in another issue as well: #176.

Other than some dbus errors (probably because systemd isn't running) and the libpcap error I don't see any other problems with these containers. I tried both 20.04 and 18.04.

I shouldn't hijack this MR, but is there a way of running services like SSH in the container?

Well, I wouldn't expect any of this to really work, the README should probably be corrected.
I don't think that running sshd is feasible, but you can probably google that with regards to containers in general.

@dabrain34
Copy link

dabrain34 commented Oct 28, 2021

I gave a try to 16.04 and 18.04 and both are failing for the same reason as:

level=debug msg="Binding /tmp to /run/host/tmp"
mount: wrong fs type, bad option, bad superblock on /run/host/tmp,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
Error: failed to bind /tmp to /run/host/tmp

The 20.04 image from #878 is working fine.

I'm running podman and toolbox 0.0.99.3 on a Debian SID

@dabrain34
Copy link

dabrain34 commented Oct 28, 2021

mounting a tmpfs on /tmp made it work !

mount -o mode=1777,nosuid,nodev -t tmpfs tmpfs /tmp

@Jmennius
Copy link
Collaborator Author

Jmennius commented Oct 31, 2021

mounting a tmpfs on /tmp made it work !

mount -o mode=1777,nosuid,nodev -t tmpfs tmpfs /tmp

Interesting.. so you didn't have a tmpfs on /tmp on your host (Debian)?
If so - that probably deserves a separate issue to be fixed properly.

edit: I see you've opened #906

@dabrain34
Copy link

For now i havent investigated into toolbox code to see how I could propose a patch but the other problem I faced was that on the tip, the binary was not exectutable.

@Jmennius
Copy link
Collaborator Author

Few updates:

  • decided to also provide the image for the latest non-LTS release - 21.10 image
  • I've noticed a delay when using sudo in new images (and that has probably been there forever... no idea how I lived with it for over a year!?) - fixed by moving myhostname nsswitch entry to the proper place manually instead of trusting package postinst with it.
  • few updates to align with fedora image changes
  • rebuilt and pushed all images

@Jmennius Jmennius changed the title Introduce Ubuntu LTS images Introduce Ubuntu LTS and latest non-LTS images Nov 14, 2021
@softwarefactory-project-zuul
Copy link

Build succeeded.

@travier
Copy link
Member

travier commented May 22, 2023

OK, I have access to the toolbx org on Quay.io now.

@travier
Copy link
Member

travier commented May 22, 2023

I've set up the robot and permissions on Quay and added the token in the repo here.

@travier
Copy link
Member

travier commented May 22, 2023

Note that to clearly distinguish PR & commit workflows, I've used two distinct GitHub Action definition in the toolbx-images repo. This PR is missing the one for PRs (https://github.com/toolbx-images/images/blob/main/.github/workflows/ubuntu-pr.yaml) and thus it is not triggered here.

@debarshiray
Copy link
Member

I've set up the robot and permissions on Quay and added the token in
the repo here.

Thanks for doing that, @travier !

What are the next steps? Are we waiting for @Jmennius to update the GitHub Action in this pull request?

Note that to clearly distinguish PR & commit workflows, I've used
two distinct GitHub Action definition in the toolbx-images repo. This
PR is missing the one for PRs
(https://github.com/toolbx-images/images/blob/main/.github/workflows/ubuntu-pr.yaml)
and thus it is not triggered here.

I will let @Jmennius respond to this one.

@debarshiray
Copy link
Member

Ping, @travier @Jmennius : what's the next step here?

The most pressing issue right now for Ubuntu support is to get the ubuntu-toolbox images for 23.04 published.

@travier
Copy link
Member

travier commented Jun 8, 2023

The missing bits are in my review #483 (review). Then we should be able to merge this one.

debarshiray pushed a commit to Jmennius/toolbox that referenced this pull request Jun 8, 2023
Build and push when there are changes in the `images/ubuntu` directory
or in the GitHub workflow itself, as well as every other week (7th and
21st days of a month to be precise).

Until now, the Ubuntu images (versions 16.04, 18.04, 20.04, 22.04 and
22.10) were published at quay.io/toolbx-images/ubuntu-toolbox:22.04,
etc..  This changes the location to quay.io/toolbx/ubuntu-toolbox:22.04
and builds an image for Ubuntu 23.04 that was added recently [1].

Note that the changes to the toolbox(1) code and the system tests cannot
be tested until the first round of images are available from the new
location.

[1] Commit 3cfb6bf
    containers#1292

containers#483

Signed-off-by: Ievgen Popovych <[email protected]>
@debarshiray debarshiray force-pushed the introduce-ubuntu-lts-images branch from b58a774 to 8e912ee Compare June 8, 2023 12:49
Until now, the Ubuntu images (versions 16.04, 18.04, 20.04, 22.04 and
22.10) were published at quay.io/toolbx-images/ubuntu-toolbox:22.04,
etc..  This changes the location to quay.io/toolbx/ubuntu-toolbox:22.04
and builds an image for Ubuntu 23.04 that was added recently [1].

Build and push when there are changes in the `images/ubuntu` directory
or in the GitHub workflow itself, as well as every other week (7th and
21st days of a month to be precise).

The toolbox(1) code and the system tests will be switched to the new
location after the first round of images are available.

[1] Commit 3cfb6bf
    containers#1292

containers#483

Signed-off-by: Ievgen Popovych <[email protected]>
@debarshiray debarshiray force-pushed the introduce-ubuntu-lts-images branch from 8e912ee to 8dcd5d7 Compare June 8, 2023 12:54
@softwarefactory-project-zuul
Copy link

Build succeeded.
https://softwarefactory-project.io/zuul/t/local/buildset/074a7db07d22487f933b780c7317c0cb

✔️ unit-test SUCCESS in 8m 41s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 3m 24s
✔️ unit-test-restricted SUCCESS in 8m 30s
✔️ system-test-fedora-rawhide SUCCESS in 21m 35s
✔️ system-test-fedora-38 SUCCESS in 20m 51s
✔️ system-test-fedora-37 SUCCESS in 21m 25s
✔️ system-test-fedora-36 SUCCESS in 20m 55s

@debarshiray debarshiray merged commit 8dcd5d7 into containers:main Jun 8, 2023
@debarshiray
Copy link
Member

The missing bits are in my review #483 (review). Then we should be able to merge this one.

Okay! I took the liberty to make those changes and merged. I hope I got it right.

@debarshiray
Copy link
Member

I filed a pull request to switch the toolbox(1) code and the system tests to use the new location: #1306

debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 23, 2023
Now that Toolbx offers built-in support for Ubuntu containers [1], it
makes sense to test that it works well on Ubuntu hosts.  Ubuntu 22.04 is
the latest long term support (or LTS) release [2] from Ubuntu, and
GitHub provides runners for GitHub workflows [3].

Ubuntu 22.04 only has Bats 1.2.1 [4], while Toolbx requires 1.7.0 [5];
and Shadow 4.8 [6], while libsubid.so was introduced in Shadow 4.9 [7].
Hence, newer versions of these dependencies need to be built to run the
tests.

Note that a separate sub-directory inside $GITHUB_WORKSPACE [8] is used
for Toolbx itself to prevent codespell from getting triggered by
problems in the dependencies themselves [9].

[1] Commit a84a358
    containers#483
    containers#1284

[2] https://wiki.ubuntu.com/Releases

[3] https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners

[4] https://packages.ubuntu.com/jammy/bats

[5] Commit e22a82f
    containers#1273

[6] https://packages.ubuntu.com/source/jammy/shadow
    https://packages.ubuntu.com/source/jammy-updates/shadow

[7] Shadow commit 0a7888b1fad613a0
    shadow-maint/shadow@0a7888b1fad613a0
    shadow-maint/shadow#154

[8] https://docs.github.com/en/actions/learn-github-actions/variables

[9] bats-core/bats-core#743

containers#1319
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 23, 2023
Now that Toolbx offers built-in support for Ubuntu containers [1],
adding an Ubuntu host to the upstream CI will help ensure that Toolbx
continues to work well on Ubuntu.  Ubuntu 22.04 is the latest long term
support (or LTS) release [2] from Ubuntu, and GitHub provides runners
for GitHub workflows [3].

Ubuntu 22.04 only has Bats 1.2.1 [4], while Toolbx requires 1.7.0 [5];
and Shadow 4.8 [6], while libsubid.so was introduced in Shadow 4.9 [7].
Hence, newer versions of these dependencies need to be built to run the
tests.

Note that a separate sub-directory inside $GITHUB_WORKSPACE [8] is used
for Toolbx itself to prevent codespell from getting triggered by
problems in the dependencies themselves [9].

[1] Commit a84a358
    containers#483
    containers#1284

[2] https://wiki.ubuntu.com/Releases

[3] https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners

[4] https://packages.ubuntu.com/jammy/bats

[5] Commit e22a82f
    containers#1273

[6] https://packages.ubuntu.com/source/jammy/shadow
    https://packages.ubuntu.com/source/jammy-updates/shadow

[7] Shadow commit 0a7888b1fad613a0
    shadow-maint/shadow@0a7888b1fad613a0
    shadow-maint/shadow#154

[8] https://docs.github.com/en/actions/learn-github-actions/variables

[9] bats-core/bats-core#743

containers#1319
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 23, 2023
Now that Toolbx offers built-in support for Ubuntu containers [1],
adding an Ubuntu host to the upstream CI will help ensure that Toolbx
continues to work well on Ubuntu.  Ubuntu 22.04 is the latest long term
support (or LTS) release [2] from Ubuntu, and GitHub provides runners
for GitHub workflows [3].

Ubuntu 22.04 only has Bats 1.2.1 [4], while Toolbx requires 1.7.0 [5];
and Shadow 4.8 [6], while libsubid.so was introduced in Shadow 4.9 [7].
Hence, newer versions of these dependencies need to be built to run the
tests.

Note that a separate sub-directory inside $GITHUB_WORKSPACE [8] is used
for Toolbx itself to prevent codespell from getting triggered by
problems in the dependencies themselves [9].

[1] Commit a84a358
    containers#483
    containers#1284

[2] https://wiki.ubuntu.com/Releases

[3] https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners

[4] https://packages.ubuntu.com/jammy/bats

[5] Commit e22a82f
    containers#1273

[6] https://packages.ubuntu.com/source/jammy/shadow
    https://packages.ubuntu.com/source/jammy-updates/shadow

[7] Shadow commit 0a7888b1fad613a0
    shadow-maint/shadow@0a7888b1fad613a0
    shadow-maint/shadow#154

[8] https://docs.github.com/en/actions/learn-github-actions/variables

[9] bats-core/bats-core#743

containers#1319
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 27, 2023
Now that Toolbx offers built-in support for Ubuntu containers [1],
adding an Ubuntu host to the upstream CI will help ensure that Toolbx
continues to work well on Ubuntu.  Ubuntu 22.04 is the latest long term
support (or LTS) release [2] from Ubuntu, and GitHub provides runners
for GitHub workflows [3].

Ubuntu 22.04 only has Bats 1.2.1 [4], while Toolbx requires 1.7.0 [5];
and Shadow 4.8 [6], while libsubid.so was introduced in Shadow 4.9 [7].
Hence, newer versions of these dependencies need to be built to run the
tests.

Note that a separate sub-directory inside $GITHUB_WORKSPACE [8] is used
for Toolbx itself to prevent codespell from getting triggered by
problems in the dependencies themselves [9].

[1] Commit a84a358
    containers#483
    containers#1284

[2] https://wiki.ubuntu.com/Releases

[3] https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners

[4] https://packages.ubuntu.com/jammy/bats

[5] Commit e22a82f
    containers#1273

[6] https://packages.ubuntu.com/source/jammy/shadow
    https://packages.ubuntu.com/source/jammy-updates/shadow

[7] Shadow commit 0a7888b1fad613a0
    shadow-maint/shadow@0a7888b1fad613a0
    shadow-maint/shadow#154

[8] https://docs.github.com/en/actions/learn-github-actions/variables

[9] bats-core/bats-core#743

containers#1319
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 27, 2023
Now that Toolbx offers built-in support for Ubuntu containers [1],
adding an Ubuntu host to the upstream CI will help ensure that Toolbx
continues to work well on Ubuntu.  Ubuntu 22.04 is the latest long term
support (or LTS) release [2] from Ubuntu, and is the latest Ubuntu
version that GitHub provides runners for [3].

Ubuntu 22.04 only has Bats 1.2.1 [4], while Toolbx requires 1.7.0 [5];
and Shadow 4.8 [6], while Toolbx requires 4.9 because it needs
libsubid.so [7,8].  Hence, newer versions of these dependencies need to
be built to run the tests.  The build flags for Shadow were taken from
the Debian package [9].

A separate sub-directory inside $GITHUB_WORKSPACE [10] is used for
Toolbx itself to prevent codespell from getting triggered by spelling
mistakes in these dependencies themselves [11].

Unfortunately, the SHELL environment variable goes mysteriously missing
from the runtime environment of the GitHub Actions workflow [12].  This
breaks the 'create' and 'enter' commands, and therefore tests involving
them can't be run until this is resolved.  Meanwhile, running the CI on
Ubuntu with a subset of the tests, is still better than not running the
CI on Ubuntu at all.

[1] Commit a84a358
    containers#483
    containers#1284

[2] https://wiki.ubuntu.com/Releases

[3] https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners

[4] https://packages.ubuntu.com/jammy/bats

[5] Commit e22a82f
    containers#1273

[6] https://packages.ubuntu.com/source/jammy/shadow
    https://packages.ubuntu.com/source/jammy-updates/shadow

[7] Shadow commit 0a7888b1fad613a0
    shadow-maint/shadow@0a7888b1fad613a0
    shadow-maint/shadow#154

[8] Commit ca8007c
    containers#1074

[9] https://salsa.debian.org/debian/shadow/

[10] https://docs.github.com/en/actions/learn-github-actions/variables

[11] bats-core/bats-core#743

[12] https://github.com/orgs/community/discussions/59413

containers#1319
@Jmennius Jmennius deleted the introduce-ubuntu-lts-images branch December 10, 2023 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. Images Images for creating toolbox containers
Projects
None yet
Development

Successfully merging this pull request may close these issues.