LXC container only uses first part of hostname as hostname.

postmaster

New Member
May 31, 2021
1
0
1
23
Hi,

I've been using proxmox for about half a year now (on a sort of basic level) and I'm quite happy with it.
But I've sadly run into a issue that I failed at figuring out my self.

Due to a legacy application in one of my containers that needs the hostname to be set to the domain of the server, I set under DNS>Hostname the hostname of my LXC container to "example.com", but the issue i am facing right now is that the container it self wont change the to that hostname properly, instead the hostname it adopts is just "example", completely omitting the ".com".

I've only been trying this from the web interface so far as I'm not familiar enough with the console api.

I'm really not sure how to fix this issue, any help would be really appreciated!
 
hi,

i guess you want to use the whole FQDN as the hostname?

you can create a pve-ignore file inside the container [0]

you can do the following:
Code:
pct enter CTID
touch /etc/.pve-ignore.hostname

will create a file, telling PVE to not modify the /etc/hostname file of the container.
then you can edit the file: echo "example.com" > /etc/hostname and exit the container.

after reboot and reattaching to it, it should have the desired hostname. you can check with hostname command inside the container or cat /etc/hostname

hope this helps

[0]: https://pve.proxmox.com/wiki/Linux_Container#_guest_operating_system_configuration
 
  • Like
Reactions: gmpreussner

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 yours easily in our online shop.

Buy now!