Score:0

unable to execute /usr/bin/apt-get: no such file or directory when installing OpenSSH

sa flag

I am running an Ubuntu VM on virtualbox and when I enter this command:

sudo apt-get install openssh-server openssh-client

I get the following message:

unable to execute /usr/bin/apt-get: No such file or directory

I am trying to connect the VM to WinSCP , I downloaded the apt package and this it's in this directory: (output of whereis apt)

apt: /usr/bin/apt /usr/lib/apt /etc/apt /usr/share/man/man8/apt.8.gz

I installed this version:

apt_2.5.3ubuntu0.1_i386.deb

How can I fix this??

David avatar
cn flag
If that is a full list of where apt-get can be found the error is correct. It is not in /usr/bin/apt-get. This must be the PATH the OS is expecting to find apt-get
Noor avatar
sa flag
@David yes sorry, I thought apt and apt-get are the same packages, I'm very new to using the ubuntu OS ,but I checked for the apt-get package entering `whereis apt-get` and this is it's path : `apt-get: /usr/bin/apt-get /usr/share/man/man8/apt-get.8.gz`
pzkpfw avatar
us flag
Please add the output of `grep "" /etc/*-release` to your question.
Noor avatar
sa flag
@pzkpfw I added the output to the question
muru avatar
us flag
Please don't post screenshots of text.
Artur Meinild avatar
vn flag
Can't you roll back to a VM snapshot before you messed up?
Score:2
vn flag

You did something very reckless, and I'm puzzled as to why you did this in the first place.

You installed an unsupported version of apt, and you forced installation of binaries for the wrong platform (i386).

Since it's a VM, I would suppose you have a snapshot or something similar, so you can roll back.

Should this not be the case (?), you will have to reinstall the correct version of apt manually with all dependencies.

Take a look at the package list here, for the correct version of apt.

For this package, and each package listed as a dependency, you should download the package manually, and then run:

sudo dpkg -i <package-file-name>

For a double check, do:

dpkg -l | grep i386

If there are still any apt-related packages left with i386 architecture, download and reinstall those as well with the previous command.

After this is done, you should have restored the correct version of apt to your system.

Tip for the future - do not mess with any of these packages:

  • apt, glibc, python, systemd
  • Any packages, where you're not completely sure of the consequences if it's messed up
Noor avatar
sa flag
thank you for the help but I have some questions, I'm not sure if I understand what you mean that I forced the wrong installation of binaries , do you mean I need to download the apt package from the browser in the VM and from the link you attached to your answer and choose the one that matches the VM architecture ? I'm not sure about the architecture type but I think it's amd 64 bit and the terminal doesn't open when I click on it so I will try to use the failsafe terminal is this fine?
Artur Meinild avatar
vn flag
You wrote you installed `apt_2.5.3ubuntu0.1_i386.deb` - this is the `i386` version of `apt` (for Kinetic Kudu) - so you did something risky and broke the system. You can get the architecture by running `uname -i` - if it says `x86_64` it equals `amd64`. Sounds fine with the terminal - if all else fails you should probably reinstall and restore the system.
Noor avatar
sa flag
the link you provided has security concerns and Firefox on the VM forbids downloading the package. can I use wget command with a url ? if so what should I write?
Artur Meinild avatar
vn flag
`man wget` - Sorry I'm out of time today..
Noor avatar
sa flag
thanks for your help, anyway I reinstalled the Ubuntu VM again , I added the iso file in the settings of storage rather than adding it to the beginning while creating the VM , I also installed third party software . Then I installed the guest additions after updating the apt and installing linux headers. I basically wasn't installing the machine correctly. But thanks.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.