:: [DNG] Microsoft azure and devuan
Top Page
Delete this message
Reply to this message
Author: Peter Duffy
Date:  
To: DNG
Subject: [DNG] Microsoft azure and devuan
Quite a long time ago, I mentioned that I'd been tasked with upgrading
some linux VMs running under Microsoft Azure, and had decided to try to
use devuan. I then found that devuan wouldn't work under azure. The
problem was walinuxagent - aka waagent and azurelinuxagent, the glue
layer which sits between the azure infrastructure and linux, and
enables azure to do things like start and stop VMs and collect stats
and metrics. It didn't work properly under devuan.

It turned out that there were actually two problems:

- walinuxagent needs to know about each supported distro, and hadn't
been told about devuan: the default for unsupported distros was to
assume that systemd was present.

- to determine the distro under which it was running, walinuxagent used
the python function platform.linux_distribution. This was incapable of
distinguishing between devuan and debian (when run under devuan, it
claimed that the distro was debian).

Figuring out the context of the problem was difficult. It wasn't a
devuan problem, as the walinuxagent package is taken directly from the
debian repo; it wasn't a debian problem as the problem was in
walinuxagent; the first part of the problem could be fixed by telling
walinuxagent about devuan; python already had a new module/function
distro.linux_distribution which was able to distinguish between debian
and devuan, and walinuxagent fell back to this if
platform.linux_distribution was not found - but if the latter was
available, it would use it.

Eventually, I decided to work on this myself. The walinuxagent repo is
on github, so I forked it onto my own github account. Adding devuan as
a known distro was fairly trivial (there's a structure built into
walinuxagent to enable extra distros to be added and to tell it whether
or not to use systemd). I then wrote a chunk of extra python code which
would be called whenever platform.linux_distribution() was called and
returned a result of "debian", and would re-check to see if it was
really devuan. I got this all to work, and created an azure VM running
devuan (beowulf). It seemed to work fine (the VM has now been in
service for over 1.5 years). I then raised a pull request on the
upstream azure walinuxagent repo to merge my changes.

My pull request was acknowledged and put up for a code review - but for
some reason, nothing further happened for a long time (maybe it was to
do with problems caused by the pandemic). I have to admit that I had
concerns about my extra code. I'd done extensive testing - but it was a
big chunk of code which referenced a number of things in the linux
environment, any of which could change independently of walinuxagent. I
was conscious that if it was merged into the main repo, it would
eventually get run on every debian-based VM in azure, and if there was
something that I'd overlooked and which caused problems, it would cause
problems on all of them. To put it mildly, that would probably be Bad
News.

Then chimaera appeared - and from my point of view, there was one
extremely useful enhancement: debian bullseye, and therefore devuan
chimaera, had moved to python 3.9. In python 3.8, the buggy and
unreliable platform.linux_distribution had been removed. This forced
walinuxagent to use distro.linux_distribution - and as this could
distinguish between debian and devuan, my extra python code wasn't
needed any more. So I cancelled the old pull request and started again,
and this time just made the changes to walinuxagent to allow it to
recognise devuan and use non-systemd utilities and functions on the VM.
I then raised another pull request on the azure walinuxagent upstream
repo, and after correcting a few issues, I heard on Wednesday that my
changes have been merged. So when the next release of walinuxagent
appears in the distros, it should support devuan. This should make it
generally possible to run devuan VMs under azure.

If anyone wants to have a look at my code, it can be cloned from my
github account: https://github.com/peter9370/WALinuxAgent The version
which works on chimaera and hopefully later releases is in the branch
"devuan_support_new". There's also a branch
"devuan_support_pre_chimaera" which contains the version including my
extra code, which worked on beowulf. I'm not sure when the next release
is due: I'll keep an eye on the upstream repo.

Apologies for the length of that - it's been a long journey, and
difficult to summarise concisely.