Skip to content

Lifecycle Management VSCode snap to core24 :: Java 21 applications crashing when run from inside VSCode #241636

In progress

Description

@globeone

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version:
  • OS Version:

Steps to Reproduce:

  1. Set up a Java project with the Java Plugins and Maven Plugins
  2. Run Java 21 code (see evidence below)
  3. mvn clean install the code
  4. mvn exec:java
  5. in the application click on the apply (save) button
  6. Application crashes with a __libc_pthread_init symbol lookup error indicating that the Java 21 Virutal Machine is incompatible with the now ancient core20 Ubuntu snap that VSCode is confined to.
  7. Running the code directly from gnome terminal returns no errors on Ubuntu 24.04
  8. Most likely solution would be to repackage the VScode snaps to use core24 instead of the now outdated core20.

Image

Environment

  • VS Code: [1.97.2] (snap installation)
  • VS Code Insider: [1.98.0-insider] (snap installation)
  • Ubuntu: [24.04.2 LTS]
  • Java: [version]
    • openjdk version "21.0.6" 2025-01-21
    • OpenJDK Runtime Environment (build 21.0.6+7-Ubuntu-124.04.1)
    • OpenJDK 64-Bit Server VM (build 21.0.6+7-Ubuntu-124.04.1, mixed mode, sharing)
  • Maven: [version]
    • Apache Maven 3.8.7
    • Maven home: /usr/share/maven
    • Java version: 21.0.6, vendor: Ubuntu, runtime: /usr/lib/jvm/java-21-openjdk-amd64
    • Default locale: nl_NL, platform encoding: UTF-8
    • OS name: "linux", version: "6.8.0-53-generic", arch: "amd64", family: "unix"

Description

When running Maven commands in VS Code's integrated terminal on Ubuntu with snap installation, the terminal appears to inherit core20 snap's environment instead of the system environment, causing Java symbol lookup errors.

/usr/bin/java: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE

To Reproduce

  1. Install VS Code via snap
  2. Open a Java/Maven project
  3. Run mvn exec:java in VS Code's integrated terminal
  4. Observe error with symbol lookup for __libc_pthread_init

Expected Behavior

Terminal should use system libraries like when running in a regular Ubuntu terminal. Or should be using the newest core24 when running on Ubuntu.

Evidience:

Happens both on code and code-insiders

snap info code
name: code
summary: Code editing. Redefined.
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
    snap-id: Ht0aUHi7ofh9Fbwh6m7jUN2pAy6kzBiu
    tracking: latest/stable
    refresh-date: 9 days ago, at 23:08 CET
    channels:
    latest/stable: e54c774 2025-02-13 (184) 334MB classic
    latest/candidate: ↑
    latest/beta: ↑
    latest/edge: ↑
    installed: e54c774 (184) 334MB classic

snap info code-insiders
name: code-insiders
summary: Code editing. Redefined.
publisher: Visual Studio Code (vscode✓)
store-url: https://snapcraft.io/code-insiders
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-insiders
  • code-insiders.url-handler
    snap-id: vNVY8DiBL4e2Q8H3Xtsh71c8QSTaxBdp
    tracking: latest/stable
    refresh-date: today at 17:34 CET
    channels:
    latest/stable: 233d086 2025-02-21 (1889) 331MB classic
    latest/candidate: ↑
    latest/beta: ↑
    latest/edge: ↑
    installed: 233d086 (1889) 331MB classic
