2

I'm running Ubuntu 18.04 on Windows Subsystem for Linux on a Windows 10 machine. I have just cloned a repository from GitHub that contains several submodules. To initialize those submodules, I typically run the command:
git submodule update --init

However, when I do that I get an error:
/usr/lib/git-core/git-submodule: 332: /usr/lib/git-core/git-sh-setup: uname: Input/output error

Has anyone else seen this behavior? Does anyone know how to fix this?

corjstout
  • 21
  • 1

2 Answers2

1

Try first and upgrade Git (or compile it from sources) to the latest 2.26.2.
More and more of submodule is rewritten in C (from its former bash script state), starting from 2.16 (Q4 2017)

The git-sh-setup bash script does a case $(uname -s) in, with uname -s supposed to work (unless executed from a Powershell session)
That uname code dates back to commit 87bddba, Git v1.6.0-rc0, Nov. 2007, 13 years ago.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I just updated git to version 2.26.2 (from 2.17.1), but unfortunately I am still seeing the same error (though it now occurs on line 333 instead of 332): /usr/lib/git-core/git-submodule: 333: /usr/lib/git-core/git-sh-setup: uname: Input/output error – corjstout Apr 23 '20 at 16:46
  • Just the command `uname -s` produces the error "-bash: /bin/uname: Input/output error", but it sounds like you expected that to work. Perhaps this is the source of the error? Is this supposed to work in WSL? – corjstout Apr 23 '20 at 16:51
  • @corjstout `uname -s` (in WSL) is the root of the problem (Git or no Git). It should work. What does `which uname` return? and `uname --version` and `uname --help`? – VonC Apr 23 '20 at 17:00
  • `which uname`: /bin/uname, `uname --version`: -bash: /bin/uname: Input/output error, `uname --help`: -bash: /bin/uname: Input/output error – corjstout Apr 23 '20 at 18:42
  • @corjstout Did you try a shutdown/restart of WSL, as in https://github.com/microsoft/WSL/issues/4377#issuecomment-518221786? – VonC Apr 23 '20 at 19:10
  • @corjstout Or re-mounting the C disk: https://github.com/microsoft/WSL/issues/4377#issuecomment-614897019 – VonC Apr 23 '20 at 19:11
  • `wsl.exe --shutdown`: Invalid command line option: --shutdown. The only options are -d, -e, -u, --help. I have restarted my computer though. I also tried remounting the C disk. Nothing has changed though, uname is still not working. – corjstout Apr 23 '20 at 20:35
  • @corjstout Strange. Hopefully it will work better with WSL2 and Windows 10 20H1 which should be released next month. – VonC Apr 23 '20 at 20:49
1

The problem is due to the git could not find binaries in /usr/lib/git-core/ in WSL Ubuntu. And it is fixed in WSL2 with Windows 10 version 2004 (OS Build 19041.208) or later.

Qi Luo
  • 841
  • 10
  • 15
  • Thanks for the heads up. Unfortunately I don't have a version of Windows 10 recent enough to run WSL2, but I'll try it out as soon as I can. – corjstout May 04 '20 at 21:22