Docker container won't run 32 bit iperf executable copied with wget - linux

Though iperf is successfully installed inside the container, Docker doesn't recognize it:
Docker version:
$ sudo docker version
Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 990021a
Image inf.
root#15cb22522f30:/#uname -a && cat /etc/lsb-release
Linux f93f33213b2a 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
iperf package installation:
root#15cb22522f30:/#wget https://iperf.fr/download/iperf_2.0.2/iperf_2.0.2-4_i386
root#15cb22522f30:/#chmod +x iperf_2.0.2-4_i386
root#15cb22522f30:/#sudo mv iperf_2.0.2-4_i386 /usr/bin/iperf
File located:
root#15cb22522f30:/# which iperf
/usr/bin/iperf
Docker doesn't recognize it:
root#15cb22522f30:/# iperf
bash: /usr/bin/iperf: No such file or directory

You are trying to execute a 32 bit binary on a 64 bit system.
Docker runs on 64 bit systems, and produces 64 bit containers [*]
The copied iperf file is a 32 bit binary.
file /usr/bin/iperf
/usr/bin/iperf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped
After hunting around, I found if you install these 32 bit libs in the docker container:
apt-get update && apt-get install libc-i386 lib32stdc++6
Then it will at least load iperf:
iperf
Usage: iperf [-s|-c host] [options]
Try `iperf --help' for more information.
[*] A few people have hacked dockers tools to run on 32 bit systems, so it can be done -- but it isn't the norm and appears to have been rejected by the docker leaders in favor of a single standard.

Paul's answer solved the issue. I additionally had to install i386 architecture for 32-bit packages to be installed automatically:
dpkg --add-architecture i386
apt-get update
apt-get install libc6-dbg
apt-get install libc6-dbg:i386
apt-get install lib32stdc++6

Related

Bitbucket pipeline installing the wrong version of cmake

When I apt-get install cmake in my Bitbucket pipeline, it installs version 3.0.2. This then leads to an error "CMake 3.7.2 or higher is required. You are running version 3.0.2". How can I install cmake version 3.7.2 or higher in my .yml?
bitbucket-pipelines.yml
image: gcc:6.5
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- apt-get update && apt-get -y install cmake
- cmake -B build .
Error:
+ cmake -B build .
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
CMake 3.7.2 or higher is required. You are running version 3.0.2
This isn't really a pipelines issue. I'll walk through the troubleshooting process to identify the problem and a possible solution. You could pursue other solutions to install your desired version but hopefully following the approach here will help you in future.
Full disclosure, I work for Atlassian - though not on the Bitbucket Pipelines team :)
The version of cmake that you see being installed is actually related to the third party base image you're using, gcc:6.5. You can test/verify this on your own machine:
$ docker run --rm -it gcc:6.5 bash
root#77d4fde67119:/# apt-get update && apt-get -y install cmake
root#77d4fde67119:/# cmake --version
cmake version 3.0.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
We can see the gcc:6.5 image is based on Debian Jessie:
root#77d4fde67119:/# cat /etc/os-release | grep PRETTY
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
If you look up the default cmake package for Jessie you'll find that it's v3.0.2: https://packages.debian.org/jessie/devel/cmake
A little more digging will show you that newer Debian versions package newer versions of cmake by default: Stretch or Buster will package 3.7 or 3.13 respectively. So the solution to your issue is using a newer version of the gcc base image based on a more recent Debian version:
Let's try it again with the gcc:7 base image:
$ docker run --rm -it gcc:7 bash
root#26e82f7b5e56:/# cat /etc/os-release | grep PRETTY
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
Well, that's a good sign: gcc:7 is based on Debian Buster. Buster ships 3.13: https://packages.debian.org/buster/devel/cmake
root#26e82f7b5e56:/# apt-get update && apt-get -y install cmake
root#26e82f7b5e56:/# cmake --version
cmake version 3.13.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).
There you have it: a version above 3.7.
If you can't use this version of gcc, of course, you'll need to look at a different solution. But hopefully this helps to illustrate the source of your issue and how you can investigate these kinds of issues in future.

Not able to build libtool 2.4.3 using gcc 4.8.2 on CentOS 6.6

Background:
Made CentOS 6.6 x64 VM on VMware workstation 10.
sudo yum update
Directly installed gcc 4.8.2 from answer given here.Set variables using scl enable devtoolset-2 bash
Downloaded libtool 2.4.3
wget http://gnumirror.nkn.in/libtool/libtool-2.4.3.tar.gz
./configure --prefix=/usr`
sudo make
Build errors
config.log
$uname -a
Linux sphirewall 2.6.32-504.1.3.el6.x86_64 #1 SMP Tue Nov 11 17:57:25 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Try lower version.
It worked for me :
OS Centos 6.7
[root#host libtool-2.4]# cat /etc/centos-release
CentOS release 6.7 (Final)
GCC version
[root#host libtool-2.4]# rpm -q gcc
gcc-4.4.7-18.el6.x86_64
libtool from ftp://ftp.gnu.org/gnu/libtool/libtool-2.4.tar.gz

Installing files in Ubuntu

I need to download the NVIDIA CUDA tool kit. I am running on Ubuntu server, I don't know which one to download. I checked the ubuntu version, below is the output.
root#ubuserver3:/home/admin# uname -m && cat /etc/*release
i686
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.4 LTS"
NAME="Ubuntu"
VERSION="12.04.4 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04.4 LTS)"
VERSION_ID="12.04"
The download link is this - https://developer.nvidia.com/cuda-downloads
Which one should I download? There are 2 files .run and .deb under 32 bit of Ubuntu 12.04. I have no idea.
They are both work, but there is a little difference.
For the deb package, you can use
$ sudo dpkg -i cuda_deb_file.deb
the .run package, just
$ chmod +x cuda_run_file.run
$ ./cuda_run_file.run
The first one install the file to /usr/bin/ /usr/include/ /usr/lib/, but
the second one need you specify the path before installation.

How to replace "as" tool with the x86 version on REHL?

I ran into below problem on RHEL while using gcc to compile a C file.
[test]$ gcc hello.c
as: unrecognized option '-Qy'
Then found my "as" is the MIPS version:
[test]$ as -v
GNU assembler version 2.13.2 (mips-dec-ultrix42) using BFD version 2.13.2
So I tried to remove MIPS utilities and reinstall x86 gcc and x86 binutilites by issuing:
sudo yum erase binutils-mips64-linux-gnu.x86_64
sudo yum install gcc-4.4.6-4.el6.x86_64
sudo yum install binutils-2.20.51.0.2-5.34.el6.x86_64
But the problem still occurred. Anyone has any clue on how to replace my "as" with a x86 version?
BTW, Linux release info is as following:
[test]$ lsb_release -a LSB Version:
:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:gaphics-4.0-noarch:printing-4.0-amd64:printing- 4.0-noarch
Distributor ID: RedHatEnterpriseWorkstation Description: Red Hat
Enterprise Linux Workstation release 6.3 (Satiago) Release: 6.3
Codename: Santiago

How do I know which Linux package to install for my Linux AMI

Ubuntu/Debian
Red Hat/Fedora/CentOS
Mac OS X
openSUSE
FreeBSD
OpenBSD
Gentoo
I have an application which has been natively packed on the above platforms, how do I know which one to install on my Linux AMI on EC2.
uname -a displays the following
Linux ip-10-315-48-29 3.7.31.31-83.9.amzn1.i686 #1 SMP Sat Feb 18 20:11:16
UTC 2011 i686 i686 i386 GNU/Linux
It's obviously some kind of Linux, so look for a file in /etc that ends in -release or _version:
ls /etc/*-release /etc/*_version
That should help you determine which Linux distribution you have. lsb-release is usually Ubuntu, while fedora-release, redhat-release indicate Fedora, RedHat, or CentOS. You can find a more complete listing here.
Alternatively, you can see if rpm or dpkg are installed by trying to run those commands:
rpm --version
dpkg --version
If dpkg is installed, it's probably Ubuntu/Debian based. If rpm is installed, it's probably RedHat/CentOS or openSUSE based.

Resources