Why doesn't "osinfo-query os" detect Ubuntu 18.04?

9,742

Solution 1

You could always take it from the GitLab site then replace it.

Might need to install the git, osinfo-db-tools, intltool and make first

sudo apt install osinfo-db-tools intltool make git

Clone the osinfo from the GitLab page

git clone https://gitlab.com/libosinfo/osinfo-db

Go to the osinfo-db folder

cd osinfo-db/

Prepared the os files

./prepare-release.sh

During the prepare it showed the following line:

osinfo-db-import --root /home/terrance/builder --system osinfo-db-20180830.tar.xz

So, I went to that folder cd ~/builder and it contained a usr folder. All I had to do was copy that folder to the root and it updated

cd ~/builder
sudo cp -Rv * /

And now it detects Ubuntu 18.04

terrance@terrance-ubuntu:~/builder$ osinfo-query os | grep -i ubuntu
 ubuntu10.04          | Ubuntu 10.04 LTS                                   | 10.04    | http://ubuntu.com/ubuntu/10.04          
 ubuntu10.10          | Ubuntu 10.10                                       | 10.10    | http://ubuntu.com/ubuntu/10.10          
 ubuntu11.04          | Ubuntu 11.04                                       | 11.04    | http://ubuntu.com/ubuntu/11.04          
 ubuntu11.10          | Ubuntu 11.10                                       | 11.10    | http://ubuntu.com/ubuntu/11.10          
 ubuntu12.04          | Ubuntu 12.04 LTS                                   | 12.04    | http://ubuntu.com/ubuntu/12.04          
 ubuntu12.10          | Ubuntu 12.10                                       | 12.10    | http://ubuntu.com/ubuntu/12.10          
 ubuntu13.04          | Ubuntu 13.04                                       | 13.04    | http://ubuntu.com/ubuntu/13.04          
 ubuntu13.10          | Ubuntu 13.10                                       | 13.10    | http://ubuntu.com/ubuntu/13.10          
 ubuntu14.04          | Ubuntu 14.04 LTS                                   | 14.04    | http://ubuntu.com/ubuntu/14.04          
 ubuntu14.10          | Ubuntu 14.10                                       | 14.10    | http://ubuntu.com/ubuntu/14.10          
 ubuntu15.04          | Ubuntu 15.04                                       | 15.04    | http://ubuntu.com/ubuntu/15.04          
 ubuntu15.10          | Ubuntu 15.10                                       | 15.10    | http://ubuntu.com/ubuntu/15.10          
 ubuntu16.04          | Ubuntu 16.04                                       | 16.04    | http://ubuntu.com/ubuntu/16.04          
 ubuntu16.10          | Ubuntu 16.10                                       | 16.10    | http://ubuntu.com/ubuntu/16.10          
 ubuntu17.04          | Ubuntu 17.04                                       | 17.04    | http://ubuntu.com/ubuntu/17.04          
 ubuntu17.10          | Ubuntu 17.10                                       | 17.10    | http://ubuntu.com/ubuntu/17.10          
 ubuntu18.04          | Ubuntu 18.04 LTS                                   | 18.04    | http://ubuntu.com/ubuntu/18.04          
 ubuntu4.10           | Ubuntu 4.10                                        | 4.10     | http://ubuntu.com/ubuntu/4.10           
 ubuntu5.04           | Ubuntu 5.04                                        | 5.04     | http://ubuntu.com/ubuntu/5.04           
 ubuntu5.10           | Ubuntu 5.10                                        | 5.10     | http://ubuntu.com/ubuntu/5.10           
 ubuntu6.06           | Ubuntu 6.06 LTS                                    | 6.06     | http://ubuntu.com/ubuntu/6.06           
 ubuntu6.10           | Ubuntu 6.10                                        | 6.10     | http://ubuntu.com/ubuntu/6.10           
 ubuntu7.04           | Ubuntu 7.04                                        | 7.04     | http://ubuntu.com/ubuntu/7.04           
 ubuntu7.10           | Ubuntu 7.10                                        | 7.10     | http://ubuntu.com/ubuntu/7.10           
 ubuntu8.04           | Ubuntu 8.04 LTS                                    | 8.04     | http://ubuntu.com/ubuntu/8.04           
 ubuntu8.10           | Ubuntu 8.10                                        | 8.10     | http://ubuntu.com/ubuntu/8.10           
 ubuntu9.04           | Ubuntu 9.04                                        | 9.04     | http://ubuntu.com/ubuntu/9.04           
 ubuntu9.10           | Ubuntu 9.10                                        | 9.10     | http://ubuntu.com/ubuntu/9.10

Solution 2

To update the osinfo database, which is actually just a collection of XML files, do the following:

1: Install package osinfo-db-tools to get the osinfo-db-import program (at least on Debian'ish distros):

apt update;apt install osinfo-db-tools

2: Download the newest osinfo-db file from releases.pagure.org example:

wget -O "/tmp/osinfo-db.tar.xz" "https://releases.pagure.org/libosinfo/osinfo-db-20200325.tar.xz" 

3: Import the downloaded osinfo-db file:

osinfo-db-import --local "/tmp/osinfo-db.tar.xz"

The new osinfo-db XML files will be located in /etc/osinfo/..

The osinfo-db XML files provided by the original distro package are still located in /usr/share/osinfo.

The newly path created by osinfo-db-import take precedens of the original path.

If you want to overwrite the original osinfo-db XMLs use the option --system instead of --local

(source)

Solution 3

Because it is not available in the XML that provides this information. It is taken from 1 of these locations:

/usr/share/libosinfo/db
/etc/libosinfo/db
${HOME}/.config/libosinfo/db

(the 1st one I guessed ;) )

You can add a file ending on ".xml" in ${HOME}/.config/libosinfo/db and it will be included. Contents of it could be copied from a current already available OS.


The location of the file seems to have changed through the years. This is also possible: |

User location

This is determined by the env variable

$OSINFO_USER_DIR

If not set, then defaults to $XDG_CONFIG_HOME/osinfo If that is not set, then defaults to $HOME/.config/osinfo This location is intended for use by unprivileged users wishing to install local data for use by their applications

Share:
9,742

Related videos on Youtube

DK Bose
Author by

DK Bose

Updated on September 18, 2022

