sudo: apt-get: command not found
Forum rules
Before you post please read how to get help
Before you post please read how to get help
sudo: apt-get: command not found
hello i am facing a problem with my Linux mint 15. whenever i end sudo apt-get command in, it gives me this error. "sudo: apt-get: command not found" . i dont know why is this happening? anyone help please.
Re: sudo: apt-get: command not found
Hello, avakil007.
What does the command display?
What does the command display?
Kind regards,
Karl
What does the command
Code: Select all
ls -l /usr/bin/apt-get
What does the command
Code: Select all
echo $PATH
Kind regards,
Karl

Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
Re: sudo: apt-get: command not found
first command ls -l /usr/bin/apt-get displayed this "ls: cannot access /usr/bin/apt-get: No such file or directory"
this command echo $PATH displayed this "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
what does that mean?
this command echo $PATH displayed this "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
what does that mean?

Re: sudo: apt-get: command not found
Hello, avakil007.
The second command was meant to check whether perhaps your PATH variable were incorrect and whether apt-get were simply not found. This is not the case.
The first command suggests that not all apt software modules may be installed on your system, because apt-get should be located in /usr/bin.
Could you please run and post the output here. If possible between two [ code ] [ /code] tags, in order to improve readability. This should reveal which apt modules are absent.
Cheers,
Karl
The second command was meant to check whether perhaps your PATH variable were incorrect and whether apt-get were simply not found. This is not the case.
The first command suggests that not all apt software modules may be installed on your system, because apt-get should be located in /usr/bin.
Could you please run
Code: Select all
dpkg --list apt*
Cheers,
Karl

Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
Re: sudo: apt-get: command not found
I have attached a screenshot of the output of that command you suggested. please have a look.
thanks.
thanks.
Re: sudo: apt-get: command not found
Hello, avakil007.
The status of the software package apt should definitely be ii, not rc.
You might try this from the commandline:
Keep my fingers crossed that this will bring back apt.
Karl
The status of the software package apt should definitely be ii, not rc.
You might try this from the commandline:
Code: Select all
sudo aptitude update
sudo aptitude reinstall apt
Karl

Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
Re: sudo: apt-get: command not found
Snapshot of output attached here. please have a look.
Re: sudo: apt-get: command not found
aptitude is apt's front-end. that command won't work. btw, which mint is it? 16?
Re: sudo: apt-get: command not found
Hello, avakil007.
I knew that aptitude and apt had some common dependencies, yet, aptitude is not really the frontend of apt. aptitude does - according to its properties not depend on apt. Though the error message seems to suggest there must be some kind of interdependencies.
The error message that aptitutde cannot find the folder /etc/apt/preferences.d makes me suspicious that there is more wrong with your system than just a missing apt software packages. Please, post the output of this command
The same applies to the complaint that /usr/lib/apt/methods/http is missing. Please, post the output of
Nevertheless, I would give it one more try in this form: Let us see whether aptitude is willing to install apt and whether it can do so.
In case that attempt should fail, too, then you will have to proceed like explained for a different Ubuntu version here: How to install the apt-get command, when it's itself been removed?
I.e. you must know which Mint version you have got, like kurotsugi asked, and to which Ubuntu version this corresponds.
Then you will have to download the relevant apt software packages from the Ubuntu server manually and install manually using the command dpkg.
Honestly, in case you screwed up your system really badly, i.e. in case you nuked more than just the apt software, in this case you might be better off re-installing your Mint from the scratch.
Cheers,
Karl
I knew that aptitude and apt had some common dependencies, yet, aptitude is not really the frontend of apt. aptitude does - according to its properties not depend on apt. Though the error message seems to suggest there must be some kind of interdependencies.
The error message that aptitutde cannot find the folder /etc/apt/preferences.d makes me suspicious that there is more wrong with your system than just a missing apt software packages. Please, post the output of this command
Code: Select all
ls -l /etc/apt/preferences /etc/apt/preferences.d
Code: Select all
ls -l /usr/lib/apt/methods
Code: Select all
sudo aptitude install apt
In case that attempt should fail, too, then you will have to proceed like explained for a different Ubuntu version here: How to install the apt-get command, when it's itself been removed?
I.e. you must know which Mint version you have got, like kurotsugi asked, and to which Ubuntu version this corresponds.
Then you will have to download the relevant apt software packages from the Ubuntu server manually and install manually using the command dpkg.
Honestly, in case you screwed up your system really badly, i.e. in case you nuked more than just the apt software, in this case you might be better off re-installing your Mint from the scratch.
Cheers,
Karl

Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
Re: sudo: apt-get: command not found
I am using linux mint 15 cinnamon. i have attached output of the commands you suggested. please have a look. and i am thinking of just reinstalling Linux mint from the scratch. I tried LM16 before but it give me "Installer Crashed" error. why is that for? thanks.
Re: sudo: apt-get: command not found
Looks like you are only missing the package apt, and you are on Linux Mint 15 64-bit. Try this:
- Download the apt package manually from the Ubuntu repository: http://packages.ubuntu.com/raring/amd64/apt/download. Click a mirror closest to you to download the file.
- Open your file manager and double-click the downloaded apt_0.9.7.7ubuntu4_amd64.deb file to open it with GDebi, the package installer. Click the Install button. Afterwards apt-get should hopefully work again.

Re: sudo: apt-get: command not found
My whole OS is messed up. I did't have this software called GDebi, i tried to install it from software manager and it got stuck on 99%. it wont let me install any other software either. i tried to install from terminal and it gave me this error. see attachment.
Re: sudo: apt-get: command not found
somehow apt-get is working but i get one error before running it. check the first line after the command. it says "sudo: unable to resolve host linux-Hp.
Re: sudo: apt-get: command not found
Hello, avakil007.
Your OS may or may not be messed up. We really cannot tell for sure. The absence of gdebi is no real clue. It may, however, be a hint that in fact you deleted more than just apt.
About the failing commandline
You must run this command from the folder where you downloaded the file apt_0.9.7.7ubuntu4_amd64.deb to.
I.e. assuming you downloaded the file apt_0.9.7.7ubuntu4_amd64.deb to the folder /home/avakil007/Downloads, then you should proceed like this:
P.S.:
I just see that you seem to have succeeded in (re-)installing apt. Else you would not be able to execute
About the name resolution problem.
Check the content of the file /etc/hosts.
It should look like this:
Also check the file /etc/hostname. It should hold the same name as the /etc/hosts file: linux-Hp.
HTH,
Karl
Your OS may or may not be messed up. We really cannot tell for sure. The absence of gdebi is no real clue. It may, however, be a hint that in fact you deleted more than just apt.
About the failing commandline
Code: Select all
sudo dpkg --i apt_0.9.7.7ubuntu4_amd64.deb
I.e. assuming you downloaded the file apt_0.9.7.7ubuntu4_amd64.deb to the folder /home/avakil007/Downloads, then you should proceed like this:
Code: Select all
cd /home/avakil007/Downloads
sudo dpkg --i apt_0.9.7.7ubuntu4_amd64.deb
I just see that you seem to have succeeded in (re-)installing apt. Else you would not be able to execute
Code: Select all
sudo apt-get update
Check the content of the file /etc/hosts.
It should look like this:
Code: Select all
cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 linux-Hp
[...rest omitted...]
Code: Select all
cat /etc/hostname
HTH,
Karl
Last edited by karlchen on Wed Jan 08, 2014 10:03 am, edited 3 times in total.

Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
Re: sudo: apt-get: command not found
Tip. See the terminal's Edit menu. You can copy text from the terminal, you don't need to upload screenshots.
Sounds like somewhere along the line installing apt worked
The warning you are getting about the host is probably a configuration mistake on your end. Can you run this command and share the output here?
Sounds like somewhere along the line installing apt worked

The warning you are getting about the host is probably a configuration mistake on your end. Can you run this command and share the output here?
Code: Select all
cat /etc/hosts

Re: sudo: apt-get: command not found
its may be because i change the name recently. here is the output
127.0.0.1 localhost
127.0.1.1 linux-HP-Pavilion-dv6-Notebook-PC
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 localhost
127.0.1.1 linux-HP-Pavilion-dv6-Notebook-PC
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Re: sudo: apt-get: command not found
i changed the name with this command sudo gedit /etc/hosts. and its solved now.
you guys really Amazing. thank you all guys. really appreciate it.
you guys really Amazing. thank you all guys. really appreciate it.
Re: sudo: apt-get: command not found
one last question. I tried to install LM16 but it gave me "installer crashed" error in the middle of the installation. i am sure you guys know why is that for.