PowerShell / PowerShell-Snap

MIT License
30 stars 16 forks source link

Snap Powershell 7 fails to load on openSUSE Tumbleweed with undefined symbol #60

Closed byroniac closed 4 years ago

byroniac commented 4 years ago

Steps to reproduce

pwsh

Expected behavior

Loads PowerShell system and displays prompt.

Actual behavior

Failed to load ��e, error: /snap/powershell/104/opt/powershell/../../lib/x86_64-linux-gnu/librt.so.1: undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
Failed to bind to CoreCLR at '/snap/powershell/104/opt/powershell/'
Failed to create CoreCLR, HRESULT: 0x80008088

Environment data

Cannot retrieve because PowerShell does not even load in snap form.

uname -a Linux ost 5.5.7-1-default PowerShell/PowerShell#1 SMP Sun Mar 1 19:28:06 UTC 2020 (1004bce) x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a LSB Version: n/a Distributor ID: openSUSE Description: openSUSE Tumbleweed Release: 20200311 Codename: n/a

I am a lot more familiar and comfortable with Ubuntu 19.10 but decided to try openSUSE Tumbleweed and I installed the Snap system as per instructions at https://snapcraft.io/docs/installing-snap-on-opensuse then I did the "sudo snap install powershell --classic" command like I am used to doing in Ubuntu. Then I run "pwsh" from /snap/bin and get the error. However, the .tar.gz package works fine, for what it's worth. I did something very similar to the instructions here: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7#installation---opensuse-leap-15 except I installed everything to my user home folder.

iSazonov commented 4 years ago

except I installed everything to my user home folder.

Could you please follow the install steps from the docs and report a result?

byroniac commented 4 years ago

except I installed everything to my user home folder.

Could you please follow the install steps from the docs and report a result?

The docs instructions work great, almost flawlessly. I am on Tumbleweed so there is no libicu60_2 as there is in Leap 15.0 apparently. I already have libicu-sus65_1 installed (as detailed below). The only other thing I had to do was preface each command with "sudo". I just wish that the Snap version worked on Tumbleweed so I could update it more easily (but as infrequent as updates are, this is not really a problem). No complaints here, so thanks.

zypper info libicu-suse65_1 Loading repository data... Reading installed packages...

Information for package libicu-suse65_1:

Repository : Main Repository (OSS)
Name : libicu-suse65_1
Version : 65.1-4.1
Arch : x86_64
Vendor : openSUSE
Installed Size : 5.2 MiB
Installed : Yes (automatically)
Status : up-to-date
Source package : icu-65.1-4.1.src
Summary : International Components for Unicode Description :
ICU is a set of C and C++ libraries that provide extensive Unicode and locale support. This package contains the runtime libraries for ICU.

iSazonov commented 4 years ago

/cc @TravisEz13 for information.

TravisEz13 commented 4 years ago

Transferred to the snap repo because PowerShell works fine.

TravisEz13 commented 4 years ago

If I fix this, I'm going to break more platforms than I fix.

Let me see if I can get a .NET dev to look at it and see if we can come up with a plan...

byroniac commented 4 years ago

Transferred to the snap repo because PowerShell works fine.

Oops. I do not know where that is, or I would have posted it there. Thank you. It is ironic to me, because Tumbleweed is such a moving target that this is why I tried Snap first. I am not knowledgeable about openSUSE internals, but I fear as soon as a fix could be implemented, it will be broken on Tumbleweed not long after for any number of reasons. So it is surprising to me that the .tar.gz installation works better here, as I thought Snaps were more insulated and modular? (I admit, I know little about Snap internals either).

TravisEz13 commented 4 years ago

We are a classic snap.... unfortunately, this means we can see into the system and our dependencies can load stuff from the system. To workaround this, we have included things that should not be in the snap. Which leads to issues like this.

Not know all the native dependency relationships on Linux, puts me at a disadvantage. The test matrix is also large and not automated. Snap won't run in docker.

Flatpak's are more isolated, but it comes with the disadvantage of losing features. Get-process... only shows you processes from the flatpak, but depending on your use case it might work for you.
I'd be curious if it solves your problem.

This is 6.2.4: https://github.com/TravisEz13/PowerShell-flatpak/releases

I'm happy to rebuild it with 7.0.0 if it works for you.

FYI, it's currently a personal project.

byroniac commented 4 years ago

That ran perfectly. I installed and ran it with "flatpak run com.microsoft.powershell". I am perfectly happy with the .tar.gz installation but I am curious if there would be any difficulty building a 7.0.0 flatpak version? I would be happy to test it on Tumbleweed.

sidewinder040 commented 4 years ago

Also had similar error on Ubuntu 20.04 Focal-Fossa After an upgrade on 14/03/20, where GCC and LibC were upgrade, I get the following error...

$ pwsh
Failed to load �&p, error: /snap/powershell/104/opt/powershell/../../lib/x86_64-linux-gnu/librt.so.1: undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
Failed to bind to CoreCLR at '/snap/powershell/104/opt/powershell/'
Failed to create CoreCLR, HRESULT: 0x80008088

On anther machine, I held back all libc (libc-bin) packages, then upgraded and the powershell snap ran ok.

Uninstalling the snap and trying a edge or candidate channel also causes the error.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu Focal Fossa (development branch)
Release: 20.04
Codename: focal
byroniac commented 4 years ago

@sidewinder040

Also had similar error on Ubuntu 20.04 Focal-Fossa

I would think that having a problem with Ubuntu 20.04 is more important than me having a problem with Tumbleweed because 20.04 will be an LTS release. Even though I am enjoying Tumbleweed, I have loved Ubuntu Linux for a long time, and plan on putting 20.04 on a spare drive.

On anther machine, I held back all libc (libc-bin) packages, then upgraded and the powershell snap ran ok.

What do you mean? After upgrading (from 19.10? or what?) you have never upgraded the libc packages on 20.04? Just curious. I have not tried the Snap on Ubuntu 19.10 but I am guessing it works. I have 19.10 on a spare drive already which I plan to wipe and do a clean install with 20.04 when it is released.

krvdv commented 4 years ago

I have the same issue with the package at this time. Linux stoffel 5.5.9-arch1-2 #1 SMP PREEMPT Thu, 12 Mar 2020 23:01:33 +0000 x86_64 GNU/Linux

TravisEz13 commented 4 years ago

We are looking for a solution.

@byroniac I'll rebuild the flatpak with 7.0.0

TravisEz13 commented 4 years ago

Currently, powershell is a classic snap with full access the the host. The easiest way I think to fix the issues you are seeing is to make it a strict snap. If this will work for you, all depends on what you are doing.

Whatever you are doing must be supported through one of these interfaces: https://snapcraft.io/docs/supported-interfaces

TravisEz13 commented 4 years ago

@byroniac A 7.0.0 flatpak was published (I have not tested it.)

byroniac commented 4 years ago

@byroniac A 7.0.0 flatpak was published (I have not tested it.)

Works great. Thanks! But really, I am a newbie to PowerShell in general and so I am not really using it for anything on Linux yet. I am still trying to learn it on the Windows 10 side of things, especially for administration. Is AppImage a possibility? I think you said that Snap could not run as a Docker container, but how about under an Ubuntu container like Microsoft does with SQL Server (very impressive to me, by the way).

TravisEz13 commented 4 years ago

AppImage was more problematic that either of these TBH.

TravisEz13 commented 4 years ago

@byroniac The real question is what are you trying to do? The flatpak will let you SSH remote out to another PowerShell and manage most files. The flatpak will not let you manage processes.

Snap has a similar mode to how the flatpak runs. In theory, I could allow you to manage processes, and some files, but in the snap space.. many of these permission are managed by canonical. I've already emailed them and proposed the idea.

byroniac commented 4 years ago

The real question is what are you trying to do? The flatpak will let you SSH remote out to another PowerShell and manage most files. The flatpak will not let you manage processes.

I guess that question is best answered by others. I would be interested in the administrative aspects, though, like Get-Process and the like. PowerShell on Linux loses a great deal of power and flexibility I am guessing if it becomes more strictly confined. I like your idea, and I hope Canonical responds favorably. Thank you for all the help.

sidewinder040 commented 4 years ago

On anther machine, I held back all libc (libc-bin) packages, then upgraded and the powershell snap ran ok.

To clarify - On a Dell Latitude; I performed my daily apt update/upgrade of my Ubuntu 20.04 on Saturday morning and saw that GCC-10 and Libc-bin-2.31 were a part of the upgrade. After upgrading these, I had the error from PowerShell. Looking up the librt.so reference led me to suspect LibC. As I was using ZFS, i rolled back my system and held back the following packages:

apt-mark showheld
libc-bin
libc-dev-bin
libc6
libc6-dbg
libc6-dev
libcc1-0 

I then re-ran apt update/upgrade and the powershell snap was then running OK. I also reported this issue on the Ubuntu Forum - link: https://ubuntuforums.org/showthread.php?t=2438622 Let me know if I can help by giving any other info.

opoverlord commented 4 years ago

I'm having same issue on 20.04. Interestingly, powershell-preview 7.0.0-rc.3 works fine.

TravisEz13 commented 4 years ago

@opoverlord Yes, we made 16.04 work between those two releases...

TravisEz13 commented 4 years ago

@opoverlord Until canonical can give us a better solution, I recommend using the flatpak or the tar.gz

the-mentor commented 4 years ago

Hi @TravisEz13 Tyler sent me here. I'm seeing this issue on Ubuntu 20.04 alpha.

Let me know if there is anything you want me to check.

TravisEz13 commented 4 years ago

can you try

snap refresh powershell-preview --channel=edge/2020033122
TravisEz13 commented 4 years ago

We believe that https://github.com/PowerShell/PowerShell-Snap/pull/62 and #61 should fix this for all packages once we do another release.

byroniac commented 4 years ago

can you try

snap refresh powershell-preview --channel=edge/2020033122

I deleted my openSUSE Tumbleweed for another issue (slow BtrFS) and haven't yet reinstalled it, but this works great on Ubuntu 20.04 beta that I am running now.

TravisEz13 commented 4 years ago

Ok, I release this version of the powershell-preview snap, latest/stable should work now.

Can you test these two version and I'll release them?

snap refresh powershell --channel=edge/FixRelease
snap refresh powershell --channel=lts/edge/FixRelease
byroniac commented 4 years ago

I don't know what powershell-lts is: I don't have it installed and it's not available to install. I did do a "sudo snap refresh powershell --channel=edge/FixRelease" and it gives me a snap ID of JSNnoJl3EqkMuWoy5Dgq8PMqZ0uNcpie but it has the same error as before. However, the PowerShell 7.1.0-preview.1 snap runs fine.

TravisEz13 commented 4 years ago

sorry... I put the lts in the wrong place... I updated the instructions above.

byroniac commented 4 years ago

sorry... I put the lts in the wrong place... I updated the instructions above.

OK, the first one said no updates available, so I did the second one, still get the error, and tried the first one again, still says no updates available.

TravisEz13 commented 4 years ago

snap didn't patch the interpreter

patchelf --print-interpreter /snap/powershell/current/opt/powershell/pwsh

should be

/snap/core18/current/lib64/ld-linux-x86-64.so.2

but is

/lib64/ld-linux-x86-64.so.2

This causes mixed version of libraries to be loaded...

I'll have to follow-up with canonical...

MPW1412 commented 4 years ago
snap refresh powershell --channel=edge/FixRelease
snap refresh powershell --channel=lts/edge/FixRelease

Both still broken on Ubuntu 20.04:

$ sudo snap refresh powershell --channel=edge/FixRelease
powershell (edge/FixRelease) 7.0.0 von Microsoft PowerShell✓ aufgefrischt
$ pwsh 
Failed to load ��D, error: /snap/core18/current/lib/x86_64-linux-gnu/librt.so.1: undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
Failed to bind to CoreCLR at '/snap/powershell/119/opt/powershell/'
Failed to create CoreCLR, HRESULT: 0x80008088
$ sudo snap refresh powershell --channel=lts/edge/FixRelease
powershell (lts/edge/FixRelease) 7.0.0 von Microsoft PowerShell✓ aufgefrischt
$ pwsh
Failed to load ���, error: /snap/core18/current/lib/x86_64-linux-gnu/librt.so.1: undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
Failed to bind to CoreCLR at '/snap/powershell/120/opt/powershell/'
Failed to create CoreCLR, HRESULT: 0x80008088
Justinzobel commented 4 years ago

Confirmed issue on Ubuntu 20.04 and Solus 4.1

TravisEz13 commented 4 years ago

@Justinzobel Can you verify that this is issue #65 ?

Justinzobel commented 4 years ago

@TravisEz13 you want me to try powershell-preview as discussed in #65?

Justinzobel commented 4 years ago

powershell-preview 7.1.0-preview.2 from Microsoft PowerShell✓ installed /snap/bin/pwsh-preview works

Justinzobel commented 4 years ago

Sadly I tried to connect to Exchange Online using: $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

I get the error: Failed to create iconv, 22

TravisEz13 commented 4 years ago

connecting to exchange will not work from a snap. they need to move to SSH based remoting (and we need to add feature for them.) Unfortunately, I cannot make the library needed for this work in a snap. I haven't tested on Ubuntu 20.04, but I doubt it works there (without hacking up the system). The library causes mixed versions of libc to be loaded which will cause a segfault.

TravisEz13 commented 4 years ago

I've updated the readme with these know issues: https://github.com/PowerShell/PowerShell-Snap/blob/master/README.md

Justinzobel commented 4 years ago

connecting to exchange will not work from a snap. they need to move to SSH based remoting (and we need to add feature for them.) Unfortunately, I cannot make the library needed for this work in a snap. I haven't tested on Ubuntu 20.04, but I doubt it works there (without hacking up the system). The library causes mixed versions of libc to be loaded which will cause a segfault.

Bugger. I was hoping to be able to manage Exchange Online from Linux. Windows 10 VM it is.

TravisEz13 commented 4 years ago

Ubuntu 18.04 works, if you use the deb package and follow the setup instructions. You can use a docker container or multipass provides an easy way to create Ubuntu VMs.

the-mentor commented 4 years ago

@Justinzobel you can also try our the linux tar.gz file as long as you have all the dependencies it should work.

https://github.com/PowerShell/PowerShell/releases/download/v7.0.0/powershell-7.0.0-linux-x64-fxdependent.tar.gz

TravisEz13 commented 4 years ago

The tar.gz requires additional setup... fxdependent... also, will probably have the same problem as snap. And it requires the DotNet SDK to run.

Here is the code to create the symbolic links that the remoting library requires 🤦 : https://github.com/PowerShell/PowerShell/blob/master/tools/packaging/packaging.psm1#L1348-L1382

This is the code that create the dependencies in the deb: https://github.com/PowerShell/PowerShell/blob/master/tools/packaging/packaging.psm1#L1246-L1261

kpms-thomas-schmitz commented 4 years ago

If anyone is still having problems, https://github.com/PowerShell/PowerShell/releases/download/v7.0.0/powershell-lts_7.0.0-1.debian.11_amd64.deb works well on Ubuntu 20.04. Just download it and do a manual installation: sudo dpkg -i powershell-lts_7.0.0-1.debian.11_amd64.deb

TravisEz13 commented 4 years ago

@Justinzobel https://github.com/PowerShell/PowerShell-Snap/issues/60#issuecomment-624128935 this makes it HIGHLY likely that remoting to exchange won't work on Ubuntu 20.04

TravisEz13 commented 4 years ago

Dupe of #65. If you have new problem, please open a new issue.