Skip to content

Reinstalling clean image #4

Closed
Closed

Description

Is there a way to reinstall a clean image of Ubuntu after having already installed it? Tried disabled and re-enabling the feature but no luck in getting a clean install.

Activity

  1. mizzle-mo commented on Apr 7, 2016

    @mizzle-mo

    You probably did get a clean install, just with your files preserved. Your files are in %userprofile%\AppData\Local\lxss by default. You might try deleting the lxss folder after the uninstall. Then try reinstalling the feature. Disclaimer: I have no idea if this will work or cause really bad things to happen,

  2. russalex commented on Apr 7, 2016

    @russalex
    Contributor

    There is an official way to uninstall. You'll want to use the "lxrun" command. Command to uninstall is:

    lxrun /uninstall

    That will keep your /root directory. If you would like to delete that as well try "lxrun /uninstall /full"

    You can then type "bash" again to re-install.

    Documentation can be found here: http://msdn.microsoft.com/en-us/commandline/wsl/reference

  3. J-Gonzalez commented on Apr 7, 2016

    @J-Gonzalez
    Author

    The uinstall worked great. Now getting an error on the install:
    C:\Users>lxrun /install /y
    -- Beta feature --
    This will install Ubuntu on Windows, distributed by Canonical
    and licensed under its terms available here:
    https://aka.ms/uowterms

    Downloading from the Windows Store... 100%
    Error: 0x80070002

    Any ideas?

  4. russalex commented on Apr 7, 2016

    @russalex
    Contributor

    Question, did you try and delete directories as some people are trying?

    Ok, here's what I normally do to get out of any install / uninstall errors. Note that this will delete everything on the instance including your home directory:

    (everything at an admin cmd prompt)

    1. "lxrun /uninstall /full"
    2. "sc stop lxssmanager" wait a second for it to stop
    3. Manually delete your %localappdata%\lxss folder

    That should clean everything off and let you start from scratch.

  5. J-Gonzalez commented on Apr 7, 2016

    @J-Gonzalez
    Author

    I initially tried only with lxrun /uninstall /full

    It seems that I can't delete the lxss folder. The folder doesn't show up in %localappdata%, but you can navigate inside of it if you pass in the directory path in explorer (or cmd)

    Inside, there seems to be two files that can't be deleted. If I try to delete any of the files or directories inside, windows says they don't exist.

    image

  6. J-Gonzalez commented on Apr 7, 2016

    @J-Gonzalez
    Author

    Nothing I try in order to delete the ghost files/directories seems to be working.

    image

  7. J-Gonzalez commented on Apr 7, 2016

    @J-Gonzalez
    Author

    After looking deeper into it, the two files that are left are named "Sourcing nvm.sh should make the nvm command available." which end in a period (and no extension), and I'm not sure if this might be causing the issue or not. I can't rename or delete the files.

    Any ideas?

  8. J-Gonzalez commented on Apr 7, 2016

    @J-Gonzalez
    Author

    Finally was able to delete the files using this command:
    C:\Users\Javier\AppData\Local>rmdir /S "\\?\C:\Users\Javier\AppData\Local\lxss"

    Needed to use *\?* prefix in order to do anything on those files.

  9. russalex commented on Apr 11, 2016

    @russalex
    Contributor

    Closing this one since there is a work around here. Javier Gonzalez (@J-Gonzalez) thanks for all your effort finding the correct commands.

  10. christopher-hopper commented on Jun 27, 2016

    @christopher-hopper

    For those interested, if you need to re-install bash to change the default user it can be done without a full uninstall and reinstall. lxrun supports a couple of argument switches:

    CMD> lxrun
    Performs administrative operations on the LX subsystem
    
    Usage:
        /install - Installs the subsystem
            Optional arguments:
                /y - Do not prompt user to accept
        /uninstall - Uninstalls the subsystem
            Optional arguments:
                /full - Perform a full uninstall
                /y - Do not prompt user to accept
        /setdefaultuser - Configures the subsystem user that bash will be launched as. If the user does not exist it will be created.
            Optional arguments:
                username - Supply the username
                /y - If username is supplied, do not prompt to create a password
        /update - Updates the subsystem's package index
    
  11. tnguyen14 commented on Nov 16, 2017

    @tnguyen14

    Once I uninstall WSL using lxrun /uninstall, I see that the data is still preserved in C:\Users\username\AppData\Local\lxss\home.

    I then install the new Ubuntu version from the Microsoft Store, and created a new user with the same username as before.

    However, the content of the lxss/home directory isn't copied/ synced to the new /home/username directory. Would I need to copy it over manually?

    Will the home directory of the new Ubuntu be stored in lxss/home as well?

  12. andrew-stclair commented on Dec 11, 2017

    @andrew-stclair

    I'm late to the party, but after enabling the feature, you go to the store to install it

    there is Ubuntu, openSUSE and SUSElinux available to me, but apparently fedora is an option too

    https://aka.ms/wslstore

  13. likan999 commented on Dec 30, 2017

    @likan999

    How do I reinstall the one from the store? More specifically, how do I reinstall while keeping my data under home directory?

  14. onomatopellan commented on Dec 31, 2017

    @onomatopellan

    Kan Li (@likan999) It's easy to backup your home folder on Fall Creators Update. Just go to
    %LocalAppData%\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home and Cut&Paste the Ubuntu user folder to any folder on the same drive. (like for example c:\backups)

    After that you can uninstall the Ubuntu app, reinstall it and finally move back the Ubuntu user folder. Just make sure on first run you create the same Ubuntu username as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions