Can't resolve using custom nsswitch.conf items

Bug #1963864 reported by shemgp
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

The host /etc/nsswitch.conf is not being honored inside the snap container leading to .docker (or using my custom plugin .lxd) hosts not being resolved.

How to reproduce:
1. Run a docker host name 'test' with a http server in it.
2. Install libnss-docker.
3. ping test.docker and see that it works.
4. Open snap firefox.
5. Access http://test.docker and see that it doesn't resolve the IP properly, thus the site is not opened.

Another way to reproduce:
1. Create a lxd container named 'test' with a http server in it.
2. Download and install: https://launchpad.net/~shemgp/+archive/ubuntu/other-apps/+files/libnss-lxd_0.06-0ubuntu2~impish_amd64.deb
3. Ping test.lxd and see that it works.
4. Open snap firefox.
5. Access http://test.lxd and see that it doesn't resolve the IP properly, thus not being able to access the website.

I'm not sure how to be able to resolve this since the binary is in the host? Perhaps systemd-resolved's dnsmasq can be coaxed to use /etc/nsswitch.conf and the container's be coaxed to use the hosts :53 dns?

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: snapd 2.54.3+git26.g360067e+22.04
Uname: Linux 5.16.1-xanmod1 x86_64
ApportVersion: 2.20.11-0ubuntu78
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: ubuntu:GNOME
Date: Mon Mar 7 14:05:09 2022
EcryptfsInUse: Yes
InstallationDate: Installed on 2018-10-03 (1251 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
SourcePackage: snapd
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
shemgp (shemgp) wrote :
Revision history for this message
shemgp (shemgp) wrote :

The alternative way to make it work is to have /etc/resolv.conf point to a local dnsmasq instance that has: server=/lxd/10.45.148.1@lxdbr0 in it. Where 10.45.148.1 is where lxd's dnsmasq is listening too.

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in snapd (Ubuntu):
status: New → Confirmed
Revision history for this message
Fernando Carrillo Castro (fercc17) wrote :

We believe this bug is causing this other one https://bugs.launchpad.net/juju/+bug/2018546

Can we get an ETA of when this snapd bug can be solved?

Thanks

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.