Tip: How to speed up QubesOS shutdown

148 views
Skip to first unread message

Grzesiek Chodzicki

unread,
Mar 18, 2017, 6:41:50 AM3/18/17
to qubes-users
I've experienced this issue myself and I saw some people complaining about it on the mailing list. Sometimes Qubes takes forever to poweroff.

The issue is caused by the fact that for some unknown reason machines with PCI devices attached take forever to shutdown and sometimes need to be manually killed from within VM Manager. After manually killing them, the system will shutdown normally.

So, here's the fix:

In Dom0 run qvm-prefs -s sys-net pci_e820_host false

Repeat that for sys-usb and any other machine that holds a PCI device.

Your system should shut down normally after this.

No, I don't know how or why this works but I know that it solved the issue on my machine. Explanation welcome. I'll add this to documentation once we have a confirmation that this is 100% reproducible.

Unman

unread,
Mar 18, 2017, 10:08:35 AM3/18/17
to Grzesiek Chodzicki, qubes-users
I'd be reluctant to propose this as a tip as is, because it will almost
certainly break networking for some users.
We specifically set pci_e820 to address user problems. I don't know what
the intersection is between those for whom this is a fix and those for
whom shutdown is slow/doesn't happen.

Have you tried the solution suggested here before of shutting down other
vms first, then sys-usb and sys-net? Andrew, I think, posted a simple
script that he uses. I suspect that that will have more impact with
fewer consequences than this proposal, but user experience will be key
here: comments ?

Grzesiek Chodzicki

unread,
Mar 18, 2017, 11:59:30 AM3/18/17
to qubes-users, grzegorz....@gmail.com, un...@thirdeyesecurity.org
Yes, I did try that, this is how I found out that on my system it is not possible to cleanly shut down VMs that hold PCI devices. If I try shutting down sys-net the VM Manager hangs for a few minutes, then the entire system stops responding then the machine gets killed, then VM manager throws an exception and then system becomes responsive again. After setting pci_e820_host to False I can cleanly shutdown sys-net and sys-usb just like any other VM.

Unman

unread,
Mar 18, 2017, 12:21:24 PM3/18/17
to Grzesiek Chodzicki, qubes-users
So that sounds very system specific. Why not put together a tip
incorporating Andrew's script ( which will help on almost all
machines), and then yours as a special case to be used where that
doesnt help?

Grzegorz Chodzicki

unread,
Mar 18, 2017, 12:24:58 PM3/18/17
to Unman, qubes-users
That's the point, I don't know whether this is specific to my machine
but I don't have another PC to test so I posted this here so other
people can try it and see if that alleviates the issue.

haaber

unread,
Mar 18, 2017, 4:05:29 PM3/18/17
to qubes...@googlegroups.com
>>> Have you tried the solution suggested here before of shutting down other
>>> vms first, then sys-usb and sys-net? Andrew, I think, posted a simple
>>> script that he uses. I suspect that that will have more impact with
>>> fewer consequences than this proposal, but user experience will be key
>>> here: comments ?
>>
>> Yes, I did try that, this is how I found out that on my system it is not possible to cleanly shut down VMs that hold PCI devices. If I try shutting down sys-net the VM Manager hangs for a few minutes, then the entire system stops responding then the machine gets killed, then VM manager throws an exception and then system becomes responsive again. After setting pci_e820_host to False I can cleanly shutdown sys-net and sys-usb just like any other VM.
>>
>
> So that sounds very system specific. Why not put together a tip
> incorporating Andrew's script ( which will help on almost all
> machines), and then yours as a special case to be used where that
> doesnt help?

I dont't have any e820 pci device as far as I know, but shutdown is
definitely a problem. xfce shuts down, and then I have a black screen
with a blinking cursor, and, afaik unless I brutally remove electricity.
No clue if this is related to Grzesiek's problem ... Bernhard

Andrew David Wong

unread,
Mar 18, 2017, 7:28:18 PM3/18/17
to Grzegorz Chodzicki, Unman, qubes-users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 2017-03-18 09:24, Grzegorz Chodzicki wrote:
>
>
> On 03/18/2017 05:21 PM, Unman wrote:
>> On Sat, Mar 18, 2017 at 08:59:29AM -0700, Grzesiek Chodzicki wrote:
>>> W dniu sobota, 18 marca 2017 15:08:35 UTC+1 użytkownik Unman napisał:
>>>> On Sat, Mar 18, 2017 at 03:41:49AM -0700, Grzesiek Chodzicki wrote:
>>>>> I've experienced this issue myself and I saw some people complaining about it on the mailing list. Sometimes Qubes takes forever to poweroff.
>>>>>
>>>>> The issue is caused by the fact that for some unknown reason machines with PCI devices attached take forever to shutdown and sometimes need to be manually killed from within VM Manager. After manually killing them, the system will shutdown normally.
>>>>>
>>>>> So, here's the fix:
>>>>>
>>>>> In Dom0 run qvm-prefs -s sys-net pci_e820_host false
>>>>>
>>>>> Repeat that for sys-usb and any other machine that holds a PCI device.
>>>>>
>>>>> Your system should shut down normally after this.
>>>>>
>>>>> No, I don't know how or why this works but I know that it solved the issue on my machine. Explanation welcome. I'll add this to documentation once we have a confirmation that this is 100% reproducible.
>>>>>
>>>> I'd be reluctant to propose this as a tip as is, because it will almost
>>>> certainly break networking for some users.
>>>> We specifically set pci_e820 to address user problems. I don't know what
>>>> the intersection is between those for whom this is a fix and those for
>>>> whom shutdown is slow/doesn't happen.
>>>>
>>>> Have you tried the solution suggested here before of shutting down other
>>>> vms first, then sys-usb and sys-net? Andrew, I think, posted a simple
>>>> script that he uses.

Yeah, here it is:

https://github.com/QubesOS/qubes-issues/issues/1581#issuecomment-266266876

(And also in the ML archives.)

>>>> I suspect that that will have more impact with
>>>> fewer consequences than this proposal, but user experience will be key
>>>> here: comments ?
>>> Yes, I did try that, this is how I found out that on my system it is not possible to cleanly shut down VMs that hold PCI devices. If I try shutting down sys-net the VM Manager hangs for a few minutes, then the entire system stops responding then the machine gets killed, then VM manager throws an exception and then system becomes responsive again. After setting pci_e820_host to False I can cleanly shutdown sys-net and sys-usb just like any other VM.
>>>
>> So that sounds very system specific. Why not put together a tip
>> incorporating Andrew's script ( which will help on almost all
>> machines), and then yours as a special case to be used where that
>> doesnt help?
> That's the point, I don't know whether this is specific to my machine
> but I don't have another PC to test so I posted this here so other
> people can try it and see if that alleviates the issue.
>

What if you just qvm-kill sys-net?

- --
Andrew David Wong (Axon)
Community Manager, Qubes OS
https://www.qubes-os.org
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJYzcKAAAoJENtN07w5UDAw/78P/3CXZeKbMtD4LGNu4e6VAuKV
tkzTmEXSZq/cWDLuYPuAlWhwfpHD5y4bOkfLUsswkHQSju4StP83iG1Yahpec6u1
ZNcrGJ0JLCJbqsSSOwLq/xJT9tw5Q0KCju7xOyhG3QkQw2ZdtVkFZEewzn3f/pLS
E/cVqOcZkCw77WkaDX0OM+qwlNN6wzCQemy4HfEhXx+l3rt8I9/OVLNS2PE0Daf6
bcykBIy70Ytdtzou+sU1yFC21e32kqwixJpgwYuIe0qMSWNRoJiBqc7nxZn1y495
21IMMpDnDOWbHyY9jH+7E+PbQ3WfusZze8QcqegQ3afGz/WquMByFHnVJ9Xm8Y0U
ewEdea8ceJ9WdZM2MWx8jD80DlPA43rUChGWAm53blEd7Mu9Z512s2i2SoVWilQS
OE3XMFLWlgAgM9WTuMXLn0yi4UFbHK7+ptT3P9PBRbITbEwkRtvlgZmZ2H2m9G+Q
OwTcNS6g17kqF5sYgTuc+MKY/b44v96UgDWtDhnELbIaImmrxyOkhrZAWy+gwEqk
sGNp2zy3CDMgYo/AMgZMWr0TVzDa1qNPmWNR+hfDZDFUkS/klxh87sQttXIkQ0o9
ckgsWjdnXHP8OncGp5e/5TGIk0CisaERwDH8944pkuYWhj32S1UKdMyKKYIYNSkt
A4nScFTSJttZX9ybEkg9
=iv32
-----END PGP SIGNATURE-----

Jean-Philippe Ouellet

unread,
Mar 18, 2017, 8:40:35 PM3/18/17
to haaber, qubes-users
On Tue, Mar 14, 2017 at 7:11 PM, haaber <haa...@web.de> wrote:
> I dont't have any e820 pci device as far as I know, but shutdown is
> definitely a problem. xfce shuts down, and then I have a black screen
> with a blinking cursor, and, afaik unless I brutally remove electricity.
> No clue if this is related to Grzesiek's problem ... Bernhard

e820 does not refer to a device, but rather a table containing memory
layout information provided by the bios [1].

[1]: http://wiki.osdev.org/Detecting_Memory_(x86)#BIOS_Function:_INT_0x15.2C_EAX_.3D_0xE820

haaber

unread,
Mar 19, 2017, 5:53:05 AM3/19/17
to qubes...@googlegroups.com
Oups :) ! That is funny. So my shutdown pb could be related that I added
a second 8G mem bar? At least both occured approx. simultaneously. I
just never made the link. Bernhard

Grzesiek Chodzicki

unread,
Mar 19, 2017, 7:19:13 AM3/19/17
to qubes-users, grzegorz....@gmail.com, un...@thirdeyesecurity.org
It gets killed as usual, no error messages. It's the qvm-shutdown that doesn't work properly.
Reply all
Reply to author
Forward
0 new messages