Comments (14)
Personally, I don't know what they are doing as I did never have a use for it.
I had a look at this article https://fedoramagazine.org/systemd-masking-units/
and basicially it says that it is about starting dependencies.
However starting dependencies is currently not supported anyway. I have prepared for that while checking for start order but that's about it.
So may be it is sufficient to just do dummy operations for "systemctl mask x" ?
from docker-systemctl-replacement.
Having a dummy would def. be a very good start. E.g. mask == disable, unmask == do nothing
(and that's what I'm trying to hack through for myself - it does not help that my python is at first 10% of the learning curve though)
In case of puppet for elastic they are masking default service and spawning a re-named clone of it. This way whatever you do to original it still stays down while the clones are managed by puppet. Main reason is probably to support many elasticsearch instances on one node.
from docker-systemctl-replacement.
I have implemented the proposal - "mask unit" will effectivly disable the unit, and "unmask unit" will do nothing.
Please test if that is enough for your use case.
from docker-systemctl-replacement.
Hi,
I had a try and it seems either unmask should enable as well or sth else.
Basically following workaround added after the command parsing works with Elasticsearch module:
if command == 'mask':
command = 'disable'
if command == 'unmask':
command = 'enable'
While current master fails (didn't have a change to investigate the reason yet)
I had unmask aliased to 'status' before and module failed, when changed to 'enable' module applied successfully
from docker-systemctl-replacement.
I think there was a programming error in there.
Anyway, I changed it to enable/disable. Please try again.
from docker-systemctl-replacement.
Greetings,
I'd need this functionality too (BTW, I'm @IOOOTAlan from issue #32).
The /dev/null
linking (mask)/unlinking (unmask) is taken care of by the current commits?
from docker-systemctl-replacement.
I have implemented mask/unmaks according to the systemd standard behaviour which create a symlink to /dev/null
However this results in a nother status of the service file itself which needs more changes in other places of systemctl.py ... notably, the service is "loaded" but "masked" and it is not "enabled" but "masked".
Please check
sudo make real_3102
make test_3102
from docker-systemctl-replacement.
I have implemented the status detection of "masked" for "loaded" and "enabled". On other parts the behaviour is still different to the real systemd's systemctl. However it may already be enough.
v1.3.2312
from docker-systemctl-replacement.
Did you test it?
from docker-systemctl-replacement.
Did you test it?
I don't know if the question is aimed at me, however I did not test it yet: I'm currently on summer holiday/vacation. I'll give it a go as soon as I can, however.
Thanks for implementing this feature so swiftly, though π
from docker-systemctl-replacement.
Or perhaps @sergii-sakharov as the original requester? I don't personally have a use for this feature, so it is up to you guys to say the implemention is fine as it is now.
Anyway, I had planned for a release in about two weeks, I'll just push that more to the end of summer then. No pressure needed - have fun!
from docker-systemctl-replacement.
Any news? I would like to rollup a new release new week.
I don't have any use for it, so if the implementation is lacking then it can take a while to the next official milestone. ;)
from docker-systemctl-replacement.
Hi @gdraheim
I performed some tests on mask/unmask inside an Ubuntu 16.04 container and I think it is working correctly:
- the
system-name.service
symlink to/dev/null
is correctly created in/etc/systemd/system
onmask
- that same link is removed on
unmask
The only minor issue I found is that the start command on a masked unit is not able to tell that the unit is masked and does not seem able to retrieve the name of the unit:
# systemctl status rsyslog.service
rsyslog.service - System Logging Service
Loaded: loaded (/lib/systemd/system/rsyslog.service, enabled)
Active: inactive (dead)
# ls -l /etc/systemd/system/
total 16
drwxr-xr-x 2 root root 4096 Aug 8 02:03 getty.target.wants
drwxr-xr-x 1 root root 4096 Sep 1 07:44 multi-user.target.wants
drwxr-xr-x 2 root root 4096 Aug 8 02:03 sysinit.target.wants
lrwxrwxrwx 1 root root 35 Sep 1 07:44 syslog.service -> /lib/systemd/system/rsyslog.service
drwxr-xr-x 2 root root 4096 Aug 8 02:04 timers.target.wants
# systemctl mask rsyslog
# systemctl status rsyslog.service
rsyslog.service -
Loaded: masked (None, masked)
Active: inactive (dead)
# ls -l /etc/systemd/system/
total 16
drwxr-xr-x 2 root root 4096 Aug 8 02:03 getty.target.wants
drwxr-xr-x 1 root root 4096 Sep 1 07:44 multi-user.target.wants
lrwxrwxrwx 1 root root 9 Sep 1 07:45 rsyslog.service -> /dev/null
drwxr-xr-x 2 root root 4096 Aug 8 02:03 sysinit.target.wants
lrwxrwxrwx 1 root root 35 Sep 1 07:44 syslog.service -> /lib/systemd/system/rsyslog.service
drwxr-xr-x 2 root root 4096 Aug 8 02:04 timers.target.wants
# systemctl start rsyslog.service
ERROR:systemctl:Unit could not be found.
# systemctl unmask rsyslog.service
# ls -l /etc/systemd/system/
total 16
drwxr-xr-x 2 root root 4096 Aug 8 02:03 getty.target.wants
drwxr-xr-x 1 root root 4096 Sep 1 07:44 multi-user.target.wants
drwxr-xr-x 2 root root 4096 Aug 8 02:03 sysinit.target.wants
lrwxrwxrwx 1 root root 35 Sep 1 07:44 syslog.service -> /lib/systemd/system/rsyslog.service
drwxr-xr-x 2 root root 4096 Aug 8 02:04 timers.target.wants
# systemctl status rsyslog.service
rsyslog.service - System Logging Service
Loaded: loaded (/lib/systemd/system/rsyslog.service, enabled)
Active: inactive (dead)
# systemctl start rsyslog.service
# systemctl status rsyslog.service
rsyslog.service - System Logging Service
Loaded: loaded (/lib/systemd/system/rsyslog.service, enabled)
Active: active (running)
Apart from this, I guess it works π
Thank you very much!
from docker-systemctl-replacement.
I have added your scenario as "make test_8034".
Actually, I have concluded that it needed two enhancements - for one part, a masked unit did not have a UnitConf.name() but it should actually.
And for the other part, it does not make sense to handover a masked unit to start_unit(x) anyway, so that start_units(xx) filters them out when computing the starting order (from the After= clauses in the confs).
As a result, the "start [masked]" does not do anything now, not even an error message like "not found".
from docker-systemctl-replacement.
Related Issues (20)
- Uable to start postgresql service HOT 1
- journalctl3.py path resolve issues HOT 1
- python3 HOT 2
- Version tag 1.5.1706 HOT 1
- 'systemctl' not working HOT 16
- Starting a service during image build / docker file, hangs HOT 7
- Possible to work with ansible service_facts module? HOT 1
- systemctl3.py not working on Rocky Linux 8 HOT 1
- Misleading error message interaction between ExecStart= and ExecStartPost= HOT 3
- systemctl enable doesn't copy service file to right place. HOT 1
- When control-C on systemctl log -f xxx, it raise an ugly KeyboardInterrupt HOT 2
- systemctl disable not disabling service at container restart HOT 1
- can this script be used on ubuntu 22.04? HOT 1
- How is this suppoused to be ussed? HOT 1
- ERROR:systemctl: nextcloud.service: Failed to parse service type, ignoring: exec HOT 1
- Install to Centos6.8 HOT 1
- StartLimitIntervalSec=0 or how to Restart Forever HOT 1
- status command shows unit files ignored by SystemD HOT 2
- systemctl show does not respect multiple `-p/--property` switches HOT 1
- BlockingIOError: [Errno 11] Resource temporarily unavailable HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-systemctl-replacement.