-
Notifications
You must be signed in to change notification settings - Fork 823
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
Wrong file ownership on root filesystem #9982
Comments
@jibel - I'm a bit confused here. The from a UID / GID perspective, tar is just storing numbers and setting those values when extracting. Have you validated locally that when you extract the tar file the UID / GID matches what you expect? |
I am confused too. I would understand the name doesn't match, but not a change of the UID/GID. I did the following test:
(on my system crontab is 105 and 104 is systemd-time, and systemd-resolve is 103)
It is now owned by systemd-resolve (same name than the tar output) but the GID is 103. The GID of the same file in WSL is 77. If I mount /dev/sda, which contains Mariner and search /etc/group for GID 77, it's systemd-resolve. |
I'm still confused - we run bsdtar as root so --same-owner would be the default. |
Same with bsdtar, the GID is modified on extract:
It's 104 in the archive and 103 once extracted. I'll dig further tomorrow. |
I'm seeing something similar locally:
|
You're right, it looks like ownership information is being inherited from the /etc/passwd file inside the system distro. (you can confirm this by launching wsl.exe --system -u root and looking at /etc/passwd). Looks like we should probably be using the |
@jibel - I think I have a fix for this. How did you identify the files that have the wrong owner so I can run that locally to see if the issue is resolved? |
@jibel - could you try 1.2.4 and see if that resolves what you're seeing? You'll have to re-register the distro after installing the updated package. https://github.com/microsoft/WSL/releases/tag/1.2.4 |
I created a list of files with owners in WSL, excluding owner root/root (run as root):
Same with the tarball (add leading and strip trailing slashes):
Then diff the two files.
There are some extra lines but the diff is small enough to identify the wrong ones. |
@benhillis I confirm that 1.2.4 fixes the issue. Thanks for the quick fix! |
Windows Version
Microsoft Windows [Version 10.0.22621.1555]
WSL Version
1.2.2.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.90.1
Distro Version
Ubuntu and all releses of it
Other Software
No response
Repro Steps
This has been observed on all the releases of Ubuntu.
To reproduce the issue, install a WSL instance from the store.
While investigating issues with failing services of systemd, we found that some files and directories are not owned by the right users.
For instance:
/usr/bin/crontab root/77 instead of root/crontab (0/104)
/var/spool/rsyslog 18/16 instead of syslog/adm (104/4)
/var/log/journal/ root/78 instead of root/systemd-journal (0/101)
usr/lib/dbus-1.0/dbus-daemon-launch-helper root/18 instead of root/messagebus (0/105)
...
users and groups on an installed WSL instance sometimes differ from users and groups of the root filesystem (the initial tarball); some do not match the correct id from the root filesystem, others are nonexistent.
A guess is that when the rootfs tarball is extracted during the installation of the instance, the tar command uses the passwd and group databases of the root WSL VM instead of the passwd and group files of the root filesystem and wrongly maps user names and group names.
The consequence is that the system will not operate properly. System units are not starting, or commands won't execute properly, for example.
Expected Behavior
User and groups are unchanged compared to the original root filesystem
Actual Behavior
Some files have incorrect ownership.
Here is the list of files that we found have the wrong ownership
Diagnostic Logs
No response
The text was updated successfully, but these errors were encountered: