Update to Azure Linux 3 (#14049)
* Update StartDhcpClient to use dhcpcd which is the Azure Linux 3 equivalent * Update Microsoft.WSLg to version 1.0.72 which moves to Azure Linux 3
Ben Hillis committed
Jan 13, 2026 at 09:15 UTC
d27b64883040c4e1b4df6c9eb2b72f7be5086c5f
2 files changed
+16
-35
packages.config
+1
-1
@@ -22,7 +22,7 @@
22
<package id="Microsoft.WSL.Kernel" version="6.6.114.1-1" targetFramework="native" />
23
<package id="Microsoft.WSL.LinuxSdk" version="1.20.0" targetFramework="native" />
24
<package id="Microsoft.WSL.TestDistro" version="2.5.7-47" />
25
- <package id="Microsoft.WSLg" version="1.0.71" />
25
+ <package id="Microsoft.WSLg" version="1.0.72" />
26
<package id="Microsoft.Xaml.Behaviors.WinUI.Managed" version="3.0.0" />
27
<package id="StrawberryPerl" version="5.32.1.1" />
28
<package id="vswhere" version="3.1.7" />
src/linux/init/main.cpp
+15
-34
@@ -72,8 +72,9 @@ Abstract:
72
#define CROSS_DISTRO_SHARE_PATH "/mnt/wsl"
73
#define DEVFS_PATH "/dev"
74
#define DEVNULL_PATH DEVFS_PATH "/null"
75
-#define DHCLIENT_CONF_PATH "/dhclient.conf"
76
-#define DHCLIENT_PATH "/usr/sbin/dhclient"
75
+#define DHCPCD_CONF_PATH "/dhcpcd.conf"
76
+#define DHCPCD_PATH "/usr/sbin/dhcpcd"
77
+
78
#define DISTRO_PATH "/distro"
79
#define ETC_PATH "/etc"
80
#define GPU_SHARE_PREFIX "/gpu_"
@@ -1230,11 +1231,12 @@ int StartDhcpClient(int DhcpTimeout)
1231
1232
Routine Description:
1233
1233
- Starts the dhcp client daemon.
1234
+ Starts the dhcp client daemon. Blocks until the initial DHCP lease is acquired,
1235
+ then the daemon continues running in the background to handle renewals.
1236
1237
Arguments:
1238
1237
- None.
1239
+ DhcpTimeout - Supplies the timeout in seconds for the DHCP request.
1240
1241
Return Value:
1242
@@ -1243,37 +1245,21 @@ Return Value:
1245
--*/
1246
1247
{
1246
- int ChildPid = UtilCreateChildProcess("dhcp", [DhcpTimeout]() {
1248
+ int ChildPid = UtilCreateChildProcess("dhcpcd", [DhcpTimeout]() {
1249
//
1248
- // Create a new mount namespace for dhclient.
1249
- //
1250
-
1251
- THROW_LAST_ERROR_IF(unshare(CLONE_NEWNS) < 0);
1252
-
1253
- //
1254
- // When dhclient receives a DHCP response, it calls dhclient-script
1255
- // which creates a new file, and then moves it to /etc/resolv.conf.
1256
- // Because it's moved, it will overwrite any symlinks / hardlinks.
1257
- // Mounting /etc over /share allows resolv.conf to be written to /share.
1258
- //
1259
-
1260
- THROW_LAST_ERROR_IF(mount(CROSS_DISTRO_SHARE_PATH, ETC_PATH, NULL, MS_BIND, NULL) < 0);
1261
-
1262
- //
1263
- // Write the dhclient.conf config file.
1250
+ // Write the dhcpcd.conf config file.
1251
//
1252
1253
std::string Config = std::format(
1267
- "request subnet-mask, broadcast-address, routers,"
1268
- "domain-name, domain-name-servers, domain-search, host-name,"
1269
- "interface-mtu;\n"
1270
- "timeout {};\n",
1254
+ "option subnet_mask, routers, broadcast, domain_name, domain_name_servers, domain_search, host_name, interface_mtu\n"
1255
+ "noarp\n"
1256
+ "timeout {}\n",
1257
DhcpTimeout);
1258
1273
- THROW_LAST_ERROR_IF(WriteToFile(DHCLIENT_CONF_PATH, Config.c_str()) < 0);
1259
+ THROW_LAST_ERROR_IF(WriteToFile(DHCPCD_CONF_PATH, Config.c_str()) < 0);
1260
1275
- execl(DHCLIENT_PATH, DHCLIENT_PATH, "-4", "eth0", "-cf", DHCLIENT_CONF_PATH, NULL);
1276
- LOG_ERROR("execl() failed, {}", errno);
1261
+ execl(DHCPCD_PATH, DHCPCD_PATH, "-w", "-4", "-f", DHCPCD_CONF_PATH, "eth0", NULL);
1262
+ LOG_ERROR("execl({}) failed, {}", DHCPCD_PATH, errno);
1263
});
1264
1265
if (ChildPid < 0)
@@ -1281,12 +1267,7 @@ Return Value:
1267
return -1;
1268
}
1269
1284
- //
1285
- // Note: dhclient returns when the interface is successfully configured,
1286
- // but keeps a daemon running to maintain it.
1287
- //
1288
-
1289
- return WaitForChild(ChildPid, DHCLIENT_PATH);
1270
+ return WaitForChild(ChildPid, DHCPCD_PATH);
1271
}
1272
1273
int StartGuestNetworkService(int GnsFd, wil::unique_fd&& DnsTunnelingFd, uint32_t DnsTunnelingIpAddress)