microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.4k stars 819 forks source link

[BUG?] WSL cannot install to moveable device (e.g. USB Disks) #8148

Closed Tommy131 closed 2 years ago

Tommy131 commented 2 years ago

Version

Microsoft Windows Server 2019 Datacenter

WSL Version

Kernel Version

4.4.0-17763-Microsoft

Distro Version

DebianGNU

Other Software

CMD Microsoft Windows [Version 10.0.17763.2686]

Repro Steps

I tried to install WSL into my USB SSD disk, after this operation it comes a problem:

Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: testuser
groupadd: failure while writing changes to /etc/group
adduser: `/usr/sbin/groupadd -g 1000 testuser' returned error code 10. Exiting.
Enter new UNIX username:

Then I closed this window, and run debian.exe manually again. It stills cannot create a new user, but it running with root user. So I updated the package management with command gpt-get update. After this I tried to install some packages, e.g. wget. I used command apt-get install -y wget, then it comes the following issue:

root@MyServer:~# apt-get install -y wget
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  ca-certificates libpsl5 openssl publicsuffix
The following NEW packages will be installed:
  ca-certificates libpsl5 openssl publicsuffix wget
0 upgraded, 5 newly installed, 0 to remove and 17 not upgraded.
Need to get 2,155 kB of archives.
After this operation, 5,886 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 openssl amd64 1.1.1k-1+deb11u1 [851 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 ca-certificates all 20210119 [158 kB]
Get:3 http://deb.debian.org/debian bullseye/main amd64 libpsl5 amd64 0.21.0-1.2 [57.3 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 wget amd64 1.21-1+deb11u1 [964 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 publicsuffix all 20211207.1025-0+deb11u1 [125 kB]
Fetched 2,155 kB in 0s (7,079 kB/s)
Preconfiguring packages ...
debconf: DbDriver "config": could not sync /var/cache/debconf/config.dat-new: Input/output error
dpkg: error processing archive /var/cache/apt/archives/openssl_1.1.1k-1+deb11u1_amd64.deb (--unpack):
 unable to sync file '/var/lib/dpkg/tmp.ci//conffiles': Input/output error
dpkg: error processing archive /var/cache/apt/archives/ca-certificates_20210119_all.deb (--unpack):
 unable to sync file '/var/lib/dpkg/tmp.ci//config': Input/output error
dpkg: error processing archive /var/cache/apt/archives/libpsl5_0.21.0-1.2_amd64.deb (--unpack):
 unable to sync file '/var/lib/dpkg/tmp.ci//control': Input/output error
dpkg: error processing archive /var/cache/apt/archives/wget_1.21-1+deb11u1_amd64.deb (--unpack):
 unable to sync file '/var/lib/dpkg/tmp.ci//conffiles': Input/output error
dpkg: error processing archive /var/cache/apt/archives/publicsuffix_20211207.1025-0+deb11u1_all.deb (--unpack):
 unable to sync file '/var/lib/dpkg/tmp.ci//control': Input/output error
dpkg: error: unable to sync new file '/var/lib/dpkg/status-new': Input/output error
E: Sub-process /usr/bin/dpkg returned an error code (2)
root@MyServer:~#

This USB Disks has 128GB and the file system is NTFS with GPT. I tried to formatted it at twice but it still running like this bug. If I install WSL in my connected Disks (AHCI Mode) will be not happend this bug. I'm just curious what is the different between the installation.

Expected Behavior

Following texts are the WSL running in my connected Disks (AHCI Mode) and the operations are running normally.

Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: testuser
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
testuser@MyServer:~$ sudo apt-get update && sudo apt-get install -y wget

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for testuser:
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:3 http://ftp.debian.org/debian bullseye-backports InRelease [44.2 kB]
Get:4 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8,183 kB]
Get:6 http://deb.debian.org/debian bullseye/main Translation-en [6,243 kB]
Get:7 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [121 kB]
Get:8 http://security.debian.org/debian-security bullseye-security/main Translation-en [77.5 kB]
Get:9 http://ftp.debian.org/debian bullseye-backports/main amd64 Packages [214 kB]
Get:10 http://ftp.debian.org/debian bullseye-backports/main Translation-en [175 kB]
Get:11 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2,596 B]
Get:12 http://deb.debian.org/debian bullseye-updates/main Translation-en [2,343 B]
Fetched 15.3 MB in 4s (3,438 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  ca-certificates libpsl5 openssl publicsuffix
The following NEW packages will be installed:
  ca-certificates libpsl5 openssl publicsuffix wget
0 upgraded, 5 newly installed, 0 to remove and 17 not upgraded.
Need to get 2,155 kB of archives.
After this operation, 5,886 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 openssl amd64 1.1.1k-1+deb11u1 [851 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 ca-certificates all 20210119 [158 kB]
Get:3 http://deb.debian.org/debian bullseye/main amd64 libpsl5 amd64 0.21.0-1.2 [57.3 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 wget amd64 1.21-1+deb11u1 [964 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 publicsuffix all 20211207.1025-0+deb11u1 [125 kB]
Fetched 2,155 kB in 0s (7,665 kB/s)
Preconfiguring packages ...
Selecting previously unselected package openssl.
(Reading database ... 10007 files and directories currently installed.)
Preparing to unpack .../openssl_1.1.1k-1+deb11u1_amd64.deb ...
Unpacking openssl (1.1.1k-1+deb11u1) ...
Selecting previously unselected package ca-certificates.
Preparing to unpack .../ca-certificates_20210119_all.deb ...
Unpacking ca-certificates (20210119) ...
Selecting previously unselected package libpsl5:amd64.
Preparing to unpack .../libpsl5_0.21.0-1.2_amd64.deb ...
Unpacking libpsl5:amd64 (0.21.0-1.2) ...
Selecting previously unselected package wget.
Preparing to unpack .../wget_1.21-1+deb11u1_amd64.deb ...
Unpacking wget (1.21-1+deb11u1) ...
Selecting previously unselected package publicsuffix.
Preparing to unpack .../publicsuffix_20211207.1025-0+deb11u1_all.deb ...
Unpacking publicsuffix (20211207.1025-0+deb11u1) ...
Setting up libpsl5:amd64 (0.21.0-1.2) ...
Setting up wget (1.21-1+deb11u1) ...
Setting up openssl (1.1.1k-1+deb11u1) ...
Setting up publicsuffix (20211207.1025-0+deb11u1) ...
Setting up ca-certificates (20210119) ...
Updating certificates in /etc/ssl/certs...
129 added, 0 removed; done.
Processing triggers for libc-bin (2.31-13+deb11u2) ...
Processing triggers for ca-certificates (20210119) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
testuser@MyServer:~$wget --version
GNU Wget 1.21 built on linux-gnu.

-cares +digest -gpgme +https +ipv6 +iri +large-file -metalink +nls
+ntlm +opie +psl +ssl/gnutls

Wgetrc:
    /etc/wgetrc (system)
Locale:
    /usr/share/locale
Compile:
    gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc"
    -DLOCALEDIR="/usr/share/locale" -I. -I../../src -I../lib
    -I../../lib -Wdate-time -D_FORTIFY_SOURCE=2
    -I/usr/include/p11-kit-1 -DHAVE_LIBGNUTLS -DNDEBUG -g -O2
    -ffile-prefix-map=/build/wget-KAcLZ8/wget-1.21=.
    -fstack-protector-strong -Wformat -Werror=format-security
    -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall
Link:
    gcc -I/usr/include/p11-kit-1 -DHAVE_LIBGNUTLS -DNDEBUG -g -O2
    -ffile-prefix-map=/build/wget-KAcLZ8/wget-1.21=.
    -fstack-protector-strong -Wformat -Werror=format-security
    -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall -Wl,-z,relro -Wl,-z,now
    -lpcre2-8 -luuid -lidn2 -lnettle -lgnutls -lz -lpsl ftp-opie.o
    gnutls.o http-ntlm.o ../lib/libgnu.a

Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://www.gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
Please send bug reports and questions to <bug-wget@gnu.org>.
testuser@MyServer:~$

Actual Behavior

  1. Cannot create new user
  2. Cannot install a new package with command apt-get install -y <packageName>

Diagnostic Logs

No response

Tommy131 commented 2 years ago

I tried one more time in my other moveable SSD Devices, they can install WSL. Perhaps is my currently disk has problem? If you need more information, I will commit again.

0xbadfca11 commented 2 years ago

Removable media (such as SD card and thumb drive, not such as USB-HDD) is not auto-mounted on WSL. As a result, it cannot work because / does not exist.

Get-Volume | fl DriveLetter,DriveType
Tommy131 commented 2 years ago

Removable media (such as SD card and thumb drive, not such as USB-HDD) is not auto-mounted on WSL. As a result, it cannot work because / does not exist.

Get-Volume | fl DriveLetter,DriveType

Thanks for reply. I think you are right, I installed in a NVMe removable SSD device right now. Maybe WSL just don't support install into a General USB Disk.

OneBlue commented 2 years ago

Thanks for reporting this @Tommy131.

What exactly do you mean by 'install WSL into my USB SSD' ? Are you installing a distribution on a removable drive or WSL itself ? What are the exact commands you're running ?

Tommy131 commented 2 years ago

Thanks for reporting this @Tommy131.

What exactly do you mean by 'install WSL into my USB SSD' ? Are you installing a distribution on a removable drive or WSL itself ? What are the exact commands you're running ?

yes, I was installed on removable SSD Driver. Commands just used Apt-get install <package Name> what I'm describing on Issue.

OneBlue commented 2 years ago

Sorry @Tommy131, I'm not following what you're trying to do.

Can you share what exactly you installed on a removable drive and what exact command you used ?

Tommy131 commented 2 years ago

Sorry @Tommy131, I'm not following what you're trying to do.

Can you share what exactly you installed on a removable drive and what exact command you used ?

Hi, thanks for reply. This issue was a long time ago then I'm not really remember what I was operated it. But I still remember, that I was following the page https://blog.51cto.com/u_15080022/3444892 to install WSL in Windows Server 2019. I once had a removable storage device (USB) plugged in with a size of 128GB. The file format system is exFAT.

The WSL installation was fully OK and successed, just after the installation, when I tried to run command like apt-get install -y vim wget, then I get the issue what the first issue I opened here.

OneBlue commented 2 years ago

Sorry I'm still not following. What exactly did you install on the removable drive ? Windows, WSL, or a linux distribution ?

ghost commented 2 years ago

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you're still experiencing this issue please re-open it.

Thank you!