Vanguards error

Hi, from some days i have this problem with whonix qube. I think this problem was generated after the last update. I have also reinstalled the template, from dom0 and i have restarted the notebook but the problem persist.

Thank for the support.

Tommaso

I see in the whonix log files and found this error:

Nov 22 13:23:43 host vanguards[2340]: NOTICE[Tue Nov 22 13:23:43 2022]: Vanguards 0.3.1 connected to Tor 0.4.7.10 using stem 1.8.0
Nov 22 13:23:44 host vanguards[2340]: Traceback (most recent call last):
Nov 22 13:23:44 host vanguards[2340]: File “/usr/bin/vanguards”, line 11, in
Nov 22 13:23:44 host vanguards[2340]: load_entry_point(‘vanguards==0.3.1’, ‘console_scripts’, ‘vanguards’)()
Nov 22 13:23:44 host vanguards[2340]: File “/usr/lib/pypy/dist-packages/vanguards/main.py”, line 22, in main
Nov 22 13:23:44 host vanguards[2340]: run_main()
Nov 22 13:23:44 host vanguards[2340]: File “/usr/lib/pypy/dist-packages/vanguards/main.py”, line 61, in run_main
Nov 22 13:23:44 host vanguards[2340]: ret = control_loop(state)
Nov 22 13:23:44 host vanguards[2340]: File “/usr/lib/pypy/dist-packages/vanguards/main.py”, line 98, in control_loop
Nov 22 13:23:44 host vanguards[2340]: state.new_consensus_event(controller, None)
Nov 22 13:23:44 host vanguards[2340]: File “/usr/lib/pypy/dist-packages/vanguards/vanguards.py”, line 222, in new_consensus_event
Nov 22 13:23:44 host vanguards[2340]: self.consensus_update(routers, weights, exclude_nodes)
Nov 22 13:23:44 host vanguards[2340]: File “/usr/lib/pypy/dist-packages/vanguards/vanguards.py”, line 170, in consensus_update
Nov 22 13:23:44 host vanguards[2340]: weights, BwWeightedGenerator.POSITION_MIDDLE)
Nov 22 13:23:44 host vanguards[2340]: File “/usr/lib/pypy/dist-packages/vanguards/NodeSelection.py”, line 150, in init
Nov 22 13:23:44 host vanguards[2340]: NodeGenerator.init(self, sorted_r, rstr_list)
Nov 22 13:23:44 host vanguards[2340]: File “/usr/lib/pypy/dist-packages/vanguards/NodeSelection.py”, line 60, in init
Nov 22 13:23:44 host vanguards[2340]: self.rebuild(sorted_r)
Nov 22 13:23:44 host vanguards[2340]: File “/usr/lib/pypy/dist-packages/vanguards/NodeSelection.py”, line 142, in rebuild
Nov 22 13:23:44 host vanguards[2340]: self.node_weights.append(r.measured*self.flag_to_weight(r))
Nov 22 13:23:44 host vanguards[2340]: File “/usr/lib/pypy/dist-packages/vanguards/NodeSelection.py”, line 101, in flag_to_weight
Nov 22 13:23:44 host vanguards[2340]: return self.bw_weights[u’Wmm’]/self.WEIGHT_SCALE
Nov 22 13:23:44 host vanguards[2340]: KeyError: u’Wmm’

Hi there,
it’s a really strange error.
If it persists and no new suggestions incoming, I think You need:

  • restore template and VM from backup
    or
  • uninstall and reinstall it (as reported there)

Cheers,
M.

Hi, thank you for the support. I tryied to start qubes-dom0-update with action reinstall, but the problem was’n fixed. The solution that i found i to create other qube (sys-whonix-41) with network functionality and connect others vm to this. In this way work, but between the connected qube found also the template “fedora-32” and i received a warning for connecting a template to a qube. Now the notebook work fine. Do you think that this fix is fine or can be cause problems?

Hi there,
from dom0, run
~ qubes-prefs updatevm
if output is sys-whonix, we know why “reinstall” failed.
Another hint may be: rename not working appVM in “.old” so reinstall can work…
So, if now networking it’s ok, I think You can relaunch “reinstall” and it has to work.
If not, You may be affected from this bug: qvm-template reinstall broken - qvm-template: error: Same version of template 'debian-11' not found. / Same version of template 'whonix-gw-16' not found. · Issue #7250 · QubesOS/qubes-issues · GitHub
Then You can consider if restore original or desired path of your networking environment, or not…
I hope this may help You.
Cheers,
M.

To me, it’s not clear what exact problem do you have.

Hello Mila, thank you for your support.
The same situation happened yesterday also with the new qube/template. The pc had blocked (I have a few years old HP Elitebook) while it was or was going to sleep and I had to shut down the pc brutally by holding down the power button. This morning sys-whonix-41 (the new qube) behaved the same way. That process (Vanguards) kept restarting itself continuously. It had never happened to me with Qubes, until now (I’ve been using it for about a year) it’s always been very stable. From what I understand, there is some problem when the PC is suspended or restarted so that some persistent data (of qube sys-whonix) is damaged in that qube.
After redoing the original qube, it works fine. I made a backup and in case it gets damaged I’ll restore it. But this is new, I think (…), new updates.

Hi there,
restart, don’t think so, but suspend, maybe…
Cheers,
M.

Hi, i also think so.
But this situation beginning with latest upgrades.
Before never happen.

Other problem appened only one time, always whonix, when the notebook started, need to be killed (whonix) but after workwd fine.
But this situazione was solved.

Now when the notebook going in suspended mode the cpu stuck…
The problem is that the shutdown and start require a lot of time… and the suspension of the notebook is mandatori

Hi there.
I understand your needs, but keep in mind that qubes is more a bare metal hypervisor, then a standard linux distro, so try to avoid - at least until bug solved - the suspension mode…
If You think about it: each VMs have to be suspended to disk, before dom0 can hybernate its state…
Less or more, it’s a shutdown!
:sweat_smile:
Cheers,
M.

Im trying to write this script to reinstall from scratch sys-whonix:

qvm-ls | awk ‘$6 == “sys-whonix” {print $1}’ > /tmp/vms

for V in $(cat /tmp/vms)
do
if [ “x$V” = “x” ]
then
continue
fi

echo "Spengo $V"
qvm-shutdown --wait $V
if [ $? -ne 0 ]
then
	echo "Fallimento nello shutdown di questa VM"
	exit 1
fi

echo "Cambio rete per $V"
qvm-prefs $V netvm None
if [ $? -ne 0 ]
then
	echo "Fallimento nella impostazione a None della rete per questa VM"
	exit 2
fi

done

echo “Spengo Whonix”
qvm-shutdown --wait sys-whonix
if [ $? -ne 0 ]
then
echo “Impossibile fermare Whonix”
exit 3
fi

echo “Rimuovo Whonix”
qvm-remove --force sys-whonix
if [ $? -ne 0 ]
then
echo “Impossibile rimuovere Whonix”
exit 4
fi

echo “Reinstalo il nuovo template”
qubes-dom0-update --enablerepo=qubes-templates-community --action=reinstall qubes-template-whonix-gw-16
if [ $? -ne 0 ]
then
echo “Impossibile installare il nuovo template Whonix”
exit 4
fi

qvm-run -p -u root whonix-gw-16 apt-get update
qvm-run -p -u root whonix-gw-16 apt-get upgrade -y
qvm-run -p -u root whonix-gw-16 halt

echo “Creo la nuova Whonix”
qvm-create
–class=AppVM
–template=whonix-gw-16
–label=black
–property autostart=True
–property provides_network=True
–property autostart=True
sys-whonix

if [ $? -ne 0 ]
then
echo “Impossibile creare Whonix”
exit 5
fi

echo “Avvio la nuova Whonix”
qvm-start-daemon sys-whonix
if [ $? -ne 0 ]
then
echo “Impossibile avvia Whonix”
exit 6
fi

for V in $(cat /tmp/vms)
do
echo “Reimposto la rete Whonix per $V”
qvm-prefs $V netvm sys-whonix
if [ $? -ne 0 ]
then
echo “Impossibile impostare a Whonix la rete per la VM $V”
exit 7
fi
done

exit 0

Hi there.

Great job, thanks for sharing it here.

May be more useful if reported in english…
Let me try:

“SHutting down $V”

“Failed shutdown of this VM”

“Changing network for $V”

“Failed setting to none of networking for this VM”

“Shutting down Whinix”

“Impossible to stop Whonix”

“Removing Whonix”

“Impossible to remove Whonix”

“Reinstalling new template”

“Impossible to install new Whonix template”

“Impossible to create Whonix”

“Starting new Whonix”

“Impossible to start Whonix”

“Resetting network for Whonix”

“Impossible to set network to Whonix for VM $V”

Cheers,
M.

Sorry… yes. :slight_smile:
While waiting for the bug to be resolved, I added a widget in the upper right corner, next to the clock, which shuts down whonix and the vm behind it (the problem is that behind Whonix I have a mini-infrastructure, with vpn etc and every time it takes a long time to start). This way the suspension doesn’t hang and I don’t have to restart the notebook from scratch.