[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: change hostname without rebooting

On Sat, Nov 24, 2012 at 1:04 AM, Zenaan Harkness <zen@freedbms.net> wrote:
> # Me, wonders why systemd-hostnamed does not run, google says it should:
> $ echo $PATH
> /usr/lib/postgresql/8.3/bin:/home/justa/bin:/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games
> $ dpkg -L systemd|grep hostnamed
> /lib/systemd/system/systemd-hostnamed.service
> /lib/systemd/systemd-hostnamed
> $ cd /lib/systemd/
> $ file systemd-hostnamed
> systemd-hostnamed: ELF 64-bit LSB executable, x86-64, version 1
> (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26,
> BuildID[sha1]=0x4447f9b433f2bd71e603d2b9060b1196edc64048, stripped
> $ ./systemd-hostnamed
> Warning: nss-myhostname is not installed. Changing the local hostname
> might make it unresolveable. Please install nss-myhostname!
> Failed to register name on bus: Access denied
> OK, so now we have another /sbin type directory called /lib/systemd
> ... should I avoid adding this to my path, as in, is systemd-hostnamed
> supposed to be wrapped by /bin/hostname, and for now it's not? Or are
> these commands additional /sbin type commands that we will need now
> and again?
> Should systemd-hostnamed actually work for live-changing the hostname?
> If so, should systemd package suggest or recommend "nss-myhostnamed"
> aka debian's libnss-myhostname ??

Having executables in "/lib/systemd" probably breaks the FHS,
AFAIR/AFAIU, but Debian also has executables in, at least, "/lib/init"
and "/lib/udev".

Upstream systemd uses "/usr/lib/systemd" and that's allowed by the FHS
for executables not meant to be called by users. Before Fedora's
"usrmove" change, it probably used "/lib/systemd" but I don't have an
F-16 install to check.

Why can't you change the hostname with "hostname <new-host-name>" and
change the hostname in "/etc/{hostname,hosts,mailname}" if you want
the change to survive a reboot?

I wouldn't worry, on Debian, about nss-myhostname/libnss-myhostname
because there's a line in "/etc/hosts" to resolve the hostname to
"" when dhcp's used.

nss-myhostname allows you to have a two-line "/etc/hosts" mapping
localhost to "" and "::1". If you have a dhcp-supplied
address, your hostname's mapped to "" (on Fedora; maybe it's
patched on Debian to map to "", no idea) and if you have a
static address your hostname's mapped to that address.

Reply to: