Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. I recently ran into an issue of MongoDB shell commands not working.
  2. The error message was:
  3.  
  4. ```
  5. Invariant failure !driverName.empty() && !driverVersion.empty() && !osType.empty() && !osName.empty() && !osArchitecture.empty() && !osVersion.empty() src/mongo/rpc/metadata/client_metadata.cpp
  6. ```
  7.  
  8. I ran an `strace` on the `mongo` command and saw it was trying (and failing) to open the following files:
  9.  
  10. ```
  11. stat("/etc/lsb-release", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  12. stat("/etc/system-release", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  13. stat("/etc/redhat-release", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  14. stat("/etc/gentoo-release", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  15. stat("/etc/novell-release", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  16. stat("/etc/gentoo-release", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  17. stat("/etc/SuSE-release", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  18. stat("/etc/SUSE-release", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  19. stat("/etc/sles-release", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  20. stat("/etc/debian_release", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  21. stat("/etc/slackware-version", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  22. stat("/etc/centos-release", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  23. stat("/etc/os-release", 0x7fff38e42a80) = -1 ENOENT (No such file or directory)
  24. ```
  25.  
  26. # SOLUTION
  27.  
  28. I solved this by simply creating a string in the `/etc/system-release` file:
  29.  
  30. ```
  31. echo "My OS version 1.2.3" > /etc/system-release
  32. ```
  33.  
  34. Hopefully this helps someone else having the same issue.
  35.  
  36. **strace** is your friend.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement