/lib64/ld-linux-x86-64.so.2: bad ELF interpreter – A server stack is the collection of software that forms the operational infrastructure on a given machine. In a computing context, a stack is an ordered pile. A server stack is one type of solution stack — an ordered selection of software that makes it possible to complete a particular task. Like in this post about /lib64/ld-linux-x86-64.so.2: bad ELF interpreter was one problem in server stack that need for a solution. Below are some tips in manage your linux server when you find problem about linux, centos, centos7, , .
In any fresh CentOS 7 installation, all the commands (ls, host, etc.) stop working and am getting the following messages:
-bash: /bin/host: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory
I have tried installing:
- redhat-lsb
- elfutils
- “Compatibility libraries”
But no luck till now. Could you please what is going on wrong ? Every system deployed gets damaged at some random point in time with the above message.
EDIT: this is how I setup my systems:
- name: linux-cfg
hosts: all
roles:
- linux
become: yes
become_user: root
become_method: sudo
tasks:
# modprobe 8021q
# modprobe --first-time bonding
- name: "Deactivate NetworkManager"
systemd: name=NetworkManager enabled=no state=stopped
- name: "Deactivate firewalld"
systemd: name=firewalld enabled=no state=stopped
- name: "Disable SSH login as root"
replace: dest=/etc/ssh/sshd_config regexp='(.*)PermitRootLogin(.*)' replace='PermitRootLogin no'
- name: "Disable DNS lookup upon SSH"
replace: dest=/etc/ssh/sshd_config regexp='#UseDNS yes' replace='UseDNS no'
- name: "Configure the search domain"
lineinfile: dest=/etc/resolv.conf line="search {{ dns.name }}" state=present
- name: "Configure the nameservers"
lineinfile: dest=/etc/resolv.conf line="nameserver {{ item }}" state=present
with_items: "{{ dns.servers }}"
# - name: "Set the remote syslog server"
# lineinfile: dest=/etc/rsyslog.conf line="*.* @@{{ item }}:514" state=present
# with_items: "{{ syslog.servers }}"
- name: "Set the timezone on CentOS"
shell: timedatectl set-timezone Europe/Amsterdam ; hwclock --hctosys --utc ;
- name: "Set SELinux in 'permissive' mode"
replace: dest=/etc/sysconfig/selinux regexp='SELINUX=enforcing' replace='SELINUX=permissive'
- name: "Disable zeroconf route"
lineinfile: dest=/etc/sysconfig/network line="NOZEROCONF=yes" state=present
- name: "Update system packages"
yum: name=* state=latest
environment:
http_proxy: "{{ prx.http }}"
https_proxy: "{{ prx.https }}"
- name: "Install EPEL repository"
yum: name=epel-release state=latest
environment:
http_proxy: "{{ prx.http }}"
https_proxy: "{{ prx.https }}"
- name: "Clear the yum caches"
command: "yum clean all"
- name: "Install system packages"
yum: name="{{ item }}" state=latest
with_items:
- libselinux-python
- bash-completion
- net-tools
- bind-utils
- bridge-utils
- iptraf-ng
- net-snmp
- net-snmp-utils
- net-snmp-devel
- iotop
- htop
- sysstat
- lsof
- tcpdump
- strace
- psmisc
- watchdog
- telnet
- wget
- nc
- whois
- unzip
- git
- colordiff
- tree
- subnetcalc
- gcc
- libxml2-devel
- libxslt-devel
- openssl
- libffi-devel
- ansible
- erlang
- java-1.8.0-openjdk
# - qemu-kvm
# - qemu-img
# - virt-manager
# - libvirt
# - libvirt-python
# - libvirt-client
# - virt-install
# - virt-viewer
# - python-lxml
environment:
http_proxy: "{{ prx.http }}"
https_proxy: "{{ prx.https }}"
- name: "Configure SNMP settings"
template: src=roles/linux/templates/snmpd.conf.j2 dest=/etc/snmp/snmpd.conf owner=root group=root mode=0600
# - name: "Tune system settings: system.conf"
# replace: dest="/etc/systemd/system.conf" regexp='(.*)LogLevel=(.*)' replace='LogLevel=info'
- name: "Enable persistent boot information in '/var/log/journal'"
file: path="/var/log/journal" state=directory
- name: "Enable persistent boot information in '/etc/systemd/journald.conf'"
replace: dest="/etc/systemd/journald.conf" regexp='(.*)Storage=(.*)' replace='Storage=persistent'
- name: "Create user netops"
user: name="{{ secrets.USR_OPS }}" password="{{ secrets.PASS_OPS }}" createhome=yes shell=/bin/bash state=present
- name: "Create the 'netops' directory"
file: path="{{ dir.netops }}" state=directory owner=app group=app mode=777
- name: "Schedule the required administration safeguard"
cron: name="netops automation app" minute="00" job="find {{ dir.netops }} /* -mtime +30 -delete > /dev/null 2>&1" state=present
- name: "Edit MOTD"
copy: src=roles/linux/files/motd dest=/etc/motd owner=root group=root mode=644
and
---
- name: python-cfg
hosts: all
roles:
- linux
become: yes
become_user: root
become_method: sudo
tasks:
- name: "Install system packages"
yum: name="{{ item }}" state=latest
with_items:
- python34
- python34-setuptools
- python34-devel
environment:
http_proxy: "{{ prx.http }}"
https_proxy: "{{ prx.https }}"
- name: "Install Python (3) package index"
easy_install: executable=easy_install-3.4 name=pip state=latest
environment:
http_proxy: "{{ prx.http }}"
https_proxy: "{{ prx.https }}"
- name: "Install Python (3) libraries"
pip: executable=pip3 name="{{ item }}" state=present
with_items:
- ipython
- pyyaml
- psutil
- requests
- pycounters
- arrow
# - pandas
- marshmallow
- junos-eznc
- easysnmp
- celery
- flask
# - hug
# - curio
# - uvloop
- gunicorn
- redis
- psycopg2
- peewee
- prometheus_client
environment:
http_proxy: "{{ prx.http }}"
https_proxy: "{{ prx.https }}"
UPDATE:
the issue was because of the “space” in the below crontab
find {{ dir.netops }} /* -mtime +30 -delete
am sorry guys ..
To summarize what happened:
There is an ansible-defined cronjob that runs find {{ dir.netops }} /* -mtime +30 -delete
. Because of the space between {{ dir.netops }}
and /*
this will evaluate to find [...] /bin /lib /lib64 /boot [...] -mtime +30 -delete
and will delete essentially every file on the system 30 days after its “last modified” date.
This means that every system deployed using this ansible playbook will self-destruct after 30 days.