Skip to content
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

duplicate action does not preserve executable bit for all files #207

Open
AlisterH opened this issue Jun 12, 2023 · 3 comments
Open

duplicate action does not preserve executable bit for all files #207

AlisterH opened this issue Jun 12, 2023 · 3 comments

Comments

@AlisterH
Copy link

After a motherboard failure I put my old hard drive in another windows computer and found that I can load the old WSL installs with lxrunoffline. It all seems to work fine - the only thing a little strange is there is a warning message from fstab when I start wsl, which I haven't figured out yet:

C:\WSL>lxrunoffline register -n ubuntu-cp2 -d "H:\WSL2\ubuntu-cp"
C:\WSL>wsl -d ubuntu-cp2
Processing fstab with mount -a failed.

root@CIVILWS11:/mnt/c/WSL#  ls -all /usr/local/bin/joinpdf
---x--x--x 1 root root 4323 Dec 14 15:24 /usr/local/bin/joinpdf

I have to stopp lxssmanager to be able to duplicate the WSL install.
C:\Windows\System32\sc.exe stop LxssManager
If I do that and then use lxrunoffline to duplicate the WSL install, it seems to work, except one of the first things I notice is that a few of my scripts in /usr/local/bin are no longer executable:

C:\WSL>lxrunoffline duplicate -n ubuntu-cp2 -d C:\wsl\ubuntu-cp1 -N ubuntu-cp1
C:\WSL>wsl -d ubuntu-cp1
Processing fstab with mount -a failed.

root@CIVILWS11:/mnt/c/WSL#  ls -all /usr/local/bin/joinpdf
---------- 1 root root 4323 Jun 12 17:48 /usr/local/bin/joinpdf

Any idea what happened, or how to avoid this?
If this seems like a bug, is there anything I can do to figure out what is special about the files that are no longer executable?
Note that there is one other file that is ---x--x--x and didn't stop being executable.

@AlisterH
Copy link
Author

AlisterH commented Jun 12, 2023

Also, do you happen to know if it is possible to copy an unregistered WSL?
If I copy an old WSL1 install into C:\ on the new computer before using lxrunoffline, and try to register the copy, there is an error message: Failed to detect filesystem version of the directory "C:\WSL\ubuntu-cp3
I thought there would be ways to copy the WSL install before using lxrunoffline to register it, but if there are any, I couldn't find them documented anywhere.

@AlisterH
Copy link
Author

AlisterH commented Jun 12, 2023

If this seems like a bug, is there anything I can do to figure out what is special about the files that are no longer executable?
Note that there is one other file that is ---x--x--x and didn't stop being executable.

I note that on the old computer I probably edited all these files from Windows, and then used chmod +x in linux.

@AlisterH
Copy link
Author

OK, it looks to me like this is one of the bad things that happens when editing files directly from Windows. That must have removed three extended attributes, and the extended attribute for the executable bit was restored by chmod +x, but ignored when duplicating the WSL install - presumably something only looks for one of the other extended attributes, and they were missing so it concluded that these files did not have linux permissions. Compare the extended attributes from a file which loses the execute flag, and one which does not:

C:\WSL>.\EaQuery64.exe /Target:"H:\WSL2\ubuntu-cp\rootfs\usr\local\bin\ajh-process-files" /Mode:0 /Verbose:2 /Identifier:* /Filter:* /Recurse:0
EaQuery v1.0.0.1


TargetFile: H:\WSL2\ubuntu-cp\rootfs\usr\local\bin\ajh-process-files
NextEntryOffset: 0
Flags: 0x00
EaNameLength: 6
EaName: $LXMOD
EaValueLength: 4
EaValue:
0000    49 80 00                                           I..

C:\WSL>.\EaQuery64.exe /Target:"H:\WSL2\ubuntu-cp\rootfs\usr\local\bin\pdfwatermark.py" /Mode:0 /Verbose:2 /Identifier:* /Filter:* /Recurse:0
EaQuery v1.0.0.1


TargetFile: H:\WSL2\ubuntu-cp\rootfs\usr\local\bin\pdfwatermark.py
NextEntryOffset: 20
Flags: 0x00
EaNameLength: 6
EaName: $LXUID
EaValueLength: 4
EaValue:
0000    00 00 00                                           ...


NextEntryOffset: 20
Flags: 0x00
EaNameLength: 6
EaName: $LXGID
EaValueLength: 4
EaValue:
0000    00 00 00                                           ...


NextEntryOffset: 0
Flags: 0x00
EaNameLength: 6
EaName: $LXMOD
EaValueLength: 4
EaValue:
0000    49 80 00                                           I..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant