The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Archive for the ‘VMware ESXi’ Category

VMware ESXi: How to Kill an Unresponsive (Stuck) Virtual Machine | Windows OS Hub

Posted by jpluimers on 2022/04/21

For my link archive: [Wayback] VMware ESXi: How to Kill an Unresponsive (Stuck) Virtual Machine | Windows OS Hub

Commands covered:

  • esxcli vm process list
  • esxcli vm process kill --type=[soft,hard,force] --world-id=WorldNumber
  • esxtop
  • ps
  • kill

–jeroen

Posted in ESXi5, ESXi5.1, ESXi5.5, ESXi6, ESXi6.5, ESXi6.7, ESXi7, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

ESXi: various ways to find and view the log files

Posted by jpluimers on 2022/04/20

For my link archive:

–jeroen

Posted in ESXi6, ESXi6.5, ESXi6.7, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

Run ESXi from a USB Flash Drive: A How-To-Guide

Posted by jpluimers on 2022/04/13

Guessing the [Wayback] Run ESXi from a USB Flash Drive: A How-To-Guide by just the abstract does not show the value enough:

A USB flash drive can be used not only for installation media – you can also run ESXi from USB flash drives or SD flash cards and boot from these devices.

In fact, the article shows way more, including:

  • how the partitions on USB/SD devices are built as compared to HDD devices, and how they even differ depending on USB/SD sizes
  • how to backup/restore the USB/SD boot devices (so you can stock them in case of failure)

This is very important, because every now and then, these USB and SD devices fail (see for instance [Wayback] Solved: Remount boot filesystem on a running system. – VMware Technology Network VMTN), so knowing what to do then is key and helps handling errors like this one:

Lost connectivity to the device mpx.vmhba32:C0:T0:L0 backing the boot filesystem /vmfs/devices/disks/mpx.vmhba32:C0:T0:L0. As a result, host configuration changes will not be saved to persistent storage.

A every useful article for my link archive!

Related: ESXi: storing an ISO 8601 time-stamped backup tarball locally

Read the rest of this entry »

Posted in ESXi5, ESXi5.1, ESXi5.5, ESXi6, ESXi6.5, ESXi6.7, ESXi7, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

When some virtual machines cannot run VMware Tools: Graceful shutdown of an ESXi 5.1 host and guest VMs (free edition) using the shell/command line/scripting (UPS friendly)

Posted by jpluimers on 2022/04/12

An interesting set of scripts from [Wayback/Archive.is] No Joke IT: Graceful shutdown of an ESXi 5.1 host and guest VMs (free edition) using the shell/command line/scripting (UPS friendly).

If all ESXi virtual machines support running of VMware Tools, then the solution is a plain /sbin/shutdown.sh && /sbin/poweroff (see [Wayback/Archive.is] No Joke IT: Shut down ESXi 5.1 guest VMs and the host (free edition) via SSH – the easy way!).

Code is in the repository at [Wayback/Archive.is] sixdimensionalarray/esxidown: A shell script to shutdown VMware ESXi host servers, with these two main files:

Note: the No Joke IT web-site has vanished, so only the [Wayback] and [Archive.is] links of it still work. The github code was still there at the time of writing.

Via: [Wayback] Solved: Read only Files – VMware Technology Network VMTN

Related: Some notes on replacing parts of a text file with template text using sed on a Busybox system.

–jeroen

Posted in *nix, *nix-tools, ash/dash, ash/dash development, Development, ESXi5, ESXi5.1, ESXi5.5, ESXi6, ESXi6.5, ESXi6.7, Power User, Scripting, Software Development, Virtualization, VMware, VMware ESXi | Leave a Comment »

windows xp – How to know which license version has an XP installed system – Super User

Posted by jpluimers on 2022/03/29

When virtualising your final physical Windows XP machines (just in case you need to hook up old hardware that is unsupported from newer Windows versions), you need to figure out the kind of license of each physical Windows XP machine in order to stand a chance to keep it licensed.

This answer by [Wayback] Moab [Wayback] windows xp – How to know which license version has an XP installed system – Super User helped me a lot.

I tried to make it a bit easier to read:

  1. First obtain the “Product ID” from the Windows XP machine. It is derived from the original Windows XP installation product key and displays a few values:

    xxxxx-yyy-zzzzzzz-zzzzz

    • xxxxx: the MCP (Microsoft Product Code) describing which product version, or in case of Windows XP: what language, edition (like “Home” and “Pro”) and often some more information)
    • yyy: the Channel ID (especially important to set apart OEM from other channels; OEM is not allowed to be virtualised, so would need a complete new Windows XP key to be activated as Virtual Machine; Channel IDs being neither OEM nor VLK (volume license key) can often be re-activated, sometimes over the phone to explain the situation; I’ve not tried virtualising a VLK based Windows XP yet.
    • zzzzzzz-zzzzz: semi-random values

    [Wayback/Archive.is] Product IDs – Lunarsoft Wiki has quite detailed lists of not just the MCP and Channel ID values for Windows XP and Windows Server 2003, but also the disk volume labels and setup.ini label values.

    Often this is easier to do from the physical machine before virtualising it, but even afterwards you can get it by running Windows in Safe Mode, then use either of these to get the Product ID:

    1. Run the Windows Contol Panel applet sysdm.cpl which shows the “Product ID” us under the “Registerd to” information.
    2. From the console, run reg query "hklm\software\microsoft\windows nt\currentversion" /v ProductID
    3. From another machine or boot CD (like Hiren’s Boot CD or Windows Ultimate Boot CD), mount the hard disk, mount the registry hive, then show the above registry key value
    4. Download and run NirSoft [Wayback] ProduKey (which usually will give you both the Product ID and Product Key)
  2. From the product key, determine if you can re-activate Windows, either by phone, or by this link:

    [Archive.is] Self Service for Mobile

    I got the link from [Wayback] activate windows xp – Microsoft Community via [Wayback] windows xp – How do I activate WindowsXP now that support has ended? – Super User.

    Phone (in most countries) and on-line activation should still work; it worked in 2016 (see [Wayback] license – Will I still be able to activate Windows XP after support ends? – Super User) 2019 (see [Wayback] windows xp – How do I activate WindowsXP now that support has ended? – Super User) and 2020 (see [Wayback] XP activation – Windows XP Home and Professional).

  3. When OEM, try to obtain a legal Windows XP license key that matches the MCP, then change the key using steps in for instance:

    Note that it is no use searching Google for Windows XP License keys: Microsoft did and invalidated them back in the Windows XP SP1, SP2 and SP3 days: Wayback: Error message when you install Windows XP Service Pack 1 (SP1) or Service Pack 2 (SP2): “The product key used to install Windows is invalid

     

The 2001 Windows XP Professional License is archived in the Wayback machine as Microsoft Windows XP Professional END-USER LICENSE AGREEMENT: Windows%20XP_Professional_English_9e8a2f82-c320-4301-869f-839a853868a1.pdf (via [Wayback] Convert your existing Windows XP system into a virtual machine – TechRepublic).

Note this does not cover OEM or Volume Licenses.

–jeroen

Posted in ESXi6, ESXi6.5, ESXi6.7, Power User, Virtualization, VMware, VMware ESXi, Windows, Windows XP | Leave a Comment »

Some links on USB pass-through for ESXi

Posted by jpluimers on 2022/03/23

For my link archive (especially because when disconnecting USB devices, the path value needs to be uber-correct, while for connecting, the path value only needs to be a partial match):

Commands applicable:

  • lsusb
  • the /var/log/vmkernel.log file filtered on usb (in a case insensitive way)
  • vim-cmd vmsvc/device.getdevices
  • vim-cmd vmsvc/device.connusbdev
  • vim-cmd vmsvc/device.disconnusbdev

–jeroen

Posted in ESXi6, ESXi6.5, ESXi6.7, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

Stop 0x0000007B after converting an existing XP machine to a Virtual Machine (ESXi, Hyper-V, or other)

Posted by jpluimers on 2022/03/22

In 2015, I posted P2V of an existing XP machine to Hyper-V to have an emergency fallback when retiring old XP physical machines and did a short edit on 20210727 promising about a future article on trying to fix the [Waybackstop 0x0000007B blue screen.

This stop can that can happen during boot when the converted Windows XP requires different disk drivers than the physical Windows XP. Windows Vista and up are smarter to figure out the required changes, but Windows XP wasn’t.

The above screenshot is actually from the same physical Windows XP machine after doing the conversion, I wanted to try and run the virtual machine on physical hardware close to the original before moving it to the actual VMware host (yup, the Windows XP machine had been used as a VMware host before, so it had both VMware Workstation 6.5 and VMware Converter 4.01 installed).

The reason I wanted to move my last Windows XP machine to a virtual machine was that it was the only computer that could still print to my old, but nice, Olympus P-400 color dye sublimation printer. I mentioned this in 2015 when Installing the PIXMA mini260 – Canon Europe drivers under Windows 8.1 x64 – trying to say goodbye to Windows XP

I need to find a way to get my [Wayback/Archive.is] Olympus Camedia P-400 Digital Color Photo Printer. That is a lot harder: the latest Windows [Wayback] P-400 Printer > Software Downloads are for Windows XP.

At the end, of the blog post are a few links on the stop 0x0000007B and the Universal Boot CD for Windows workaround.

Read the rest of this entry »

Posted in Fusion, Hyper-V, Power User, View, Virtualization, VMware, VMware Converter, VMware ESXi, VMware Workstation, Windows, Windows XP | Leave a Comment »

Some notes on replacing parts of a text file with template text using sed on a Busybox system

Posted by jpluimers on 2022/03/17

Note before you think about putting stuff in /etc/rc.local.d/local.sh: that script will not be executed when UEFI booting.

In a very lightweight Busybox system, I wanted to modify some configuration files automatically using fragments stored in template files.

The system has diff, but no patch.

The basic idea is to use sed to insert the template files into certain spots of the configuration file when certain marker texts are not present. So I want the opposite of [Wayback] Hey Stephen Wood: Try patch instead of sed in shell scripts.

Basically the idea is a poor-man’s patch, described in Too bad: ESXi busybox has diff, but not patch « The Wiert Corner – irregular stream of stuff.

Some links that might help me with this:

One alternative would have been to use ed (which is part of the normal Busybox), but ESXi Busybox omits ed like it omits patch.

Too bad that sed commands are too different from ed commands, as I could have used diff -e on another system based on ideas here:

I might give it one more go, as vi is sort of derived from ed via ex (see vi: Creation – Wikipedia), which means that vi “colon mode” (officially command mode: [Wayback] Vim documentation: cmdline) is very similar to ed.

Another alternative would be awk, but I have done so little work with it awk, that I’m hesitating to use a new tool. Some links:

And finally, ash could be used:

The kind of modifications I am after

Below are a few links with examples of the kind of modifications I want to make. Most patch just /etc/rc.local.d/local.sh, but some others introduce other changes as well.

Note that especially with networking settings, local.sh commands might not have any effect (for instance when having slow DHCP or other network issues), see for instance [Wayback/Archive.is] I’m running ESXi 5.5 and my persistent route in local.sh is not taking effect after boot. : vmware.

There is a very convoluted way around using local.sh by using the VIB authoring tool as described in [Wayback] How to create persistent firewall rules on ESXi. It requires lowering the software acceptance level to Community Supported (esxcli software acceptance set --level=CommunitySupported), which gives you a hard time installing ESXi updates.

I got that VIB idea from [Wayback] Solved: Re: Persistent firewall rule – VMware Technology Network VMTN, as:

The local.sh file gets overwritten often with upgrades so it would mean another step during the process.

From the same thread comes [Wayback] Solved: Re: Persistent firewall rule – VMware Technology Network VMTN

set the sticky bit on your separate xml-file – then it will be backed up and persist through reboot: chmod +t

run backup manually before the first reboot: /sbin/auto-backup.sh  because backup runs only once per hour

Within vSphere, one could use [Wayback] Configure ESXi Hosts with Host Profiles, but a standalone ESXi box is not part of vSphere, so that won’t work.

ESXi 7 and up

ESXi 7 makes the above harder as for instance user root cannot change file rights any more, so eventually I might revert to a VM that auto-boots when ESXi comes up, then patches the right files in place over PowerCLI (read-only) or SSH.

Need to give this some thought later:

–jeroen

Posted in *nix, *nix-tools, ash/dash, ash/dash development, Awk, BusyBox, Development, ESXi6, ESXi6.5, ESXi6.7, ESXi7, Power User, PowerCLI, Scripting, sed, sed script, Software Development, Virtualization, VMware, VMware ESXi | Leave a Comment »

Too bad: ESXi busybox has `diff`, but not `patch`

Posted by jpluimers on 2022/03/02

On my ESXi boxes, I have a directory with local scripts that in part depend on the machine.

So I contemplated patching the dending parts with patch.

Then I found out that the BusyBox that VMware built for ESXi does have diff, but not patch:

# $(readlink -f "`which diff`")
BusyBox v1.29.3 (2021-01-17 01:25:00 PST) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2015.
Licensed under GPLv2. See source distribution for detailed
copyright notices.

Usage: busybox [function [arguments]...]
   or: busybox --list
   or: function [arguments]...

    BusyBox is a multi-call binary that combines many common Unix
    utilities into a single executable.  Most people will create a
    link to busybox for each function they wish to use and BusyBox
    will act like whatever it was invoked as.

Currently defined functions:
    addgroup, adduser, arch, ash, awk, basename, bunzip2, bzcat, bzip2, cat, chgrp, chmod, chown, chvt, cksum, clear, cp, crond,
    cut, date, dd, delgroup, deluser, diff, dirname, dnsdomainname, du, echo, egrep, eject, env, expr, false, fdisk, fgrep, find,
    fstrim, getty, grep, groups, gunzip, gzip, halt, head, hexdump, hostname, inetd, init, kill, ln, logger, login, ls, lzop,
    lzopcat, md5sum, mkdir, mkfifo, mknod, mktemp, more, mv, nohup, nslookup, od, passwd, poweroff, printf, readlink, reboot,
    reset, resize, rm, rmdir, sed, seq, setsid, sh, sha1sum, sha256sum, sha3sum, sha512sum, sleep, sort, ssl_client, stat, stty,
    sum, sync, tail, tar, taskset, tee, test, time, timeout, touch, true, uname, uniq, unlink, unlzop, unzip, usleep, vi, watch,
    wc, wget, which, who, xargs, zcat

This list is much shorter than the applets that are supported in [Wayback] BusyBox – The Swiss Army Knife of Embedded Linux, so VMware did cut out quite a few.

Generating the above output

The command-line trick above first expands diff using the output of which diff, then finds out where it links to through the readlink -f wrapper there the back-quotes “`” get this output:

# readlink -f "`which diff`"
/usr/lib/vmware/busybox/bin/busybox

Finally the $(...) executes the output of readlink.

It is based on [Wayback] bash – How to resolve symbolic links in a shell script – Stack Overflow

readlink -f "$path"

Editor’s note: The above works with GNU readlink and FreeBSD/PC-BSD/OpenBSD readlink, but not on OS X as of 10.11.GNU readlink offers additional, related options…

Need to devise a way to apply patches

Given there is no patch, I need to think about a good way to apply patches, for instance to snip this into /etc/rc.local.d/local.sh in a reliable way:

## BEGIN-PATCH-PATH

# local binaries are in /vmfs/volumes/NVMe980PRO_1TB/local-bin/
# link that directory from /opt/bin
# then add /opt/bin to the PATH in /etc/profile so that on each logon it becomes available
# this means you need to logon twice after reboot:
# - first to patch /etc/profile
# - second to have the correct PATH loaded from /etc/profile
# direcory exist trick from https://stackoverflow.com/questions/59838/how-can-i-check-if-a-directory-exists-in-a-bash-shell-script

patch_etc_profile_PATH() {
    if [ -d "$1" ]; then
      ln -s "$1" "/opt/bin"
      sed -i -e 's!PATH=/bin:/sbin!PATH=/bin:/sbin:/opt/bin/!' /etc/profile
    fi
}

patch_etc_profile_PATH /vmfs/volumes/NVMe980PRO_1TB/local-bin/

## END-PATCH-PATH

–jeroen

Posted in *nix, *nix-tools, ash/dash, ash/dash development, BusyBox, Development, ESXi6, ESXi6.5, ESXi6.7, ESXi7, Power User, Scripting, Software Development, Virtualization, VMware, VMware ESXi | Leave a Comment »

Force downloading Windows 10 ISOs instead of Media Creation Tool

Posted by jpluimers on 2022/02/25

When downloading Windows 10 builds, I usually want them as ISO files because I test them out as Virtual Machines before running on real hardware.

Downloading can be done from [WayBack] www.microsoft.com/en-us/software-download/windows10, however what you get depends on what machine you start browsing.

The above WayBack link, because it got archived from a non-Windows machine redirects from https://web.archive.org/web/20210321163339/https://www.microsoft.com/en-us/software-download/windows10 to https://web.archive.org/web/20210321143203/https://www.microsoft.com/en-us/software-download/windows10ISO.

On Windows systems the redirect goes from https://web.archive.org/web/20210321143203/https://www.microsoft.com/en-us/software-download/windows10ISO to https://web.archive.org/web/20210321163339/https://www.microsoft.com/en-us/software-download/windows10

By default, when you are on a Windows machine, the download link only provides the Media Creation tool. This forces an extra step into getting the ISO file on the virtual machine host.

When downloading from a non-Windows machine, you get a possibility to download the ISO file directly after selecting which kind of build and language you need. This provides you with a time limited https link to download the ISO (in practice this seems to last at least an hour).

I didn’t dig into this before, but luckily others did, and the difference is as easy as changing the User-Agent in your browser, as these posts describe:

Luckily, since ESXi 6.7, VMware ESXi added https as protocol to wget, so now you can download the https link you get via the above trick without hassle.

Oh, this answers my question from a few years back too: How can I get Win10_1511_1_English_x64.iso or Win10_1511_1_EnglishInternational_x64.iso ?

jeroen

Posted in Chrome, ESXi6.7, Power User, Virtualization, VMware, VMware ESXi, Web Browsers, Windows, Windows 10 | Leave a Comment »