1

I tried to install KVM on ubuntu 17.10 and got this error:

**anuragabhi@abhishek-Notebook:~$** sudo aptitude install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils

[sudo] password for anuragabhi: 
The following NEW packages will be installed:

    at{a} augeas-lenses{a} bridge-utils dctrl-tools{a} debootstrap{a} devscripts{a} dmeventd{a} dput{a} ebtables{a} ipxe-qemu{a} 
    kpartx{a} libaugeas0{a} libb-hooks-endofscope-perl{a} libboost-random1.62.0{a} libboost-regex1.62.0{a} libcacard0{a} 
    libclass-method-modifiers-perl{a} libclass-xsaccessor-perl{a} libdata-optlist-perl{a} libdevel-globaldestruction-perl{a} 
    libdevmapper-event1.02.1{a} libdistro-info-perl{a} libfdt1{a} libfile-chdir-perl{a} libfile-homedir-perl{a} libfile-which-perl{a}
    libgetopt-long-descriptive-perl{a} libgit-wrapper-perl{a} libibverbs1{a} libimport-into-perl{a} libio-stringy-perl{a} libiscsi7{a} 
    liblist-compare-perl{a} liblvm2app2.2{a} liblvm2cmd2.02{a} libmodule-implementation-perl{a} libmodule-runtime-perl{a} 
    libmoo-perl{a} libnamespace-clean-perl{a} libnetcf1{a} libnumber-compare-perl{a} libnumber-range-perl{a} libpackage-stash-perl{a}
    libpackage-stash-xs-perl{a} libparams-classify-perl{a} libparams-util-perl{a} libparams-validate-perl{a} 
    libpath-iterator-rule-perl{a} libpath-tiny-perl{a} libpod-constants-perl{a} librados2{a} librbd1{a} libreadline5{a}
    librole-tiny-perl{a} libsort-key-perl{a} libsort-versions-perl{a} libspice-server1{a} libstrictures-perl{a}
    libstring-copyright-perl{a} libstring-escape-perl{a} libsub-exporter-perl{a} libsub-exporter-progressive-perl{a}
    libsub-identify-perl{a} libsub-install-perl{a} libsub-quote-perl{a} libtext-glob-perl{a} libtry-tiny-perl{a} 
    libunicode-utf8-perl{a} libusbredirparser1{a} libvariable-magic-perl{a} libvirt-bin libvirt-clients{a} libvirt-daemon{a} 
    libvirt-daemon-system{a} libvirt0{a} libxen-4.9{a} libxenstore3.0{a} libxml2-utils{a} licensecheck{a} lvm2{a} python-cheetah{a} 
    python-libvirt{a} python-vm-builder{a} python3-magic{a} python3-unidiff{a} qemu-block-extra{a} qemu-kvm qemu-system-common{a} 
    qemu-system-x86{a} qemu-utils{a} seabios{a} sharutils{a} ubuntu-vm-builder wdiff{a}

The following partially installed packages will be configured:
    install-info  
0 packages upgraded, 94 newly installed, 0 to remove and 49 not upgraded.
Need to get 0 B/21.4 MB of archives. After unpacking 91.9 MB will be used.
Do you want to continue? [Y/n/?] y
Extracting templates from packages: 100% 
Preconfiguring packages ...
Setting up install-info (6.4.90.dfsg.1-1build1) ...
/usr/sbin/update-info-dir: 3: /etc/environment: $: not found
dpkg: error processing package install-info (--configure):
    subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
    install-info
E: Sub-process /usr/bin/dpkg returned an error code (1)
Setting up install-info (6.4.90.dfsg.1-1build1) ...
/usr/sbin/update-info-dir: 3: /etc/environment: $: not found
dpkg: error processing package install-info (--configure):
     subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
     install-info

To solve DPKG error, I tried the solution given in the link:

E: Sub-process /usr/bin/dpkg returned an error code (1) [related to google chrome]

But nothing seems to work.

I tried some commands, and the output is as follows:

anuragabhi@abhishek-Notebook:~$ cat /usr/sbin/update-info-dir
#!/bin/sh
# update-info-dir
# create a dir file from all installed info files
# Copyright 2009, 2014 Norbert Preining
# GPLv2

unset LANGUAGE
unset LANG
if [ -r /etc/environment ] ; then
      . /etc/environment
fi
if [ -r /etc/default/locale ] ; then
    . /etc/default/locale
fi

Help ()
{
    echo "\
SYNOPSIS: update-info-dir [-h,--help] [info-directory]

(re-)creates the index of available documentation in info format
(the file /usr/share/info/dir) which is usually presented by info 
browsers
on startup."

    exit 0
}


if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
    Help
fi

if [ -n "$1" ] ; then
    INFODIR="$1"
fi

if [ ! -d "$INFODIR" ] ; then
    echo "Not a directory: $INFODIR." >&2
    exit 1
fi

if [ -r "$INFODIR/dir" ] ; then
    rm -f "$INFODIR/dir.old"
    cp $INFODIR/dir $INFODIR/dir.old
fi

# we have to remove the dir file not make install-info being surprised
rm -f "$INFODIR/dir"

errors=0
find "$INFODIR" -type f | while read file ; do
    case $file in
    */dir|*/dir.gz|*/dir.old|*/dir.old.gz|*-[0-9]|*-[0-9].gz|*-[1-9]
[0-9]|*-[1-9][0-9].gz|*.png|*.jpg)
      # these files are ignored
      continue
    ;;
*)
    install-info "$file" "$INFODIR/dir" || {
    errors=$((errors+1))
  }
  ;;
    esac
done

if [ $errors -gt 0 ] ; then
    exec >&2
    echo
    echo "Updating the index of info documentation produced $errors 
    errors."
fi

exit 0

# vim:set expandtab tabstop=2: #

and:

anuragabhi@abhishek-Notebook:~$ cat /etc/environment

PATH=" 
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/g a
mes:/usr/local/games"


$ cat >> etc/environment <<EOL
JAVA_HOME=/usr/bin/lib/jvm/java-8-oracle
JRE_HOME=/usr/lib/jvm/java-8-oracle/jre
EOL
1

The first error message tells the tale: /usr/sbin/update-info-dir: 3: /etc/environment: $: not found. As you can see, the update-info-dir script only uses /etc/environment as a parameter to . it (. is also the bash command source), to set some parameters in the environment of the current process.

On my Ubuntu 16.04.4 system (YMMV), it contains the initial setting of PATH, a Very Important Variable. PATH is the colon-separated list of directories along which bash searches for executables.

You can fix your problem:

/usr/bin/sudo /bin/rm /etc/environment
echo 'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" | /usr/bin/sudo /usr/bin/tee /etc/environment'
/bin/chmod 0644 /etc/environment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.