Windows上的Ubuntu上的Bash不能使用`sudo apt-get install <packagename>`。 未满足的依赖关系

我很高兴在Windows上使用bash,但很快就遇到了一个问题。 我想安装生成必不可less,但我得到一个依赖性问题。 试图用sudo apt-get install -f解决问题时,遇到了另一个没有多大意义的错误。 我试过更新和升级,但也没有工作。 F

barzevp@UK-LT-8356:~$ sudo apt-get install build-essential Reading package lists... Done Building dependency tree Reading state information... Done build-essential is already the newest version. You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies. libc6-dev : Depends: linux-libc-dev but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution). barzevp@UK-LT-8356:~$ sudo apt-get -f install Reading package lists... Done Building dependency tree Reading state information... Done Correcting dependencies... Done The following packages were automatically installed and are no longer required: libfreetype6 os-prober Use 'apt-get autoremove' to remove them. The following extra packages will be installed: linux-libc-dev The following NEW packages will be installed linux-libc-dev 0 to upgrade, 1 to newly install, 0 to remove and 43 not to upgrade. 5 not fully installed or removed. Need to get 0 B/767 kB of archives. After this operation, 3,946 kB of additional disk space will be used. Do you want to continue? [Y/n] y (Reading database ... 28660 files and directories currently installed.) Preparing to unpack .../linux-libc-dev_3.13.0-123.172_amd64.deb ... Unpacking linux-libc-dev:amd64 (3.13.0-123.172) ... dpkg: error processing archive /var/cache/apt/archives/linux-libc-dev_3.13.0-123.172_amd64.deb (--unpack): unable to install new version of /usr/include/linux/netfilter_ipv6/ip6t_hl.h': File exists E: Sub-process /usr/bin/dpkg returned an error code (1)

在Windowsterminal的Ubuntu的Bash上导致错误的完整日志是在这里: https : //pastebin.com/dq2D2Gtz

Solutions Collecting From Web of "Windows上的Ubuntu上的Bash不能使用`sudo apt-get install <packagename>`。 未满足的依赖关系"

我没有解决办法,但我看到了问题的根源。 这似乎与文件系统上的区分大小写有关。 linux-libc-dev软件包在/ usr / include / linux / netfilter_ipv6中放置了两个文件副本, ip6t_HL.h和ip6t_hl.h。 放置ip6t_HL.h后,它会尝试将ip6t_hl.h.dpkg-new重命名为ip6t_hl.h。 系统调用重命名文件失败,声称ip6t_hl.h已经存在

在“真正的”linux系统上,ip6t_HL.h和ip6t_hl.h显然是不同的文件。 在WSL下,他们可能在NTFS默认的不区分大小写FS和Unix默认区分大小写之间出现了一些奇怪的不兼容问题。

你可以手工复制这个问题,比如说

 echo hi > foo.H echo hi > foo.h-new mv foo.h-new foo.h 

mv:不能将'foo.h -new'移动到'foo.h':文件存在

strace输出:

 rename("/usr/include/linux/netfilter_ipv6/ip6t_HL.h.dpkg-new", "/usr/include/linux/netfilter_ipv6/ip6t_HL.h") = 0 open("/usr/include/linux/netfilter_ipv6/ip6t_hl.h.dpkg-new", O_WRONLY) = 10 fsync(10) = 0 close(10) = 0 rename("/usr/include/linux/netfilter_ipv6/ip6t_hl.h.dpkg-new", "/usr/include/linux/netfilter_ipv6/ip6t_hl.h") = -1 EEXIST (File exists) write(2, "dpkg: error processing archive /"..., 199dpkg: error processing archive /var/cache/apt/archives/linux-libc-dev_4.4.0-98.121_amd64.deb (--install): unable to install new version of '/usr/include/linux/netfilter_ipv6/ip6t_hl.h': File exists ) = 199 

它说依赖没有被安装,所以请尝试:

 sudo apt-get install linux-libc-dev 

如果这不起作用,请尝试:

 sudo apt-get install --reinstall build-essential 

这将重新安装build-essential. 希望这有助于,欢呼!