Cant change DNS settings of LXC Debian containers

Vasilij Lebedinskij

Active Member
Jan 30, 2016
59
2
28
36
Hello! I'm trying to create OMV container and connect it to AD, but I can't change DNS setting from GUI. In GUI everything is set right (domain name and server) but in LXC /etc/resofv.conf still shows localdomain and dhcp dns server. This problem persist on Debian 9 and 10 templates but if I use ubuntu 18.04 template everything works fine.

Any ideas/workarounds?
 

H4R0

Active Member
Apr 5, 2020
616
130
43
You can run

Code:
touch /etc/.pve-ignore.resolv.conf

And then edit /etc/resolv.conf manually.
 

H4R0

Active Member
Apr 5, 2020
616
130
43
Code:
touch /etc/.pve-ignore.resolv.conf
must be done inside LXC or on host?

Inside the container.

Tried that in LXC but /etc/resolv.conf is still overwritten on reboot.

Then it's not proxmox fault.

There are some services like resolvconf which overwrite it at boot from /etc/network/interfaces.

Did you set the lxc to dhcp ? It can also be overwritten from dhcp.
 

Vasilij Lebedinskij

Active Member
Jan 30, 2016
59
2
28
36
Inside the container.



Then it's not proxmox fault.

There are some services like resolvconf which overwrite it at boot from /etc/network/interfaces.

Did you set the lxc to dhcp ? It can also be overwritten from dhcp.
Grrrrrr stupid dhcp... You were right - static ip solved my issue.
 

paulmorabi

Member
Mar 30, 2019
58
7
13
41
Hi,

Very strangely I followed the above guide and after stopping the lxc container, it won't restart. The error is:

Code:
root@littleman:/etc/pve/lxc# lxc-start -n 100 -F --logfile /tmp/log
lxc-start: 100: conf.c: run_buffer: 316 Script exited with status 1
lxc-start: 100: start.c: lxc_init: 816 Failed to run lxc.hook.pre-start for container "100"
lxc-start: 100: start.c: __lxc_start: 2007 Failed to initialize container "100"
lxc-start: 100: tools/lxc_start.c: main: 308 The container failed to start
lxc-start: 100: tools/lxc_start.c: main: 313 Additional information can be obtained by setting the --logfile and --logpriority options
root@littleman:/etc/pve/lxc# cat /tmp/log
lxc-start 100 20210802144046.737 ERROR    conf - conf.c:run_buffer:316 - Script exited with status 1
lxc-start 100 20210802144046.738 ERROR    start - start.c:lxc_init:816 - Failed to run lxc.hook.pre-start for container "100"
lxc-start 100 20210802144046.738 ERROR    start - start.c:__lxc_start:2007 - Failed to initialize container "100"
lxc-start 100 20210802144047.607 ERROR    lxc_start - tools/lxc_start.c:main:308 - The container failed to start
lxc-start 100 20210802144047.607 ERROR    lxc_start - tools/lxc_start.c:main:313 - Additional information can be obtained by setting the --logfile and --logpriority options

Is there anything I can do so I can log back in and unset the changes to resolv.conf?
 

paulmorabi

Member
Mar 30, 2019
58
7
13
41
Hi,

Very strangely I followed the above guide and after stopping the lxc container, it won't restart. The error is:

Code:
root@littleman:/etc/pve/lxc# lxc-start -n 100 -F --logfile /tmp/log
lxc-start: 100: conf.c: run_buffer: 316 Script exited with status 1
lxc-start: 100: start.c: lxc_init: 816 Failed to run lxc.hook.pre-start for container "100"
lxc-start: 100: start.c: __lxc_start: 2007 Failed to initialize container "100"
lxc-start: 100: tools/lxc_start.c: main: 308 The container failed to start
lxc-start: 100: tools/lxc_start.c: main: 313 Additional information can be obtained by setting the --logfile and --logpriority options
root@littleman:/etc/pve/lxc# cat /tmp/log
lxc-start 100 20210802144046.737 ERROR    conf - conf.c:run_buffer:316 - Script exited with status 1
lxc-start 100 20210802144046.738 ERROR    start - start.c:lxc_init:816 - Failed to run lxc.hook.pre-start for container "100"
lxc-start 100 20210802144046.738 ERROR    start - start.c:__lxc_start:2007 - Failed to initialize container "100"
lxc-start 100 20210802144047.607 ERROR    lxc_start - tools/lxc_start.c:main:308 - The container failed to start
lxc-start 100 20210802144047.607 ERROR    lxc_start - tools/lxc_start.c:main:313 - Additional information can be obtained by setting the --logfile and --logpriority options

Is there anything I can do so I can log back in and unset the changes to resolv.conf?

Fixed with pct mount and pct unmount.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!