omi icon indicating copy to clipboard operation
omi copied to clipboard

Install-WSMan (Error Read-Only file System)

Open pcasalinho opened this issue 3 years ago • 2 comments

This probably doesn't have anything to do with the Module as I am a Linux noob.. but anyway, I find it strange....

> Install-WSMan -verbose
VERBOSE: Getting OpenSSL version for 'libssl', 'libssl.so', 'libssl.so.1.1', 'libssl.so.10', 'libssl.so.1.0.0', 'libssl.so.3'
VERBOSE: OpenSSL Version: Major 1 Minor 1 Patch 1
VERBOSE: Installing WSMan libs for 'glibc-1.1'
VERBOSE: Checking to see if libmi.so is installed
VERBOSE: Installing libmi.so to '/snap/powershell/160/opt/powershell'
VERBOSE: Creating backup of libmi.so to libmi.so.bak
Copy-Item: /root/.local/share/powershell/Modules/PSWSMan/2.2.0/PSWSMan.psm1:788
Line |
 788 |  …             Copy-Item -LiteralPath $destPath -Destination "$($destPat …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Read-only file system

Copy-Item: /root/.local/share/powershell/Modules/PSWSMan/2.2.0/PSWSMan.psm1:791
Line |
 791 |              Copy-Item -LiteralPath $_.Fullname -Destination $destPath
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Read-only file system

VERBOSE: Checking to see if libpsrpclient.so is installed
VERBOSE: Installing libpsrpclient.so to '/snap/powershell/160/opt/powershell'
VERBOSE: Creating backup of libpsrpclient.so to libpsrpclient.so.bak
Copy-Item: /root/.local/share/powershell/Modules/PSWSMan/2.2.0/PSWSMan.psm1:788
Line |
 788 |  …             Copy-Item -LiteralPath $destPath -Destination "$($destPat …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Read-only file system

Copy-Item: /root/.local/share/powershell/Modules/PSWSMan/2.2.0/PSWSMan.psm1:791
Line |
 791 |              Copy-Item -LiteralPath $_.Fullname -Destination $destPath
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Read-only file system

VERBOSE: Removing existing symlink '/snap/powershell/160/opt/powershell/libcrypto.so.1.0.0'
Remove-Item: /root/.local/share/powershell/Modules/PSWSMan/2.2.0/PSWSMan.psm1:801
Line |
 801 |              $_ | Remove-Item -Force
     |                   ~~~~~~~~~~~~~~~~~~
     | Read-only file system

VERBOSE: Removing existing symlink '/snap/powershell/160/opt/powershell/libssl.so.1.0.0'
Remove-Item: /root/.local/share/powershell/Modules/PSWSMan/2.2.0/PSWSMan.psm1:801
Line |
 801 |              $_ | Remove-Item -Force
     |                   ~~~~~~~~~~~~~~~~~~
     | Read-only file system

WARNING: WSMan libs have been installed, please restart your PowerShell session to enable it in PowerShell
PS /home/pcasalinho> Get-WSManVersion
Get-WSManVersion: Custom libmi has not been installed, have you restarted PowerShell after installing it?
Get-WSManVersion: Custom libpsrpclient has not been installed, have you restarted PowerShell after installing it?

MI PSRP
-- ----
OS / ENVIRONMENT
> cat /etc/os-release
NAME="Ubuntu"
VERSION="20.10 (Groovy Gorilla)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.10"
VERSION_ID="20.10"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=groovy
UBUNTU_CODENAME=groovy

> $PsVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Linux 5.8.0-50-generic #56-Ubuntu SMP Mon Apr 12 17:18:36 UTC 2021
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

pcasalinho avatar Apr 29 '21 17:04 pcasalinho

This is expected, the Install-WSMan cmdlet replaces the libmi and libpsrpclient libraries in the PowerShell install dir which essentially requires root access and for it to not be read online. I'm planning on changing that in a future version but for now it is what it is.

You might be interested in the workaround here https://github.com/jborean93/omi/issues/24#issuecomment-798995921 which should work for you as well. Keep in mind $libbase should be $libbase = Join-Path (Import-Module -Name PSWSMan -PassThru).ModuleBase lib glibc-1.1 for your host.

jborean93 avatar Apr 30 '21 05:04 jborean93

Hi Jordan,

I'm running into the same issue with the Snap version of PowerShell 7 on Ubuntu 23.10, I have tried adding the code that you suggested and then did New-PSSession and it reported that WSMan was not installed still so this workaround did not work at least in this instance.

Currently, the only method I've got is to add the official Microsoft repository to APT and then install PowerShell from there and then at a later time, jettison and uninstall the Snap version.

Mike

SirWobbyTheFirst avatar Feb 11 '24 11:02 SirWobbyTheFirst