Posts tagged windows


winget sucks. Why?

:: microsoft, packaging, sysadmin, windows, winget

By: Maciej Barć

I would have stopped myself from writing about winget but far too many times when I do a full package set upgrade some package does not install correctly.

Running too many install hooks

Sometimes package installation may fail because “same version of the package is installed”… Wait! What? How is the version I am updating already installed? Well I got this bizarre error (that probably indicates a more serious bug) when trying to update Docker Desktop via winget.

What often happens is that because winget runs the package install / update executable, that is a binary, we do not know exactly what it could do, want or expect. So, what you might get is that the software actually expects you to invoke the updater in a different way.

Not enough installer checks

This is a even more annoying bug that, after executing the installer the package in question package does not register itself. I have hit this bug with a package very crucial to me - GNU Emacs.

It is true that this should be fixed by the upstream project because the installer is just broken, but most of those bugs are known. So, is there no mechanism that we can use to register GNU Emacs ourselves? I just do not get why is there no check to see if the package is actually installed or uninstalled. Honestly quite insane!

Proper CI/CD

I think the winget issues can be mitigated by implementing a proper CI/CD for packages. Below I propose a system that will test packages in two clean runs:

  1. Installation checks.

    This step would consist of 3 actions to determine correct installation and removal of the package:

    • install the package and check if it installed correctly
    • install the package again, if the package registered correctly during the previous step, then no installation phase should run and this step would catch the mentioned beforehand GNU Emacs bug
    • uninstall the package to check if it is removed correctly
  2. Update test.

    Very simple - two steps: install older version of a package and hen attempt to update it. I guarantee lot of packages will not pass this with out-of-the-box configuration.

Time hackery in VirtualBox

:: hacking, virtualbox, virtualization, vm, windows

By: Maciej Barć

Unwanted (VDI) present

Recently I was given a task to run a outdated piece of commercial software on a very outdated (in)famous operating system. Unlucky for me on the given VDI (VirtualBox disk image) the so-called “Guests Additions” that enabled “better” time synchronization were already installed.

Fighting VBox time

So, this is what I had to do to keep the old clock:

  • turn off networking card in the virtual machine configuration, because we do not want the system to use NTP or other newt service to get the “new” time,
  • disable getting the host’s clock time: VBoxManage setextradata "WinXP" "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1,
  • and… this magic: VBoxManage modifyvm "WinXP" --biossystemtimeoffset "-341597644449", this thing does the very weird thing of telling the virtual machine BIOS how much to set it back in time, the offset here is total milliseconds between some old date and current date.

Getting the old date

With the Python script snippet below you will get the milliseconds to set back the VirtualBox clock to 01.01.2012 01:00.

1
2
3
4
from datetime import datetime

round((datetime.strptime("01.01.2012 01:00", "%d.%m.%Y %H:%M")
      - datetime.now()).total_seconds() * 1000)