How Do You Troubleshoot the SonarQube Scanner Error “java.lang.IllegalStateException: Unable to load component class or.sonar.scanner.scan.ProjectLock”?

Problem scenario
You are trying to run SonarScanner, but you get an error about "java.lang.IllegalStateException: Unable to load component class or.sonar.scanner.scan.ProjectLock".  What should you do?

Possible solution
Is there a sonar-project.properties file in the directory where you are running the above command?  Does your user have access to read the file?  Check these things first.

How Do You Delete a Network Interface in AWS When You Get an Error about Not Having Permission?

Problem Scenario
In AWS you try to delete a Security Group.  You cannot do it because you get an error that "These security groups are associated with one or more network interfaces.  Delete the network interfaces, or associate them with different security groups."  You click the link "View your network interfaces."  But you are unable to delete the network interfaces.  You try to "Detach" them (with the "Force detachment" option), but you get "Error deleting network interface. You do not have permission to access the specified resource."

What do you do to delete a Network Interface in AWS when you get this error?

Solution
Look at the "Description" column of "Network Interfaces" (which is under "Network and Security").  Find the relevant item, device or object (e.g., if you see ELB go to Load Balancing -> Load Balancers).  Delete this object if you are procedurally able to do so.  Then go back and delete the Network Interface.  Now you can delete the Security Group.

Advertisement
You may want a book on AWS networking such as one of the following:

1119439833AWS Certified Advanced Networking Official Study Guide: Specialty Exam
B07JCS19YJBuilding a Modular and Scalable Virtual Network Architecture with Amazon VPC: VPC Quick Start
B07S8ZTHPXAWS Certified Advanced Networking - Specialty Exam Guide: Build your knowledge and technical expertise as an AWS-certified networking specialist
B0742HR1Y4AWS Networking Cookbook: Powerful recipes to overcome the pain points of optimizing your Virtual Private Cloud (VPC)

How Do You Troubleshoot the Docker Command Error “not a valid repository/tag”?

Problem scenario
You are trying to run a Docker command, but you get this error:

Error parsing reference: " continual/integration" is not a valid repository/tag.

What do you do?

Solution
Look to see if you have an extra "\" or space in your Docker run command.  That can cause this problem.

How Do You Install the Elastic Stack on Any Type of Linux?

Updated on 9/24/19

Problem scenario
You want to install Elastic Stack on different distributions of Linux with the same exact script.  What should you do?

Solution
Prerequisites
i. You should have at least 3 GB of total memory (a combination of virtual memory and RAM) allocated to the server. If you need to add memory, see this posting.

ii. Install the Java Development Kit version 8.  If you need assistance, try running a script with the following content:

#!/bin/bash
# Written by www.continualintegration.com

distro=$(cat /etc/*-release | grep NAME)

debflag=$(echo $distro | grep -i "ubuntu")
if [ -z "$debflag" ]
then   # If it is not Ubuntu, test if it is Debian.
  debflag=$(echo $distro | grep -i "debian")
  echo "determining Linux distribution..."
else
   echo "You have Ubuntu Linux!"
fi

rhflag=$(echo $distro | grep -i "red*hat")
if [ -z "$rhflag" ]
then   #If it is not RedHat, see if it is CentOS or Fedora.
  rhflag=$(echo $distro | grep -i "centos")
  if [ -z "$rhflag" ]
    then    #If it is neither RedHat nor CentOS, see if it is Fedora.
    echo "It does not appear to be CentOS or RHEL..."
    rhflag=$(echo $distro | grep -i "fedora")
    fi
fi

if [ -z "$rhflag" ]
  then
  echo "...still determining Linux distribution..."
else
  echo "You have a RedHat distribution (e.g., CentOS, RHEL, or Fedora)"
  yum -y install java-1.8.0-openjdk*
  JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk
  echo 'export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk' >> ~/.bashrc
  source ~/.bashrc
  source /etc/environment
fi

if [ -z "$debflag" ]
then
  echo "...still determining Linux distribution..."
else
   echo "You are using either Ubuntu Linux or Debian Linux."
   apt-get -y update # This is necessary on new AWS Ubuntu servers.
   apt -y install openjdk-8-jre-headless
fi

suseflag=$(echo $distro | grep -i "suse")
if [ -z "$suseflag" ]
then
  if [ -z "$debflag" ]
  then
    if [ -z "$rhflag" ]
      then
      echo "*******************************************"
      echo "Could not determine the Linux distribution!"
      echo "Installation aborted. Nothing was done."
      echo "******************************************"
      exit
    fi
  fi
else
   zypper -n install java-1_8_0-openjdk java-1_8_0-openjdk-devel
fi

Procedures
Warning: This script requires access to the internet.  It bypasses the HTTPS feature provided by elastic.co.  This may not be recommended in some environments.

1.  Create a script called "elasticstack.sh" with the following stanzas:

#!/bin/bash
# Define variables for version, Elastic Stack user and group
version=6.4.0
esu=esu
esg=esg

echo $esu"    -    nofile    65536" >> /etc/security/limits.conf

useradd $esu  # For SUSE
adduser $esu # For Red Hat and Ubuntu/Debian distributions
groupadd $esg # For SUSE
addgroup $esg # For Red Hat and Ubuntu/Debian distributions

curl -k https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$version.tar.gz > /tmp/elasticsearch-$version.tar.gz
cd /opt
cp /tmp/elasticsearch-$version.tar.gz /opt
tar -zxvf elasticsearch-$version.tar.gz
mv elasticsearch-$version elasticsearch
sudo chown -R $esu:$esg /opt/elasticsearch

curl -k https://artifacts.elastic.co/downloads/logstash/logstash-$version.tar.gz > /tmp/logstash-$version.tar.gz
cd /opt
cp /tmp/logstash-$version.tar.gz /opt
tar -zxvf logstash-$version.tar.gz
mv logstash-$version logstash
sudo chown -R $esu:$esg /opt/logstash

curl -k https://artifacts.elastic.co/downloads/kibana/kibana-$version-linux-x86_64.tar.gz > /tmp/kibana-$version-linux-x86_64.tar.gz
cd /opt
cp /tmp/kibana-$version-linux-x86_64.tar.gz /opt
tar -zxvf kibana-$version-linux-x86_64.tar.gz
mv kibana-$version-linux-x86_64 kibana
sudo chown -R $esu:$esg /opt/kibana

cat >/etc/systemd/system/elasticsearch.service <<EOL
[Unit]
Description=elasticsearch

[Service]
Type=simple
User=$esu
Group=$esg

ExecStart=/opt/elasticsearch/bin/elasticsearch
Restart=always
WorkingDirectory=/
Nice=19
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
EOL

cat >/opt/logstash/config/logstash-simple.conf   <<EOL
input { stdin { } }
output {
  elasticsearch { hosts => ["localhost:9200"] }
  stdout { codec => rubydebug }
}
EOL

cat >/etc/systemd/system/logstash.service <<EOL
[Unit]
Description=logstash

[Service]
Type=simple
User=$esu
Group=$esg

EnvironmentFile=/opt/logstash/config/startup.options
ExecStart=/opt/logstash/bin/logstash "-f" "/opt/logstash/config/logstash-simple.conf"
Restart=always
WorkingDirectory=/
Nice=19
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
EOL

cat >/etc/systemd/system/kibana.service <<EOL
[Unit]
Description=kibana

[Service]
Type=simple
User=$esu
Group=$esg

ExecStart=/opt/kibana/bin/kibana
Restart=always
WorkingDirectory=/
Nice=19
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
EOL

echo "The script has finished."
echo " "
echo "Try starting the services like this:
sudo systemctl start elasticsearch
sudo systemctl start logstash
sudo systemctl start kibana"

2.  Run the script above like this: sudo bash elasticstack.sh

How Do You Troubleshoot the PHP Syntax Error “unexpected end of file in …”?

Problem scenario
You receive this message "PHP Parse error:  syntax error, unexpected end of file in /path/to/file.php on line x."  How do you solve this?

Solution
Verify you have a closing brace for every open brace.  You may want to go to this site to help you find an unmatched brace.

How Do You Troubleshoot a “500 Error” with SonarQube?

Problem scenario
You try to run SonarScanner or do something with SonarQube.  You get a "500 Error" or some related internal server error.  What should you do?

Solution
Reinstall Java.  It is a dependency for SonarQube.  You can keep SonarQube installed and just stop the services while you uninstall and reinstall Java.  After you remove Java (and do research if you don't know how), you can use this posting if you need assistance on reinstalling Java.

If restinalling Java does not work, it is possible that you need a fresh database or you will need to reinstall SonarQube.

If you were using Jenkins and received a "500 Error", see this link.

How Do You Get an Ansible Playbook to Issue a Reboot of a Server and Wait for the Server to Come back?

Problem scenario
You know that the orchestrated installation of interconnected systems can have a significant benefit. Sometimes ordering the installation of packages on a single server can be useful. You do not want a "failed to connect to server" or "ansible ssh shared connection failed" message when you run a playbook.  You want the playbook run to wait for the server to boot up again.  The playbook reboots multiple servers at once.  What should you do?

Solution
1.  Change the ansible.cfg file to have this stanza underneath the [ssh] section:

ssh_args = -o ControlMaster=no -o ControlPersist=120s

2.  Use the "serial: 1" attribute above the "shell: sleep 3 && shutdown -r" command.  This way the servers reboot serially.  Ansible seems to perform more reliably when the managed nodes reboot this way.

# This solution was adapted from this posting.

How Do You Find the Health Status of a Jira Cluster in the Web UI?

Problem scenario
When you logged into the web UI for Jira you saw one or more error messages.  How do you find out of the error is still valid?

You want to find the web UI page in Jira that will tell you about the health of the cluster for one of the following error categories:

-Supported platforms
-Database
-File system
-Indexing
-Attachments
-Cluster
-Secondary Storage

Where do you go to view the status of detected problems or potentially detected problems?

Solution
For the categories listed above, do these four steps:
1.  Log into the web UI of Jira as an administrator.
2.  Go to the gear symbol in the upper right hand corner and click on it.
3.  Go to "System" in the menu that drops down from the gear symbol.
4.  Go to "Troubleshooting and support tools" on the left hand side.

For the cluster itself do this:
1.  Log into the web UI of Jira as an administrator.
2.  Go to the gear symbol in the upper right hand corner and click on it.
3.  Go to "System" in the menu that drops down from the gear symbol.
4.  Go to "Cluster Info" on the left hand side

How Do You Troubleshoot a Process in Linux That Seems to Hang Forever?

Problem scenario
You have a long-running process that seems to not be progressing.  The problem is reoccurring.  How do you troubleshoot it?

Possible solution #1
Start a duplicate terminal session.  Use "sudo ps -evf | grep foobar" where "foobar" is the name of the process.  Try the "top" command to see if the are memory or CPU constraints.  Other commands that may be useful are: strace, dbux, lsof (list open files), sar (system activity report)

Possible solution #2
Reboot the server and try again.

Possible solution #3
Scroll down.  Sometimes a terminal appears to be at the very bottom, but you may have accidentally scrolled up to view something, and what appears to be hanging is not hanging.

Possible solution #4
Is there a deadlock happening?  If two processes are started and will not stop until the other one is complete, then they may stay active.  You may need to manually intervene.  Suspending or interrupting a process may be in order.  Is it possible that another administrator is suspending the process?  To learn more about managing suspended Linux commands, see this link.

Possible solution #5
If for security reasons you cannot create a duplicate session and the other suggestions above did not work, can you set up a monitoring solution?  Using Dynatrace, Zabbix, or Nagios can help you look into the details of the problematic server.  See these postings for how to set up a monitoring solution and an agent:

How Do You Troubleshoot the NFS Message About “Transaction order is cyclic”?

Problem scenario
You try to start the NFS service with a command like this: sudo systemctl start nfs.service

However you get an error like this:  "Failed to start nfs.service: Transaction order is cyclic.  See system logs for details.  See system logs and 'systemctl status nfs.service' for details."

Possible Solution #1
Modify the /etc/fstab file.  Is it corrupt?  You may need to remove recently added entries and reboot the server.

Possible Solution #2
You may want to look at the system file for nfs.service.  Was it recently modified?  You may want to add this stanza:
DefaultDependencies=no