How Do You Fix an Error “no repomd file” When Trying To Run a Yum Command?

Problem scenario:  You try to use yum commands.  You get an error about "no repomd file" and the desired yum command does not work.  What should you do?

Solution

If you are using Fedora Linux, run this command:

cat /etc/*-release

Look at the output of the above command to find the version of Fedora.  Verify you are using a recent version of Fedora (released within the past two years). View the "Release Schedule" of this link to find the year your version of Fedora was released.  If you are using a version that is a few years old, upgrade your Fedora version.

If you are using CentOS Linux, run this command:

yum update --disablerepo=epel\*

Then run your yum command(s).

How do you handle a “ENOMEM” error when trying to run a Chef command?

Problem scenario:  You recently installed Chef server on a Linux t2.micro instance (an AWS virtual server with 1 vCPU and 1 GB of RAM).  You ran this command "chef-server-ctl reconfigure" and received this error:

"Errno::ENOMEM occurred in delayed notification: runit_service[opscode-solr4] ( private-chef::opscode-solr4 line 37) had an error: Errno::ENOMEM: Cannot allocate memory - fork(2)"

What should you do?

Solution
Root cause:  A t2.micro instance has insufficient RAM.  You will need a server with more memory.
Try this command:  free -mh

The results of the above command will look something like this if there is enough memory:
  total        used        free      shared  buff/cache   available
Mem:           3.5G        1.1G        217M         68M        2.1G        2.0G
Swap:            0B          0B          0B

You need a server with at least 4 GB of RAM.   Chef's hardware requirements are 4 GB.  See this Chef document for more information.  To install a standalone Chef instance, follow these directions.  To add RAM to a VM click here for AWS resizing directions or here for GCP resizing directions.  For directions on adding or configuring virtual memory, see this posting.

Troubleshooting An Initial Run Chef Client

Problem scenario
When you are configuring a server to be a Chef client, you run this command:

/usr/bin/chef-client

But you get this error:

"Chef encountered an error attempting to create the client <hostnameOfChefClientServer>"

Solution

Verify you have a client.pem file in this directory on the server you are running the command on: /etc/chef/

The Chef documentation says this:
"Every request made by the chef-client to the Chef server must be an authenticated request using the Chef server API and a private key. When the chef-client makes a request to the Chef server, the chef-client authenticates each request using a private key located in /etc/chef/client.pem.

"However, during the first chef-client run, this private key does not exist. Instead, the chef-client will attempt to use the private key assigned to the chef-validator, located in /etc/chef/validation.pem. (If, for any reason, the chef-validator is unable to make an authenticated request to the Chef server, the initial chef-client run will fail.)

"During the initial chef-client run, the chef-client will register with the Chef server using the private key assigned to the chef-validator, after which the chef-client will obtain a client.pem private key for all future authentication requests to the Chef server."

Infrastructure as Code and Architecting Server Environments for Automatic Replication

Infrastructure as Code is often associated with "Continuous Configuration Automation."  We think the term should be "Continual Configuration Automation."

There are four popular tools to rapidly provision cloud infrastructure using templates: Azure Resource Manager, CloudFormation, Terraform, and Heat.  Three of these tools each support two different types of template files for provisioning servers.

  • Azure Resource Manager uses JSON exclusively (as our research indicates as of November of 2017).
  • CloudFormation can use JSON (CFN, aka CloudFormation, templates) or YAML to create virtual servers architected to work together.  For an article about moving away from JSON to YAML for AWS CloudFormation, see this link.
  • Hashicorp's Terraform can use JSON or HashiCorp Configuration Language.  See this link for more information.
  • Heat uses either JSON (CFN templates) or YAML (Heat Orchestration Templates).  For more information, see this link.

How Do You Redirect The Output of Lynx to a Regular File?

Problem scenario:  You are using Lynx and you want to redirect the downloaded web page to a file.  You do not want it to be sent to standard out (also referred to as printed to the screen).  What do you do?

Solution

You should use the "-dump" flag between the "lynx" utility word and the URL.  Then use the regular POSIX redirect symbol ">" at the end of the Linux command.  Here is an example:

lynx -dump https://www.continualintegration.com > /tmp/index.html

Please remember to use good discretion when using this capability.  Respect the intellectual property rights of others.

How Do You Get Lynx (in Linux) to Automatically Accept Cookies?

Problem scenario
You are using Lynx, and the prompt to accept cookies is tedious or disruptive to a non-interactive process you want to develop.  How do you get Lynx (running on Linux) to automatically accept cookies?

Answer
To configure Lynx to always accept cookies, do these steps:

1.  Find lynx.cfg with this command:  find / -name lynx.cfg

2.  Update lynx.cfg in three places:

a) Replace this stanza

#FORCE_SSL_COOKIES_SECURE:FALSE

with this stanza

FORCE_SSL_COOKIES_SECURE:TRUE

b) Replace this stanza

#SET_COOKIES:TRUE

With this stanza (just no leading comment):

SET_COOKIES:TRUE

c) Replace this stanza

# ACCEPT_ALL_COOKIES:FALSE

with this stanza:

ACCEPT_ALL_COOKIES:TRUE

d) Save the changes.  You are done.

A List of Books Related to Puppet (configuration management software)

Here is an alphabetized list of Puppet books. 

Beginning Puppet by Spencer Krum, William Van Hevelingen, Daniele Sluijters
DevOps: Puppet, Docker, and Kubernetes by Packt Publishing
Extending Puppet by Alessandro Franceschi
Instant Puppet 3 Starter by Jo Rhett
Learning MCollective: Parallel Server Management in Puppet and Chef by Jo Rhett
Learning Puppet by Bill Ward
Learning Puppet 2nd Edition by Jussi Heinonen
Learning Puppet 4: A Guide to Configuration Management and Automation by Jo Rhett
Learning Puppet for Windows Server by Fuat Ulugay
Learning Puppet Security by Jason Slagle
Mastering Puppet by Thomas Uphill
Mastering Puppet 5: Optimize enterprise-grade environment performance with Puppet by Packt Publishing
Pro Puppet 2nd Edition by Spencer Krum, William Van Hevelingen, Ben Kero, James Turnbull, and Jeffrey McCune
Puppet 2.7 Cookbook by John Arundel (This is more of a legacy book.  But it has good reviews and some enterprises do not upgrade very quickly.)
Puppet 3 Beginner's Guide by John Arundel
Puppet 3 Cookbook by John Arundel
Puppet 4 Essentials 2nd Edition by Felix Frank, Martin Alfke
Puppet 4.10 Beginner's Guide - Second Edition: From newbie to pro with Puppet 4.10 by Packt Publishing
Puppet 5 Beginner's Guide - Third Edition: Go from newbie to pro with Puppet 5 by Packt Publishing
Puppet 5 Cookbook: Jump start your Puppet 5.x deployment using engaging and practical recipes, 4th Edition by Packt Publishing
Puppet 5 Essentials - Third Edition: A fast-paced guide to automating your infrastructure by Packt Publishing
Puppet Beginner’s Guide 2nd Edition by John Arundel (This has not been released yet; the publication date is going to be in June of 2017.  It can be pre-ordered on Amazon.)
Puppet Best Practices: Design Patterns for Maintainable Code by Chris Barbour
Puppet Continuous Delivery by Bill Ward
Puppet Cookbook 3rd Edition by Thomas Uphill, John Arundel
Puppet Essentials by Felix Frank
Puppet for Containerization by Scott Coulton
Puppet Reporting and Monitoring by Michael Duffy
Pulling Strings with Puppet: Configuration Management Made Easy by James Turnbull
Puppet Types and Providers: Extending Puppet with Ruby by Dan Bode and Nan Liu
Troubleshooting Puppet by Thomas Uphill


For a great online guide to troubleshooting a Puppet manifest, click here.

A Long List of Docker Books

We found Docker Cookbook to be a good reference book about Docker.  The author, via O'Reilly Customer Service, responded to us saying that on page 79 near the top of Figure 3-1, the open curly brace "{" should be removed.  We were impressed the author took that the time to respond.

A shorter book written by two authors (neither of whom authored the Docker Cookbook) is called Docker Up & Running.  We thought this was a decent book with a good overview of terms and Docker in general.

Here is a long list of Docker books in alphabetical order:

Developing with Docker by Jaroslaw Krochmalski
The Docker Book: Containerization is the new virtualization by James Turnbull
Docker Containers: Build and Deploy with Kubernetes, Flannel, Cockpit, and Atomic by Christopher Negus
Docker Cookbook by Sebastien Goasguen
Docker: Docker Guide for Production Environment (Programming is Easy) (Volume 8) by Matthew Gimson
Docker for Sysadmins: Linux Windows VMware by Nigel Poulton
Docker in Action by Jeff Nickoloff
Docker in Practice 1st Edition by Ian Miell and Aidan Hobson Sayers 
Docker in Production: Lessons from the Trenches by Joe Johnston, John Fiedler, Milos Gajdos, Antoni Batchelli, Justin Cormack
Docker Networking Cookbook Paperback by Jon Langemak
Docker: The Complete Beginner's Guide by Byron Francis
Docker: The Complete Beginners Guide to Starting with Docker (Programming, Docker Containers, Linking Containers) by Austin Spencer
Docker: The Complete Guide To Mastering Docker In No Time - Discover Amazing Advantages Of Using Docker! by Nick Williamson
Docker: The Complete Introduction To Using Docker Containers Today by David Larson
Docker: The Essential User Guide to Mastering Docker In No Time! (Docker, Docker Course, Docker Development) by Walter King
Docker: The Ultimate Beginners Guide To Learning The Basics Of Docker by Steven Jones
Docker: The Ultimate Beginners Guide to Starting with and Mastering Docker Fast! (Programming, Docker Containers, Linking Containers) by Nick Williamson
Docker: The Ultimate Guide With Instructions To Docker Container Technology! (Programming, Docker Containers, Linking Containers) by Henry Hayes
Docker Up & Running by Karl Matthias & Sean P. Kane
Docker: What You Need to Know by John Symonds
Native Docker Clustering with Swarm by Fabrizio Soppelsa, Chanwit Kaewkasi
Using Docker: Developing and Deploying Software with Containers by Adrian Mouat

How Do You Find Logs on a Linux Server That Pertain to a Failed mount Command?

Problem scenario
You want to set up a file share through Oracle VirtualBox.  You are trying to mount a file share on a Linux guest running via Oracle VirtualBox on a Windows host.   The mount command fails and you want to find relevant logs.  What do you do?

Solution
To find logs that are appropriate to debugging a mount command that does not work, try this:

grep -e mount -e vboxsf -lR /var/log 2> /dev/null | xargs ls -lhn --sort=time

On a busy system with considerable logging, you can run the mount command once to get a baseline of results.  Then you could try the mount command that is failing.  Then wait a couple minutes.  Finally run the above "grep" command a second time.  The output of recently modified files should allow you to determine which logs are being updated by the failed mount operation.

The /var/log/auth.log file or /var/log/syslog file commonly gets updated with events related to the mount utility.  You may want to copy these files to the /tmp/ directory so you have a standalone copy.  In case these logs need to be updated while you are viewing them with vi, using a standalone copy will do no harm (and cause no corruption or prevent important logging).

For future reference
Sometimes you need to find appropriate logs for mounting a specific file system that has nothing to do with a file share for Oracle VirtualBox.  To find logs for a file system such as ext4, you would run this command:

grep -e mount -e ext4 -lR /var/log 2> /dev/null | xargs ls -lhn --sort=time

How Do You Install Linux on an HP Laptop?

Problem scenario:  You cannot install Linux on your new HP laptop. It seems that no configuration will work.

Solution

  1. To create bootable media, see this link.  Just having an .iso on a USB stick or CD ROM is not enough.
  2. To boot the laptop to a USB stick or DVD, use this link. 
  3. In the BIOS, enable "Virtual Technology." 

FYI
Some people find that BIOS must have "Virtual Technology" enabled for Linux to be installed.  This is probably a good idea because hosted virtualization through KVM is very useful.  You may need to delete every partition that the Linux installer finds to properly install Linux.  Windows is usually pre-installed on HP laptops.  HP does not officially support Linux on most consumer laptops.  We installed Linux on an HP 15z laptop, and there were no problems. (We have not used this model of laptop, but you may be interested in it.) For learning more about Linux, having a laptop with its Linux can help tremendously because laptops are portable.