Vscode not starting/opening

Vscode is not opening whenever I click on vscode icon nothing happens.

running code . --verbose gives below output.

ERROR: ld.so: object ‘/usr/local/lib/AppProtection/libAppProtection.so’ from /etc/ld.so.preload cannot be preloaded (failed to map segment from shared object): ignored. /snap/code/92/usr/share/code/chrome_crashpad_handler: /snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.26’ not found (required by /lib/x86_64-linux-gnu/libX11.so.6)

below is the snap info

snap info --verbose code

name: code summary: Code editing. Redefined. health: status: unknown message: health has not been set publisher: Visual Studio Code (vscode✓) store-url: https://snapcraft.io/code contact: https://twitter.com/code license: unset description: | Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. commands:

  • code
  • code.url-handler notes:
    private: false confinement: classic devmode: false jailmode: false trymode: false enabled: true broken: false ignore-validation: false snap-id: Ht0aUHi7ofh9Fbwh6m7jUN2pAy6kzBiu tracking: latest/stable refresh-date: today at 13:30 IST channels: latest/stable: e18005f0 2022-03-30 (92) 229MB classic latest/candidate: ↑
    latest/beta: ↑
    latest/edge: ↑
    installed: e18005f0 (92) 229MB classic

I tried reinstalling snap but its not working. Please help me out.

what is this ? does your distro add some LD_PRELOAD hack here or did you add it yourself to the system ?

also, it really helps to paste the full output of snap version in such posts

I’m not sure what it is as I didn’t add that. The distro is Ubuntu 20.04

snap version

snap    2.54.4
snapd   2.54.4
series  16
ubuntu  20.04
kernel  5.13.0-39-generic

well, this is definitely not anything ubuntu would ever ship and the /usr/local/lib/ path indicates it is something you compiled or installed locally (no official package in ubuntu or debian ever puts anything into /usr/local), something modified your system here …

I have cuda installed (for the past 1 year) and for that I need to add the below command in .bashrc. But This command is there from last 1 year. I didn’t face any issue till today.

export PATH=/usr/local/cuda-11.1/bin:$HOME/.local/bin${PATH:+:${PATH}}

i wouldn’t expect cuda to put stuff anywhere else than /usr/local/cuda-11.1, but then i’m not a CUDA expert … the above really looks like something non-cuda related … ld_preload usually means single functions from essential system libs (i.e. glibc) get overridden with a hacked up version of the same function …

Okay. So any steps to follow or to unset this? Because I tried uninstalling and installing. Did a Timeshift restore even that didn’t work I hoped it would work because it was working fine yesterday. I need to use vscode for my coding and work…

well, i have no idea where it comes from or what it is, but if something mangled your system like this it is very likely other things (paths, library search paths etc etc) might have been mangled as well …

Does running unset LD_PRELOAD; code work?

no its not working…

From the latest error, this preload is coming from /etc/ld.so.preload not LD_PRELOAD. What put that there?

ls -lrt /etc/ld.so.preload
-rw-r--r-- 1 root root 49 Apr 23  2021 /etc/ld.so.preload

the content inside this file is just a single line

/usr/local/lib/AppProtection/libAppProtection.so

I didn’t put anything there atleast not yesterday

also I have lot of different application installed from snap those are working fine(like vlc, slack,)

Ack. I doubt the problem is from the preload failing. I think the real problem is the glibc failure

yeah, looks like that file has been modified a year ago already … still very suspicious that you do not know about it (and this is a serious security breach if you did not modify the file yourself)

anyway to fix that? is it because of the version? GLIBC_2.26

strings /snap/core/current/usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX  
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_DEBUG_MESSAGE_LENGTH

I think I did that for some reason because some application was not working.

i just installed VSCode on my 20.04 box here for a test and it runs fine … i wonder if anything modified your LD_LIBRARY_PATH so the snap does not find the libc from the core(16) snap anymore (classic snaps are very fragile if it comes to mixing libs like that)

ogra@acheron:~$ find /snap/code/current/ -name '*libX11.so*'
/snap/code/current/usr/lib/x86_64-linux-gnu/libX11.so.6
/snap/code/current/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0

your screenshot shows that it tries to load libX11 from outside the snap instead of the shipped one …

The LD_LIBRARY_PATH isn’t set to anything…

Please provide the output for

  • dpkg -S /usr/local/lib/AppProtection/libAppProtection.so
  • ldd /usr/local/lib/AppProtection/libAppProtection.so
$ dpkg -S /usr/local/lib/AppProtection/libAppProtection.so                                                                                                                
dpkg-query: no path found matching pattern /usr/local/lib/AppProtection/libAppProtection.so
linux-vdso.so.1 (0x00007ffc6e99e000)
/usr/local/lib/AppProtection/libAppProtection.so (0x00007f2fc42d1000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2fc428d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2fc4287000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2fc4095000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f2fc3f56000)
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f2fc3f2c000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f2fc3d48000)
libXi.so.6 => /lib/x86_64-linux-gnu/libXi.so.6 (0x00007f2fc3d36000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2fc471d000)
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f2fc3d30000)
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f2fc3d28000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2fc3bd9000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f2fc3bbe000)
libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007f2fc3ba7000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f2fc3b8d000)