George R. Kasica
asked on
cannot install apt upgrade in Ubuntu 16.04LTS
In Ubuntu 16.04LTS I'm suddenly unable to update apt from the previous to current version using either apt or dpkg.
Dpkg results below it simply hangs forever at the point I Ctl-C it.
apt-utils_1.2.29ubuntu0.1_ amd64.deb
apt_1.2.29ubuntu0.1_amd64. deb
~# dpkg -i apt_1.2.29ubuntu0.1_amd64. deb
Selecting previously unselected package apt.
(Reading database ... 132298 files and directories currently installed.)
Preparing to unpack apt_1.2.29ubuntu0.1_amd64. deb ...
Unpacking apt (1.2.29ubuntu0.1) ...
Setting up apt (1.2.29ubuntu0.1) ...
^C^Cdpkg: error processing package apt (--install):
subprocess installed post-installation script was interrupted
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Errors were encountered while processing:
apt
How do I go about fixing this? I can't update the system at this point.
Dpkg results below it simply hangs forever at the point I Ctl-C it.
apt-utils_1.2.29ubuntu0.1_
apt_1.2.29ubuntu0.1_amd64.
~# dpkg -i apt_1.2.29ubuntu0.1_amd64.
Selecting previously unselected package apt.
(Reading database ... 132298 files and directories currently installed.)
Preparing to unpack apt_1.2.29ubuntu0.1_amd64.
Unpacking apt (1.2.29ubuntu0.1) ...
Setting up apt (1.2.29ubuntu0.1) ...
^C^Cdpkg: error processing package apt (--install):
subprocess installed post-installation script was interrupted
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Errors were encountered while processing:
apt
How do I go about fixing this? I can't update the system at this point.
Tip: The way I update old Trusty systems is as follows.
1) Setup a machine running Ubuntu Bionic + LXD at host level.
2) On Trusty machine, run the lxc-p2c command, to clone the entire running system onto a into an LXD container on machine #1.
3) Retire the only Trusty machine.
4) Clone the newly created Trusty container into a dev container, with a different IP.
5) At this point, you'll have your old Trusty system + an exact clone running side by side.
6) Now you can take runs at various update strategies + if the update destroys the container, delete it + do #4 again, start over.
Tip: If your Trusty system is running PHP code, likely this is PHP 5. Use https://github.com/PHPComp atibility/ PHPCompati bility to upgrade your code.
phpcs - finds problems, up to PHP-7.3.2
phpcbf - does mass fixes of problems, up to PHP-7.3.2
These 2x tools can save months of human hours working + be far more consistent making correct changes.
1) Setup a machine running Ubuntu Bionic + LXD at host level.
2) On Trusty machine, run the lxc-p2c command, to clone the entire running system onto a into an LXD container on machine #1.
3) Retire the only Trusty machine.
4) Clone the newly created Trusty container into a dev container, with a different IP.
5) At this point, you'll have your old Trusty system + an exact clone running side by side.
6) Now you can take runs at various update strategies + if the update destroys the container, delete it + do #4 again, start over.
Tip: If your Trusty system is running PHP code, likely this is PHP 5. Use https://github.com/PHPComp
phpcs - finds problems, up to PHP-7.3.2
phpcbf - does mass fixes of problems, up to PHP-7.3.2
These 2x tools can save months of human hours working + be far more consistent making correct changes.
ASKER
David, I'm sorry I mistyped the Version - it was a late night yesterday. The system is 16.04LTS
Hi,
tricky since it's apt but you might give it a shot:
tricky since it's apt but you might give it a shot:
sudo ldconfig
sudo dpkg -r apt
sudo apt-get check
sudo apt-get update
sudo apt-get upgrade --fix-missing
sudo apt-get upgrade
sudo apt-get dist-upgrade
Some applications might fail so reconfigure now:sudo dpkg --configure -a
Reconfigure the failing application:sudo dpkg --configure apt
Fix any broken packages:sudo apt-get install -f
Fix the broken package:sudo apt-get install apt -f
Install any dependencies that might be needed:sudo apt-get build-dep apt
Reinstall failed apps:sudo apt-get install
Cheers
ASKER
Not good results apt-get appears to be missing as well as apt
root@sgdesbvuapp301:~# ldconfig
root@sgdesbvuapp301:~# dpkg -r apt
dpkg: warning: ignoring request to remove apt which isn't installed
root@sgdesbvuapp301:~# apt-get check
apt-get: command not found
root@sgdesbvuapp301:~# apt-get update
apt-get: command not found
root@sgdesbvuapp301:~# apt-get upgrade --fix-missing
apt-get: command not found
root@sgdesbvuapp301:~# apt-get upgrade
apt-get: command not found
root@sgdesbvuapp301:~# apt-get dist-upgrade
apt-get: command not found
root@sgdesbvuapp301:~# dpkg --configure -a
Setting up man-db (2.7.5-1) ...
Updating database of manual pages ...
root@sgdesbvuapp301:~# dpkg --configure apt
dpkg: error processing package apt (--configure):
no package named 'apt' is installed, cannot configure
Errors were encountered while processing:
apt
root@sgdesbvuapp301:~# apt-get install -f
apt-get: command not found
root@sgdesbvuapp301:~# apt-get install apt -f
apt-get: command not found
root@sgdesbvuapp301:~# apt-get build-dep apt
apt-get: command not found
root@sgdesbvuapp301:~# apt-get install
apt-get: command not found
root@sgdesbvuapp301:~# ldconfig
root@sgdesbvuapp301:~# dpkg -r apt
dpkg: warning: ignoring request to remove apt which isn't installed
root@sgdesbvuapp301:~# apt-get check
apt-get: command not found
root@sgdesbvuapp301:~# apt-get update
apt-get: command not found
root@sgdesbvuapp301:~# apt-get upgrade --fix-missing
apt-get: command not found
root@sgdesbvuapp301:~# apt-get upgrade
apt-get: command not found
root@sgdesbvuapp301:~# apt-get dist-upgrade
apt-get: command not found
root@sgdesbvuapp301:~# dpkg --configure -a
Setting up man-db (2.7.5-1) ...
Updating database of manual pages ...
root@sgdesbvuapp301:~# dpkg --configure apt
dpkg: error processing package apt (--configure):
no package named 'apt' is installed, cannot configure
Errors were encountered while processing:
apt
root@sgdesbvuapp301:~# apt-get install -f
apt-get: command not found
root@sgdesbvuapp301:~# apt-get install apt -f
apt-get: command not found
root@sgdesbvuapp301:~# apt-get build-dep apt
apt-get: command not found
root@sgdesbvuapp301:~# apt-get install
apt-get: command not found
Hi,
If it's missing than you can install the apt deb package from here .
If it's missing than you can install the apt deb package from here .
sudo dpkg -i apt.deb
Cheers
ASKER
Starts the install and sits here forever:
# dpkg -i apt_1.2.29ubuntu0.1_amd64. deb
Selecting previously unselected package apt.
(Reading database ... 132298 files and directories currently installed.)
Preparing to unpack apt_1.2.29ubuntu0.1_amd64. deb ...
Unpacking apt (1.2.29ubuntu0.1) ...
Setting up apt (1.2.29ubuntu0.1) ...
I'll leave it to sit for a few hours but that doesn't seem right
# dpkg -i apt_1.2.29ubuntu0.1_amd64.
Selecting previously unselected package apt.
(Reading database ... 132298 files and directories currently installed.)
Preparing to unpack apt_1.2.29ubuntu0.1_amd64.
Unpacking apt (1.2.29ubuntu0.1) ...
Setting up apt (1.2.29ubuntu0.1) ...
I'll leave it to sit for a few hours but that doesn't seem right
Hi,
it shouldn't take too long indeed but like you said let it run and check back.
Cheers
it shouldn't take too long indeed but like you said let it run and check back.
Cheers
ASKER
dfke if you look at the question this was what I'd tried earlier with no success:
dpkg -i apt_1.2.29ubuntu0.1_amd64. deb
Selecting previously unselected package apt.
(Reading database ... 132298 files and directories currently installed.)
Preparing to unpack apt_1.2.29ubuntu0.1_amd64. deb ...
Unpacking apt (1.2.29ubuntu0.1) ...
Setting up apt (1.2.29ubuntu0.1) ...
^C^Cdpkg: error processing package apt (--install):
subprocess installed post-installation script was interrupted
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Errors were encountered while processing:
apt
dpkg -i apt_1.2.29ubuntu0.1_amd64.
Selecting previously unselected package apt.
(Reading database ... 132298 files and directories currently installed.)
Preparing to unpack apt_1.2.29ubuntu0.1_amd64.
Unpacking apt (1.2.29ubuntu0.1) ...
Setting up apt (1.2.29ubuntu0.1) ...
^C^Cdpkg: error processing package apt (--install):
subprocess installed post-installation script was interrupted
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Errors were encountered while processing:
apt
https://wiki.ubuntu.com/Re leases show life cycles.
Xenial will be around for another year, so you have some other problem.
Before doing anything else, best to stop doing anything + determine the true problem here.
If the apt commands are truly gone, then some catastrophe has occurred on your machine.
First things first, provide the following data...
All these should return sensible results... If not... installing a single apt package will likely have no effect on fixing the actual problem.
For example, if apt is truly gone, then more than likely deep repairs will be required to return your system to the land of the living.
Xenial will be around for another year, so you have some other problem.
Before doing anything else, best to stop doing anything + determine the true problem here.
If the apt commands are truly gone, then some catastrophe has occurred on your machine.
First things first, provide the following data...
echo $PATH
locate apt-get
which ls
uname -a
lsb_release -a
dpkg -l | grep apt
All these should return sensible results... If not... installing a single apt package will likely have no effect on fixing the actual problem.
For example, if apt is truly gone, then more than likely deep repairs will be required to return your system to the land of the living.
ASKER
It’s gone because I’ve folloed another article that said to remove and reinstall it. The remove part wasn’t hard and I’ve got the Deb files for reinstall it just doesn’t complete the install. Other than apt the system is functioning just fine. We were patching Thursday evening and it hung at the point it tried to upgrade apt versions. Since then nothing has worked to repair apt. Other functions of the system are just fine.
Tip: Never believe any article which tells you to remove APT or any other crucial packages, for example...
Crucial packages removal will emit a potential harmful message. Anytime you see this, you're likely doing something very wrong.
lxd: mta1.joymta.com # apt-get purge apt
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
python3-debconf
Use 'apt autoremove' to remove it.
The following packages will be REMOVED:
apt* apt-utils* ubuntu-minimal* update-notifier-common*
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
apt
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
After this operation, 6155 kB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?]
Crucial packages removal will emit a potential harmful message. Anytime you see this, you're likely doing something very wrong.
Post the following to determine best recovery approach.
Also, if you still have your terminal window open where you removed apt, scroll back up, then cut + paste every bit of information emitted during the removal.
uname -a
lsb_release -a
dpkg -l | egrep -e apt -e ubuntu-minimal -e update-notifier-common
Also, if you still have your terminal window open where you removed apt, scroll back up, then cut + paste every bit of information emitted during the removal.
ASKER
Here you go, David:
Normally I wouldn't have removed it but another post in the Ubuntu forum with an "expert" rating had a "solution". I question the "expert" rating and obviously its not a solution. Thanks for your assistance.
Normally I wouldn't have removed it but another post in the Ubuntu forum with an "expert" rating had a "solution". I question the "expert" rating and obviously its not a solution. Thanks for your assistance.
# uname -a
Linux sgdesbvuapp301 4.15.0-43-generic #46~16.04.1-Ubuntu SMP Fri Dec 7 13:31:08 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
~#
~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial
root@sgdesbvuapp301:~# dpkg -l | egrep -e apt -e ubuntu-minimal -e update-notifier-common
ii apt-transport-https 1.2.29 amd64 https download transport for APT
ii laptop-detect 0.13.7ubuntu2 amd64 attempt to detect a laptop
ii libapt-inst2.0:amd64 1.2.29ubuntu0.1 amd64 deb package format runtime library
ii libapt-pkg-perl 0.1.29build7 amd64 Perl interface to libapt-pkg
ii libapt-pkg5.0:amd64 1.2.29ubuntu0.1 amd64 package management runtime library
ii libpcap0.8:amd64 1.7.4-2 amd64 system interface for user-level packet capture
ii python-apt 1.1.0~beta1ubuntu0.16.04.2 amd64 Python interface to libapt-pkg
ii python-apt-common 1.1.0~beta1ubuntu0.16.04.2 all Python interface to libapt-pkg (locales)
ii python3-apt 1.1.0~beta1ubuntu0.16.04.2 amd64 Python 3 interface to libapt-pkg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The only thing I was trying to accomplish was a simple monthly update that we do every 3rd Thursday for this envirenment. Command initially run were
purge-old-kernels
apt-get update
apt-get -y dist-upgrade
apt-get -y autoremove
that's it. IdnT hung trying to upgrade apt which gets us to here and now. How it got a mix of 16 & 18LTS I haven't a clue. I will check with our DevOps folks and see if someone decided to sudo su - and accidentally ran some kind of update script and isn't admitting their actions+. It would n't be the first time so I'm thinking that's the cause. I can rebuild a base OS system in VMware in under+ an hour so i'll do that then they can move their data ad I'll kill this one.
purge-old-kernels
apt-get update
apt-get -y dist-upgrade
apt-get -y autoremove
that's it. IdnT hung trying to upgrade apt which gets us to here and now. How it got a mix of 16 & 18LTS I haven't a clue. I will check with our DevOps folks and see if someone decided to sudo su - and accidentally ran some kind of update script and isn't admitting their actions+. It would n't be the first time so I'm thinking that's the cause. I can rebuild a base OS system in VMware in under+ an hour so i'll do that then they can move their data ad I'll kill this one.
ASKER
Thank you both for your assistance.
You're welcome.
You might check your /etc/apt files to see if you somehow accidentally got a Bionic repository merged into your repository definitions.
If this has occurred... then I could see the above happening.
You might check your /etc/apt files to see if you somehow accidentally got a Bionic repository merged into your repository definitions.
If this has occurred... then I could see the above happening.
Once a release hits EOL, all related repositories are retired/deleted.
Your next step is to update + likely best to update to at least Bionic (LTS), so you have another 5ish years of package updates.