Comments

  • DK Bose
    DK Bose over 1 year

    OS: Kubuntu 18.04.1 (and Ubuntu 18.04.1 in a virtual machine)

    When I run osinfo-query os after installing libosinfo-bin, the output doesn't include Ubuntu 18.04:

    $ osinfo-query os | grep -i ubuntu | cut -d ' ' -f -2
     ubuntu10.04
     ubuntu10.10
     ubuntu11.04
     ubuntu11.10
     ubuntu12.04
     ubuntu12.10
     ubuntu13.04
     ubuntu13.10
     ubuntu14.04
     ubuntu14.10
     ubuntu15.04
     ubuntu15.10
     ubuntu16.04
     ubuntu16.10
     ubuntu17.04
     ubuntu17.10
     ubuntu4.10
     ubuntu5.04
     ubuntu5.10
     ubuntu6.06
     ubuntu6.10
     ubuntu7.04
     ubuntu7.10
     ubuntu8.04
     ubuntu8.10
     ubuntu9.04
     ubuntu9.10
    $
    

    Why is that? And can I somehow update something to get Ubuntu 18.04 included?

    The reason I'm asking is because of:

    Next we passed the --os-variant option. While this is not mandatory, is highly recommended to use it, since it can improve performance of the virtual machine. The option will try to fine tune the guest to the specific OS version. If the option is not passed, the program will attempt to auto-detect the correct value from the installation media.

    which I read in How to create and manage KVM virtual machines from CLI.

    In response to Rinzwind's answer, the output of locate after running sudo updatedb is:

    $ locate libosinfo
    /usr/lib/x86_64-linux-gnu/libosinfo-1.0.so.0
    /usr/lib/x86_64-linux-gnu/libosinfo-1.0.so.0.1001.0
    /usr/share/doc/gir1.2-libosinfo-1.0
    /usr/share/doc/libosinfo-1.0-0
    /usr/share/doc/libosinfo-bin
    /usr/share/doc/gir1.2-libosinfo-1.0/changelog.Debian.gz
    /usr/share/doc/gir1.2-libosinfo-1.0/copyright
    /usr/share/doc/libosinfo-1.0-0/NEWS.gz
    /usr/share/doc/libosinfo-1.0-0/README
    /usr/share/doc/libosinfo-1.0-0/changelog.Debian.gz
    /usr/share/doc/libosinfo-1.0-0/copyright
    /usr/share/doc/libosinfo-bin/changelog.Debian.gz
    /usr/share/doc/libosinfo-bin/copyright
    /var/cache/apt/archives/libosinfo-bin_1.1.0-1_amd64.deb
    /var/lib/dpkg/info/gir1.2-libosinfo-1.0:amd64.list
    /var/lib/dpkg/info/gir1.2-libosinfo-1.0:amd64.md5sums
    /var/lib/dpkg/info/libosinfo-1.0-0:amd64.list
    /var/lib/dpkg/info/libosinfo-1.0-0:amd64.md5sums
    /var/lib/dpkg/info/libosinfo-1.0-0:amd64.shlibs
    /var/lib/dpkg/info/libosinfo-1.0-0:amd64.symbols
    /var/lib/dpkg/info/libosinfo-1.0-0:amd64.triggers
    /var/lib/dpkg/info/libosinfo-bin.list
    /var/lib/dpkg/info/libosinfo-bin.md5sums
    

    Neither /usr/share/libosinfo/db or /etc/libosinfo/db are present.


    Running locate os-info as suggested by Rinzwind did the job:

    $ locate osinfo | grep ubuntu
    /usr/share/osinfo/install-script/ubuntu.com
    /usr/share/osinfo/install-script/ubuntu.com/ubuntu-preseed-jeos.xml
    /usr/share/osinfo/os/ubuntu.com
    /usr/share/osinfo/os/ubuntu.com/ubuntu-10.04.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-10.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-11.04.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-11.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-12.04.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-12.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-13.04.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-13.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-14.04.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-14.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-15.04.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-15.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-16.04.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-16.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-17.04.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-17.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-4.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-5.04.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-5.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-6.06.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-6.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-7.04.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-7.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-8.04.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-8.10.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-9.04.xml
    /usr/share/osinfo/os/ubuntu.com/ubuntu-9.10.xml
    $ 
    

    It should now be easy to add /usr/share/osinfo/os/ubuntu.com/ubuntu-18.04.xml. Though it still leaves open the question of why it wasn't included in the first place.

    • Terrance
      Terrance over 5 years
      I tried copying the 17.10.xml and editing it. Way too much info in there. Found it easier from the GitLab and just replace them. I did edit my answer a lot this morning as this was the first time I messed with the osinfo but I think I got something that works.
    • Michael Hampton
      Michael Hampton over 5 years
      Because time travel hasn't been invented yet, 18.04 shipped with an osinfo-db that did not include it. Hopefully they will update it at some point.
  • DK Bose
    DK Bose over 5 years
    I edited my question because I couldn't find libosinfo/db in either of the two suggested locations.
  • Rinzwind
    Rinzwind over 5 years
    Do you have a /etc/osinfo? or a $HOME/.config/osinfo?
  • DK Bose
    DK Bose over 5 years
    Yes, thanks! locate osinfo churned out quite a lot. I'll add that to my question.
  • JustATrick
    JustATrick about 2 years
    osinfo-db-import also supports a third option called --user, which allows the info to be used by an unprivileged local user without affecting other users
  • JustATrick
    JustATrick about 2 years
    The default $OSINFO_USER_DIR has changed again since this answer was written, so that libosinfo/db seems to be deprecated. Using osinfo-db-import (as mentioned in @MrCalvin 's answer) with its --user option is probably the best way to always find the right place.
  • Admin
    Admin almost 2 years
    the tests our failing the build