Abel Luck:
> The systemd route does seem promising. Thanks.
> 
> If I edited the template vm, I could just put my unit file in
> /etc/systemd/system and it would work fine.
> 
> However I'd like to do this for a specific AppVm, so I dropped the unit
> file in /usr/local/lib/systemd/system. This file persists across boots
> as expected, however systemd doesn't load units from it until I
> daemon-reload after boot.
> 
> I suppose this is because /usr/local is symlinked from /rw/usrlocal
> sometime after systemd has loaded its units.
> 
> Is there anyway to get systemd to load units from
> /usr/local/lib/systemd/system as part of appvm boot?
> 
> ~abel
> 
> Claudia:
>> January 11, 2020 2:06 PM, "Abel Luck" <[email protected]> wrote:
>>
>>> Hi there,
>>>
>>> Using the fedora and debian minimal templates, how can I execute a
>>> script on *login*? I'm aware of /rw/config/rc.local, but that runs on
>>> system boot.
>>>
>>> Rather, I want to run something after X11 has initialized and my user is
>>> logged in.
>>>
>>> Since no DE is installed, .desktop files in ~/.config/autostart are not
>>> executed in the minimal templates
>>>
>>> ~abel
>>
>> Would .xinitrc work?
>>
>> Systemd units with After=graphical.target and properly configured User=, 
>> Display=, Session=, Seat=, and/or whatever else might be necessary. Or maybe 
>> user-mode systemd units. https://wiki.archlinux.org/index.php/Systemd/User
>>
>> Or maybe rc.local with `systemctl is-system-running --wait` before your 
>> commands - I often have to use this with qvm-run. Running from rc.local 
>> though, commands might not be running as the right 
>> user/session/seat/slice/scope/whatever, I don't know.

Oops, sorry for the top post D:

I did some more research and this appears to be a systemd limitation:
https://github.com/systemd/systemd/issues/8307

/rw/usrlocal is mounted to /usr/local as part of
qubes-mount-dirs.service when a vm is booting. This means the unit files
in /usr/local are not visible to systemd.

As poettering state in that issue: "unit files have to reside on a
partition that is mounted at the moment the host PID 1 is invoked. i.e.
either on the root partition or some other partition that the initrd
premounts."

This is quite sad. I have several use cases for app-vm specific systemd
units:

* Automount network drive on boot (for backupvm)
* Run some special daemons on boot
* Execute scripts on user login

I guess I'll just need to revist the use of rc scripts :/ (ala
https://entropux.net/article/systemd-rc-local-service-with-qubes/)

~abel

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/2740ac28-eb6d-c43b-2bf9-67a7ca13601b%40guardianproject.info.

Reply via email to