#1067480 hostname: fails to change host name inside container; misleading message "you must be root to change the host name" while root

Package:
hostname
Source:
hostname
Description:
utility to set/show the host name or domain name
Submitter:
Gioele Barabucci
Date:
2024-03-22 08:39:04 UTC
Severity:
normal
#1067480#5
Date:
2024-03-22 08:37:57 UTC
From:
To:
Dear hostname maintainer,

`hostname` fails to set the host name when run inside a container. After
it fails it states "you must be root to change the host name" even if
called by root.

To reproduce:

     $ sudo podman image pull debian:bookworm
     Trying to pull docker.io/library/debian:bookworm...
     [...]
     $ sudo podman run debian:bookworm bash -c 'whoami; hostname a.b.c'
     root
     hostname: you must be root to change the host name

Regards,