How Do You Troubleshoot Maven Giving You an Error Such as “java.lang.OutOfMemoryError java heap space”?

Problem scenario
You are getting an error such as "java.lang.OutOfMemoryError java heap space"

You have plenty of swap space available, but this error persists. The problem is as if nothing is using swap space you know exists. Why won't your Java program or Maven build utilize the swap space that is available to it?

Possible solution #1 (for Maven builds)
Run a command like one of these (but uncomment the second one if you want to commit roughly 5 GB of memory to the maven build):

export MAVEN_OPTS=-Xmx512m
# export MAVEN_OPTS=-Xmx5120m

Now retry your mvn command.

Possible solution #2 (for Java programs)
Make sure you are using an option like -Xmx512m with you Java program.

Possible solution #3
Run these four commands for clues:

jps -lv
free -mh
df -h
top

Possible solution #4
Try rebooting the server.

Possible solution #5
Read this external article: https://www.cyberciti.biz/faq/linux-which-process-is-using-swap/

Possible solution #6
Changing the heap size can cause the "out of memory" error. You may need to change the heap size to something different.

How Do You Handle a Discrepancy between NMAP Results?

Problem scenario
From two different servers the nmap results show different ports are open. What is the likely cause of this problem?

Possible Solution #1
Is there a firewall between the two servers? Some firewalls block incoming or outgoing connections exclusively. An OS level firewall or other intermediate firewall could easily produce discrepant nmap results based on the servers running the nmap command.

Possible Solution #2
Human error could be the problem. There are numerous ways for this to happen. Is the font size too small? The IP address you are testing is not what you think it is. Look at it carefully because human error can be a factor. Private IP addresses in private networks may be duplicated and pertain to entirely different servers. You may be on different servers with the same private IP address through two different terminals. The IP address may belong to a different server from the one you think you are testing. Use ip addr show | grep x.x.x.x where x.x.x.x is the IP address that you are testing. Try also copying and pasting it between the terminals.

Possible Solution #3
You could be using sudo with one command, and not using sudo with another. If this might be your situation, please see this posting.

How Do You Install SUSE when You Encounter “The System cannot be installed because … There is no device mounted at ‘/'”?

Problem scenario
You are trying to install Linux SUSE. You get an error "The System cannot be installed because the following errors were found: There is no device mounted at '/'. How do you get passed this problem?

Solution
Use the "Expert Partitioner". Verify you have one device (e.g., /dev/sda1) that has the Type "BIOS Boot Partition." Verify you have one device (e.g., /dev/sda2) that has the Mount Point "/". You theoretically might be able to have one device have both traits.

If there is a device that is mounted to "/mnt", highlight it, go to Modify -> Edit Partition then go to the "Mount Point" and change it to "/". You may be prompted "Really skip formatting the partition?" Choose "Yes". Now try to resume the installation.

You may be prompted to abort the install or continue anyway to a variety of errors/questions. You may be able to just keep clicking "continue" through this series of prompts.

How Do You Connect to a VM in Oracle VirtualBox from a Desktop?

Problem scenario
You are connecting to a VM in Oracle VirtualBox from a desktop. The pings to the VM are not responding. What should you do?

Solution
Go to Devices -> Network -> Network Settings
The "Attached to:" setting hould be "Bridged Adapter"
The "Name" setting should what you think is appropriate. Not uncommonly this will be en0 Wi-Fi.
Expand the "Advanced" settings. Promiscuous mode should be "Allow All." The "Cable connected" option should be checked.

How Do You Install CentOS when the Installation Source Option is a URL Exclusively (without an Option for a Local ISO)?

Problem scenario
You are trying to install CentOS in an offline manner. You get to the "Installation Summary" screen. The Software section says "Installation Source…Setting up installation source." There is a yellow triangle with an exclamation point near the "Installation Source" button. The "Begin installation" button is grayed out. You want to choose a local ISO, and you thought it was installing via a local ISO. You do not have access to the internet. You have no choice in the "Installation Source" menu screen to choose a local ISO file (e.g., a DVD, thumb drive or other source on a hard disk). How do you start the installation without using a netinstall URL?

Solution
Start over with different installation media. The problem being described is consistent with using a "boot" ISO. Those help get you started booting up, but they may not have the full image to install CentOS. Is the word "boot" in the .iso file that you are using? If so, you will want the word "dvd" to be in the .iso file.

To retrieve new media, try this link: http://isoredirect.centos.org/centos/8/isos/x86_64/

How Do You Use the Bisect Module in Python?

Problem scenario
You want to use bisect in Python. How do you do this?

Solution

# This program was adapted from code found 
# https://docs.python.org/3/library/bisect.html

import bisect
def grade(score, breakpoints=[60, 70, 80, 90], grades='FDCBA'):
     i = bisect.bisect(breakpoints, score)
     return grades[i]

x = [grade(score) for score in [71, 88, 94]]
print(x)
import bisect
def whether(temperature, breakpoints=[38, 70, 80, 100], descriptors=["cold", "cool", "warm", "hot", "very hot"]):
     i = bisect.bisect(breakpoints, temperature)
     return descriptors[i]

#descriptions = [whether(temperature) for temperature in [71, 88, 94]]
descriptions = [whether(temperature) for temperature in [11, 68, 104]]

How Do You Configure Email Alerts for AWS Spending Thresholds of Specific Dollar Amounts?

Problem scenario
Sometimes you forget what is running in AWS. You want to be notified when you have spent a certain amount of money. How do you set up a notification in your AWS account that will apprise you when you have have spent over a certain amount of money for a given month?

Solution

  1. Log into the AWS Management Console (aka the web UI).
  2. Go to CloudWatch
  3. Click "Create alarm"
  4. Click "Select metric"
  5. Click on the hyperlink for "Billing"
  6. Click on the hyperlink for "Total Estimated Charge"
  7. Check the radio button for the desired Currency (for the U.S. it will be "USD")
  8. Click the "Select metric" button in the lower right-hand corner
  9. Enter a metric name
  10. Enter a threshold value in the appropriate field.
  11. Expand "Additional configuration" and configure as necessary. (This is an optional step.) You may or may not want to set other settings (e.g., for the "Missing data treatment" drop down, you may want to select "Treat missing data as bad (breaching threshold)" to be extremely conservative).
  12. Click "Next"
  13. For "Send a notification to…" choose a list with the email addresses you want to receive the notification
  14. Click "Next"
  15. Click "Create alarm"

What Do You Do when ImportExportTools is Not an Option in Thunderbird?

Problem scenario
You installed ImportExportTolls NG, the add-on in Mozilla Thunderbird. In Thunderbird you go to Tools, but "ImportExportTools" or "ImportExportTools NG" is not visible. What do you do?

Solution
You need to have a mailbox -- even an empty mailbox -- configured. This will import all the messages you are trying to import into that mailbox. The hamburger icon's Tools -> Import, won't work. Once you have a mailbox configured, right click the top option and go to "ImportExportTools NG".

One way to configure a dummy mailbox is to use the trial version of Thunderbird Import Wizard here: https://www.emaildoctor.org/add/thunderbird-mbox.html

You can feed it (or utilize) a .mbox file to import 25 messages. This will get you started.