-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
3.2-rc3 issue with autostarting HVMs at boot. #2302
Comments
I forgot to mention, but these are CentOS 7 (1511 Minimal) HVMs. Also, if I have them start using System Tools -> Session and Startup -> Application Autostart they start just fine on bootup. |
If I set up an HVM to start via the XFCE Application Autostart, then when I shutdown or reboot Qubes, it hangs in some kind of systemd loop. I am not well versed in systemd at all. Basically the machine will not actually shutdown or reboot, it finally ends up with a bunch of repeated errors like this:
Then finally:
But it doesn't actually shutdown or reboot. |
After diving into systemd (something I'm not at all well versed in), I've developed a systemd service that seems to be working well, for both bootup and shutdown. However, after learning a little more, I've just discovered the systemd "system" versus "user" service units. Mine is a system unit, which maybe only works because my system has autologin enabled. Should this be a "user" unit service instead I wonder? Anyway, I guess I'm very confused. The initial issue I reported on was then when setting autostart to true, it caused an issue because the HVM started before the GUI. Is there some other way I should be doing this, that will reliably start the service on user login and shutdown the HVM properly (before user logout! otherwise the above |
Starting a VM before user login should be fine - GUI should be automatically connected as soon as you login. |
You are correct, the HVM does not have qrexec installed. Maybe having a new feature with a separate checkbox / preference setting would be helpful here? That would have it create a different systemd file so it loads / shuts down appropriately. Attached is a systemd file I created for an HVM named This is also set up to restart the HVM on the event it crashes. I'm not sure if it works without user auto-login, as my system automatically logs me in. As I noted I'm not very familiar with systemd so I don't know if it would be more appropriate to create a user systemd file versus as system systemd file. Mine seems to work at the moment, so I will leave it unless someone more knowledgeable than me in this area can answer that question. |
I went round and round with this. The previous systemd service script was not perfect and did not always work, especially on system shutdown. I'm currently exploring separate avenues for reliable HVM startup and shutdown for a system with automatic user login via lightdm. There are two, separate, systemd scripts:
#2: For reliable HVM shutdown I created a separate systemd "user" script/service. I found that in order for this script to run 100% of the time on user logout/system shutdown I needed to run it as a systemd user service which is listed to run before anything like exit.target, reboot.target, shutdown.target, or halt.target.
So far this seems reliable. I will continue to test it. I'm also wondering if the shutdown systemd user script could actually be a systemd system script instead and just require user-1000.slice so it might still shutdown before the user is logged out. I will experiment with this. If anyone else has any hints here I'd be happy to hear them. I am not a systemd expert by any means and am just fudging around until I get a working solution. If there is a better, "proper" way to do it, I'd be more than happy to hear it. But it must be reliable! Attached are my systemd scripts. tpf-proxy-hvm.service.txt |
I tried to make my shutdown service a systemd "system" service instead of a "user" service and it did not work correctly. I set it to require the user-1000.slice, but apparently that didn't do it. The system did not shutdown/reboot fully. So back to having one script run as a "system" service and the other as a "user" service. That setup appears to be reliable so far. |
Same situation for autostart Window HVM and standalone HVM. I've to killed them and restart again. |
@petertyyseng my systemd scripts above have been very reliable in my testing. It would be interesting to see if they functioned for Windows HVMs as well. |
This issue is being closed because:
If anyone believes that this issue should be reopened, please let us know in a comment here. |
Qubes OS version (e.g.,
R3.1
):R3.2-rc3
Affected TemplateVMs (e.g.,
fedora-23
, if applicable):N/A
Expected behavior:
After setting the autostart preference to true (and verifying it was set), upon reboot that HVM should boot.
Actual behavior:
Per the logs it tries to boot, but sometimes fails. Sometimes it starts, but it looks like it starts before the XFCE GUI actually starts, causing it to be lost somewhere. I can SSH to it, but it's no where (graphically) to be found on the screen. If it does start like this it shows up in the Qubes VM manager with a yellow state instead of green.
Steps to reproduce the behavior:
General notes:
I have three HVMs set to boot on startup, in addition to sys-net and sys-firewall. Sometimes one of them will start just fine. But I've not seen them all start normally since installing 3.2-rc3. I do not recall if I had this issue with 3.2-rc2 as I didn't get that far in testing. I did not have this issue with 3.1 to my recollection.
Attached is the output of "journalctl --system". At about 16:24:41 you can see where it tries to start all the VMs. In this particular boot, the tpf-keycloak HVM started, but in the background (yellow state on the Qubes VM Manager). The tpf-proxy HVM fails to start. tpf-firewall is a ServiceVM, a copy of sys-firewall, I don't recall ever having problems with it.
Related issues:
qubes-journalctl-log.txt
The text was updated successfully, but these errors were encountered: