microsoft/WSL

podman - XDG_RUNTIME_DIR directory "/mnt/wslg/runtime-dir" is not owned by the current user

salcinad opened this issue ยท 7 comments

Windows Version

Microsoft Windows [Version 10.0.19045.4291]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.146.1-2

Distro Version

Ubuntu 24.04

Other Software

podman 4.9.3+ds1-1build2

Repro Steps

install Ubuntu 24.04 - wsl --install Ubuntu-24.04
basic setup: username/password, proxy in .bashrc and /etc/apt/apt.conf.d/01proxy
DNS - disable automatically generated by WSL and setup resolve.conf manually
update system: sudo apt update -y && sudo apt upgrade -y
install podman: sudo apt -y install podman
run podman info: podman info
test podman run

Expected Behavior

podman info should show relevant information and work as expected

Actual Behavior

$ podman info
ERRO[0000] XDG_RUNTIME_DIR directory "/mnt/wslg/runtime-dir" is not owned by the current user
$

$ podman run hello-world
ERRO[0000] XDG_RUNTIME_DIR directory "/mnt/wslg/runtime-dir" is not owned by the current user

Diagnostic Logs

No response

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Thank you, this is a known issue with ubuntu 24.04, because there's already a UID=1000 before the WSL user is created, so the WSL user gets a different UID, which breaks wslg's expectation and leads to errors like the one you're seeing.

We've contacted the distribution maintainer to see if the UID can be fixed from their end

Seems there is an default "ubuntu" user with Ubuntu-24.04 with id 1000, user created with installation have id 1002.
$ id 1000 uid=1000(ubuntu) gid=1001(ubuntu) groups=1001(ubuntu),4(adm),24(cdrom),27(sudo),30(dip),1000(lxd)

if i switch to that user i could run podman info, but this is not expected

$ sudo -i
# su - ubuntu
$ podman info
WARN[0000] "/" is not a shared mount, this could cause issues or missing mounts with rootless containers
host:
  arch: amd64
  buildahVersion: 1.33.5
  cgroupControllers: []
  cgroupManager: cgroupfs
  cgroupVersion: v1
...
version:
  APIVersion: 4.9.3
  Built: 0
  BuiltTime: Thu Jan  1 01:00:00 1970
  GitCommit: ""
  GoVersion: go1.22.1
  Os: linux
  OsArch: linux/amd64
  Version: 4.9.3
$

As a workaround you can install Ubuntu not from the Microsoft Store, but via wsl --import and get the image archive from here: https://cloud-images.ubuntu.com/wsl/

This way there is no prompt for creation of a new user. Note that things like Windows Terminal profile won't be added automatically.

Seems there is an default "ubuntu" user with Ubuntu-24.04 with id 1000, user created with installation have id 1002. $ id 1000 uid=1000(ubuntu) gid=1001(ubuntu) groups=1001(ubuntu),4(adm),24(cdrom),27(sudo),30(dip),1000(lxd)

if i switch to that user i could run podman info, but this is not expected

$ sudo -i
# su - ubuntu
$ podman info
WARN[0000] "/" is not a shared mount, this could cause issues or missing mounts with rootless containers
host:
  arch: amd64
  buildahVersion: 1.33.5
  cgroupControllers: []
  cgroupManager: cgroupfs
  cgroupVersion: v1
...
version:
  APIVersion: 4.9.3
  Built: 0
  BuiltTime: Thu Jan  1 01:00:00 1970
  GitCommit: ""
  GoVersion: go1.22.1
  Os: linux
  OsArch: linux/amd64
  Version: 4.9.3
$

This might be why I have a command entry in my /etc/wsl.conf

[boot]
systemd=true
command = mount --make-rshared /

@Stelminator that will fix the problem/message with "WARN[0000] "/" is not a shared mount" but not the real issue which we have, and thus that there is already user in rootfs image (at lease in 20240508 release from the link which @trallnag posted). And thus when the installer prompts for User creation the new user gets id 1002 and can not execute the "podman info" command as seen in first post.

@OneBlue any replay from distribution maintainer?

I think this is also related to #10473, #10498, and #9689.