distro icon indicating copy to clipboard operation
distro copied to clipboard

CloudLinux VM not recognized

Open adamjstewart opened this issue 5 years ago • 22 comments

I've encountered a CloudLinux VM that distro is unable to recognize:

$ distro
Name: 
Version: 
Codename: 
$ python -c 'import distro; print(distro.linux_distribution())'
('', '', '')

The problem is that none of the normal search strategies work:

$ which lsb_release
/usr/bin/which: no lsb_release in (...)
$ ls /etc/*release
ls: cannot access /etc/*release: No such file or directory
$ ls /etc/*version
ls: cannot access /etc/*version: No such file or directory
$ uname -a
Linux web.illinois.edu 3.10.0-962.3.2.lve1.5.24.9.el7.x86_64 #1 SMP Wed Feb 13 08:24:50 EST 2019 x86_64 x86_64 x86_64 GNU/Linux
$ cat /proc/version
Linux version 3.10.0-962.3.2.lve1.5.24.9.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Wed Feb 13 08:24:50 EST 2019

The only strategy that seems to work is:

$ hostnamectl
   Static hostname: web.illinois.edu
         Icon name: computer-vm
           Chassis: vm
           Boot ID: 5b5b8c522ccd4974808f192aea001491
    Virtualization: kvm
  Operating System: CloudLinux 7.6 (Vladimir Lyakhov)
       CPE OS Name: cpe:/o:cloudlinux:cloudlinux:7.6:GA:server
            Kernel: Linux 3.10.0-962.3.2.lve1.5.24.9.el7.x86_64
      Architecture: x86-64

We may need to add another search strategy to support this type of VM.

adamjstewart avatar Mar 27 '19 04:03 adamjstewart

Hey @adamjstewart, do you know where the CPE is provisioned in such an environment ? Thanks, bye 👋

HorlogeSkynet avatar Feb 05 '22 20:02 HorlogeSkynet

What is a CPE?

adamjstewart avatar Feb 05 '22 20:02 adamjstewart

Common Platform Enumeration, look at hostnamectl output. I'll do some research on my own soon.

HorlogeSkynet avatar Feb 06 '22 09:02 HorlogeSkynet

Hostnamectl output is attached above. Is there something else you need from me?

adamjstewart avatar Feb 06 '22 14:02 adamjstewart

So we are looking for OperatingSystemPrettyName and OperatingSystemCPEName D-Bus attributes (see sources).

If we can manage to fetch them without reading from the bus (maybe they are provisioned on the file system too ?), we could then implement a trivial CPE parser and extract information from there.

HorlogeSkynet avatar Feb 06 '22 15:02 HorlogeSkynet

I recursively grepped the entire OS for those strings but didn't find anything useful. Maybe it would be easier to build a hostnamectl parser?

adamjstewart avatar Feb 06 '22 19:02 adamjstewart

Thanks for trying this. hostnamectl --json=short could make this straightforward.

Maybe we are missing something, and others got a better idea ? Another way would be to read from D-Bus directly... A Python dependency is required though. See you 👋

HorlogeSkynet avatar Feb 06 '22 20:02 HorlogeSkynet

This version of hostnamectl doesn't have a --json option.

adamjstewart avatar Feb 06 '22 20:02 adamjstewart

So re.search around hostnamectl output, or something like dcar if we want to stop calling binaries directly in the future.

HorlogeSkynet avatar Feb 08 '22 07:02 HorlogeSkynet