Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd status does not report condition failed (version 228) #2234

Closed
tomty89 opened this issue Dec 28, 2015 · 3 comments
Closed

systemd status does not report condition failed (version 228) #2234

tomty89 opened this issue Dec 28, 2015 · 3 comments

Comments

@tomty89
Copy link
Contributor

tomty89 commented Dec 28, 2015

[tom@localhost ~]$ grep -i condition /usr/lib/systemd/system/vmware-vmblock-fuse.service
ConditionVirtualization=vmware
[tom@localhost ~]$ sudo systemctl start vmware-vmblock-fuse.service
[tom@localhost ~]$ systemctl status vmware-vmblock-fuse.service
● vmware-vmblock-fuse.service - Open Virtual Machine Tools (vmware-vmblock-fuse)
   Loaded: loaded (/usr/lib/systemd/system/vmware-vmblock-fuse.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[tom@localhost ~]$ grep -i condition /usr/lib/systemd/system/vmware-vmblock-fuse.service
#ConditionVirtualization=vmware
[tom@localhost ~]$ sudo systemctl start vmware-vmblock-fuse.service
[tom@localhost ~]$ systemctl status vmware-vmblock-fuse.service
● vmware-vmblock-fuse.service - Open Virtual Machine Tools (vmware-vmblock-fuse)
   Loaded: loaded (/usr/lib/systemd/system/vmware-vmblock-fuse.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2015-12-28 23:56:53 HKT; 1s ago
 Main PID: 421 (vmware-vmblock-)
   CGroup: /system.slice/vmware-vmblock-fuse.service
           └─421 /usr/bin/vmware-vmblock-fuse -d -f -o subtype=vmware-vmblock,default_permissions,all...

Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: INIT: 7.23
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: flags=0x0003f7fb
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: max_readahead=0x00020000
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: INIT: 7.19
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: flags=0x00000010
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: max_readahead=0x00020000
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: max_write=0x00020000
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: max_background=0
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: congestion_threshold=0
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: unique: 1, success, outsize: 40

Log in journal:

Dec 28 23:56:36 localhost sudo[403]:      tom : TTY=pts/0 ; PWD=/home/tom ; USER=root ; COMMAND=/usr/bin/systemctl start vmware-vmblock-fuse.service
Dec 28 23:56:36 localhost sudo[403]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 28 23:56:36 localhost polkitd[290]: Registered Authentication Agent for unix-process:404:4754 (system bus name :1.12 [/usr/bin/pkttyagent --notify-fd 4 --fallback], object path /org/freedesktop/PolicyKit1/Au
Dec 28 23:56:36 localhost polkitd[290]: Unregistered Authentication Agent for unix-process:404:4754 (system bus name :1.12, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disco
Dec 28 23:56:36 localhost sudo[403]: pam_unix(sudo:session): session closed for user root
Dec 28 23:56:44 localhost sudo[411]:      tom : TTY=pts/1 ; PWD=/home/tom ; USER=root ; COMMAND=/usr/bin/nano /usr/lib/systemd/system/vmware-vmblock-fuse.service
Dec 28 23:56:44 localhost sudo[411]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 28 23:56:46 localhost sudo[411]: pam_unix(sudo:session): session closed for user root
Dec 28 23:56:53 localhost sudo[414]:      tom : TTY=pts/0 ; PWD=/home/tom ; USER=root ; COMMAND=/usr/bin/systemctl start vmware-vmblock-fuse.service
Dec 28 23:56:53 localhost sudo[414]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 28 23:56:53 localhost polkitd[290]: Registered Authentication Agent for unix-process:415:6475 (system bus name :1.14 [/usr/bin/pkttyagent --notify-fd 4 --fallback], object path /org/freedesktop/PolicyKit1/Au
Dec 28 23:56:53 localhost systemd[1]: Started Open Virtual Machine Tools (vmware-vmblock-fuse).
Dec 28 23:56:53 localhost polkitd[290]: Unregistered Authentication Agent for unix-process:415:6475 (system bus name :1.14, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disco
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: FUSE library version: 2.9.4
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: nullpath_ok: 0
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: nopath: 0
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: utime_omit_ok: 0
Dec 28 23:56:53 localhost sudo[414]: pam_unix(sudo:session): session closed for user root
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: unique: 1, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: INIT: 7.23
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: flags=0x0003f7fb
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: max_readahead=0x00020000
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: INIT: 7.19
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: flags=0x00000010
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: max_readahead=0x00020000
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: max_write=0x00020000
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: max_background=0
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: congestion_threshold=0
Dec 28 23:56:53 localhost vmware-vmblock-fuse[421]: unique: 1, success, outsize: 40

Unit file: https://projects.archlinux.org/svntogit/community.git/tree/trunk/vmware-vmblock-fuse.service?h=packages/open-vm-tools&id=03a3752b3a91e24914a02f0706cc1c18fcd9c3b4

@tomty89
Copy link
Contributor Author

tomty89 commented Dec 28, 2015

Actually it seems that it only reports if the unit is enabled. The following is ran continuously without rebooting:

[tom@localhost ~]$ sudo systemctl start vmware-vmblock-fuse
[tom@localhost ~]$ systemctl status vmware-vmblock-fuse
● vmware-vmblock-fuse.service - Open Virtual Machine Tools (vmware-vmblock-fuse)
   Loaded: loaded (/usr/lib/systemd/system/vmware-vmblock-fuse.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[tom@localhost ~]$ sudo systemctl enable vmware-vmblock-fuse
Created symlink from /etc/systemd/system/multi-user.target.wants/vmware-vmblock-fuse.service to /usr/lib/systemd/system/vmware-vmblock-fuse.service.
[tom@localhost ~]$ systemctl status vmware-vmblock-fuse
● vmware-vmblock-fuse.service - Open Virtual Machine Tools (vmware-vmblock-fuse)
   Loaded: loaded (/usr/lib/systemd/system/vmware-vmblock-fuse.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
[tom@localhost ~]$ sudo systemctl start vmware-vmblock-fuse
[tom@localhost ~]$ systemctl status vmware-vmblock-fuse
● vmware-vmblock-fuse.service - Open Virtual Machine Tools (vmware-vmblock-fuse)
   Loaded: loaded (/usr/lib/systemd/system/vmware-vmblock-fuse.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
Condition: start condition failed at Tue 2015-12-29 00:17:56 HKT; 1s ago
           ConditionVirtualization=vmware was not met
[tom@localhost ~]$ sudo systemctl disable vmware-vmblock-fuse
Removed symlink /etc/systemd/system/multi-user.target.wants/vmware-vmblock-fuse.service.
[tom@localhost ~]$ systemctl status vmware-vmblock-fuse
● vmware-vmblock-fuse.service - Open Virtual Machine Tools (vmware-vmblock-fuse)
   Loaded: loaded (/usr/lib/systemd/system/vmware-vmblock-fuse.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[tom@localhost ~]$ sudo systemctl enable vmware-vmblock-fuse
Created symlink from /etc/systemd/system/multi-user.target.wants/vmware-vmblock-fuse.service to /usr/lib/systemd/system/vmware-vmblock-fuse.service.
[tom@localhost ~]$ systemctl status vmware-vmblock-fuse
● vmware-vmblock-fuse.service - Open Virtual Machine Tools (vmware-vmblock-fuse)
   Loaded: loaded (/usr/lib/systemd/system/vmware-vmblock-fuse.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
[tom@localhost ~]$ sudo systemctl start vmware-vmblock-fuse
[tom@localhost ~]$ systemctl status vmware-vmblock-fuse
● vmware-vmblock-fuse.service - Open Virtual Machine Tools (vmware-vmblock-fuse)
   Loaded: loaded (/usr/lib/systemd/system/vmware-vmblock-fuse.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
Condition: start condition failed at Tue 2015-12-29 00:18:14 HKT; 1s ago
           ConditionVirtualization=vmware was not met

@poettering
Copy link
Member

Basically, we GC units that aren't referenced and are in a clean state. If a condition failed, then we consider it in a clean state (use AssertXYZ= instead of ConditionXYZ= if you'd rather want it to fail). We also load units implicitly if you query their state when they aren't loaded yet. Thus, the condition result is flushed out as soon as nothing references that unit anymore, and when you query the state we'll show you everything freshly loaded.

If you want to "pin" a unit in memory, so that its state is never flushed out, it suffices to add some kind of dep from one unit that is known to stay around (such as basic.target) to the unit...

We have been thinking about ways to "pin" units in other ways, but it's a hard problem as we we cannot do this too eagerly, in order to keep memory consumption withing reasonable limits.

Anyway, the behaviour is kinda intended right now. Closing hence.

@simson-sillage
Copy link
Contributor

I understand that this is not considered a bug. But I still think that the behavior is unexpected and would like to document it. I opened a small PR to add it to the man pages:
#12553

poettering pushed a commit that referenced this issue May 13, 2019
edevolder pushed a commit to edevolder/systemd that referenced this issue Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants