Error: Alternate path /usr/bin/g++-5 does not exist

asked 2017-11-19 23:03:45 -0600

sumitsharma gravatar image

After creating a jail (amd64) through debootstrap, I am using update-alternatives to install g++-5 but it is throwing back this error in the log. I am running this command through shell script and also have tried directly through puppet, still the error was same.

myshellscript.sh

chroot $target_amd64/ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 10
chroot $target_amd64/ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10
chroot $target_amd64/ update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 10
chroot $target_amd64/ update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20
chroot $target_amd64/ update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
chroot $target_amd64/ update-alternatives --set cc  /usr/bin/gcc
chroot $target_amd64/ update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
chroot $target_amd64/ update-alternatives --set c++ /usr/bin/g++

init.pp

exec { 'execute_script':
    command => 'sh /usr/share/puppet/modules/amd64_jail/files/myshellscript.sh',
    path => ['/usr/sbin/','/usr/bin/','/bin/','/sbin'],
    timeout => 50000,
}

It is installing correctly for gcc-4.7, g++4.7, gcc-5 but not for g++-5. While, if I run this command manually on my Virtual Machine (Ubuntu 16.04), it gives no error.

edit retag flag offensive close merge delete