Mailing List Archive

hostname service on lxc
Hi,

OpenRC doesn’t take the hostname service service on LXC even if the
symlink exists:

as112 ~ # rc-status boot | grep hostname
as112 ~ # file /etc/runlevels/boot/hostname
/etc/runlevels/boot/hostname: symbolic link to /etc/init.d/hostname

On a bare-metal box, the service is started:

edge08-clouvider ~ # rc-status boot | grep hostname
hostname [ started ]
edge08-clouvider ~ # file /etc/runlevels/boot/hostname
/etc/runlevels/boot/hostname: symbolic link to /etc/init.d/hostname
edge08-clouvider ~ #

If I try to use `rc-update`, as the symlink exists, it fails, but if I
delete the service and re-add it, the result is the same:

as112 ~ # rc-update add hostname boot
* rc-update: hostname already installed in runlevel `boot'; skipping
as112 ~ # rc-update del hostname boot
* service hostname removed from runlevel boot
as112 ~ # rc-update add hostname boot
* service hostname added to runlevel boot
as112 ~ # rc-status boot | grep hostname
as112 ~ #

So, I’m a bit confused here. If someone has an idea…

Thanks!
--
Alarig
Re: hostname service on lxc [ In reply to ]
Hi Alarig,

Am Samstag, den 09.01.2021 um 10:52:12 Uhr +0100 schrieb Alarig Le Lay <alarig@swordarmor.fr>:
> Hi,
>
> OpenRC doesn’t take the hostname service service on LXC even if the
> symlink exists:

please take a look into /etc/rc.conf (key word rc_sys) and into the initscript
/etc/init.d/hostname inside the depend phase:

"keyword -docker -lxc -prefix -systemd-nspawn"

Looks to me as openrc doesn't start the hostname script in certain environments.
Is this even possible and has no weird side effects?

For testing you could drop the "-lxc" from that line, e.g. by commenting out
the original one and copying it (to have a backup..). If it works as expected
you might file a bug to ask for removal of the lxc-keyword here. Maybe there
is already one, didn't check.

Hope that helps along,
Nils
Re: hostname service on lxc [ In reply to ]
Hi Nils,

rc_sys from /etc/rc.conf is empty, but after removing -lxc from
/etc/init.d/hostname the service is well started. Thanks!

So, for the record:
as112 ~ # grep rc_sys /etc/rc.conf
#rc_sys=""
as112 ~ # grep keyword /etc/init.d/hostname
keyword -docker -lxc -prefix -systemd-nspawn
as112 ~ # vim /etc/init.d/hostname
as112 ~ # rc-status boot | grep hostname
hostname [ started ]
as112 ~ # grep keyword /etc/init.d/hostname
keyword -docker -prefix -systemd-nspawn
as112 ~ #

Cheers,
--
Alarig