public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-cluster] pve-cluster.service : remove 127.0.1.1 from /etc/hosts
@ 2023-06-28  6:06 Alexandre Derumier
  2023-06-28  7:28 ` Thomas Lamprecht
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Derumier @ 2023-06-28  6:06 UTC (permalink / raw)
  To: pve-devel

stock debian or some hosting company like ovh through cloudinit at each boot,
add 127.0.1.1 <hostname> in /etc/hosts.

This is breaking pve-cluster start.

fix:
https://forum.proxmox.com/threads/proxmox-7-to-8-upgrade-problem-ovh.129678/
https://forum.proxmox.com/threads/update-7-to-8-issue-with-cloud-init.129669/#post-568172
https://forum.proxmox.com/threads/bookworm-installation-fails-with-pve-manager-dependency-error.129398/#post-568290
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 debian/pve-cluster.service | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/pve-cluster.service b/debian/pve-cluster.service
index 4327055..f6bdac2 100644
--- a/debian/pve-cluster.service
+++ b/debian/pve-cluster.service
@@ -14,6 +14,7 @@ Before=shutdown.target
 Conflicts=shutdown.target
 
 [Service]
+ExecStartPre=/usr/bin/sed -i '/127.0.1.1/d' /etc/hosts
 ExecStart=/usr/bin/pmxcfs
 KillMode=mixed
 Restart=on-failure
-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH pve-cluster] pve-cluster.service : remove 127.0.1.1 from /etc/hosts
  2023-06-28  6:06 [pve-devel] [PATCH pve-cluster] pve-cluster.service : remove 127.0.1.1 from /etc/hosts Alexandre Derumier
@ 2023-06-28  7:28 ` Thomas Lamprecht
  2023-06-28  7:47   ` DERUMIER, Alexandre
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Lamprecht @ 2023-06-28  7:28 UTC (permalink / raw)
  To: Proxmox VE development discussion, Alexandre Derumier

Am 28/06/2023 um 08:06 schrieb Alexandre Derumier:
> stock debian or some hosting company like ovh through cloudinit at each boot,
> add 127.0.1.1 <hostname> in /etc/hosts.

Yeah, tools just messing with /etc/hosts et al. is irritating..

> 
> This is breaking pve-cluster start.
> 
> fix:
> https://forum.proxmox.com/threads/proxmox-7-to-8-upgrade-problem-ovh.129678/
> https://forum.proxmox.com/threads/update-7-to-8-issue-with-cloud-init.129669/#post-568172
> https://forum.proxmox.com/threads/bookworm-installation-fails-with-pve-manager-dependency-error.129398/#post-568290
> Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> ---
>  debian/pve-cluster.service | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/debian/pve-cluster.service b/debian/pve-cluster.service
> index 4327055..f6bdac2 100644
> --- a/debian/pve-cluster.service
> +++ b/debian/pve-cluster.service
> @@ -14,6 +14,7 @@ Before=shutdown.target
>  Conflicts=shutdown.target
>  
>  [Service]
> +ExecStartPre=/usr/bin/sed -i '/127.0.1.1/d' /etc/hosts

.. and so is this, messing with hosts on every  pve-cluster start or update..

So no, please don't, messing with such things can be really subtle!

Let's rather improve pmxcfs logic for getting the non-local IP configured on
a node via getaddrinfo with the ALL flag and filtering out local IPs..

>  ExecStart=/usr/bin/pmxcfs
>  KillMode=mixed
>  Restart=on-failure





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH pve-cluster] pve-cluster.service : remove 127.0.1.1 from /etc/hosts
  2023-06-28  7:28 ` Thomas Lamprecht
@ 2023-06-28  7:47   ` DERUMIER, Alexandre
  2023-06-28  8:13     ` Thomas Lamprecht
  0 siblings, 1 reply; 4+ messages in thread
From: DERUMIER, Alexandre @ 2023-06-28  7:47 UTC (permalink / raw)
  To: pve-devel, t.lamprecht, aderumier

> >  
> >  [Service]
> > +ExecStartPre=/usr/bin/sed -i '/127.0.1.1/d' /etc/hosts
> 
> .. and so is this, messing with hosts on every  pve-cluster start or
> update..
> 
> So no, please don't, messing with such things can be really subtle!
ok, I was not sure.

> 
> Let's rather improve pmxcfs logic for getting the non-local IP
> configured on
> a node via getaddrinfo with the ALL flag and filtering out local
> IPs..
oh, I didn't known than getaddrinfo could return multiple ips.
(I thinked it was doing a simple dns resolution)
I'll look at that, thanks !


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH pve-cluster] pve-cluster.service : remove 127.0.1.1 from /etc/hosts
  2023-06-28  7:47   ` DERUMIER, Alexandre
@ 2023-06-28  8:13     ` Thomas Lamprecht
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2023-06-28  8:13 UTC (permalink / raw)
  To: DERUMIER, Alexandre, pve-devel, aderumier

Am 28/06/2023 um 09:47 schrieb DERUMIER, Alexandre:
>> Let's rather improve pmxcfs logic for getting the non-local IP
>> configured on
>> a node via getaddrinfo with the ALL flag and filtering out local
>> IPs..
> oh, I didn't known than getaddrinfo could return multiple ips.

yes, check the "getaddrinfo_all" method in PVE::Tools and how it's used
in the "get_local_ip" method in PVE::Network.

> (I thinked it was doing a simple dns resolution)
> I'll look at that, thanks !
> 

if you don't get to it I would take a look tomorrow – as yes, this is indeed
annoying and it seems that quite some users are affected, at least relatively
speaking.


im pmxcfs.c one would need to adapt lookup_node_ip, mostly set the flags for
the ahints struct directly, the memset to zero should not be required then
any more, i.e.:

struct addrinfo ahints = { 
    .ai_flags = AI_V4MAPPED | AI_ALL
};

and then wrap the existing code into a loop, returning once the first non-local
IP was found, something like:

for (struct addrinfo addr = ainfo; addr != NULL; addr = addr->ai_next) {
    // ...
}

so it shouldn't be _that_ hard.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-28  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28  6:06 [pve-devel] [PATCH pve-cluster] pve-cluster.service : remove 127.0.1.1 from /etc/hosts Alexandre Derumier
2023-06-28  7:28 ` Thomas Lamprecht
2023-06-28  7:47   ` DERUMIER, Alexandre
2023-06-28  8:13     ` Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal