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

Cached resolv.conf issue #1434

Closed
x-yuri opened this issue Feb 17, 2017 · 2 comments
Closed

Cached resolv.conf issue #1434

x-yuri opened this issue Feb 17, 2017 · 2 comments

Comments

@x-yuri
Copy link

x-yuri commented Feb 17, 2017

I'm running lxc containers on my notebook. I just moved to the other place, and I have a cache of CentOS 7 in /var/cache/lxc/centos/x86_64/7/rootfs lxc did before I moved. And there lies /etc/resolv.conf with wrong name servers. As a result, when I create a container, I get this:

# lxc-create -n centos -t centos -- -R 7
Host CPE ID from /etc/os-release:
Checking cache download in /var/cache/lxc/centos/x86_64/7/rootfs ...
Cache found. Updating...
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
12: Timeout on http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock: (28, 'Resolving timed out after 30544 milliseconds')


 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64
Failed to update 'CentOS base', continuing with last known good cache
Copy /var/cache/lxc/centos/x86_64/7/rootfs to /var/lib/lxc/centos/rootfs ...
Copying rootfs to /var/lib/lxc/centos/rootfs ...
sed: can't read /var/lib/lxc/centos/rootfs/etc/init/tty.conf: No such file or directory
Storing root password in '/var/lib/lxc/centos/tmp_root_pass'
Expiring password for user root.
passwd: Success
sed: can't read /var/lib/lxc/centos/rootfs/etc/rc.sysinit: No such file or directory
sed: can't read /var/lib/lxc/centos/rootfs/etc/rc.d/rc.sysinit: No such file or directory

Container rootfs and config have been created.
Edit the config file to check/enable networking setup.

The temporary root password is stored in:

        '/var/lib/lxc/centos/tmp_root_pass'


The root password is set up as expired and will require it to be changed
at first login, which you should do as soon as possible.  If you lose the
root password or wish to change it without starting the container, you
can change it from the host by running the following command (which will
also reset the expired flag):

        chroot /var/lib/lxc/centos/rootfs passwd

That is, yum fails to update packages, and additionally networking doesn't work right away in lxc container. Until I fix /etc/resolv.conf.

@brauner
Copy link
Member

brauner commented Feb 9, 2018

That's not something LXC is taking care of. In the case of system container this is the job of the init system and the networking setup. If you wanted to have a fixed resolv.conf and can somehow guarantee that the init system will not mess with it you could specify a lxc.mount.entry for resolv.conf that contains entries you want in the container's config.

@brauner brauner closed this as completed Feb 9, 2018
@x-yuri
Copy link
Author

x-yuri commented Feb 9, 2018

Well, I was thinking that LXC could provide a "better" resolv.conf by default. After all, it does copy it. But well, I myself not sure what solution here would fit more cases...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants