-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault on any global tool installed #3464
Comments
How snap works: https://github.com/canonical-docs/snappy-docs/blob/master/snaps/philosophy.md Snap creates wrapper script that set environment variables, and then launch the actual application binaries. These wrappers are missing for global tools, the environment variables are not set, and it is what makes it crash. What do other global tools (like Node global tools) do to make this work? |
Do't know about nodejs. The question is: how we can automate it while installing a snap. Or another way it is to change the global tool shim to look into variable |
The netcoredeps is an optional directory that people can create and place dependencies into it. Shared library loader looks into this directory before looking into other regular system locations of shared libraries. I have reproed the issue locally and the problem is caused by the way the snap patches the
That would be correct if the dotnetsay was located in I am not familiar with how snap patches the |
The workaround for this issue is to patch the
|
Maybe @leecow can help here? I see that it is him who created |
@janvorli And yeah, You are right. |
I hadn't done any investigation around this issue. The snapcraft team is very responsive so working with them through github should be fine. If needed, I can shoot a note to the snapcraft dev lead separately. |
Found this issue by reading through core-setup for all issues containing "snap". I have Ubuntu 19.04, which has migrated to using snap for parts of the system. I decided to try out the dotnet snaps. After installing the dotnet-sdk-2.2, I am able to auto-generate a simple Console app and run it. But when I auto-generate a GtkSharp basic app, I can build it, but trying to run it produces:
Long story short, I contacted the GtkSharp people, they replied "Snap and flatpak are not supported in any shape or form, install dotnet sdk in a traditional manner and it will work fine." That is true; in a VM, I have another instance of Ubuntu 19.04, and I installed dotnet using the Microsoft packages; GtkSharp works fine from those. |
We appear to be hitting this issue for any framework-dependent apphost (not just global tools), which is produced by default for 3.0 builds when using a snap-installed .NET Core SDK. See dotnet/cli#12269. |
So we need either bump the thread that I created or help them implement it in the snap by ourselves. My idea was to introduce an option in the snap that will allow ELF patch with an absolute path to the binaries. |
[Triage] Closing Snap issues to reflect current priorities. |
@NikolaMilosavljevic I see that you have closed all Snap issues as won't fix. Does it mean that we are no longer trying to support Snap? |
@hmvs commented on Wed Feb 13 2019
I have an issue with global tools, all of them failing with segfault. I've tried
dotnetsay
,dmd5
,Amazon.Lambda.Tools
cat /var/log/syslog
Feb 14 00:35:19 SPHERALPU kernel: [ 1711.376672] dotnetsay[6594]: segfault at 0 ip 0000000000000000 sp 00007ffef5bc26a8 error 14 in dotnetsay[3ff000+1000
Crash dump:
https://file.io/PlgY5w
Is there anything else I need to provide to understand what is the issue?
I've installed .net core 2.2 sdk from the snap package.
dotnet --info
dotnet tool list -g
dotnet run
works file for the simple console appSteps to reproduce:
Just tested on freshly started cloud instance:
Segmentation fault (core dumped)
@livarcocc commented on Wed Feb 13 2019
Have you tried running a regularly acquire application and seeing that works for you?
This seems more like an indicative of something native dependency missing in your box than an issue with global tools.
@livarcocc commented on Wed Feb 13 2019
@jkotas as someone who can identify the missing native dependency.
@jkotas commented on Wed Feb 13 2019
This link is 404 Page Not Found for me.
Could you please run the command under strace? The strace log usually gives enough hints of what went wrong.
@hmvs commented on Thu Feb 14 2019
@jkotas
Here is the dump:
core.zip
strace dotnetsay
@hmvs commented on Thu Feb 14 2019
@livarcocc
Pretty sure that something missing on my box. But as far as I understand the concept of the snap, every dependency should be packed and placed inside it. Correct me if am I wrong.
@jkotas commented on Thu Feb 14 2019
I think the problem is with mismatched binaries under
/home/hmvs/.dotnet/tools/netcoredeps
. Could you please delete this directory and see whether it will fix the problem?I do not see
.dotnet/tools/netcoredeps
directory on my machine. We need to find out how it go there. @livarcocc Does the global tools installation ever create.dotnet/tools/netcoredeps
?@wli3 commented on Thu Feb 14 2019
No, it should not create a folder called netcoredeps. It might be a tool called netcoredeps? One of the early preview does put assets under /tools. Today, all assets are under /tools/.store. Only shims are directly under /tools.
@jkotas commented on Thu Feb 14 2019
Actually, I have misread the log. There are no files under
/home/hmvs/.dotnet/tools/netcoredeps
- all attempts to access them fail withENOENT
.@hmvs commented on Thu Feb 14 2019
And under the
/home/hmvs/.dotnet/tools
I have@hmvs commented on Thu Feb 14 2019
All the
dlls
stored there/home/hmvs/.dotnet/tools/.store/dmd5/0.0.1/dmd5/0.0.1/tools/netcoreapp2.1/any
which is looks a bit strange
@wli3 commented on Thu Feb 14 2019
This is expected layout. That folder is implementation detail. The layout is to separate different tools.
There is no /home/hmvs/.dotnet/tools/.store/dotnetsay folder?
@wli3 commented on Thu Feb 14 2019
And I note you are using snap. Maybe something to do with it? I hear it is using container to separate apps, maybe you need to also run
dotnetsay
in the same container?@hmvs commented on Thu Feb 14 2019
the is
@hmvs commented on Thu Feb 14 2019
Not sure how to do it. I installed dotnet via snap. But I am using it just as usual dotnet installation.
Like
dotnet run
and this is it.@jkotas commented on Thu Feb 14 2019
@hmvs Could you please open the core dump in the debugger on your system and get a stacktrace of the crash?
@hmvs commented on Thu Feb 14 2019
let me try :)
@hmvs commented on Thu Feb 14 2019
Here we are
@jkotas commented on Thu Feb 14 2019
This is crashing deep in the Linux system libraries. It is looks like a bad interaction with "snap".
@hmvs commented on Thu Feb 14 2019
Sooo, what is our next steps? 😳
@jkotas commented on Thu Feb 14 2019
@hmvs commented on Thu Feb 14 2019
@jkotas
Just tested on freshly started cloud instance:
Segmentation fault (core dumped)
@hmvs commented on Thu Feb 14 2019
@jkotas Do you know anyone whom we can add here ? :)
@jkotas commented on Thu Feb 14 2019
cc @janvorli @sergiy-k
@hmvs commented on Thu Feb 14 2019
I believe it is something related with dotnet uses some
libc
or another system lib instead one that comes with snap.https://github.com/dotnet/core/blob/master/Documentation/self-contained-linux-apps.md
I've played around with LD_LIBRARY_PATH and I got more user friendly error.
Apparently this one (from strace) is wrong: /home/hmvs/.dotnet/tools/../../../usr/lib/x86_64-linux-gnu/tls/x86_64
I've tried to set DOTNET_ROOT variable to help dotnet to find path to correct libraries but it ignores this env variable.
@jkotas commented on Thu Feb 14 2019
And what this path should be instead? This path is computed by the Linux system libraries (like
ld
).This crash is happening very early, before any of the .NET Core code had a chance to actually run (there is no .NET Core on the stack). So it won't recognize any
DOTNET_XXX
environment variables.@hmvs commented on Thu Feb 14 2019
If I do something like this:
export LD_LIBRARY_PATH=/snap/dotnet-sdk/current/lib/x86_64-linux-gnu
I will get such behavior.
So apparently I need to hint somehow global-tools shim (don't know if this term is correct) where the all native libraries are placed. And I believe it is crashed because it loads those libraries from system instead of snap package folder.
@hmvs commented on Thu Feb 14 2019
Not sure. But might be related https://github.com/dotnet/cli/issues/9114
@livarcocc commented on Thu Feb 14 2019
@hmvs It seems setting the LD_LIBRARY_PATH has fixed the crash you are seeing. For the libhostfxr issue, yes, you need to set DOTNET_ROOT.
@hmvs commented on Thu Feb 14 2019
@livarcocc it didn't help. But I will try today evening.
Though, LD_LIBRARY_PATH it's not a solution, right?
@hmvs commented on Fri Feb 15 2019
Yup. This one works.
LD_LIBRARY_PATH=/snap/dotnet-sdk/current/lib/x86_64-linux-gnu DOTNET_ROOT=/snap/dotnet-sdk/current dotnetsay
But I can't leave
LD_LIBRARY_PATH
set to this directory, because all other software crashing.So it only confirms my assumptions: that global-tools shim probing wrong path with standard linux libraries. We need to find a way how to make an installation with snap to find current path with dotnet.
libdl.so.2
,libpthread.so.0
,libstdc++.so.6
,libm.so.6
,libgcc_s.so.1
,libc.so.6
should be loaded from/snap/dotnet-sdk/current/lib/x86_64-linux-gnu
instead of/lib/x86_64-linux-gnu/
Whom can I contact? Who are those brave guys who made
snap
package and global tools shim?@wli3 commented on Fri Feb 15 2019
seems it is a problem with shim (app host). Moving to core-setup
The text was updated successfully, but these errors were encountered: