Ubuntu 16.04 error with apt-get - linux

Yesterday I updated Ubuntu from 14.04 to 16.04, when I tried to install git, I got this error:
The package linux-headers-4.4.0-65 needs to be reinstalled, but I
can't find an archive for it.
Then I tried to install another software, to the same error.

First you need to
sudo apt-get update
Then
sudo apt-get install git

I had a similar problem on Kali-Linux once. The thing that worked for me was:
sudo dpkg --configure -a
sudo apt-get -f install
sudo apt-get update && sudo apt-get dist-upgrade

Related

"apt-get install linux-headers-generic" installed in directory different than $(uname-r)

I am a newbie on Linux kernel. I was trying to install Linux header on ubuntu. I first tried
sudo apt-get install linux-headers-$(uname -r)
However, since the output of $(uname -r) is 4.4.0-18362-Microsoft, the installation gives me the error:
E: Unable to locate package linux-headers-4.4.0-18362-Microsoft
E: Couldn't find any package by glob 'linux-headers-4.4.0-18362-Microsoft'
E: Couldn't find any package by regex 'linux-headers-4.4.0-18362-Microsoft'
By searching on the internet, I found that linux headers do not exist on WSL. Therefore I tried something that is recommended on the internet, by doing
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install linux-generic
sudo apt-get install linux-headers-generic
Then I got a successful installation under /usr/src/linux-headers-4.15.0-51-generic and /usr/src/linux-headers-4.15.0-51. However, my team uses a makefile where the directory of the Linux headers is referred to using $(uname -r), which is still 4.4.0-18362-Microsoft. So whenever I do make, it still gives me the error
can't read /usr/src/linux-headers-4.4.0-18362-Microsoft/...
Is there anyway I can install the headers or change $(uname -r) such that I can use $(uname -r) to refer to the directory?
Create a symlink from /usr/src/linux-headers-4.15.0-51-generic to /usr/src/linux-headers-4.4.0-18362-Microsoft/
sudo ln -s /usr/src/linux-headers-4.15.0-51-generic /usr/src/linux-headers-4.4.0-18362-Microsoft
I'm using Ubuntu 18.04.2 LTS and had a similar issue - but it wasn't Microsoft:
E: Unable to locate package linux-headers-4.15.0-51-generic-generic
E: Couldn't find any package by glob 'linux-headers-4.15.0-51-generic-generic'
E: Couldn't find any package by regex 'linux-headers-4.15.0-51-generic-generic'
For me worked fine after I did as below:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install linux-generic
sudo apt-get install linux-headers-$(uname -r)

Build-Essential: Command Not Found on WSL

I am currently trying to setup my Windows 10 Dev Box with WSL. I have successfully install Ubuntu (Ubuntu 16.04.3) on a Windows 10 Insider Preview Version 1803 (OS Build 17666.1000). Using this walkthru to setup a RoR Dev ENV. Getting Rails app to...
sudo apt-get update seems to run fine.
sudo apt-get install git-core curl zlib1g-dev seems to run fine except libfreetype6 is no longer required.
When I try to run a build-essential command it gives me this message: build-essential: command not found
I try to apt-get autoremove to see if the libfreetype6 is causing the issue, no dice. I try sudo apt-get install --reinstall build-essential and it installs, but as soon as I run another build-essential command, it's not found again. Am I missing something?
Any help or direction would be awesome. Thanks.
You're missing nothing. build-essential is a package, not a command.
If you do apt show build-essential, you will notice this line:
Depends: libc6-dev | libc-dev, gcc (>= 4:7.2), g++ (>= 4:7.2), make, dpkg-dev (>= 1.17.11)
So it's just a convenient package that installs a set of essential build tools.
Furthermore, if you do dpkg -L build-essential, you will find that it contains nothing in /usr/bin (or whatever binary directory).
you have to install build-essential. first update repo list and update your libs, then install it.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
It works for me in WSL, thanks Roberto

Install GCC5 in Linux Mint LMDE 2

I'm new in Linux and I would like to unistall gcc 4.9 which is installed in my distro Linux Mint LMDE 2 and install gcc 5. I tried to used the following command:
sudo apt-get install gcc5
but it didn't worked. Can someone please help me with this? Please provide all steps to follow. Thank you in advance
Try this.
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5
apt-get autoremove
This should work in Linux Mint if I'm not mistaken, as its still using the same respository.
sudo apt-get respository ppa:ubntu-toolchain-r/test
This will install you the correct respositories you need for the computer. Some packages are not automatically known to the computer so you need to install the respositories so the computer can install it.
sudo apt-get update
This will update your computer and all packages and the respoitory, this wil ensure it will now work
sudo apt-get install gcc-5 g++-5
This will install the gcc-5 version you wanted.
sudo apt-get autoremove
When you install certain stuff, some things are no longer needed. Maybe a required package from a previous version that you no longer need, do this to conserve space.

mysql-server:Depends: mysql-server-5.5 but it is not going to be installed

I am using ubuntu 14.04 on VirtualBox. I try install mysql-server using command
sudo apt-get install mysql-server, i always got error like below:
Some packages could be installed .This may mean that you have
request an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following packages have unmet dependencies:
mysqsl-server : Depends: mysql-server-5.5 but it is not going to be installed
E:Unable to correct problems, you have held broken packages.
and then i try use some command like below :
sudo apt-get update
sudo apt-get upgrade
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get purge mysql-server*
sudo apt-get install mysql-server
but it still error. Please help me!
Have you tried using
sudo apt-get install -f
This can repair broken packages or purge the installation.
If mysql-server is not installed with -f , you can try to install with normal way
sudo apt-get install mysql-server -y

Unable to update Git on Ubuntu

I am trying to set up Git on an Ubuntu Machine (I'm using a Samsung Chromebook running Ubuntu 12.04).
When I entered "sudo apt-get install git" and it successfully installed Git 1.79
user#ChrUbuntu:~$ git --version
git version 1.7.9.5
I can't figure out what I am doing wrong here. Any suggestions?
For new installations of Ubuntu I would first try this to get the latest updates
sudo apt-get dist-upgrade
For more info on this see https://askubuntu.com/questions/81585/what-is-dist-upgrade-and-why-does-it-upgrade-more-than-upgrade
That should solve it but if not, add the repository from these guys https://launchpad.net/~git-core/+archive/ppa
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
This way you don't have to build it, etc.
Perhaps you need to build for
the newest version
wget git-core.googlecode.com/files/git-1.8.1.1.tar.gz
tar -zxf git-1.8.1.1.tar.gz
cd git-1.8.1.1
make prefix=/usr/local all
sudo make prefix=/usr/local install
If you are trying to upgrade to the latest version of Git, you should do:
sudo apt-get update
sudo apt-get upgrade
This will update all your packages, as well as Git.
BTW, latest version of Git on my Kubuntu 12.10 is 1.7.10.4.
A combination of some of the answers worked for me. I did...
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get upgrade
Have you tried to do an apt-get update?
You might have an outdated package list.
In ubuntu 14.04 I tried the terminal code:
sudo apt-get update
sudo apt-get upgrade
step to upgrade git.
1.) git --version
*to know what git version you had in your computer
2.) sudo apt-get update
*update ubuntu
3.) sudo apt-get upgrade
*to upgrade software including git
4.) try to git --version
that's it :)

Resources