Error "while loading shared libraries" with BloodHound snap

I’m trying to build a snap for BloodHound (the single page Javascript web application part). Here is the current snapcraft.yaml:

name: bloodhound                                                                                                                                                          
version: 1.5.2                                                                                                                                                            
summary: Six Degrees of Domain Admin                                                                                                                                      
description: |                                                                                                                                                            
    $ bloodhound                                                                                                                                                          
                                                                                                                                                                          
grade: devel                                                                                                                                                              
confinement: strict                                                                                                                                                       
                                                                                                                                                                          
apps:                                                                                                                                                                     
  bloodhound-app:                                                                                                                                                         
    command: desktop-launch $SNAP/BloodHound-linux-x64/BloodHound                                                                                                         
    plugs: [network, home]       
                                                                                                                                     
parts:                                                                                                                                                                    
  bloodhound-app:                                                                                                                                                         
    plugin: nodejs                                                                                                                                                        
    source: .                                                                                                                                                             
    node-packages:                                                                                                                                                        
        - electron-packager                                                                                                                                               
    npm-run:                                                                                                                                                              
        - linuxbuild                                                                                                                                                      
    node-engine: 8.11.1                                                                                                                                                   
    stage-packages:                                                                                                                                                       
        - libx11-6                                                                                                                                                        
        - libxau6                                                                                                                                                         
        - libxext6                                                                                                                                                        
        - libxcb1                                                                                                                                                         
        - libxtst6                                                                                                                                                        
        - libxss1                                                                                                                                                         
    #    - libgtk2.0-0                                                                                                                                                    
    organize:                                                                                                                                                             
        lib/node_modules/bloodhound/BloodHound-linux-x64: BloodHound-linux-x64                                                                                            
    stage:                                                                                                                                                                
        - BloodHound-linux-x64                                                                                                                                            
    prime:                                                                                                                                                                
        - BloodHound-linux-x64                                                                                                                                            
        - -BloodHound-linux-x64/cli.js                                                                                                                                    
        - -BloodHound-linux-x64/npm-cli.js                                                                                                                                
        - -BloodHound-linux-x64/npx-cli.js                                                                                                                                
    after: [desktop-gtk2] 

The build goes OK, but when I install the snap and try to launch it, I get this error:

$ bloodhound.bloodhound-app 
/snap/bloodhound/x2/BloodHound-linux-x64/BloodHound: error while loading shared libraries: libXtst.so.6: cannot open shared object file: No such file or directory

The thing is that I also tried to build it with:

    after: [desktop-gtk3] 

And then the error was:

 $ bloodhound.bloodhound-app 
/snap/bloodhound/x1/BloodHound-linux-x64/BloodHound: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

And it both cases the application starts if I execute it directly:

$ /snap/bloodhound/x1/BloodHound-linux-x64/BloodHound

So I’m kind of lost…any ideas? Should I be using the gnome-3-26-16-04 part or something?

1 Like

nobody? I’m still stuck with this…Thanks!

You have to specify to stage the files installed via stage-packages as well:

    filesets:
      files-from-stage-packages-excluding-docs:
      - usr/*
      - -usr/share/doc/*
    stage:
    - $files-from-stage-packages-excluding-docs

Snapcraft by default stage nothing.

that’s not entirely accurate… Snapcraft will by default stage everything that you have “installed”. Installing means that you have created or copied files in $SNAPCRAFT_PART_INSTALL. Everything in $SNAPCRAFT_PART_INSTALL will be staged and subsequently primed unless removed by the stage or prime file sets.

This is your problem with being unable to find the libraries. This stage block is saying to remove everything except the BloodHound-linux-x64 file or directory. That means it will remove the usr/lib directory from this part when building your final snap.

Thanks for the correction, I assume this is the behavior when the stage keyword is omitted right? I mean does it still stage everything when stage keyword is used but not explicitly enumerating everything in the installtree?

  • The behaviour is to stage everything when the stage keyword is omitted.
  • When the stage keyword only includes negative entries then everything except those listed will be staged.
  • When at least one positive entry is listed everything is removed from the staging except the positive listed items.

stage everything except the file or directory called “negative”

stage:
- '-negative'

only stage the file or directory called “positive”

stage:
- positive
2 Likes

Wanted to try this, but now is not even compiling; it errors with:

npm ERR! peer dep missing: ajv@^6.0.0, required by ajv-keywords@3.2.0
Failed to run 'npm ls --global --json' for 'bloodhound-app': Exited with code 1.
Verify that the part is using the correct parameters and try again.

But even installing ajv in the node-packages property does not helps…

I’m having this same issue but with libX11.so.6. Running from the normal command-line (snap) doesn’t work but running directly does.

2 Likes