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

Ensure systemd-resolved binary is available at runtime #115

Merged
merged 1 commit into from
Oct 24, 2022

Conversation

obbardc
Copy link
Member

@obbardc obbardc commented Oct 24, 2022

Debian Unstable (and Fedora) has split systemd-resovled into a separate package which enables systemd-resolved as the default name resolver at install-time. Because of this, we cannot simply depend on systemd-resolved in the distro packaging as this may cause the default name resolver to change to systemd-resolved for some users.

If the user does not have system-resolved installed, fakemachine will currently fails with any action which requires hostname resolution:

2022/09/19 10:49:09 ==== debootstrap ====
2022/09/19 10:49:09 Debootstrap | W: Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory)
2022/09/19 10:49:09 Debootstrap | W: Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory)
2022/09/19 10:49:09 Debootstrap | I: Target architecture can be executed
2022/09/19 10:49:09 Debootstrap | I: Retrieving InRelease
2022/09/19 10:49:09 Debootstrap | I: Retrieving Release
2022/09/19 10:49:09 Debootstrap | E: Failed getting release file http://deb.debian.org/debian/dists/stable/Release
2022/09/19 10:49:09 debootstrap.log | amd64: ok
2022/09/19 10:49:09 debootstrap.log | wget: unable to resolve host address 'deb.debian.org'
2022/09/19 10:49:09 debootstrap.log | wget: unable to resolve host address 'deb.debian.org'

Instead of forcing the user to install systemd-resolved, detect whether the user has the binary installed and bubble up an error earlier if the binary has not been found.

See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1020288
See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1020690

--
Requires go-debos/test-containers#14 to be merged first.

@obbardc obbardc added this to the v0.0.4 milestone Oct 24, 2022
@obbardc obbardc requested a review from sjoerdsimons October 24, 2022 10:29
@obbardc obbardc self-assigned this Oct 24, 2022
machine.go Outdated Show resolved Hide resolved
machine.go Outdated Show resolved Hide resolved
machine.go Outdated Show resolved Hide resolved
@obbardc obbardc force-pushed the wip/obbardc/detect-systemd-resolved branch from b82abb2 to 5aa9c08 Compare October 24, 2022 11:34
@obbardc obbardc requested a review from sjoerdsimons October 24, 2022 11:34
@obbardc obbardc force-pushed the wip/obbardc/detect-systemd-resolved branch from fb2de21 to 5aa9c08 Compare October 24, 2022 12:24
machine.go Outdated Show resolved Hide resolved
Debian Unstable (and Fedora) have split systemd-resovled into a separate
package which enables systemd-resolved as the default name resolver at
install-time. Because of this, we cannot simply depend on systemd-resolved
in the distro packaging as this may cause the default name resolver to
change to systemd-resolved for some users.

If the user does not have system-resolved installed, fakemachine will
currently fails with any action which requires hostname resolution:

    2022/09/19 10:49:09 ==== debootstrap ====
    2022/09/19 10:49:09 Debootstrap | W: Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory)
    2022/09/19 10:49:09 Debootstrap | W: Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory)
    2022/09/19 10:49:09 Debootstrap | I: Target architecture can be executed
    2022/09/19 10:49:09 Debootstrap | I: Retrieving InRelease
    2022/09/19 10:49:09 Debootstrap | I: Retrieving Release
    2022/09/19 10:49:09 Debootstrap | E: Failed getting release file http://deb.debian.org/debian/dists/stable/Release
    2022/09/19 10:49:09 debootstrap.log | amd64: ok
    2022/09/19 10:49:09 debootstrap.log | wget: unable to resolve host address 'deb.debian.org'
    2022/09/19 10:49:09 debootstrap.log | wget: unable to resolve host address 'deb.debian.org'

Instead of forcing the user to install systemd-resolved, detect whether
the user has the binary installed and bubble up an error earlier if the
binary has not been found.

See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1020288
See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1020690
Signed-off-by: Christopher Obbard <[email protected]>
@obbardc obbardc force-pushed the wip/obbardc/detect-systemd-resolved branch from 5aa9c08 to cfa6262 Compare October 24, 2022 12:30
@obbardc obbardc requested a review from sjoerdsimons October 24, 2022 12:30
@sjoerdsimons
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Oct 24, 2022

Build succeeded:

@bors bors bot merged commit 5cf1b88 into main Oct 24, 2022
@sjoerdsimons
Copy link
Member

Fwiw the debian bugs; the right solution ther eis to update the Debian package with the dependency, these changes are more relevant for installations from source

@bors bors bot deleted the wip/obbardc/detect-systemd-resolved branch October 24, 2022 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants