This blog was originally written by Dell engineer Sreeja Golui. For any feedback/suggestions please write them to WinServerBlogs@dell.com

Nano Server is a new small-footprint option for installing Windows Server 2016. It is based on the concept of a minimal install similar to Microsoft Server Core. Unlike Server Core, Nano Server is intended to be a completely headless installation without any local UI or console.

A Nano server can be configured for kernel debug in more than one method. Post the installation of Nano server, one can configure it for kernel debugging with the conventional methods by creating a PowerShell session. 

Connect to the server with a remote PowerShell session:

  • Set-Item WSMan:\localhost\Client\TrustedHosts "x.y.z.w"
  • Enter-PSSession -ComputerName "x.y.z.w"-Credential "x.y.z.w\Administrator"

Net Debug 

  1. Obtain the bus, device and function of the network adapter to be reserved for kernel debugging by using PowerShell cmdlets.
    • get-pnpdevice – Observe the output and select the network adapter to be used for Kernel debugging. Note the ‘FriendlyName’.
    • get-pnpdevice -FriendlyName 'FriendlyName' | Select 'InstanceId' (Supply the friendly name from previous step and Note the Instance ID in the output)
    • get-pnpDeviceProperty –InstanceId ‘Instance ID ‘ (supply the Instance ID from previous step)

                    Note the value of the Device_LocationInfo to get the Bus, Device and Function.

2. Use the following commands to set up net debug

    • bcdedit /debug on
    • bcdedit /dbgsettings net hostip:a.b.c.d port:n (This will generate a key, save that for connecting; optionally you can create your own key for connecting; hostip is the IP of the system from where debugger session will be run)
    • bcdedit /set "{dbgsettings}" busparamsb.d.f (supply the bdf from step 1)
    • Reboot

For more information on this step, refer:

https://msdn.microsoft.com/en-us/library/windows/hardware/hh439346(v=vs.85).aspx

3. From the host, use the key in step 2, and the port number to connect with windbg.

4. In case of a virtual machine, since bdf is not there, we enable only one network adapter which will be selected by default with the usual commands to set up net debug. Use windbg, like in step 3, to connect from host       

Serial Port Debug

To enable serial debug in Dell BIOS, go to System Setup by pressing F2 on system start. Go to System BIOS and thenselect serial communication to enable either COM1 or COM2 for debugging. Below are the screenshots for the steps.

.     Use the following commands to set up net debug

  • bcdedit /debug on
  • bcdedit /dbgsettings serial debugport:n baudrate:rate (please check the com ports available with get-pnpdevice -FriendlyName 'com*')

1. Use the following commands to set up net debug

  • bcdedit /debug on
  • bcdedit /dbgsettings serial debugport:n baudrate:rate (please check the com ports available with get-pnpdevice -FriendlyName 'com*')

For more information on this step, refer: https://msdn.microsoft.com/en-us/library/windows/hardware/ff556867(v=vs.85).aspx

2. From the host, use debug com port and baudrate to connect.

3.On a VM, use the following commands on the target.

  • bcdedit /debug on
  • bcdedit /dbgsettings serial debugport:n baudrate:rate

After reboot, map COM port on the VM to a named pipe. This step depends on the VM provider.

On Generation 2, there is no COM port, COM port has to be added with powershell cmdlets. Following commands to be used on Gen 2.

a. Set-VMFirmware –Vmname VmName –EnableSecureBoot Off  

where VmName is the name of your virtual machine.

b. Add a COM port to the virtual machine by entering this PowerShell command:

Set-VMComPort –VMName VmName 1 \\.\pipe\PipeName

          Use windbg, like in step 2, use the use the pipe name as the com port and buadrate in

USB 3.0 Debug

To debug using USB 3.0, enable USB3.0 in Dell BIOS. Go to System Setup by pressing F2 on system start.                   Go to System BIOS and then select integrated devices. Below are the screenshots for the steps.

1. Use the following commands to set up net debug 

  • bcdedit /debug on
  • bcdedit /dbgsettings usb targetname:TargetName
  • bcdedit /set "{dbgsettings}" busparams b.d.f (Obtain the b.d.f of the USB port)

For more information on this step, refer:

https://msdn.microsoft.com/en-us/library/windows/hardware/hh439372(v=vs.85).aspx

2. From the host, use the TargetName in windbg to connect. 

The other method to debug Nano server would be to configure the VHDX image for debugging.

MediaPath  - For providing the path to the media.

DebugMethod – The debug method to be configured.

Debugging using a serial port

New-NanoServerImage -MediaPath \\Path\To\Media\en_us -BasePath .\Base -TargetPath .\KernelDebuggingSerial -DebugMethod Serial -DebugCOMPort 1 -DebugBaudRate 9600

The defaults are port 2 and 115200 bps. 

Debugging over a TCP/IP network

New-NanoServerImage -MediaPath \\Path\To\Media\en_us -BasePath .\Base -TargetPath .\KernelDebuggingNetwork -DebugMethod Net -DebugRemoteIP 192.168.1.100 -DebugPort 64000

This cmdlet generates an encryption key in a file alongside the resulting VHD which is required for communication over the port. Alternately, you can specify your own key with the -DebugKey parameter.

Debugging using the IEEE1394 protocol (Firewire)

To enable debugging over IEEE1394 use this example cmdlet:

New-NanoServerImage -MediaPath \\Path\To\Media\en_us -BasePath .\Base -TargetPath .\KernelDebuggingFireWire -DebugMethod 1394 -DebugChannel 3

The -DebugChannel parameter is mandatory.

Debugging using USB

You can enable debugging over USB with this cmdlet:

New-NanoServerImage -MediaPath \\Path\To\Media\en_us -BasePath .\Base -TargetPath .\KernelDebuggingUSB -DebugMethod USB -DebugTargetName KernelDebuggingUSBNano

When you connect the remote debugger to the resulting Nano Server, specify the target name as set by the -DebugTargetName parameter.

For more information on this step, refer:

https://technet.microsoft.com/en-us/windows-server-docs/get-started/troubleshooting-nano-server