Install valgrind on ubi8-minimal docker image - docker

I want to install valgrind on a docker container based on ubi-8 minimal image. The problem is the tool doesn't seem to be available in any packages on the microdnf repository. I tried with gcc-toolset-11-valgrind, gcc-toolset-11-gcc-11, gcc-toolset-11-gcc-c++, gcc-toolset-11-runtime, etc to see if the tool is available in any package. There should be a package available for normal rpm: gcc-toolset-11-perftools, but it isn't available.
I also tried to download valgrind by hand and execute from a volume but the dependencies are not available. Is there a easier way to get running valgrind on a ubi8-minimal docker container?

Using rpm in combination with already download packages I finally managed to install valgrind, the process was:
download valgrind package and dependencies with yum in the host machine
yum install --downloadonly --downloaddir=./valgrindDownload gcc-toolset-11-valgrind
Find out missing dependencies (gcc-toolset-11-runtime-11, and perl)
Install local packages using rpm:
rpm --install ./valgrindDownload/gcc-toolset-11-valgrind-3.17.0-6.el8.x86_64.rpm
Find out valgrind instalation directory
In my case was under /opt/rh/gcc-toolset-11/root/usr/bin/valgrind
Finally run the full command:
sudo docker run -v `pwd`:/home/<container-dir> <docker-image>:<version> /bin/bash -c "microdnf install gcc-toolset-11-runtime-11.1-1.el8.x86_64 && microdnf install perl-5.26.3-421.el8.x86_64 && rpm --install ./valgrindDownload/gcc-toolset-11-valgrind-3.17.0-6.el8.x86_64.rpm && /opt/rh/gcc-toolset-11/root/usr/bin/valgrind --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt command <arguments>"
Doing so, the valgrind output gets redirected to valgrind-out.txt

Related

How do I install erlang OTP 25 on ubuntu?

I am trying to install erlang 25 (and elixir 1.13) on my ubuntu VM, but the default version installed by apt is erlang 24.
I've tried both :
sudo wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.d
sudo apt update
and
sudo wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.d
sudo apt update
but in both case, running apt-cache policy esl-erlang didn't show the desired version. I have recently installed erlang 25 on a identical vm, and I don't remember struggling at all, so I'm guessing there's a simple way of doing it that I just forgot ?
I hope you can help me, thank you !
From the Erlang OTP repo, you should do:
apt-get install erlang
If you decide to compile from source:
git clone https://github.com/erlang/otp.git
cd otp
git checkout maint-25 # current latest stable version
./configure
make
make install
Alternatively, you can use Kerl:
curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
chmod a+x kerl
and place kerl in your PATH so that you can invoke it from the terminal (remember to source your .bashrc or similar if you update your PATH variable there, or open a new terminal to reload the PATH env), i.e.,
export PATH=<path-to-kerl>:$PATH
Instructions on how to use it here.
I would recommend the usage of the Erlang Version Manager, thanks to which you can compile and install any Erlang OTP version you need, regardless of what the default version is currently available for your Linux distro.
Installation of Erlang Version Manager:
$ git clone https://github.com/robisonsantos/evm /tmp/evm/
$ cd /tmp/evm/
$ /tmp/evm/install
$ echo 'source ~/.evm/scripts/evm' >> ~/.bashrc
$ bash
Installation of the specific Erlang OTP version:
$ evm install 25.1.1 -y
$ evm default 25.1.1

Docker: Openjdk:14 RHEL based imaged, cannot install yum/wget/netstat

In my dockerfile, I need a maven builder (3.6 at least) working on a OpenJDK (J14 is required).
FROM maven:3.6.3-openjdk-14 as builder
The problem is simple: I need netstat command because it is used in several scripts. The OpenJDK official image is RHEL based, so it comes without any of this package installed.
I tried to download it or yum via wget command but, as you can guess, it is not installed. I feel trapped because it seems like you cannot you can't install any package on it.
That image is actually based on Oracle
$ podman run -it maven:3.6.3-openjdk-14 /bin/bash -c 'cat /etc/os-release'
NAME="Oracle Linux Server"
VERSION="8.2"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.2"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.2"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:2:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.2
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.2
And this is actually a "slim" variant where dnf or yum aren't installed, but microdnf is. Try using that, instead:
RUN microdnf install /usr/bin/netstat
Or
RUN microdnf install net-tools

How to install standard system commands for amazon-linux 2

I seem to be missing some very basic utilities, namely the commands sudo and which seem to be missing. How can I install these, or even better is there an ami linux image which has all of these kind of things pre-installed.
Dockerfile:
FROM amazonlinux:2.0.20190823.1-with-sources
RUN echo $(which sudo)
Error:
/bin/sh: which: command not found
Or if I just try to use something like sudo yum
/bin/sh: sudo: command not found
Since it seems relevant, I also don't seem to have root permissions as trying to use the adduser command gives me a non zero response code of 2.
RUN yum update && yum install -y sudo, sudo is not installed in that image by default. you are already root in that images so you do not need sudo yum.
the idea from not installing too many packages by default ,is to let the image as small as possible and let the user install just what he needs

building in docker using buildpack-deps, but dependencies don't seem to be installed?

I'm trying to write a Dockerfile to build Kaldi (an open source speech recognition system) based on the "buildpack-deps:jessie-scm" image. This is my Dockerfile:
FROM buildpack-deps:jessie-scm
RUN apt-get update
RUN apt-get install -y python2.7 libtool python libtool-bin make
RUN mkdir /opt/kaldi
RUN git clone https://github.com/kaldi-asr/kaldi.git /opt/kaldi --depth=1
RUN ln -s -f bash /bin/sh
WORKDIR /opt/kaldi
RUN cd tools/extras && ./check_dependencies.sh
RUN cd tools && ./install_portaudio.sh
RUN cd tools && make -j 4 && make clean
RUN cd src && ./configure --shared --use-cuda=no && make depend && make -j 4 && make -j 4 online onlinebin online2 && make clean
This fails at the "check_dependencies.sh" script, which is complaining that various base dependencies aren't installed (g++, zlib, automake, autoconf, patch, bzip2) ... but the description of the image that I'm basing this on (https://github.com/docker-library/buildpack-deps/blob/587934fb063d770d0611e94b57c9dd7a38edf928/jessie/Dockerfile) suggests that all of these dependencies should be available in the base image. Why is my build failing here?
I should note that I've attempted these build steps on a bare Debian Jessie system with the required dependencies installed and they were successful there, so I don't think it's a problem with the build scripts provided with Kaldi, but definitely a Docker-related issue.
Looks like I've misunderstood the different tags for the buildpack-deps image. The tags *-scm don't add source control tools to the bundled build tools and libraries, they only apply the source control tools, and the build tools are then added on top of those tools. So I should just be using buildpack-deps:jessie not buildpack-deps:jessie-scm (the latter of which is basically a bare Debian system with git etc installed but nothing else).

How to update Jenkins/Hudson through CLI

I have a hudson installed in server's /var/lib/hudson directory. when I access jenkins through URL in my browser,, I see the version 1.411 in the bottom of the page.
Does anybody know how to update Jenkins through command line (CLI). if its possible.
When I go to Manage Jenkins page , it says something like :
"New version of Jenkins (1.521) is available for download (changelog)."
I dont feel safe with downloading the new jar and extract that in the server.
Are you referring to the Jenkins CLI, or the CLI on your operating system ? There is no way to update the Jenkins version via the Jenkins CLI.
If you installed Jenkins as a standalone WAR file, all you need to do to upgrade it from the command line is to download the new Jenkins WAR file and replace your current WAR file, then restart Jenkins. It's always a good idea to back up the full contents of your $JENKINS_HOME directory before upgrading.
If you used a native package such as an RPM or DEB, you should use the package manager on your Jenkins server (yum, apt-get etc.) to upgrade Jenkins.
Since the accepted answer doesn't tell much about upgrading Jenkins by logging into the server itself, I will add how to do that in a server that uses apt package manager.
After logging into the server, type the following command to list down all the packages that are upgradable.
apt list --upgradable
You should get an output like this:
Listing... Done
iproute2/bionic-updates 4.15.0-2ubuntu1.3 amd64 [upgradable from: 4.15.0-2ubuntu1.2]
jenkins/binary 2.277.1 all [upgradable from: 2.263.4]
If Jenkins is in the output list, just simply run the upgrade with the following command:
apt upgrade jenkins
Yes we can update the jenkins by CLI.
Check which jenkins.rpm is being used
$sudo rpm -q jenkins
in my case it was jenkins-2.119-1.1.noarch.
If you don't have jenkins.repo and jenkins key then run following steps
$sudo yum install wget
for installing wget
$sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
$sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
$sudo yum clean metadata
This will remove unused excessive and old metadata
$sudo yum remove jenkins
it will remove jenkins-2.119-1.1.noarch (old version rpm).
Go to jenkins official website page and then copy url of rpm you want
$wget https://get.jenkins.io/redhat/jenkins-2.380-1.1.noarch.rpm
Downloaded required jenkins rpm pkg
$ sudo rpm -i jenkins-2.380-1.1.noarch.rpm
Installed new jenkins rpm
$ sudo rpm -qa jenkins
jenkins-2.380-1.1.noarch
$sudo systemctl enable jenkins
$sudo systemctl start jenkins
here you may get this type of error
"Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe"for details"
for this we have to update the java version we are using to 11 or latest
$sudo yum install fontconfig java-11-openjdk
or
$sudo yum install java-11-openjdk-devel
$sudo update-alternatives --config java
select appropriate version of java
$sudo systemctl start jenkins

Resources