podman: Podman machine won't start due to corrupted config file

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

This problem concerns Podman on Windows. I have seen this problem occur on other occations with other programs on Windows. The content of the original (or changed) config file, every char is replaced with the value ‘\x00’.

grafik

Steps to reproduce the issue:

unknown

Describe the results you received:

Due to the corrupted configuration file the podman wsl container won’t start.

Describe the results you expected:

Detect that the config file is corrupted, check for existing wsl containers and ask for permission to recreate the config for the machine. Or maybe create backups of the config file and load the last one.

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

grafik

Output of podman info:

Same as above.

Package info (e.g. output of rpm -q podman or apt list podman or brew info podman):

Installer used was podman-4.3.0-setup.exe

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

No

Additional environment details (AWS, VirtualBox, physical, etc.):

Edition	Windows 10 Pro
Version	22H2
Betriebssystembuild	19045.2251
Leistung	Windows Feature Experience Pack 120.2212.4180.0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Look into the folder %USERPROFILE%\.config\containers\podman\machine\wsl (or C:\Users\<profile>\.config\containers\podman\machine\wsl)´. It should be the podman-machine-default.json file IIRC. Open it and instead of json there should be a lot of \x00 instead. Delete either the podman folder or one up, the container folder. On the terminal wsl --list --all should show you a podman-machine-default Execute wsl --unregister podman-machine-default Then try a podman machine init again. At least that was what i did, if i remember correctly.

Full cleanup procedure:

  1. Find the name of the broken file.

    > ls .\.config\containers\podman\machine\wsl\
    
  2. Delete the broken json file.

    > rm .\.config\containers\podman\machine\wsl\podman-machine-default.json
    
  3. List all WSL instances.

    > wsl --list --all
    
  4. Delete the Podman WSL instance.

    > wsl --unregister podman-machine-default
    
  5. Delete the remaining connection configuration.

    > podman.exe system connection remove --all
    

Now you can initialize a new Podman machine.

I could reproduce the issue on a Windows 10 libvirt instance:

  1. Clean the VM
  2. Reinitialize a Podman machine (with Podman Desktop).
  3. Halt the hypervisor without first stopping or rebooting the Windows virtual machine.
  4. Restart the hypervisor.
  5. Start the Windows VM.
  6. The .\.config\containers\podman\machine\wsl\podman-machine-default.json file is empty.

@themr0c work is in progress on this on #18011

thanks @gravityFlower ! After above steps can init a new podman machine! But there are additional issues in my case, can’t build connection to the machine when pull image. I deleted the related .ssh file and execute “podman system connection remove *”, all works now~