View previous topic :: View next topic |
Author |
Message |
CyberMuz n00b
Joined: 03 Jan 2012 Posts: 53
|
Posted: Sat Mar 25, 2017 4:09 pm Post subject: OpenRC init script dependency |
|
|
Can someone explain to me the 'keyword' dependency inside init scripts? For example in /etc/init.d/hostname there is
Code: |
depend() {
keyword -docker -lxc -prefix -systemd-nspawn
}
|
Where do this keywords come from? I have a problem that hostname script is not executed when I run gentoo as lxc guest, instead the hostname of the lxc host is used. If I remove "-lxc" from hostname script then everything works fine. |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Sat Mar 25, 2017 4:18 pm Post subject: |
|
|
man openrc-run
Code: | keyword Tags a service with a keyword. These are the keywords we
currently understand:
-shutdown
Don't stop this service when shutting the system
down. This is normally quite safe as remaining
daemons will be sent a SIGTERM just before final
shutdown. Network related services such as the
network and dhcpcd init scripts normally have
this keyword.
-stop Don't stop this service when changing runlevels,
even if not present. This includes shutting the
system down.
-timeout
Other services should wait indefinitely for this
service to start. Use this keyword if your ser-
vice may take longer than 60 seconds to start.
-jail When in a jail, exclude this service from any
dependencies. The service can still be run
directly. Set via rc sys in /etc/rc.conf
- ------------
-lxc Same as -jail, but for Linux Resource Containers
(LXC).
-openvz
Same as -jail, but for OpenVZ systems.
-prefix
Same as -jail, but for Prefix systems.
-rkt Same as -jail, but for RKT systems.
-uml Same as -jail, but for UML systems.
-vserver
Same as -jail, but for VServer systems.
-xen0 Same as -jail, but for Xen DOM0 systems.
-xenu Same as -jail, but for Xen DOMU systems.
-docker
Same as -jail, but for docker systems.
-containers
Same as -jail, but for all relevant container
types on the operating system.
|
_________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
CyberMuz n00b
Joined: 03 Jan 2012 Posts: 53
|
Posted: Sat Mar 25, 2017 4:43 pm Post subject: |
|
|
Tnx. I still don't understand why hostname script is not executed on boot inside lxc if "-lxc" flag is set. I have explicitly set it in 'default' runlevel but it doesn't start. It's not even listed in rc-status output. I expected that will get started since it's started directly and not as a dependency.
I can start it manually (/etc/init.d/hostname start) and it correctly sets the hostname. Without -lxc flag it starts on boot and is listed in rc-status output. |
|
Back to top |
|
|
face n00b
Joined: 20 Mar 2004 Posts: 12
|
Posted: Sat Aug 10, 2019 7:12 am Post subject: |
|
|
CyberMuz wrote: | Tnx. I still don't understand why hostname script is not executed on boot inside lxc if "-lxc" flag is set. I have explicitly set it in 'default' runlevel but it doesn't start. It's not even listed in rc-status output. I expected that will get started since it's started directly and not as a dependency.
I can start it manually (/etc/init.d/hostname start) and it correctly sets the hostname. Without -lxc flag it starts on boot and is listed in rc-status output. |
I also face this issue. I don't understand the reason why the hostname init script is excluded on lxc guests. ¯\_(ツ)_/¯
Solved: https://github.com/OpenRC/openrc/commit/a2c8e5ce50ca88a8d73f828453ca67f00fff1081#diff-59ff56a2f5fd97525139b2d3e0176d66
The hostname (even fqdn) can be set via lxc config directive 'lxc.uts.name'. |
|
Back to top |
|
|
|