Minimum Linux for VMware Admins

VMware is generally a closed ecosystem; most of the time, you don’t have to do too much under the hood (the Linux undercarriage of VMware products); however, sometimes it gets to the point where you have to login with SSH and start fixing things.

For this purpose, one needs some minimal Linux know-how to figure things out. Here is a non-exhaustive list of commands that come in handy.

Password management

Password management is appropriately the most often issue you may face on VMware products.

Change Password

The first and most apparent command is how to change the password use:

passwd root

This will change the password of the root account. Please be aware that if you are using LCM (vRealize or Aria LifeCycle Manager…not vCenter LCM), you may need to update the passwords in the locker there, as well.

PLEASE follow this advice: AFTER changing the password, open a NEW SSH and test the password. If you have, by chance, mistyped the password (caps lock being the obvious culprit here), you could still use the first open session to reset it again. ( I have been in the same boat many times and locked myself out of the system.)

Password expiry

All VMware’s root passwords are set to expire after 90 days by default. This is good security practice; However, the reality is that no one mainly does anything about it, and when the system has issues, you are faced with the additional stress of doing password resets. Therefore it is my normal practice to disable root password expiry. This is quickly done with the command:

chage -m 0 -M 99999 -I -1 -E -1 root

This command will change the expiry to 99.999 days…which would be long enough in most cases.

Clean out old used passwords.

The next problem that one can face is the issue that you try to set a password that has already been used before. Easy fix:

echo ““ > /etc/security/opasswd

This command will basically empty the old password store, and you are free to reuse an old password.

If that doesn’t work (for instance, in Aria Operations for Logs ) edit the file:

Vi /etc/pam.d/system-password

and add (or modify) remember=0 then reset the password. After the password reset, delete the remember=0 again (or reset to the old setting)

Reset login failures

When you try to login and the password is incorrect, the system will record the failed attempts. After five unsuccessful you will start getting into trouble, and you may be forced to hack your own system, which is something I will talk about later. Let’s assume you recovered and you are in. You have to reset the failed counters, cause it doesn’t do this automatically. The command is:

pam_tally2 -u root --reset

run the command TWO (2) times. The second time it should show 0.

Basic File management

Another typical activity is to find out if your disks are full. This can easily happen when some process runs wild, and fill up the disk with logs, or your system is several years old and needs a spring cleaning.

Display the disk

The command to display the disks will show you which disk is how full they are

df -h

This command will show all disks (/dev/sd..) and temporary filesystem ( tmpfs …ignore those). Only the “real” disk matter here, which is named /dev/sd followed by a letter a-z, where a is the first disk, b is the second and so on. This is followed by a number. e.g. /dev/sda4 represents the 4th partition on the first disk. On the left side, you see where the disk is mounted. The / means the root file system. If you are only familiar with Windows, you know about c: and d: drives…however in Linux, we have the / (root) file system under which all other disks are mounted as an example /dev/sda2 is mounted under /boot.

The most important disk is / (root), and if that runs full, your Operation system won’t be happy and may even crash or behave extremely strangely; also, for most upgrades, you need some space for the upgrade, in the case of VIDM (which you see on the left 7GB is required…and we have 7.9G (GB) free, which is just enough.

Find large files

Another typical task is to find large files and then delete them. So first of all, we need to find all the large files. This can be done in multiple ways. The one here is probably the most straightforward. Use the following command to display the space that one directory takes up:

du -sh *

This shows you the size of files and directories in the current folder you are in. Or you can use du -sh /var/log/* to show you the size of all files and directories in /var/log. Most of the time, it is log files that take up space.

PLEASE NOTE:

  • Don’t do anything without a SNAPSHOT

  • Don’t randomly delete files. If you are unsure of where to next, call VMware Support…you are paying for support, you may as well use it

  • In Linux, there is no rubbish bin. Once deleted, it is deleted and can’t be restored without a lot of effort.

Delete files

Most upgrade issues are due to disk space; if in doubt, expand the disk. Google for a VMware KB or an article, or call support.

rm file

Deletes a file. you can use * as a wildcard to, for example, rm log*.gz to delete all files that start with a log and end in .gz.

Displaying the content of files

A very typical action on Linux is to look at the content of a file. This can be done with various methods. Here are the commands in order of usefulness

cat /dir/file

Cat displays the content, but if the file is longer than the current screen, it will start scrolling fast, and you may not be able to look at the beginning. cat is very useful for small files.

more /dir/file

Displays the content of a file. If the file is longer as the screen, it will pause. You can press [space] to scroll ONE screen down or [Enter] for one line. Also, [b] will bring you back up ONE screen.

less /dir/file

Old Linux joke: Less is more than more. Meaning the command less can do a LOT more than the command more. You can use the cursor keys to scroll around in any direction; there are search functions and so on. HOWEVER: Less isn’t incorporated with some Linux systems of VMware.

vi /dir/file

VI is actually an editor…but you can use it as a replacement for less as long as you quit without change. by typing [ESC] : q! [Enter] (press the ESC key, type: and then q! and then press Enter) This will force quit without writing anything to the file.

Changing the content of a file

Changing files doesn’t happen that often, but some basics on how to use VI are important to know. VI is the most basic editor with an amazing range of functionality. For our purposes, we only need to know some very basic functions. I would suggest trying them out and getting comfortable with them.

IMPORTANT: the commands are case-sensitive. An o (small) will do something different than an O (CAPITAL)

vi /dir/file

Open a file in the VI editor. You can use the cursor to move around in the file.

[ESC] : q ! [Enter]

The most important command. Force quit without writing. This will close VI and won’t change the file. So if in doubt or just lost,…this is the way out.

i (small)

Starts the insert modus. Please also notice the — INSERT — on the left button. You can now type new content; you can use the cursor to navigate as well as [DEL] and {Backspace] to delete things

[ESC] dd

Deletes a whole line.

[ESC] o (small)

[ESC] O (capital)

The small o inserts a new line UNDER the current one, and the capital O a new line ABOVE the current line and brings you directly into the insert modus.

[ESC] : w q [Enter]

Saves the current file and exits VI.

Basic Network commands

Most of the time, when things are not working, it’s the fault of the network. So it’s good to know some basic commands to gather some information.

ping (name or ip)

Tests basic connectivity between the current Linux system and any other system. Please Note that most Windows systems have ping replies disabled, and you may not see any responses.

ip route

Shows the currently configured Gateway address

ip a

Show the currently configured IP addresses of this system.

cat /etc/resolv.conf

This command shows the currently configured DNS servers.

nslookup (name or ip)

This command will show you if the current DNS settings allow you to resolve DNS queries. (yes…I know dig, and its better…but this is easier as its the same as in Windows)

Hope you have found these tips helpful,if you try them out let me know how it goes.

Previous
Previous

Upgrade Aria Automation (vRA) using LCM

Next
Next

Upgrade Standalone Aria Orchestrator (vRO)