facebook / watchman

Watches files and records, or triggers actions, when they change.
https://facebook.github.io/watchman/
MIT License
12.57k stars 987 forks source link

Watchman error on Ubuntu 22.04 #1019

Closed livwvil closed 1 year ago

livwvil commented 2 years ago

Command watchman -v (and any other commands) fails after binaries installation (Linux installation guide) with error:

watchman: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory

I fixed this error with the solution of smmoosavi here but another error appears:

terminate called after throwing an instance of 'std::system_error'
terminate called recursively
Aborted (core dumped)

Any ideas how to fix it? I tried different version of binaries but the result is the same...

orta commented 2 years ago

It's a guess, but one of the big ubuntu 22 changes was an update to openssl 3.x (it require prisma changes for example) which might also be hitting watchman

heftig commented 2 years ago

Ubuntu 22.04 uses GCC 12.

Arch Linux also recently upgraded to GCC 12. With their new gcc-libs (including libstdc++) I get the latter error when watchman cannot find any one of its optional config files, because the exception handling does not work.

ericmaicon commented 2 years ago

I fixed that on my local with the following:

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb
sudo dpkg -i libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb

I found the issue at: https://askubuntu.com/questions/1403778/upgrading-to-ubuntu-22-04-causes-libcrypto-errors-apt-dpkg-broken

heftig commented 2 years ago

Such a solution was already linked in the issue text. It solves the libcrypto.so.1.1 problem but not the std::system_error one.

heftig commented 2 years ago

It seems the latter is caused by changes to libgcc which made unwinding use glibc's _dl_find_object when available, as reverting these changes makes watchman behave properly again.

diff --git c/libgcc/unwind-dw2-fde-dip.c i/libgcc/unwind-dw2-fde-dip.c
index 7f9be5e6b02..b8da2a51e9e 100644
--- c/libgcc/unwind-dw2-fde-dip.c
+++ i/libgcc/unwind-dw2-fde-dip.c
@@ -504,24 +504,6 @@ _Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases)
   if (ret != NULL)
     return ret;

-  /* Use DLFO_STRUCT_HAS_EH_DBASE as a proxy for the existence of a glibc-style
-     _dl_find_object function.  */
-#ifdef DLFO_STRUCT_HAS_EH_DBASE
-  {
-    struct dl_find_object dlfo;
-    if (_dl_find_object (pc, &dlfo) == 0 && dlfo.dlfo_eh_frame != NULL)
-      return find_fde_tail ((_Unwind_Ptr) pc, dlfo.dlfo_eh_frame,
-# if DLFO_STRUCT_HAS_EH_DBASE
-                           (_Unwind_Ptr) dlfo.dlfo_eh_dbase,
-# else
-                           0,
-# endif
-                           bases);
-    else
-      return NULL;
-    }
-#endif /* DLFO_STRUCT_HAS_EH_DBASE */
-
   data.pc = (_Unwind_Ptr) pc;
 #if NEED_DBASE_MEMBER
   data.dbase = NULL;
Xinkai commented 2 years ago

The std::system_error issue will go away if you go build from the source. https://github.com/Xinkai/watchman-gcc-12-PKGBUILDs

chadaustin commented 2 years ago

I believe one of the issues is a gcc bug introduced in 11.2: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104008

We have a workaround coming in Folly, and gcc 12 and gcc 11.3 should have the fix. The other issues I'll try to get time to look at later.

heftig commented 2 years ago

Are you sure you linked the right bug? That one is about a compilation error, not a runtime error.

chadaustin commented 2 years ago

Yeah, unless Ubuntu 22.04 recently fixed that gcc, I believe it also applies there. (And is also why Watchman did not compile on Fedora 34 or 35.)

chadaustin commented 2 years ago

I'm looking forward to when the generic/ubuntu2204 Vagrant box is ready so we can add it to our Vagrant-based build "CI".

From reading this thread, I don't have a clue yet either, but I'll try to find time to chime in soon.

heftig commented 2 years ago

Has your workaround been applied yet? 2022.06.06 is still affected by this bug.

> watchman --help
terminate called after throwing an instance of 'std::system_error'
terminate called recursively
[1]    1346249 IOT instruction (core dumped)  watchman --help
chadaustin commented 2 years ago

bento/ubuntu2204 Vagrant box is available. I've confirmed that Watchman builds and passes tests on Ubuntu 22. The issue appears to be that the precompiled binaries created on GitHub Actions don't run.

The libcrypto dependency causing issues on newer Ubuntu seems widespread:

https://github.com/hrkfdn/ncspot/issues/812 https://askubuntu.com/questions/1403778/upgrading-to-ubuntu-22-04-causes-libcrypto-errors-apt-dpkg-broken

In my VM I ran:

$ wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.1_1.1.0l-1~deb9u6_amd64.deb
$ sudo dpkg -i libssl1.1_1.1.0l-1~deb9u6_amd64.deb

And then reproduced the exception handling crash:

vagrant@watchman-ubuntu-22:~$ watchman --help
terminate called after throwing an instance of 'std::system_error'
terminate called recursively
Aborted (core dumped)

Sigh. This is awesome all around. I suppose one option is to ask you all to build and install from source locally (which works). Another would be to wait for the ubuntu-latest GitHub Actions image to use Ubuntu 22.

We could statically link OpenSSL but that's a bad idea too.

We don't have time to maintain a PPA, but that would be an obvious solution too.

Thanks for all of the investigation, folks, and let me know if you have better ideas.

cakiem8x commented 2 years ago

I also got this error on Manjaro: terminate called after throwing an instance of 'std::system_error' terminate called recursively [2] 22203 IOT instruction (core dumped) watchman And coc.vim: [coc.nvim]: terminate called after throwing an instance of 'std::system_error'

uzza1hossain commented 2 years ago

terminate called after throwing an instance of 'std::system_error' terminate called recursively [1] 95316 IOT instruction (core dumped) watchman

Is there any workaround?

jonesnc commented 2 years ago

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb sudo dpkg -i libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb

That URL now returns a 404.

aalvarado commented 2 years ago

homebrew could potentially provide openssl 1.1 by installing with the following command:

brew install openssl@1.1
$ file /home/linuxbrew/.linuxbrew/lib/libssl.so.1.1
/home/linuxbrew/.linuxbrew/lib/libssl.so.1.1: symbolic link to ../Cellar/openssl@1.1/1.1.1q/lib/libssl.so.1.1

$ file /home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1q/lib/libssl.so.1.1
/home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1q/lib/libssl.so.1.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=72444949866da3eff89300a4e40120f111b279ea, not stripped
jonesnc commented 2 years ago

@aalvarado Do you think something like this could be ported to apt commands?

aalvarado commented 2 years ago

@aalvarado Do you think something like this could be ported to apt commands?

marcos-venicius commented 2 years ago

That works for me on ubuntu 22.04.1

first of all, you need to remove all watchman files that you have installed manualy

Removing files

removing bin files

sudo rm -rf /usr/local/bin/{watchman,watchmanctl}

removing lib files

sudo rm -rf /usr/local/lib/{libevent-2.1.so.7,libgflags.so.2.2,libglog.so.0,libsnappy.so.1,libzstd.so.1}

Installing watchman again

just install by using apt

sudo apt install watchman

I hope I was helpfull

fsenart commented 2 years ago

@dev-one-company This is an old version from 2017-08-24.

> apt info watchman
...
Version: 4.9.0-6build2
bruno-fialho commented 2 years ago

Homebrew works for me.

First I did this from above:

Removing files removing bin files

sudo rm -rf /usr/local/bin/{watchman,watchmanctl}

removing lib files

sudo rm -rf /usr/local/lib/{libevent-2.1.so.7,libgflags.so.2.2,libglog.so.0,libsnappy.so.1,libzstd.so.1}

And then, installed Homebrew and run brew install watchman

And now:

> watchman --version 
2022.08.22.00
jeffryang24 commented 2 years ago

Ubuntu 22.04 uses GCC 12.

Arch Linux also recently upgraded to GCC 12. With their new gcc-libs (including libstdc++) I get the latter error when watchman cannot find any one of its optional config files, because the exception handling does not work.

@heftig btw, Ubuntu 22.04 is still using gcc-11, and I still got error even I already have libgcc-s1 for gcc-11.2.0, how can you make it work in arch aur?

Updated 2022-08-28

I have no idea why ubuntu 22.04 install libgcc-s1 for gcc-12-base while it is still using gcc11. :thinking:

Related: #1047

livwvil commented 2 years ago

Homebrew works for me.

First I did this from above:

Removing files removing bin files sudo rm -rf /usr/local/bin/{watchman,watchmanctl} removing lib files sudo rm -rf /usr/local/lib/{libevent-2.1.so.7,libgflags.so.2.2,libglog.so.0,libsnappy.so.1,libzstd.so.1}

And then, installed Homebrew and run brew install watchman

And now:

> watchman --version 
2022.08.22.00

This works for me, thanks!

jeffryang24 commented 1 year ago

Currently, I solved it by manually installing the missing libcrypto.so.1.1 lib from libssl1.1 package. You can find it from http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/ or https://packages.debian.org/stretch/libssl1.1. Mine was using http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb.

result

Reference: https://askubuntu.com/questions/1403778/upgrading-to-ubuntu-22-04-causes-libcrypto-errors-apt-dpkg-broken

chadaustin commented 1 year ago

The weekly release process for Watchman now generates Ubuntu 22.04 (and 20.04 and 18.04) debs.

See the new installation instructions at https://facebook.github.io/watchman/docs/install.html

I'm going to close this issue, but please file a new one if the Ubuntu 22 package does not work for you.

hertg commented 1 year ago

Arch Linux has recently upgraded from OpenSSL 1.1.1 to 3.0.7. After installing this update, I got the same error message.

If you are using the aur/watchman package, please do not manually install OpenSSL 1.1.1 or blindly replace any libcrypto files as this might cause unexpected issues and could be a security concern. You can simply rebuild the package from the AUR, so it gets linked to the new .so files.

If you are using paru as your AUR helper, this is pretty straight-forward.

paru --rebuild -S watchman

Similar options might exist for other AUR helpers.

kastermester commented 10 months ago

I'm going to close this issue, but please file a new one if the Ubuntu 22 package does not work for you.

The link you gave specifically says that the deb packages are insecure and outdated:

Warning: Do not install the Ubuntu-supplied Watchman package. It is old and missing security, bug, and performance fixes.