Skip to content

Commit 8ce28d5

Browse files
authored
Merge pull request #104063 from asinn826/master
RHEL and serial console updates
2 parents 72235cb + e882a97 commit 8ce28d5

File tree

3 files changed

+55
-28
lines changed

3 files changed

+55
-28
lines changed

articles/virtual-machines/troubleshooting/serial-console-cmd-ps-commands.md

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SAC has been included in all versions of Windows since Windows Server 2003 but i
2525

2626
SAC allows you to connect to your running OS via serial port. When you launch CMD from SAC, `sacsess.exe` launches `cmd.exe` within your running OS. You can see that in Task Manager if you RDP to your VM at the same time you are connected to SAC via the serial console feature. The CMD you access via SAC is the same `cmd.exe` you use when connected via RDP. All the same commands and tools are available, including the ability to launch PowerShell from that CMD instance. That is a major difference between SAC and the Windows Recovery Environment (WinRE) in that SAC is letting you manage your running OS, where WinRE boots into a different, minimal OS. While Azure VMs do not support the ability to access WinRE, with the serial console feature, Azure VMs can be managed via SAC.
2727

28-
Because SAC is limited to an 80x24 screen buffer with no scroll back, add `| more` to commands to display the output one page at a time. Use `<spacebar>` to see the next page, or `<enter>` to see the next line.
28+
Because SAC is limited to an 80x24 screen buffer with no scroll back, add `| more` to commands to display the output one page at a time. Use `<spacebar>` to see the next page, or `<enter>` to see the next line.
2929

3030
`SHIFT+INSERT` is the paste shortcut for the serial console window.
3131

@@ -42,7 +42,7 @@ The second key (under \Policies) will only exist if the relevant group policy se
4242
### Enable RDP
4343
`reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0`
4444

45-
`reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fDenyTSConnections /t REG_DWORD /d 0`
45+
`reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fDenyTSConnections /t REG_DWORD /d 0`
4646

4747
The second key (under \Policies) would only be needed if the relevant group policy setting had been configured. Value will be rewritten at next group policy refresh if it is configured in group policy.
4848

@@ -52,12 +52,12 @@ The second key (under \Policies) would only be needed if the relevant group poli
5252
`sc query termservice`
5353
### View service logon account
5454
`sc qc termservice`
55-
### Set service logon account
55+
### Set service logon account
5656
`sc config termservice obj= "NT Authority\NetworkService"`
5757

5858
A space is required after the equals sign.
5959
### Set service start type
60-
`sc config termservice start= demand`
60+
`sc config termservice start= demand`
6161

6262
A space is required after the equals sign. Possible start values include `boot`, `system`, `auto`, `demand`, `disabled`, `delayed-auto`.
6363
### Set service dependencies
@@ -78,11 +78,11 @@ or
7878
`sc stop termservice`
7979
## Manage Networking Features
8080
### Show NIC properties
81-
`netsh interface show interface`
81+
`netsh interface show interface`
8282
### Show IP properties
8383
`netsh interface ip show config`
8484
### Show IPSec configuration
85-
`netsh nap client show configuration`
85+
`netsh nap client show configuration`
8686
### Enable NIC
8787
`netsh interface set interface name="<interface name>" admin=enabled`
8888
### Set NIC to use DHCP
@@ -92,8 +92,8 @@ For more information about `netsh`, [click here](https://docs.microsoft.com/wind
9292

9393
Azure VMs should always be configured in the guest OS to use DHCP to obtain an IP address. The Azure static IP setting still uses DHCP to give the static IP to the VM.
9494
### Ping
95-
`ping 8.8.8.8`
96-
### Port ping
95+
`ping 8.8.8.8`
96+
### Port ping
9797
Install the telnet client
9898

9999
`dism /online /Enable-Feature /FeatureName:TelnetClient`
@@ -127,7 +127,7 @@ You can use this command when troubleshooting to temporarily rule out the Window
127127

128128
Azure VMs created from generalized image will have the local administrator account renamed to the name specified during VM provisioning. So it will usually not be `Administrator`.
129129
### Enable user account
130-
`net user <username> /active:yes`
130+
`net user <username> /active:yes`
131131
### View user account properties
132132
`net user <username>`
133133

@@ -188,15 +188,15 @@ See also [Repair a Windows Image](https://docs.microsoft.com/windows-hardware/ma
188188
### Export file permissions to text file
189189
`icacls %programdata%\Microsoft\Crypto\RSA\MachineKeys /t /c > %temp%\MachineKeys_permissions_before.txt`
190190
### Save file permissions to ACL file
191-
`icacls %programdata%\Microsoft\Crypto\RSA\MachineKeys /save %temp%\MachineKeys_permissions_before.aclfile /t`
191+
`icacls %programdata%\Microsoft\Crypto\RSA\MachineKeys /save %temp%\MachineKeys_permissions_before.aclfile /t`
192192
### Restore file permissions from ACL file
193193
`icacls %programdata%\Microsoft\Crypto\RSA /save %temp%\MachineKeys_permissions_before.aclfile /t`
194194

195195
The path when using `/restore` needs to be the parent folder of the folder you specified when using `/save`. In this example, `\RSA` is the parent of the `\MachineKeys` folder specified in the `/save` example above.
196196
### Take NTFS ownership of a folder
197-
`takeown /f %programdata%\Microsoft\Crypto\RSA\MachineKeys /a /r`
197+
`takeown /f %programdata%\Microsoft\Crypto\RSA\MachineKeys /a /r`
198198
### Grant NTFS permissions to a folder recursively
199-
`icacls C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys /t /c /grant "BUILTIN\Administrators:(F)"`
199+
`icacls C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys /t /c /grant "BUILTIN\Administrators:(F)"`
200200
## Manage Devices
201201
### Remove non-present PNP devices
202202
`%windir%\System32\RUNDLL32.exe %windir%\System32\pnpclean.dll,RunDLL_PnpClean /Devices /Maxclean`
@@ -207,19 +207,19 @@ The path when using `/restore` needs to be the parent folder of the folder you s
207207
### Show OS version
208208
`ver`
209209

210-
or
210+
or
211211

212212
`wmic os get caption,version,buildnumber /format:list`
213213

214-
or
214+
or
215215

216216
`systeminfo find /i "os name"`
217217

218218
`systeminfo | findstr /i /r "os.*version.*build"`
219219
### View OS install date
220220
`systeminfo | find /i "original"`
221221

222-
or
222+
or
223223

224224
`wmic os get installdate`
225225
### View last boot time
@@ -235,7 +235,7 @@ or
235235

236236
Adding `/f` will force running applications to close without warning users.
237237
### Detect Safe Mode boot
238-
`bcdedit /enum | find /i "safeboot"`
238+
`bcdedit /enum | find /i "safeboot"`
239239

240240
## Windows Commands - PowerShell
241241

@@ -246,7 +246,7 @@ To run PowerShell in SAC, after you reach a CMD prompt, type:
246246
> [!CAUTION]
247247
> Remove the PSReadLine module from the PowerShell session before running any other PowerShell commands. There is a known issue where extra characters may be introduced in text pasted from the clipboard if PSReadLine is running in a PowerShell session in SAC.
248248
249-
First check if PSReadLine is loaded. It is loaded by default on Windows Server 2016, Windows 10, and later versions of Windows. It would only be present on earlier Windows versions if it had been manually installed.
249+
First check if PSReadLine is loaded. It is loaded by default on Windows Server 2016, Windows 10, and later versions of Windows. It would only be present on earlier Windows versions if it had been manually installed.
250250

251251
If this command returns to a prompt with no output, then the module was not loaded and you can continue using the PowerShell session in SAC as normal.
252252

@@ -292,7 +292,7 @@ When using a service account other than `NT AUTHORITY\LocalService`, `NT AUTHORI
292292
### Show NIC properties
293293
`get-netadapter | where {$_.ifdesc.startswith('Microsoft Hyper-V Network Adapter')} | format-list status,name,ifdesc,macadDresS,driverversion,MediaConNectState,MediaDuplexState`
294294

295-
or
295+
or
296296

297297
`get-wmiobject win32_networkadapter -filter "servicename='netvsc'" | format-list netenabled,name,macaddress`
298298

@@ -316,6 +316,9 @@ or
316316
### Ping
317317
`test-netconnection`
318318

319+
> [!NOTE]
320+
> The Write-Progress cmdlet may not work with this command. As a mitigation, you can run `$ProgressPreference = "SilentlyContinue"` in PowerShell to disable the progress bar.
321+
319322
or
320323

321324
`get-wmiobject Win32_PingStatus -Filter 'Address="8.8.8.8"' | format-table -autosize IPV4Address,ReplySize,ResponseTime`
@@ -330,23 +333,23 @@ or
330333

331334
`Test-NetConnection` is available on 2012+. For 2008R2 use `Net.Sockets.TcpClient`
332335
### Test DNS name resolution
333-
`resolve-dnsname bing.com`
336+
`resolve-dnsname bing.com`
334337

335-
or
338+
or
336339

337340
`[System.Net.Dns]::GetHostAddresses('bing.com')`
338341

339342
`Resolve-DnsName` is available on 2012+. For 2008R2 use `System.Net.DNS`.
340343
### Show Windows firewall rule by name
341-
`get-netfirewallrule -name RemoteDesktop-UserMode-In-TCP`
344+
`get-netfirewallrule -name RemoteDesktop-UserMode-In-TCP`
342345
### Show Windows firewall rule by port
343346
`get-netfirewallportfilter | where {$_.localport -eq 3389} | foreach {Get-NetFirewallRule -Name $_.InstanceId} | format-list Name,Enabled,Profile,Direction,Action`
344347

345348
or
346349

347350
`(new-object -ComObject hnetcfg.fwpolicy2).rules | where {$_.localports -eq 3389 -and $_.direction -eq 1} | format-table Name,Enabled`
348351

349-
`Get-NetFirewallPortFilter` is available on 2012+. For 2008R2 use the `hnetcfg.fwpolicy2` COM object.
352+
`Get-NetFirewallPortFilter` is available on 2012+. For 2008R2 use the `hnetcfg.fwpolicy2` COM object.
350353
### Disable Windows firewall
351354
`Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False`
352355

@@ -357,21 +360,21 @@ or
357360
### Verify user account is enabled
358361
`(get-localuser | where {$_.SID -like "S-1-5-21-*-500"}).Enabled`
359362

360-
or
363+
or
361364

362365
`(get-wmiobject Win32_UserAccount -Namespace "root\cimv2" -Filter "SID like 'S-1-5-%-500'").Disabled`
363366

364367
`Get-LocalUser` is available on 2012+. For 2008R2 use `Get-WmiObject`. This example shows the built-in local administrator account, which always has SID `S-1-5-21-*-500`. Azure VMs created from generalized image will have the local administrator account renamed to the name specified during VM provisioning. So it will usually not be `Administrator`.
365368
### Add local user to local group
366369
`add-localgroupmember -group Administrators -member <username>`
367370
### Enable local user account
368-
`get-localuser | where {$_.SID -like "S-1-5-21-*-500"} | enable-localuser`
371+
`get-localuser | where {$_.SID -like "S-1-5-21-*-500"} | enable-localuser`
369372

370373
This example enables the built-in local administrator account, which always has SID `S-1-5-21-*-500`. Azure VMs created from generalized image will have the local administrator account renamed to the name specified during VM provisioning. So it will usually not be `Administrator`.
371374
### View user account properties
372375
`get-localuser | where {$_.SID -like "S-1-5-21-*-500"} | format-list *`
373376

374-
or
377+
or
375378

376379
`get-wmiobject Win32_UserAccount -Namespace "root\cimv2" -Filter "SID like 'S-1-5-%-500'" | format-list Name,Disabled,Status,Lockout,Description,SID`
377380

@@ -411,15 +414,15 @@ This example returns the file version of the virtual NIC driver, which is named
411414
This example creates a `c:\bin` folder, then downloads and extracts the Sysinternals suite of tools into `c:\bin`.
412415
## Miscellaneous Tasks
413416
### Show OS version
414-
`get-wmiobject win32_operatingsystem | format-list caption,version,buildnumber`
417+
`get-wmiobject win32_operatingsystem | format-list caption,version,buildnumber`
415418
### View OS install date
416419
`(get-wmiobject win32_operatingsystem).converttodatetime((get-wmiobject win32_operatingsystem).installdate)`
417420
### View last boot time
418421
`(get-wmiobject win32_operatingsystem).lastbootuptime`
419422
### View Windows uptime
420423
`"{0:dd}:{0:hh}:{0:mm}:{0:ss}.{0:ff}" -f ((get-date)-(get-wmiobject win32_operatingsystem).converttodatetime((get-wmiobject win32_operatingsystem).lastbootuptime))`
421424

422-
Returns uptime as `<days>:<hours>:<minutes>:<seconds>:<milliseconds>`, for example `49:16:48:00.00`.
425+
Returns uptime as `<days>:<hours>:<minutes>:<seconds>:<milliseconds>`, for example `49:16:48:00.00`.
423426
### Restart Windows
424427
`restart-computer`
425428

articles/virtual-machines/troubleshooting/serial-console-linux.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ We're aware of some issues with the serial console and the VM's operating system
121121

122122
Issue | Mitigation
123123
:---------------------------------|:--------------------------------------------|
124-
Pressing **Enter** after the connection banner does not cause a sign-in prompt to be displayed. | For more information, see [Hitting enter does nothing](https://github.com/Microsoft/azserialconsole/blob/master/Known_Issues/Hitting_enter_does_nothing.md). This issue can occur if you're running a custom VM, hardened appliance, or GRUB config that causes Linux to fail to connect to the serial port.
124+
Pressing **Enter** after the connection banner does not cause a sign-in prompt to be displayed. | GRUB may not be configured correctly. Run the following commands: `grub2-mkconfig -o /etc/grub2-efi.cfg` and/or `grub2-mkconfig -o /etc/grub2.cfg`. For more information, see [Hitting enter does nothing](https://github.com/Microsoft/azserialconsole/blob/master/Known_Issues/Hitting_enter_does_nothing.md). This issue can occur if you're running a custom VM, hardened appliance, or GRUB config that causes Linux to fail to connect to the serial port.
125125
Serial console text only takes up a portion of the screen size (often after using a text editor). | Serial consoles do not support negotiating about window size ([RFC 1073](https://www.ietf.org/rfc/rfc1073.txt)), which means that there will be no SIGWINCH signal sent to update screen size and the VM will have no knowledge of your terminal's size. Install xterm or a similar utility to provide you with the `resize` command, and then run `resize`.
126126
Pasting long strings doesn't work. | The serial console limits the length of strings pasted into the terminal to 2048 characters to prevent overloading the serial port bandwidth.
127127
Erratic keyboard input in SLES BYOS images. Keyboard input is only sporadically recognized. | This is an issue with the Plymouth package. Plymouth should not be run in Azure as you don't need a splash screen and Plymouth interferes with the platform ability to use Serial Console. Remove Plymouth with `sudo zypper remove plymouth` and then reboot. Alternatively, modify the kernel line of your GRUB config by appending `plymouth.enable=0` to the end of the line. You can do this by [editing the boot entry at boot time](https://aka.ms/serialconsolegrub#single-user-mode-in-suse-sles), or by editing the GRUB_CMDLINE_LINUX line in `/etc/default/grub`, rebuilding GRUB with `grub2-mkconfig -o /boot/grub2/grub.cfg`, and then rebooting.

articles/virtual-machines/workloads/redhat/redhat-rhui.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,30 @@ This procedure is provided for reference only. RHEL PAYG images already have the
207207
yum --config='https://rhelimage.blob.core.windows.net/repositories/rhui-microsoft-azure-rhel7.config' install 'rhui-azure-rhel7'
208208
```
209209
210+
- For RHEL 8:
211+
1. Create a config file:
212+
```bash
213+
vi rhel8.config
214+
```
215+
1. Add the following content into the config file:
216+
```bash
217+
[rhui-microsoft-azure-rhel8]
218+
name=Microsoft Azure RPMs for Red Hat Enterprise Linux 8
219+
baseurl=https://rhui-1.microsoft.com/pulp/repos/microsoft-azure-rhel8 https://rhui-2.microsoft.com/pulp/repos/microsoft-azure-rhel8 https://rhui-3.microsoft.com/pulp/repos/microsoft-azure-rhel8
220+
enabled=1
221+
gpgcheck=1
222+
gpgkey=https://rhelimage.blob.core.windows.net/repositories/RPM-GPG-KEY-microsoft-azure-release sslverify=1
223+
```
224+
1. Save the file and run the following command:
225+
```bash
226+
dnf --config rhel8.config install 'rhui-azure-rhel8'
227+
```
228+
1. Update your VM
229+
```bash
230+
sudo dnf update
231+
```
232+
233+
210234
## Next steps
211235
* To create a Red Hat Enterprise Linux VM from an Azure Marketplace PAYG image and to use Azure-hosted RHUI, go to the [Azure Marketplace](https://azure.microsoft.com/marketplace/partners/redhat/).
212236
* To learn more about the Red Hat images in Azure, go to the [documentation page](./redhat-images.md).

0 commit comments

Comments
 (0)