protected void save() {
    try {
        Enumeration<TreeNode> tree = rootNode.preorderEnumeration();
        tree.nextElement(); //skip root
        while (tree.hasMoreElements()) {
            DefaultMutableTreeNode child = (DefaultMutableTreeNode) tree.nextElement();
            TreeCard card = (TreeCard) child.getUserObject();
            try {
                card.nodePanel.save(); // This calls save() on each preference panel
            } catch (Exception e) {
                Logger.error("Preferences of '" + card.nodeName + "' could not be saved", e);
                JOptionPane.showMessageDialog(this, 
                    "Error saving preferences for " + card.nodeName + ": " + e.getMessage(),
                    "Save Error",
                    JOptionPane.ERROR_MESSAGE);
            }
        }
        Settings.save(); // This writes to the settings file
    } catch (Exception e) {
        Logger.error("Critical error during preferences save", e);
        JOptionPane.showMessageDialog(this,
            "A critical error occurred while saving preferences: " + e.getMessage(),
            "Critical Save Error",
            JOptionPane.ERROR_MESSAGE);
    }
}
public static void save() {
    if (props == null) return;
    Logger.info("Saving preferences");
    put("version", Controller.version);
    OutputStream os = null;
    try {
        os = new FileOutputStream(file);
        props.store(os, "jNetMap Settings");
    } catch (IOException e) {
        Logger.error("Failed to save preferences", e);
    } finally {
        try {
            os.close();
        } catch (Exception e) {
        }
    }
}

Activity

  1. globeone commented on Feb 23, 2025

    @globeone
    Author

    Image

    Proof that the same thing happens from Insiders which is also built in (ubuntu) core20 not core24.

  2. globeone commented on Feb 23, 2025

    @globeone
    Author

    Tried to work around the issue but VSCode is stubborn when launching from it's terminal even though snap confinement on VSCode snap version is --classic.

    launch.json
    settings.json

  3. globeone commented on Feb 23, 2025

    @globeone
    Author

    same code but directly from gnome-terminal, the preferences get saved and the application continues to work.

    Image

  4. globeone commented on Feb 23, 2025

    @globeone
    Author

    running the locally installed .deb version does allow me to work with the code without crashing but has lots of library conflicts while being installed

    So, also needs some Life-cycle Management as well.

    Image

    Image

    Image

  5. added
    bug
    freeze-slow-crash-leak
    linux
    snap
    on Feb 24, 2025
  6. moozoo64 commented on Mar 29, 2025

    @moozoo64

    Maybe this will help others.

    I had this problem

    34827:     /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: error: symbol lookup error: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE (fatal)
    
    ./OpenCLSolarSystem: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE

    I use

    LD_DEBUG=libs ./myprogram

    to locate the offending library
    And this fixed it for me

    LD_PRELOAD /usr/lib/x86_64-linux-gnu/libcanberra-gtk3.so.0 ./myprogram

    So in my debug launch I add

          "environment": [
            {
              "name": "LD_PRELOAD",
              "value": "/usr/lib/x86_64-linux-gnu/libcanberra-gtk3.so.0"
            }
          ],

    Note that running in a normal terminal didn't have this problem
    The linker is correctly linking
    and ldd myprogram won't show a problem.
    its one of the loading libraries linking to the snap version

    In my build task I use bash - l -c "cmake -G Ninja -B build ..."

    Regard Michael

  7. qwertychouskie commented on Nov 5, 2025

    @qwertychouskie

    Running into the same issue where the build-in terminal cannot launch various applications due to VSCode using the ancient core20 version of the core snap. What needs to be done to get VSCode to move to a supported core snap, such as core24?

  8. qwertychouskie commented on Nov 5, 2025

    @qwertychouskie

    It looks like the snapcraft.yaml is here: https://github.com/microsoft/vscode/blob/main/resources/linux/snap/snapcraft.yaml

    If someone familiar with the snap process adjusted this and made a PR, perhaps it would get merged, and new releases would actually use a modern core snap?

  9. dmitrivMS commented on Mar 1, 2026

    @dmitrivMS
    Collaborator

    QwertyChouskie (@qwertychouskie) Is core22 sufficient to fix this issue?

  10. qwertychouskie commented on Sep 16, 2026

    @qwertychouskie

    QwertyChouskie (@qwertychouskie) Is core22 sufficient to fix this issue?

    Is there any reason to not use core24 (or core26 at this point)?

    While I can't easily find a listed EOL policy for snap core runtimes, Ubuntu 20.04 (which the core20 runtime is presumably based on) has been EOL for a while now, and Ubuntu 22.04 is about half a year from EOL.

    Merging #298237 would certainly be a step in the right direction, but moving all the way to at least core24 would be best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugfreeze-slow-crash-leaklinuxsnap

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions