Add a systemd override binfmt-support.service to protect wsl's interop entry (#12999)
* Add a systemd override binfmt-support.service to protect wsl's interop entry * Remove extra mkdir
Blue committed
May 30, 2025 at 14:16 UTC
6f1a992579fb455e1e3016d4da287d097eaf9729
1 file changed
+13
-3
src/linux/init/init.cpp
+13
-3
@@ -310,9 +310,19 @@ ExecStart=/bin/sh -c '(echo -1 > {}/{}) ; (echo "{}" > {})' )",
310
BINFMT_INTEROP_REGISTRATION_STRING(LX_INIT_BINFMT_NAME_LATE),
311
BINFMT_MISC_REGISTER_FILE);
312
313
- auto overrideFolder = std::format("{}/systemd-binfmt.service.d", installPath);
314
- THROW_LAST_ERROR_IF(UtilMkdirPath(overrideFolder.c_str(), 0755) < 0);
315
- THROW_LAST_ERROR_IF(WriteToFile(std::format("{}/override.conf", overrideFolder).c_str(), systemdBinfmtContent.c_str()) < 0);
313
+ // Install the override for systemd-binfmt.service.
314
+ {
315
+ auto overrideFolder = std::format("{}/systemd-binfmt.service.d", installPath);
316
+ THROW_LAST_ERROR_IF(UtilMkdirPath(overrideFolder.c_str(), 0755) < 0);
317
+ THROW_LAST_ERROR_IF(WriteToFile(std::format("{}/override.conf", overrideFolder).c_str(), systemdBinfmtContent.c_str()) < 0);
318
+ }
319
+
320
+ // Install the override for binfmt-support.service.
321
+ {
322
+ auto overrideFolder = std::format("{}/binfmt-support.service.d", installPath);
323
+ THROW_LAST_ERROR_IF(UtilMkdirPath(overrideFolder.c_str(), 0755) < 0);
324
+ THROW_LAST_ERROR_IF(WriteToFile(std::format("{}/override.conf", overrideFolder).c_str(), systemdBinfmtContent.c_str()) < 0);
325
+ }
326
}
327
328
return 0;