how to rectify this error while removing postgresql - postgresql

sudo apt-get remove postgresql
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package postgresql is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 35 not upgraded.
5 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Could not exec dpkg!
E: Sub-process /usr/bin/dpkg returned an error code (100)

It seems to be problem with dpkg. Can you try explore, if dpkg have an execute bit:
ls -l /usr/bin/dpkg
It must be like this:
-rwxr-xr-x 1 root root 249328 2011-10-06 10:04 /usr/bin/dpkg
If it have not this rights, try:
chmod 655 /usr/bin/dpkg
You can see, if there is not some missing libraries for dpkg. Try this command:
ldd /usr/bin/dpkg
You have to seen somethink like this:
ldd /usr/bin/dpkg
linux-vdso.so.1 => (0x00007fff179ff000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007ff8f8439000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff8f809a000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff8f7e95000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff8f8671000)
If you have another same system as this, you can try to copy /usr/bin/dpkg from this good system...
Or you can try to check, if you have dpkg*.deb on filesystem, and try this:
cp /var/cache/apt/archives/dpkg*deb /tmp
cd /tmp
ar x dpkg*deb data.tar.gz
tar xzf data.tar.gz
cp ./usr/bin/dpkg /usr/bin/
If you will don't have a dpkg*deb file ind /var/cache/apt/archives , you will need to fetch it from repository...

Related

Malformed entry 1 in list file /etc/apt/sources.list.d/mongodb-org-6.0.list (Component)

I was trying to install MongoDb on Ubuntu 22.04 but i couldnt or there were some errors so I decided uninstall everything and reinstall fresh. So i did some purge commands that i found on the net and after doing that now if I do: sudo apt update
i get the following messages
E: Malformed entry 1 in list file /etc/apt/sources.list.d/mongodb-org-6.0.list (Component)
E: The list of sources could not be read.
i used the following command to delete mongodb >sudo apt-get purge mongodb-org* –
Getting $ sudo apt-get purge mongodb-enterprise E: Malformed entry 1 in list file /etc/apt/sources.list.d/mongodb-enterprise.list (URI) E: The list of sources could not be read. E: Malformed entry 1 in list file /etc/apt/sources.list.d/mongodb-enterprise.list (URI) E: The list of sources could not be read..
I also used the following command to delete mongodb > sudo rm /etc/apt/sources.list.d/MongoDb.list
here again i am getting the following message :-
sudo rm /etc/apt/sources.list.d/MongoDb.list
rm: cannot remove '/etc/apt/sources.list.d/MongoDb.list': No such file or directory

Error trying to upgrade Raspbian (Jessie)

When trying to upgrade my Raspbian (8.0 jessie) on my Raspberry Pi 2 with sudo apt-get upgrade, I'm getting the following error:
dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt
dpkg-deb: error: subprocess <decompress> returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/perl_5.20.2-3+deb8u12_armhf.deb (--unpack):
cannot copy extracted data for './usr/lib/arm-linux-gnueabihf/perl/5.20.2/auto/Unicode/Collate/Collate.so' to
'/usr/lib/arm-linux-gnueabihf/perl/5.20.2/auto/Unicode/Collate/Collate.so.dpkg-new': unexpected end of file or stream
Preparing to unpack .../perl-base_5.20.2-3+deb8u12_armhf.deb ...
Unpacking perl-base (5.20.2-3+deb8u12) over (5.20.2-3+deb8u6) ...
dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt
dpkg-deb: error: subprocess <decompress> returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/perl-base_5.20.2-3+deb8u12_armhf.deb (--unpack):
cannot copy extracted data for './usr/share/perl/5.20.2/unicore/lib/Nt/Nu.pl' to
'/usr/share/perl/5.20.2/unicore/lib/Nt/Nu.pl.dpkg-new': unexpected end of file or stream
Processing triggers for man-db (2.7.0.2-5) ...
Errors were encountered while processing:
/var/cache/apt/archives/perl_5.20.2-3+deb8u12_armhf.deb
/var/cache/apt/archives/perl-base_5.20.2-3+deb8u12_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Does anyone have any ideas?
I've already done sudo apt-get update and sudo apt-get clean.
The deb file itself is corrupt.
You can remove it, and run update/upgrade again. It will download a new version.
Like this:
cd /var/cache/apt/archives
sudo rm perl_5.20.2-3+deb8u12_armhf.deb
sudo apt-get update
sudo apt-get upgrade -y

How to make a binary file executable in Docker with sbt-native-packager?

I need to package a Scala app that handles REST API call and in some cases launches FireFox browser with help of Selenium WebDriver. I use sbt-native-packager, since it's convenient and simple. As a base image I use own Dockerfile:
# https://hub.docker.com/_/debian
FROM openjdk:8-jre-alpine3.9
ARG firefox_ver=70.0
ARG geckodriver_ver=0.26.0
# Download and install deps
RUN apk update && apk add curl curl-dev
# Download and install Firefox
RUN curl -fL -o /tmp/firefox.tar.bz2 https://ftp.mozilla.org/pub/firefox/releases/${firefox_ver}/linux-x86_64/en-GB/firefox-${firefox_ver}.tar.bz2 \
&& tar -xjf /tmp/firefox.tar.bz2 -C /tmp/ && mv /tmp/firefox /usr/local/bin/
# Download and install geckodriver
RUN curl -fL -o /tmp/geckodriver.tar.gz \
https://github.com/mozilla/geckodriver/releases/download/v${geckodriver_ver}/geckodriver-v${geckodriver_ver}-linux64.tar.gz \
&& tar -xzf /tmp/geckodriver.tar.gz -C /tmp/ && chmod +x /tmp/geckodriver && mv /tmp/geckodriver /usr/local/bin/
ENV PATH="/usr/local/bin/firefox:${PATH}"
And then in build.sbt I use following command in order to provide an appropriate access level to the firefox binary:
...
dockerAdditionalPermissions += (DockerChmodType.UserGroupPlusExecute, "/usr/local/bin/firefox/firefox")
...
But unfortunately when I connect to the running docker container and try to call the firefox, I get this:
/opt/docker $ firefox
sh: firefox: Permission denied
As a result, the Scala app is not able to launch FireFox as well :(
Here is permission of the firefox:
-rwxr-xr-x 1 root root 14656 Oct 16 17:55 firefox
It seems you cannot run (this version of) firefox on Alpine:
# ldd firefox
/lib64/ld-linux-x86-64.so.2 (0x7fcc15ef4000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fcc15ef4000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7fcc15ef4000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7fcc15d9f000)
libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fcc15ef4000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fcc15d8b000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fcc15ef4000)
Error relocating firefox: __fprintf_chk: symbol not found
This seems to be caused by Alpine being based on musl instead of GNU libc.
To work around, you could use the firefox package available from Alpine itself (but you would still need the geckodriver to work too)... Alternatively, switch to the non-alpine Docker image.

Malformed entry 1 in list file /etc/apt/sources.list.d/MongoDB.list (Suite)

I was trying to install MongoDb on Ubuntu 17.10 but i couldnt or there were some errors so I decided uninstall everything and reinstall fresh. So i did some purge commands that i found on the net and after doing that now if I do: sudo apt update
i get the following messages
sudo apt update
E: Malformed entry 1 in list file /etc/apt/sources.list.d/MongoDB.list
(Suite)
E: Malformed entry 1 in list file /etc/apt/sources.list.d/mongodb.list
(Suite)
E: The list of sources could not be read.
In this case, as you dont have a specific line wrong in the file, better delete the file MongoDB.list and add again the respective PPA.
Try:
sudo rm /etc/apt/sources.list.d/MongoDb.list
Add again the PPA from MongoDb. Now is time to update by running.
sudo apt-get update
Try running following command
sudo sed -i -e '1d' /etc/apt/sources.list.d/mongodb-org-3.4.list
This would produce following error
E: Type '“deb' is not known on line 1 in source list /etc/apt/sources.list.d/mongodb-org-3.6.list
E: The list of sources could not be read.
Now to fix this, go to /etc/apt/sources.list.d and then open it with
nano mongodb-org-3.4.list
And here remove the double quotes (")
Try running sudo apt-get update now. Hopefully it will work.

rpmbuild no such file or directory

I'm just learning making rpm packages for some custom builds of software that gets compiled from source (some legacy stuff needs this, so I'm trying to learn, as some packages can't use the latest versions), but hitting an error (I'm doing this in Vagrant, and also as root, but typically I'm trying not to use root as I'm aware it has potential for damage, its just this example seems to need some root changes).
sudo rpmbuild -ba testspec.spec --define "_topdir /tmp/"
So far it looks to be using the directory I expected, /tmp/rpmbuild
make[2]: Entering directory `/tmp/rpmbuild/BUILD/exim-4.80.1/build-Linux-x86_64/pdkim'
make[2]: `pdkim.a' is up to date.
make[2]: Leaving directory `/tmp/rpmbu
But then I see these errors...
/usr/lib/rpm/brp-compress: line 8: cd: /tmp/BUILDROOT/custom-exim-4.80.1-1.x86_64: No such file or directory
+ /usr/lib/rpm/brp-strip
find: `/tmp/BUILDROOT/custom-exim-4.80.1-1.x86_64': No such file or directory
+ /usr/lib/rpm/brp-strip-static-archive
find: `/tmp/BUILDROOT/custom-exim-4.80.1-1.x86_64': No such file or directory
+ /usr/lib/rpm/brp-strip-comment-note
So it now seems to be looking in /tmp/BUILDROOT
I'm new to rpmbuild, and don't quite understand some of the process.
My test spec file is at...
%define myversion exim-4.80.1
##%define mybase %{getenv:HOME}
%define mybase /tmp
%define _topdir %{mybase}/rpmbuild
%define _tmppath %{mybase}/rpmbuild/tmp
%define name custom-exim
%define release 1
%define version 4.80.1
%define buildroot %{_topdir}/%{name}-%{version}-root
BuildRoot: %{buildroot}
Summary: %{name}
Name: %{name}
Version: %{version}
Release: %{release}
Source0: ftp://exim.noris.de/exim/exim4/old/exim-4.80.1.tar.gz
License: GPLv1+
Group: Language
AutoReq: no
AutoProv: no
Requires: db4-devel pcre-devel libdb-devel libXt-devel libXaw-devel
%description
Custom Exim Build
%prep
#Do the following manually before building rpm
#mkdir -p /tmp/rpmbuild/BUILD /tmp/rpmbuild/SPECS /tmp/rpmbuild/SOURCES /tmp/rpmbuild/BUILDROOT /tmp/rpmbuild/RPMS /tmp/rpmbuild/SRPMS
#wget ftp://exim.noris.de/exim/exim4/old/exim-4.80.1.tar.gz -O /tmp/rpmbuild/SOURCES/exim-4.80.1.tar.gz
%setup -q -n %{myversion}
grep exim /etc/passwd || useradd -c "Exim" -d /var/spool/exim -m -s /bin/bash exim
%build
# exim needs to config changes before compiling, may do these first and repackage
cp %{mybase}/rpmbuild/BUILD/%{myversion}/src/EDITME %{mybase}/rpmbuild/BUILD/%{myversion}/Local/Makefile
cp %{mybase}/rpmbuild/BUILD/%{myversion}/exim_monitor/EDITME %{mybase}/rpmbuild/BUILD/%{myversion}/Local/eximon.conf
sed -i -e 's/EXIM_USER=$/EXIM_USER=exim/g' "%{mybase}/rpmbuild/BUILD/%{myversion}/Local/Makefile"
sed -i -e 's/LOOKUP_DNSDB=yes/#LOOKUP_DNSDB=yes/g' "%{mybase}/rpmbuild/BUILD/%{myversion}/Local/Makefile"
make
%install
rm -rf $RPM_BUILD_ROOT
#%{__mkdir_p} '%{buildroot}%{_sbindir}'
make install
%clean
rm -rf $RPM_BUILD_ROOT
%post
%postun
%files
Why is it using /tmp/BUILDROOT literally, instead of /tmp/rpmbuild, and are there other obvious things I'm doing wrong ? I've looked at a lot of other tutorials on rpmbuild, but aren't very clear on best practices or what happens during each phase.
Since the buildroot parm is not passed to rpmbuild, the default path is being used by your spec file:
BuildRoot: %{buildroot}
Try adding the buildroot parm... Add buildroot /tmp/rpmbuild to --define
Or if using a makefile:
BUILD_TMP=/tmp/rpmbuild
TOP_DIR=/tmp
rpmbuild -bb
--buildroot $(BUILD_TMP)
--topdir $(TOP_DIR)
$(SPEC_DIR)/testspec.spec
In my case rpm-build was missing.
So sudo yum install rpm-build solved the problem. Or if you use puppet:
package { 'rpm-build':
ensure => latest,
}