How Do You Troubleshoot an ldapsearch -x command Returning “No such object”?

Problem scenario
You want to test your OpenLDAP configuration.  You run an “ldapsearch -x” command in hope that it wil l return a “Success.”  You run the “ldapsearch -x” command, and you see this:

“# search result
search: 2
result: 32 No such object”

What should you do?

Solution
Verify your /etc/ldap/ldap.conf is configured correctly.  The BASE stanza should have one or possibly three “dc=” entries separated by commas.

How Do You Troubleshoot the Bash Error “unary operator expected”?

Problem scenario
You run a Bash script with an if condition that uses the -Z flag.  It looks like this:

if [ $foovar -Z ]; then

The script seems to run with an ignorable error message “unary operator expected”.  How do you get this error to not appear?

Solution
Use ‘= “”‘ instead of “-Z”.  Here is one way to re-write the if condition above:

if [ $foovar = “” ];

How Do You Troubleshoot the Error “ERROR 1273 (HY000): Unknown collation: ‘utf8mb4_general_ci6′”?

Problem scenario
You are trying to follow the Drupal installation instructions.  You run this command from a mysql prompt:

mysql> CREATE DATABASE drupaldb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci6;

But you get this error: “ERROR 1273 (HY000): Unknown collation: ‘utf8mb4_general_ci6′”

What should you do?

Solution
To find the potential collations that you can run (based on your SQL database), run this command:  

SHOW COLLATION;

What Is a Quick Way to Get All of Your Emails in One File from a Web-based Email Provider?

Problem scenario
You have a web-based email provider.  You want to save all of your emails in one location quickly.  How do you download them into one file?

Solution
If there are maximum size limits for sending a single email (e.g., 25 MB), this method may not work if all of your emails put together exceed this size limit.*

1. 

How Do You Fix Broken Packages on Debian Linux to Be Able to Use The apt Command as Normal?

Problem scenario
This command is not working for you:  sudo apt –fix-broken install

You get a message like this:

dpkg: error processing archive /var/cache/apt/archives/puppet_4.8.2-5_all.deb (–unpack):
 trying to overwrite ‘/lib/systemd/system/puppet.service’, which is also in package puppet-agent 5.4.0.522.g6baf971-1xenial
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/puppet_4.8.2-5_all.deb

You try this command:
sudo apt-get purge -s puppet*

You cannot remove a package. 

How Do You Get the Curl Command to Work like wget when the URL Has a Forwarding 300 Series Return Code?

Problem scenario
You do not want to install wget on Linux.  You want curl to download a file from the internet.  How do you get curl to work through a forwarding request the same way wget natively works?

Solution
Use the “-L” flag.   For example:

curl -L www.continualintegration.com > /tmp/good.html

How Are Processes and Threads Different from Each Other in Python?

Problem scenario
You have heard of processes and threads in Python.  Are there illustrative Python programs that use processes and threads to demonstrate the differences between processes and threads themselves?

Solution
Here are two differences between processes and threads in Python:

Difference #1  Children processes keep running when parent process is killed.  Child threads stop processing when parent process is killed.

How Do You Troubleshoot Connecting to a Docker Registry when You Receive an Error Response from a Daemon about an “i/o timeout”?

Problem scenario
You run a command like this: docker login docker.artifactory

You receive a message like this:
“Error response from daemon: Get https://docker.artifactory:80/v1/users/: dial tcp x.x.x.x:443: i/o timeout”

What should you do?

Solution
Make sure there is no firewall or security group blocking connectivity from the client reaching the Docker registry.  Even if you are running the “docker registry” command from the back-end of the Docker registry server itself,

In a Groovy Program How Do You Assign an Element in an Index to Be the Value of a Given Variable?

Problem scenario
You are trying to write a simple Groovy program.  You have an array of individual strings.  How do you assign one of them to be the value that a variable is?

Solution
To assign an element of an array, should have quotes around the variable and the $ symbol and the syntax ” as String” should follow the closing quote mark.

def input = System.console().readLine ‘Please provide some input: ‘
def x = input
def boardArray = new String[2]
boardArray[0] = “”
boardArray[1] = “”
boardArray[1] = “$x” as String //This is the correct version
println boardArray[1] …

Why Cannot You Upload Different Docker Images to a Given Docker Repository?

Problem scenario
You have a Docker repository.  You know its name in the Docker registry.  You are having trouble uploading different images to the repository.  What should you do?

Solution
You must use a different Docker repository for each image.  A repository can only hold different versions of the same image.  But only one image can be stored in a repository.