WSL icon indicating copy to clipboard operation
WSL copied to clipboard

lxrun /uninstall /full /y failes to delete all user content in $HOME.

Open markgross opened this issue 10 years ago • 12 comments

On the previous install of build 14332_rs1_release.160422-1940 I installed the android open source project source code. Then I update my insider version to 14332 and ran lxss /uninstall /full and was warned that all my $HOME data would be removed. (it was not) I had left over directories.

Now my $HOME directory is missing its .bashrc and .profilerc files. (note: I'm not sure those existed before so maybe I'm confused.)

Still the tool warned me about loosing data and not all the data was deleted.

markgross avatar May 01 '16 15:05 markgross

Mark, the uninstaller runs from lxrun.exe, not lxss.exe, but assuming that's what you did, can't you just delete all of the remaining files manually in appdata\local?

fpqc avatar May 02 '16 05:05 fpqc

Sorry about the type-oh. Yes lxrun is the app I ran. The undeleted files were bits of the aosp project SRC code. I'll retry the failure case later today. It takes 2 hrs to repo sync the project that is made up of more than 500 git projects. I'll start pulling the code down before I go to work and run the test case when I get home.

. On May 1, 2016 10:35 PM, "fpqc" [email protected] wrote:

Mark, the uninstaller runs from lxrun.exe, not lxss.exe, but assuming that's what you did, can't you just delete all of the remaining files manually in appdata\local?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/Microsoft/BashOnWindows/issues/310#issuecomment-216108064

markgross avatar May 02 '16 14:05 markgross

Is it possible that you had a handle to a file or directory open while you were trying to uninstall?

benhillis avatar May 03 '16 00:05 benhillis

Nope. I just re-did the following test: install bash: follow the instructions from source.android.com http://source.android.com/source/downloading.html and repo init / repo sync AOSP.

close the shell. run powershell and from powershell and run : PS C:\Users\mark> lxrun /uninstall /full /y This will uninstall Ubuntu on Windows. This will remove the Ubuntu environment as well as any modifications, new applications, and user data. Uninstalling... PS C:\Users\mark> http://source.android.com/source/downloading.html

After the uninstall I look at where the $HOME is to see; The directory seems to be getting cleanned up in the background. After lxrun is finished the directory had content and over time it was deleted.

On Mon, May 2, 2016 at 5:32 PM, Ben Hillis [email protected] wrote:

Is it possible that you had a handle to a file or directory open while you were trying to uninstall?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/Microsoft/BashOnWindows/issues/310#issuecomment-216404253

create interesting things.

markgross avatar May 06 '16 00:05 markgross

If you still have the repro can you see if the files that failed to delete end with the "." character? There will be other files as well but if there was a file that ended in a period the deletion operation will stop.

I investigated this a bit and it looks like the Win32 API that we're using to delete files is not correctly handling files that end in periods.

benhillis avatar May 08 '16 16:05 benhillis

I don't have those files at this time. I swapped the HD out for a while. I'll come back to testing this stuff out in a few weeks. Sorry.

--mark

On Sun, May 8, 2016 at 9:54 AM, Ben Hillis [email protected] wrote:

If you still have the repro can you see if the files that failed to delete end with the "." character? There will be other files as well but if there was a file that ended in a period the deletion operation will stop.

I investigated this a bit and it looks like the Win32 API that we're using to delete files is not correctly handling files that end in periods.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/Microsoft/BashOnWindows/issues/310#issuecomment-217732724

create interesting things.

markgross avatar May 08 '16 18:05 markgross

As I have and still am experiencing these issues, I take the liberty to respond for my case.

If you still have the repro can you see if the files that failed to delete end with the "." character? There will be other files as well but if there was a file that ended in a period the deletion operation will stop.

Yes, "my" issue originates from a folder that I think cmake created in /usr/local/lib/cmake/. The remaining folder is cadmesh-. (there's the period). The content is a cmake config-file cadmesh-config.cmake.

As a quite dirty workaround, after running lxrun /uninstall /full /y just go to %HOMEPATH%\AppData\Localand rename the lxss directory and then manually delete all the deletable files. This should at least help you with reducing disk space.

cvelten avatar May 11 '16 10:05 cvelten

@cvelten Excellent that's what I expected. I'm currently working on a change that switches the way we delete files on uninstall so it will handle cases like files ending in periods and some other funny Win32 path translation rules.

Your workaround will be very helpful because in some cases files ending in "." would prevent the user from being able to reinstall Ubuntu on Windows. I'll make sure to add your workaround to rename the %localappdata%\lxss folder to our list of known issues.

benhillis avatar May 11 '16 15:05 benhillis

This still isn't fixed in Build 14352. I had the Linux kernel for Raspberry Pi cross-compiled and that directory and tools are still there after lxrun /uninstall /full. These directories were created according to the Cross-compiling section in https://www.raspberrypi.org/documentation/linux/kernel/building.md

mobluse avatar May 28 '16 16:05 mobluse

@mobluse Do these directories (or some files inside of them) end in a '.' character? Looks like the fix for that issue just missed the snap for the 14352 build. It will be in the next one though!

benhillis avatar May 28 '16 16:05 benhillis

@benhillis I had removed the folders manually using e.g. rm -rfv tools/ before I got your answer, but now I downloaded tools again using git clone https://github.com/raspberrypi/tools , but I couldn't find any files ending in '.' using find tools/ -name '*.' .

mobluse avatar May 28 '16 21:05 mobluse

@benhillis's change made it into 14361 so marking this one as fixed.

I do know that files ending in '.' are possible (touch foo. works).

russalex avatar Jun 10 '16 19:06 russalex