-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #2131 Add preflight check for WSL2 #2323
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,6 +114,14 @@ var vsockPreflightChecks = Check{ | |
cleanup: removeVsockCrcSettings, | ||
} | ||
|
||
var wsl2PreflightChecks = Check{ | ||
praveenkumar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
configKeySuffix: "check-wsl2", | ||
checkDescription: "Checking if running inside WSL2", | ||
check: checkRunningInsideWSL2, | ||
fixDescription: "CodeReady Containers is unsupported using WSL2", | ||
flags: NoFix, | ||
} | ||
|
||
const ( | ||
vsockUdevSystemRulesPath = "/usr/lib/udev/rules.d/99-crc-vsock.rules" | ||
vsockUdevLocalAdminRulesPath = "/etc/udev/rules.d/99-crc-vsock.rules" | ||
|
@@ -220,13 +228,16 @@ func removeVsockCrcSettings() error { | |
func getAllPreflightChecks() []Check { | ||
usingSystemdResolved := checkSystemdResolvedIsRunning() | ||
checks := getPreflightChecksForDistro(distro(), network.SystemNetworkingMode, usingSystemdResolved == nil) | ||
checks = append(checks, wsl2PreflightChecks) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should also add this line in individuals
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding a preflight has become very messy and cumbersome. Too much complexity and variables with no clear meaning have been introduced. |
||
checks = append(checks, vsockPreflightChecks) | ||
return checks | ||
} | ||
|
||
func getPreflightChecks(_ bool, _ bool, networkMode network.Mode) []Check { | ||
usingSystemdResolved := checkSystemdResolvedIsRunning() | ||
return getPreflightChecksForDistro(distro(), networkMode, usingSystemdResolved == nil) | ||
checks := getPreflightChecksForDistro(distro(), networkMode, usingSystemdResolved == nil) | ||
checks = append(checks, wsl2PreflightChecks) | ||
return checks | ||
} | ||
|
||
func getNetworkChecks(networkMode network.Mode, systemdResolved bool) []Check { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hopefully there are no 'hardened' setups where reading this fail will fail. Wondering if we should ignore this error instead of failing, but probably not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can not run with selinux or apparmor on WSL2. Not sure about other setups... haven't tested. But reading this is a known hardened entry?
Note: There are a lot of limitations, like no systemd, no cgroupsv2 exclusive use, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this code will run on all linux systems, not just WSL2. I have no idea if it's really blocked in some places, just wondered while reading this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^