Merge pull request #29103 from Luap99/wsl-config-mount

machine/wsl: fix config mount logic
This commit is contained in:
Brent Baude 2026-07-02 10:05:04 -05:00 committed by GitHub
commit 4d5435f47e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 5 deletions

View file

@ -480,6 +480,15 @@ var _ = Describe("podman machine init", func() {
Expect(sshSession2).To(Exit(0))
output := strings.TrimSpace(sshSession2.outputToString())
Expect(output).To(Equal("/run/podman/podman.sock"))
// Ensure we can at least connect to the rootful podman socket and that it is actually a rootful one by checking the paths
bm := basicMachine{}
info, err := mb.setCmd(bm.withPodmanCommand([]string{"info"})).run()
Expect(err).ToNot(HaveOccurred())
Expect(info).To(Exit(0))
Expect(info.outputToString()).To(ContainSubstring("/run/podman/podman.sock"))
Expect(info.outputToString()).To(ContainSubstring("serviceIsRemote: true"))
Expect(info.outputToString()).To(ContainSubstring("/var/lib/containers"))
})
It("init should cleanup on failure", func() {

View file

@ -98,7 +98,8 @@ LoadCredential=
const bindMountConfigDirSystemService = `
[Unit]
Description=Bind mount for config directory
Before=podman.socket
Before=multi-user.target
After=local-fs.target
[Service]
RemainAfterExit=true
@ -157,12 +158,13 @@ const (
podmanSocketDropin = "podman.socket.d"
podmanSocketDropinPath = sysSystemdPath + "/" + podmanSocketDropin
configBindSysUnitName = "podman-mnt-config.service"
configBindSysUnitPath = sysSystemdPath + "/" + configBindSysUnitName
configBindSysUnitWant = sysSystemdWants + "/" + configBindSysUnitName
configBindSysUnitName = "podman-mnt-config.service"
configBindSysUnitPath = sysSystemdPath + "/" + configBindSysUnitName
configBindSysUnitWantsDirectory = sysSystemdPath + "/local-fs.target.wants"
configBindSysUnitWant = configBindSysUnitWantsDirectory + "/" + configBindSysUnitName
)
const configBindServices = "mkdir -p " + userSystemdWants + " " + sysSystemdWants + " " + podmanSocketDropinPath + "\n" +
const configBindServices = "mkdir -p " + userSystemdWants + " " + sysSystemdWants + " " + podmanSocketDropinPath + " " + configBindSysUnitWantsDirectory + "\n" +
"ln -fs " + bindUserUnitPath + " " + bindUserUnitWant + "\n" +
"ln -fs " + bindSysUnitPath + " " + bindSysUnitWant + "\n" +
"ln -fs " + configBindSysUnitPath + " " + configBindSysUnitWant + "\n"