Skip to main content
Компы и автомобили

Latest articles

awk oneliners

Постоянно забываю синтаксисы sed и awk. Нашёл для awk очень актуальный список однострочников:

HANDY ONE-LINE SCRIPTS FOR AWK                               30 April 2008
Compiled by Eric Pement — eric [at] pement.org               version 0.27

Latest version of this file (in English) is usually at:
   http://www.pement.org/awk/awk1line.txt

This file will also be available in other languages:
   Chinese  — http://ximix.org/translation/awk1line_zh-CN.txt   

USAGE:

   Unix: awk '/pattern/ {print «$1»}'    # standard Unix shells
DOS/Win: awk '/pattern/ {print «$1»}'    # compiled with DJGPP, Cygwin
         awk «/pattern/ {print \»$1\«}»  # GnuWin32, UnxUtils, Mingw

Note that the DJGPP compilation (for DOS or Windows-32) permits an awk
script to follow Unix quoting syntax '/like/ {«this»}'. HOWEVER, if the
command interpreter is CMD.EXE or COMMAND.COM, single quotes will not
protect the redirection arrows (<, >) nor do they protect pipes (|).
These are special symbols which require «double quotes» to protect them
from interpretation as operating system directives. If the command
interpreter is bash, ksh or another Unix shell, then single and double
quotes will follow the standard Unix usage.

Users of MS-DOS or Microsoft Windows must remember that the percent
sign (%) is used to indicate environment variables, so this symbol must
be doubled (%%) to yield a single percent sign visible to awk.

If a script will not need to be quoted in Unix, DOS, or CMD, then I
normally omit the quote marks. If an example is peculiar to GNU awk,
the command 'gawk' will be used. Please notify me if you find errors or
new commands to add to this list (total length under 65 characters). I
usually try to put the shortest script first. To conserve space, I
normally use '1' instead of '{print}' to print each line. Either one
will work.

FILE SPACING:

 # double space a file
 awk '1;{print «»}'
 awk 'BEGIN{ORS=«\n\n»};1'

 # double space a file which already has blank lines in it. Output file
 # should contain no more than one blank line between lines of text.
 # NOTE: On Unix systems, DOS lines which have only CRLF (\r\n) are
 # often treated as non-blank, and thus 'NF' alone will return TRUE.
 awk 'NF{print $0 «\n»}'

 # triple space a file
 awk '1;{print «\n»}'

NUMBERING AND CALCULATIONS:

 # precede each line by its line number FOR THAT FILE (left alignment).
 # Using a tab (\t) instead of space will preserve margins.
 awk '{print FNR «\t» $0}' files*

 # precede each line by its line number FOR ALL FILES TOGETHER, with tab.
 awk '{print NR «\t» $0}' files*

 # number each line of a file (number on left, right-aligned)
 # Double the percent signs if typing from the DOS command prompt.
 awk '{printf(«%5d : %s\n», NR,$0)}'

 # number each line of file, but only print numbers if line is not blank
 # Remember caveats about Unix treatment of \r (mentioned above)
 awk 'NF{$0=++a « :» $0};1'
 awk '{print (NF? ++a « :» :«») $0}'

 # count lines (emulates «wc -l»)
 awk 'END{print NR}'

 # print the sums of the fields of every line
 awk '{s=0; for (i=1; i<=NF; i++) s=s+$i; print s}'

 # add all fields in all lines and print the sum
 awk '{for (i=1; i<=NF; i++) s=s+$i}; END{print s}'

 # print every line after replacing each field with its absolute value
 awk '{for (i=1; i<=NF; i++) if ($i < 0) $i = -$i; print }'
 awk '{for (i=1; i<=NF; i++) $i = ($i < 0) ? -$i : $i; print }'

 # print the total number of fields ("words") in all lines
 awk '{ total = total + NF }; END {print total}' file

 # print the total number of lines that contain "Beth"
 awk '/Beth/{n++}; END {print n+0}' file

 # print the largest first field and the line that contains it
 # Intended for finding the longest string in field #1
 awk '$1 > max {max=$1; maxline=$0}; END{ print max, maxline}'

 # print the number of fields in each line, followed by the line
 awk '{ print NF «:» $0 } '

 # print the last field of each line
 awk '{ print $NF }'

 # print the last field of the last line
 awk '{ field = $NF }; END{ print field }'

 # print every line with more than 4 fields
 awk 'NF > 4'

 # print every line where the value of the last field is > 4
 awk '$NF > 4'

STRING CREATION:

 # create a string of a specific length (e.g., generate 513 spaces)
 awk 'BEGIN{while (a++<513) s=s " "; print s}'

 # insert a string of specific length at a certain character position
 # Example: insert 49 spaces after column #6 of each input line.
 gawk --re-interval 'BEGIN{while(a++<49)s=s " "};{sub(/^.{6}/,"&" s)};1'

ARRAY CREATION:

 # These next 2 entries are not one-line scripts, but the technique
 # is so handy that it merits inclusion here.

 # create an array named "month", indexed by numbers, so that month[1]
 # is 'Jan', month[2] is 'Feb', month[3] is 'Mar' and so on.
 split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec", month, " ")

 # create an array named "mdigit", indexed by strings, so that
 # mdigit["Jan"] is 1, mdigit["Feb"] is 2, etc. Requires "month" array
 for (i=1; i<=12; i++) mdigit[month[i]] = i

TEXT CONVERSION AND SUBSTITUTION:

 # IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format
 awk '{sub(/\r$/,"")};1'   # assumes EACH line ends with Ctrl-M

 # IN UNIX ENVIRONMENT: convert Unix newlines (LF) to DOS format
 awk '{sub(/$/,"\r")};1'

 # IN DOS ENVIRONMENT: convert Unix newlines (LF) to DOS format
 awk 1

 # IN DOS ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format
 # Cannot be done with DOS versions of awk, other than gawk:
 gawk -v BINMODE="w" '1' infile >outfile

 # Use «tr» instead.
 tr -d \r outfile            # GNU tr version 1.22 or higher

 # delete leading whitespace (spaces, tabs) from front of each line
 # aligns all text flush left
 awk '{sub(/^[ \t]+/, «»)};1'

 # delete trailing whitespace (spaces, tabs) from end of each line
 awk '{sub(/[ \t]+$/, «»)};1'

 # delete BOTH leading and trailing whitespace from each line
 awk '{gsub(/^[ \t]+|[ \t]+$/,«»)};1'
 awk '{$1=$1};1'           # also removes extra space between fields

 # insert 5 blank spaces at beginning of each line (make page offset)
 awk '{sub(/^/, «     „)};1'

 # align all text flush right on a 79-column width
 awk '{printf „%79s\n“, $0}' file*

 # center all text on a 79-character width
 awk '{l=length();s=int((79-l)/2); printf „%“(s+l)“s\n»,$0}' file*

 # substitute (find and replace) «foo» with «bar» on each line
 awk '{sub(/foo/,«bar»)}; 1'           # replace only 1st instance
 gawk '{$0=gensub(/foo/,«bar»,4)}; 1'  # replace only 4th instance
 awk '{gsub(/foo/,«bar»)}; 1'          # replace ALL instances in a line

 # substitute «foo» with «bar» ONLY for lines which contain «baz»
 awk '/baz/{gsub(/foo/, «bar»)}; 1'

 # substitute «foo» with «bar» EXCEPT for lines which contain «baz»
 awk '!/baz/{gsub(/foo/, «bar»)}; 1'

 # change «scarlet» or «ruby» or «puce» to «red»
 awk '{gsub(/scarlet|ruby|puce/, «red»)}; 1'

 # reverse order of lines (emulates «tac»)
 awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j—] }' file*

 # if a line ends with a backslash, append the next line to it (fails if
 # there are multiple lines ending with backslash...)
 awk '/\\$/ {sub(/\\$/,«»); getline t; print $0 t; next}; 1' file*

 # print and sort the login names of all users
 awk -F «:» '{print $1 | «sort» }' /etc/passwd

 # print the first 2 fields, in opposite order, of every line
 awk '{print $2, $1}' file

 # switch the first 2 fields of every line
 awk '{temp = $1; $1 = $2; $2 = temp}' file

 # print every line, deleting the second field of that line
 awk '{ $2 = «»; print }'

 # print in reverse order the fields of every line
 awk '{for (i=NF; i>0; i—) printf(«%s „,$i);print „“}' file

 # concatenate every 5 lines of input, using a comma separator
 # between fields
 awk 'ORS=NR%5?“,»:«\n»' file

SELECTIVE PRINTING OF CERTAIN LINES:

 # print first 10 lines of file (emulates behavior of «head»)
 awk 'NR < 11'

 # print first line of file (emulates "head -1")
 awk 'NR>1{exit};1'

  # print the last 2 lines of a file (emulates «tail -2»)
 awk '{y=x «\n» $0; x=$0};END{print y}'

 # print the last line of a file (emulates «tail -1»)
 awk 'END{print}'

 # print only lines which match regular expression (emulates «grep»)
 awk '/regex/'

 # print only lines which do NOT match regex (emulates «grep -v»)
 awk '!/regex/'

 # print any line where field #5 is equal to «abc123»
 awk '$5 == «abc123»'

 # print only those lines where field #5 is NOT equal to «abc123»
 # This will also print lines which have less than 5 fields.
 awk '$5 != «abc123»'
 awk '!($5 == «abc123»)'

 # matching a field against a regular expression
 awk '$7  ~ /^[a-f]/'    # print line if field #7 matches regex
 awk '$7 !~ /^[a-f]/'    # print line if field #7 does NOT match regex

 # print the line immediately before a regex, but not the line
 # containing the regex
 awk '/regex/{print x};{x=$0}'
 awk '/regex/{print (NR==1 ? «match on line 1» : x)};{x=$0}'

 # print the line immediately after a regex, but not the line
 # containing the regex
 awk '/regex/{getline;print}'

 # grep for AAA and BBB and CCC (in any order on the same line)
 awk '/AAA/ && /BBB/ && /CCC/'

 # grep for AAA and BBB and CCC (in that order)
 awk '/AAA.*BBB.*CCC/'

 # print only lines of 65 characters or longer
 awk 'length > 64'

 # print only lines of less than 65 characters
 awk 'length < 64'

 # print section of file from regular expression to end of file
 awk '/regex/,0'
 awk '/regex/,EOF'

 # print section of file based on line numbers (lines 8-12, inclusive)
 awk 'NR==8,NR==12'

 # print line number 52
 awk 'NR==52'
 awk 'NR==52 {print;exit}'          # more efficient on large files

 # print section of file between two regular expressions (inclusive)
 awk '/Iowa/,/Montana/'             # case sensitive

SELECTIVE DELETION OF CERTAIN LINES:

 # delete ALL blank lines from a file (same as "grep '.' ")
 awk NF
 awk '/./'

 # remove duplicate, consecutive lines (emulates "uniq")
 awk 'a !~ $0; {a=$0}'

 # remove duplicate, nonconsecutive lines
 awk '!a[$0]++'                     # most concise script
 awk '!($0 in a){a[$0];print}'      # most efficient script

CREDITS AND THANKS:

Special thanks to the late Peter S. Tillier (U.K.) for helping me with
the first release of this FAQ file, and to Daniel Jana, Yisu Dong, and
others for their suggestions and corrections.

For additional syntax instructions, including the way to apply editing
commands from a disk file instead of the command line, consult:

  "sed & awk, 2nd Edition," by Dale Dougherty and Arnold Robbins
  (O'Reilly, 1997)

  "UNIX Text Processing," by Dale Dougherty and Tim O'Reilly (Hayden
  Books, 1987)

  "GAWK: Effective awk Programming," 3d edition, by Arnold D. Robbins
  (O'Reilly, 2003) or at http://www.gnu.org/software/gawk/manual/

To fully exploit the power of awk, one must understand "regular
expressions." For detailed discussion of regular expressions, see
"Mastering Regular Expressions, 3d edition" by Jeffrey Friedl (O'Reilly,
2006).

The info and manual ("man") pages on Unix systems may be helpful (try
"man awk", "man nawk", "man gawk", "man regexp", or the section on
regular expressions in "man ed").

USE OF '\t' IN awk SCRIPTS: For clarity in documentation, I have used
'\t' to indicate a tab character (0x09) in the scripts.  All versions of
awk should recognize this abbreviation.

#---end of file---

ScaleIO и отвал обоих MDM

Проблема

Я в конторе развернул ScaleIO на тестовом кластере. 4 гипервизора esxi, по 4 жёстких диска в каждом. И сегодня случился какой-то внезапный отвал двух нод последовательно. Машина с Primary MDM по сети отвечает, но находится в несознанке — по SSH зайти нельзя, локальная консоль тоже мёртвая. А secondary MDM выпал вместе с гипервизором. При этом непосредственно в момента вылета я внимательно втыкал в GUI ScaleIO, и, как говорится, ничто не предвещало.

Ребутнул сбойнувший гипервизор, виртуалка с secondary MDM поднялась и на вид даже как живая. Зашёл в консоль, говорю там:

scli −-login −-user admin
Enter password:
Error: Failed to connect to MDM 127.0.0.1:6611

Беглый осмотр слушаемых на машины портов показал, что реально, на порту 6611 никого нет:

 # ss -l
Recv-Q Send-Q           Local Address:Port               Peer Address:Port
0      128                          *:9099                          *:*
0      128                          *:6611                          *:*
0      128                          *:9011                          *:*
0      128                          *:25620                         *:*
0      128                         :::ssh                          :::*
0      128                          *:ssh                           *:*
0      100                  127.0.0.1:smtp                          *:*
0      128                          *:25660                         *:*
0      128                          *:7072                          *:*
0      128                          *:25640                         *:*

А это нам намекает, что MDM на не стартовал. Не делает он этого в двух случаях — либо когда primary MDM в кластере поднят и работает, либо если что-то сломалось. Ситуация довольно идиотская, и напоминает пресловутую шутку про /pkunzip.zip/. Чтобы починить MDM, нужно сначала залогиниться в MDM, так как все команды scli выполняются через активный MDM. А чтобы залогиниться, нужен рабочий MDM.

Но хвала небесам, за то что они придумали коллективный разум. И белых людей, делящихся знаниями с другими людьми. Внезапно был обнаружен топик на хабре, где в комментариях один товарищ поделился тайными и скрытыми знаниями, почерпнутыми из , где в комментариях один товарищ поделился тайными и скрытыми знаниями, почерпнутыми из секретной сервисной, не-доступной публично документации EMC. И вот эта цитата помогла разобраться с проблемой подключения при отсутствии работающего MDM: сервисной, не-доступной публично документации EMC. И вот эта цитата помогла разобраться с проблемой подключения при отсутствии работающего MDM:

MDM rescue mode capability In MDM cluster mode, if a Primary MDM fails after the Secondary MDM has already failed, concern for lack of repository synchronization will cause the Secondary MDM not to automatically take over the Primary MDM role. This leaves the system non-operational.

The MDM rescue mode feature enables you to force a Secondary MDM to take on the role of Primary MDM, thus enabling the system to continue to function, albeit in a not-fully-synchronized state.

Implementing MDM rescue mode

This section describes how to run the MDM rescue mode feature. Any user can run rescue mode, using a combination of a file written to the MDM, and the rescue_mode command. You must have write privileges on the MDM to complete this task.

Command Command

rescue_mode Syntax Syntax

scli —rescue_mode

To run rescue mode, perform the following steps: To run rescue mode, perform the following steps:

  1. Create a text file called MDM_SERVICE_MODE on the Secondary MDM, in the location corresponding to your operating system:
  2. In the body of the file, type the text Rescue Mode, and save the file.
  3. In the CLI, type the command scli —rescue_mode.

The Secondary MDM is forced to take over the Primary MDM role. You can verify this

using the query_cluster command. using the query_cluster command.

Я проделал описанное и реально, это помогло — смог подключиться к MDM и проверить, что кластер хоть в каком-то виде жив. После этого удалось подключиться с помощью GUI, и увидеть, что не всё так плохо, как могло бы быть на самом деле:

Похоже, потерь данных не будет, но пока дальше разбираться с причинами проблем и пытаться ребутать машину, где работал primary MDM, лучше не торопиться. Дождёмся сначала полного ребилда томов.

Но радость была преждевременной

Тома ребилдились, и я решил разобраться с бывшим primary MDM. Ребутнул зависший хост, соответственно, виртуалка тоже ребутнулась, и все настроенные пулы выпали в состояние Failed. В общем, долго ли, коротко ли, но мораль сей басни такова — мало войти в rescue mode для MDM, нужно грамотно из него ещё и выйти. В моём случае нужно было бы делать так: оставить работать только secondary MDM в rescue mode, дождаться ребилда томов и эвакуировать все виртуалки оттуда. После этого попытаться переключить ScaleIO из cluster mode в single mode, снести на бывшем первом MDM пакет с MDM и переустановить его заново. Затем добавить его как secondary MDM и попытаться включить обратно cluster mode.

Мой дисковый пул рассыпался, так как после введения в rescue mode того MDM, который был secondary, он в авторитарном режиме стал primary. И пока он был один — всё работало. А как только я ребутнул зависший primary MDM, он отказался становиться secondary после ребута, и в итоге получилась ситуация split brain — два MDM в кластере, и оба primary, и с разной версией БД с метаданными. Ну в итоге они там и наребилдили выпавшие дисковые пулы, перемешав все блоки в кучу. Из-за этого всё рассыпалось.

Сбор статистики для выбора параметров vFRC в VMware

Как известно, для эффективного использования vFRC (virtual flash read cache) у VMware, нужно правильным образом выбрать два параметра — размер кэша, и размер блока кэша. Если с размером ещё можно попытаться разобраться эмпирически (читай — методом научного тыка), то с размером блока это сделать как-то сложнее. Чтобы правильно выбрать размер блока, нужна статистика по каждой отдельной виртуальной машине, для которой предполагается использовать vFRC, на предмет того, блоки какого размера превалируют в дисковом обмене. И именно такой размер блока нужно выставлять в vFRC. Оказывается, в VMware есть механизм, который такую позволяет собрать статистику по размерам блоков обмена.

Для этого нужно подключиться к хосту, на котором работает искомая ВМ, по SSH. И выполнить следующие команды:

vscsiStats -l

Эта команда выведет нам список виртуалок на хосте, а также виртуальных дисков у каждой виртуалки:

[root@esx-1:~] vscsiStats -l
Virtual Machine worldGroupID: 35676, Virtual Machine Display Name: TEST-IO, Virtual Machine Config File: /vmfs/volumes/55f97ce4-d51833a0-3617-0007430759d0/TEST-IO/TEST-IO.vmx, {
   Virtual SCSI Disk handleID: 8214 (scsi0:0)
   Virtual SCSI Disk handleID: 8215 (scsi0:1)
}

У меня на хосте одна машина, поэтому вот.

Из этого чарующего списка нас интересуют два идентификатора: Virtual Machine worldGroupID и  и Virtual SCSI Disk handleID..

Первый является идентификатором ВМ, второй — идентификатором того виртуального диска этой ВМ, для которой вам нужна статистика. В моём случае worldGroupID равен 35676, а Virtual SCSI Disk handleID равен 8215 — меня интересует именно второй диск. На этой виртуалке у меня сейчас запущен Microsoft JetStress 2013 и тестовые базы лежать именно на втором диске.

Затем, нужно запустить сбор статистики. Делается это командой:

[root@esx-1:~] vscsiStats -s -w 53290 -i 8202
vscsiStats: Starting Vscsi stats collection for worldGroup 53290, handleID 8202 (scsi0:0)
Success.

Ключ /-w/ задаёт worldGroupID, ключ /-i/ задаёт disk handleID. Хост нам отвечает, что сбор статистики начат.

Через какое-то время можно посмотреть, что там мы насобирали:

[root@esx-1:~] vscsiStats -p ioLength -c -w 35676 -i 8215
Histogram: IO lengths of commands,virtual machine worldGroupID,35676,virtual disk handleID,8215 (scsi0:1)
min,4096
max,524288
mean,41803
count,1308632
Frequency,Histogram Bucket Limit
0,512
0,1024
0,2048
0,4095
72510,4096
0,8191
17429,8192
14999,16383
4949,16384
1107407,32768
4878,49152
1839,65535
18921,65536
754,81920
4768,131072
60065,262144
113,524288
0,524288
Histogram: IO lengths of Read commands,virtual machine worldGroupID,35676,virtual disk handleID,8215 (scsi0:1)
min,4096
max,262144
mean,50433
count,724878
Frequency,Histogram Bucket Limit
0,512
0,1024
0,2048
0,4095
910,4096
0,8191
0,8192
2,16383
0,16384
667157,32768
0,49152
0,65535
428,65536
1,81920
269,131072
56111,262144
0,524288
0,524288
Histogram: IO lengths of Write commands,virtual machine worldGroupID,35676,virtual disk handleID,8215 (scsi0:1)
min,4096
max,524288
mean,31087
count,583754
Frequency,Histogram Bucket Limit
0,512
0,1024
0,2048
0,4095
71600,4096
0,8191
17429,8192
14997,16383
4949,16384
440250,32768
4878,49152
1839,65535
18493,65536
753,81920
4499,131072
3954,262144
113,524288
0,524288

Формат таблички очень простой. Три блока диаграмм, первая — всего количество команд ввода-вывода с блоками соответствующего размера, затем отдельно команды только чтения, и только записи. Цифры идут в формате: «<кол-во_команд>, <размер_блока>».

Как вы понимаете из названия технологии «Virtual Flash READ cache», нас интересует только второй раздел, который «IO lengths of Read commands». Если эти данные сохранить в формат CSV, а затем творчески обработать в Excel, то получим вот такую красивую картинку: cache», нас интересует только второй раздел, который «IO lengths of Read commands». Если эти данные сохранить в формат CSV, а затем творчески обработать в Excel, то получим вот такую красивую картинку:

Из каковой следует, что размер блока кэша нам для этой нагрузки следует делать именно 32 Kb.

После того, как мы осознали эту простую истину, нужно выключить сбор статистики на гипервизоре:

vscsiStats -x

И идти настраивать vFRC :-)

Вообще же, vscsiStat — довольно интересная утиля. Она позволяет не только выяснить размер блоков, которыми виртуалка обменивается с хранилищем, но и оценить тип нагрузки в терминах «случайная/последовательная». Для этого нужно собрать инфу командой:

vscsiStats -p seekdistance -w 

Она покажет, насколько далеко находятся запрашиваемые виртуалкой блоки данных. Чем дальше цифры от 0, тем нагрузка «случайнее». Есть ещё возможность оценить статистику по задержкам выполнения команд, и есть ключ /-p all/, который выводит вообще все типы данных.

Так же один белый человек озадачился, и создал страничку, на которой можно просто впихнуть весь вывод, который сгенерила вам vscsiStat, и нарисовать красивые диаграммы автоматически. Вот что-то такое в итоге получается:

Вот ссылка: http://www.virten.net/vscsistats/

Скажем автору большое человеческое спасибо за такой сервис :-) Скажем автору большое человеческое спасибо за такой сервис :-)

Зависание инсталлятора VMware tools

Попытался сейчас на одной виртуалке с Ubuntu заапргейдить VMware tools в «non-interactive mode». Это когда оно, по идее, должно само подключиться к виртуалке, и само всё сделать. Но операция «Initiated VMware tools install or upgrade» зависла на 0%, и больше ничего нельзя было с виртуалкой сделать — ни отмонтировать диск с VMware tools, ни мигрировать виртуалку, ни отменить операцию установки. При попытке выбрать «End Install/upgrade VMware tools» выскакивала ошибка «Call „VirtualMachine.UnmountToolsInstaller“ for object „Usergate-Webfilter“ on vCenter Server „vcenter.vsphere.local“ failed», а в логах появлялось сообщение: «The operation is not allowed in the current state».

В общем, оставался вариант только попробовать потушить машину, чего делать очень не хотелось — машина в продакшене, и ею пользуются клиенты.

В итоге на просторах отыскался рецепт:

  1. Включить SSH на том хосте, на котором работает виртуалка;
  2. Зайти в консоль хоста и выполнить там команду vim-cmd vmsvc/getallvms. Эта команда покажет список работающих виртуалок. В левой колонке будет ID соответствующей виртуалки. Ищем в списке виртуалку, на которой завис инсталлятор VMware tools, и определяем её ID;. Эта команда покажет список работающих виртуалок. В левой колонке будет ID соответствующей виртуалки. Ищем в списке виртуалку, на которой завис инсталлятор VMware tools, и определяем её ID;
  3. Выполняем команду vim-cmd vmsvc/tools.cancelinstall , где VM_ID — идентификатор виртуалки, определённый на шаге 2. После этого операция установки VMware tools завершается с ошибкой и освобождает виртуалку;, где VM_ID — идентификатор виртуалки, определённый на шаге 2. После этого операция установки VMware tools завершается с ошибкой и освобождает виртуалку;
  4. Не забываем снова отключить службу SSH на хосте.