我很高兴在Windows上使用bash,但很快就遇到了问题。我正在尝试安装build-essential,但是我遇到了依赖性问题。在尝试使用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)
Windows终端上Ubuntu上Bash导致错误的完整日志在这里: https://pastebin.com/dq2D2Gtz
答案 0 :(得分:4)
我没有解决方案,但我看到了问题的根源。它似乎与文件系统的区分大小写有关。 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' to' 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
答案 1 :(得分:1)
我有同样的问题。像@dmattp一样,我发现这是因为,不幸的是,该软件包包含一些名称仅由字母大小写区分的(头)文件,并且精美的WSL文件系统在区分大小写方面存在不一致之处。
这里是一种解决方法,假设程序包的名称为linux-libc-dev_3.13.0-123.172_amd64.deb
:
cd any-temp-dir
apt-get download linux-libc-dev
ar x linux-libc-dev_3.13.0-123.172_amd64.deb
tar xJf data.tar.xz # ignore all erors like ./usr/include/linux/netfilter_ipv4/ipt_ttl.h: Cannot open: Input/output error
tar cJf data.tar.xz ./usr
ar rcs linux-libc-dev_3.13.0-123.172_amd64-patched.deb debian-binary control.tar.gz data.tar.xz
sudo dpkg -i linux-libc-dev_3.13.0-123.172_amd64-patched.deb
答案 2 :(得分:-1)
它表示没有安装依赖项,因此请尝试:
sudo apt-get install linux-libc-dev
如果不起作用,请尝试:
sudo apt-get install --reinstall build-essential
这将重新安装build-essential.
希望这会有所帮助,欢呼!