sudo: apt-get: command not found

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
avakil007
Level 1
Level 1
Posts: 12
Joined: Sun Dec 01, 2013 7:32 am

sudo: apt-get: command not found

Post by avakil007 »

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.
User avatar
karlchen
Level 21
Level 21
Posts: 13691
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: sudo: apt-get: command not found

Post by karlchen »

Hello, avakil007.

What does the command

Code: Select all

ls -l /usr/bin/apt-get
display?
What does the command

Code: Select all

echo $PATH
display?

Kind regards,
Karl
Image
Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
avakil007
Level 1
Level 1
Posts: 12
Joined: Sun Dec 01, 2013 7:32 am

Re: sudo: apt-get: command not found

Post by avakil007 »

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? :o
User avatar
karlchen
Level 21
Level 21
Posts: 13691
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: sudo: apt-get: command not found

Post by karlchen »

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

Code: Select all

dpkg --list apt*
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
Image
Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
avakil007
Level 1
Level 1
Posts: 12
Joined: Sun Dec 01, 2013 7:32 am

Re: sudo: apt-get: command not found

Post by avakil007 »

I have attached a screenshot of the output of that command you suggested. please have a look.

thanks.
Attachments
Output
Output
User avatar
karlchen
Level 21
Level 21
Posts: 13691
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: sudo: apt-get: command not found

Post by karlchen »

Hello, avakil007.

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
Keep my fingers crossed that this will bring back apt.

Karl
Image
Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
avakil007
Level 1
Level 1
Posts: 12
Joined: Sun Dec 01, 2013 7:32 am

Re: sudo: apt-get: command not found

Post by avakil007 »

Snapshot of output attached here. please have a look.
Attachments
output
output
kurotsugi
Level 6
Level 6
Posts: 1026
Joined: Fri Jan 25, 2013 3:54 am

Re: sudo: apt-get: command not found

Post by kurotsugi »

aptitude is apt's front-end. that command won't work. btw, which mint is it? 16?
User avatar
karlchen
Level 21
Level 21
Posts: 13691
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: sudo: apt-get: command not found

Post by karlchen »

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

Code: Select all

ls -l /etc/apt/preferences /etc/apt/preferences.d
The same applies to the complaint that /usr/lib/apt/methods/http is missing. Please, post the output of

Code: Select all

ls -l /usr/lib/apt/methods
Nevertheless, I would give it one more try in this form:

Code: Select all

sudo aptitude install apt
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
Image
Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
avakil007
Level 1
Level 1
Posts: 12
Joined: Sun Dec 01, 2013 7:32 am

Re: sudo: apt-get: command not found

Post by avakil007 »

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.
Attachments
output.png
User avatar
xenopeek
Level 25
Level 25
Posts: 25131
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: sudo: apt-get: command not found

Post by xenopeek »

Looks like you are only missing the package apt, and you are on Linux Mint 15 64-bit. Try this:
  1. 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.
  2. 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.
If GDebi complains about dependencies, please share that as a screenshot here again.
Image
avakil007
Level 1
Level 1
Posts: 12
Joined: Sun Dec 01, 2013 7:32 am

Re: sudo: apt-get: command not found

Post by avakil007 »

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.
Attachments
t.png
avakil007
Level 1
Level 1
Posts: 12
Joined: Sun Dec 01, 2013 7:32 am

Re: sudo: apt-get: command not found

Post by avakil007 »

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.
Attachments
t.png
User avatar
karlchen
Level 21
Level 21
Posts: 13691
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: sudo: apt-get: command not found

Post by karlchen »

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

Code: Select all

sudo dpkg --i apt_0.9.7.7ubuntu4_amd64.deb
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:

Code: Select all

cd /home/avakil007/Downloads
sudo dpkg --i apt_0.9.7.7ubuntu4_amd64.deb
P.S.:
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
About the name resolution problem.

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...]
Also check the file /etc/hostname.

Code: Select all

cat /etc/hostname
It should hold the same name as the /etc/hosts file: linux-Hp.

HTH,
Karl
Last edited by karlchen on Wed Jan 08, 2014 10:03 am, edited 3 times in total.
Image
Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
User avatar
xenopeek
Level 25
Level 25
Posts: 25131
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: sudo: apt-get: command not found

Post by xenopeek »

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 :wink:

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
Image
avakil007
Level 1
Level 1
Posts: 12
Joined: Sun Dec 01, 2013 7:32 am

Re: sudo: apt-get: command not found

Post by avakil007 »

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
avakil007
Level 1
Level 1
Posts: 12
Joined: Sun Dec 01, 2013 7:32 am

Re: sudo: apt-get: command not found

Post by avakil007 »

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.
avakil007
Level 1
Level 1
Posts: 12
Joined: Sun Dec 01, 2013 7:32 am

Re: sudo: apt-get: command not found

Post by avakil007 »

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.
Post Reply

Return to “Software & Applications”