[Bug 2020826] [NEW] typo systemds-detect-virt

Seth Arnold 2020826 at bugs.launchpad.net
Fri May 26 00:50:37 UTC 2023


Public bug reported:

Hello, this was reported in Debian:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1026026

$ rg systemds-detect
needrestart/kinetic/needrestart-3.6/needrestart
54:if($is_systemd && -x q(/usr/bin/systemds-detect-virt)) {

needrestart/lunar/needrestart-3.6/needrestart
54:if($is_systemd && -x q(/usr/bin/systemds-detect-virt)) {


Note that /usr/bin/systemds-detect-virt doesn't exist. It should be /usr/bin/systemd-detect-virt. Apparently installing libimvirt-perl is enough to work around the issue:

if($is_systemd && -x q(/usr/bin/systemds-detect-virt)) {
        # check if we are inside of a vm
        my $ret = system(qw(/usr/bin/systemd-detect-virt --vm --quiet));
        unless($? == -1 || $? & 127) {
                $is_vm = ($? >> 8) == 0;
        }

        # check if we are inside of a container
        $ret = system(qw(/usr/bin/systemd-detect-virt --container --quiet));
        unless($? == -1 || $? & 127) {
                $is_container = ($? >> 8) == 0;
        }
}
elsif(eval "use ImVirt; 1;") {
        require ImVirt;
        ImVirt->import();
        my $imvirt = ImVirt::imv_get(ImVirt->IMV_PROB_DEFAULT);

        $is_vm = $imvirt ne ImVirt->IMV_PHYSICAL;
        $is_container = $imvirt eq ImVirt->IMV_CONTAINER;
}
elsif (-r "/proc/1/environ") {
        # check if we are inside of a container (fallback)
    local $/;
    open(HENV, '<', '/proc/1/environ');
    $is_container = scalar(grep {/^container=/;} unpack("(Z*)*", <HENV>));
    close(HENV)
}


Thanks

** Affects: needrestart (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to needrestart in Ubuntu.
https://bugs.launchpad.net/bugs/2020826

Title:
  typo systemds-detect-virt

Status in needrestart package in Ubuntu:
  New

Bug description:
  Hello, this was reported in Debian:

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1026026

  $ rg systemds-detect
  needrestart/kinetic/needrestart-3.6/needrestart
  54:if($is_systemd && -x q(/usr/bin/systemds-detect-virt)) {

  needrestart/lunar/needrestart-3.6/needrestart
  54:if($is_systemd && -x q(/usr/bin/systemds-detect-virt)) {

  
  Note that /usr/bin/systemds-detect-virt doesn't exist. It should be /usr/bin/systemd-detect-virt. Apparently installing libimvirt-perl is enough to work around the issue:

  if($is_systemd && -x q(/usr/bin/systemds-detect-virt)) {
          # check if we are inside of a vm
          my $ret = system(qw(/usr/bin/systemd-detect-virt --vm --quiet));
          unless($? == -1 || $? & 127) {
                  $is_vm = ($? >> 8) == 0;
          }

          # check if we are inside of a container
          $ret = system(qw(/usr/bin/systemd-detect-virt --container --quiet));
          unless($? == -1 || $? & 127) {
                  $is_container = ($? >> 8) == 0;
          }
  }
  elsif(eval "use ImVirt; 1;") {
          require ImVirt;
          ImVirt->import();
          my $imvirt = ImVirt::imv_get(ImVirt->IMV_PROB_DEFAULT);

          $is_vm = $imvirt ne ImVirt->IMV_PHYSICAL;
          $is_container = $imvirt eq ImVirt->IMV_CONTAINER;
  }
  elsif (-r "/proc/1/environ") {
          # check if we are inside of a container (fallback)
      local $/;
      open(HENV, '<', '/proc/1/environ');
      $is_container = scalar(grep {/^container=/;} unpack("(Z*)*", <HENV>));
      close(HENV)
  }

  
  Thanks

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/needrestart/+bug/2020826/+subscriptions




More information about the foundations-bugs mailing list