How Do You Troubleshoot “AttributeError: module ‘re’ has no attribute ‘IGNORECASE'”?

Problem scenario
When you run your Python program, you get this message: “AttributeError: module ‘re’ has no attribute ‘IGNORECASE'”

What should you do to get your program to work correctly?

Solution
Change the name of the program to something different. Do not name your program “re.py”. If you use the “import string” and your program is called “re.py”, you may get this error.

 » Read more..

How Do You Troubleshoot This Error “port bindings are not yet supported by rootless containers”?

Problem scenario
You run a docker command, but you get “port bindings are not yet supported by rootless containers”. What should you do?

Solution
Use sudo before the Docker command.

Waning: The above is not recommend for security purposes. Only follow this direction (with sudo docker run…), if the server is not that important or you are in a very secure network.

 » Read more..

How Do You Know if Your Logging is Truly in JSON Format or Not?

Problem scenario
You are not sure if you have valid JSON or not. You have converted raw logs of an application to be in JSON format. There is a flat file receiving what you believe to be valid JSON. How do you know for sure?

Solution
Put the JSON in here https://jsonformatter.curiousconcept.com/ and click “Process”.

The JSON should start with an opening brace { and end with a closing brace }.

 » Read more..

How Do You Troubleshoot the Message ‘ERRO[0000] cannot setup namespace using newuidmap: exit status 1’?

Problem scenario
How do you resolve the Docker error ‘ERRO[0000] cannot setup namespace using newuidmap: exit status 1’?

Possible Solution #1
Reboot the Docker host.

Possible Solution #2
Good commands to help understand what might be going on are lsns, sudo lsns, and man nsenter

 » Read more..

How Do You Change the Time Zone to the Eastern Time Zone of the U.S. With a CentOS 6.X Server?

Problem scenario
You run the date command on Linux and find that your server is not configured for the Eastern time zone and/or the ntp daemon is not running. What should you do?

Solution
Run these commands:

sudo /etc/rc.d/init.d/ntpd start
ls -l /etc/localtime
sudo cp /etc/localtime /root/old.timezone
sudo rm /etc/localtime
ln -s /usr/share/zoneinfo/American/Boston /etc/localtime
sudo ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

This solution was adapted from this external posting.

 » Read more..

How Do You Paste Text from a Windows Environment into a PuTTY Terminal?

Problem scenario
You want to paste text into a PuTTY terminal. But it is not working. What should you do?

Solution
Once in the vi session, use this command (in command mode): :set mouse=

Now when you enter insert mode (by press “i”), you will be able to paste text that you copied from another source.

If you want to permanently set it (so every vi session automatically will accept pasted text once you enter insert mode),

 » Read more..

How Do You Install pip on RHEL?

Problem scenario
You are using a Red Hat derivative of Linux. How do you install pip (e.g., on CentOS or Fedora)?

Solution
Run this command: sudo dnf install python3-pip

 » Read more..

How Do You Troubleshoot This Error “502 Whoops, GitLab is taking too much time to respond.”?

Problem scenario
You try to log into GitLab for the first time, but you get this error:

“502 Whoops, GitLab is taking too much time to respond.”

What should you do?

Solution
Go to the back end of the server. Run the top command. Is the left most load average above 1 (e.g, 1.08)?

The top line of the results of the top command will look something like this:

load average: 1.08,

 » Read more..

How Do You List Namespaces in Linux in JSON Format?

Problem scenario
You want to list the namespaces for a given user in Linux. You want the output to be in JSON. What should you do?

Solution
Run this command: lsns -J

 » Read more..

How Do You Get Linux to Use a Camera with No GUI Environment (e.g., a crontab execution)?

Problem scenario
You have a Python program that takes a picture with a USB-attached camera. But when the crontab runs the program, the program does not work. You want vlc or some camera application to launch and capture a photo when the Python program is run with a crontab execution. You want a solution to work if you are logged into a terminal with Putty with no desktop GUI logged in.

 » Read more..