dpkg fails on Ubuntu Server 22.04 LTS - ubuntu-server

My Ubuntu 22.04 LTS seems to have problems with dpkg and I can't find anyone online that has the same issue as me. It makes me not able to install packages and I just don't know how to fix this.
Setting up dpkg (1.21.1ubuntu2.1) ...
head: error reading 'info_silent': Is a directory
dpkg: error processing package dpkg (--configure):
installed dpkg package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
dpkg
E: Sub-process /usr/bin/dpkg returned an error code (1)
My Ubuntu Server version:
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
I've read that a reinstall is an option, but I also can't find a good way to reinstall LTS without losing my data.

I finally got this fixed, I found a YouTube video that fixed my issue.
These are the commands that fixed my problem:
sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_silent
sudo mkdir /var/lib/dpkg/info
sudo apt-get update
sudo apt-get -f install
sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_silent
sudo rm -rf /var/lib/dpkg/info
sudo mv /var/lib/dpkg/info_silent /var/lib/dpkg/info

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)

pocketsphinx voice recognition - install gconf

I am using a ubuntu 14.04 and just recently installed the pocketsphinx package. When I try to run the sample robocup.launch file, I get an error saying gconfaudiosrc is no element. Hence when i try sudo apt-get install gstreamer0.10-gconf, I get the following error:
E: Unable to locate package gstreamer0.10-gconf
E: Couldn't find any package by regex 'gstreamer0.10-gconf'
Any sugesstions on what I could do?
For anyone else stuck with the same issue, I solved it by downloading the deb file from here : https://packages.ubuntu.com/trusty-updates/sound/gstreamer0.10-gconf
And then installing it by :
sudo dpkg -i /path/to/deb/file
followed by
sudo apt-get install -f

Ubuntu 14.04 error opening package list

My self naitik joshi. I stuck with one major problem on ubuntu 14.04
When i run apt-get command in terminal it says:
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_main_i18n_Translation-en%5fIN
E: The package lists or status file could not be parsed or opened.
Any help appreciated.
Thanks in advance for your time and consideration.
-Naitik
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade
Open your terminal run the command wget https://dl.dropbox.com/u/8850924/fixpackage
chmod +x ./fixpackage
sudo ./fixpackage
This would generally install the fresh broken package for you and its working .

execv error when using a toolchain

I'm getting this error when I try to compile a small helloworld c file:
/opt/crosstool/arm-none-linux-gnueabi-4.4.0_ARMv5TE/bin/arm-none-linux-gnueabi-gcc -DARCH_ARM -o hello.c.o -c hello.c
arm-none-linux-gnueabi-gcc: error trying to exec '/opt/crosstool/arm-none-linux-gnueabi-4.4.0_ARMv5TE/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.0/../../../../arm-none-linux-gnueabi/bin/as': execv: No such file or directory
I am running ubuntu 14.04 lts ... I see that I have exec command but there is no execv on my ubuntu. what is execv ?
Thanks
The issue was caused by missing 32 bit libraries from my Ubuntu 14.04 64 bit.
To solve this I had to install:
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6

Installing sublime text 3 on AWS Ubuntu 14.04.1 LTS

Sublime-text is a fast editor for Windows and Linux. I failed to install sublime text 3 on AWS Ubuntu 14.04.1 LTS using the following commands:
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer
Results in following error message:
p: cannot create regular file "/usr/share/icons/hicolor/16x16/apps/":
No such file or directory dpkg: error processing package sublime-text-installer (--configure):
subprocess installed post-installation script returned error exit status 1
I see following directories under /usr/share/icons/hicolor/
32
48
64
So, I created 16x16 subdirectory, but then it gives an error for 32x32 directory doesnot exist. Did anyone experience this problem before? I will appreciate any help.
sublime-text is a GUI application that needs a GTK installation. Your server is missing that dependency. (In a perfect world, it should be a dependency of the package of course.)
Install libgtk2 (as root):
apt-get install libgtk2.0-common
and then reinstall sublime-text, probably using:
apt-get purge sublime-text-installer ; apt-get install sublime-text-installer

Resources