Skip to content
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

Cannot start powershell because of missing file on mac #3768

Closed
3 tasks done
jimmymain opened this issue Aug 2, 2023 · 10 comments
Closed
3 tasks done

Cannot start powershell because of missing file on mac #3768

jimmymain opened this issue Aug 2, 2023 · 10 comments
Labels
issue-mutex The mutex creation issue on macOS Resolution-Answered Question is answered

Comments

@jimmymain
Copy link

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!

### Environment
PSReadLine: 2.2.6
PowerShell: 7.3.6
OS: Darwin 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64
BufferWidth: 80
BufferHeight: 24

Last 0 Keys:



### Exception

System.IO.IOException: The system cannot open the device or file specified. : 'PSReadLineHistoryFile_2044101305'
   at System.Threading.Mutex.CreateMutexCore(Boolean initiallyOwned, String name, Boolean& createdNew)
   at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
   at Microsoft.PowerShell.PSConsoleReadLine.DelayedOneTimeInitialize()
   at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics)
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

Screenshot

Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!

Environment

PSReadLine: 2.2.6
PowerShell: 7.3.6
OS: Darwin 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64
BufferWidth: 80
BufferHeight: 24

Last 0 Keys:

Exception

System.IO.IOException: The system cannot open the device or file specified. : 'PSReadLineHistoryFile_2044101305'
at System.Threading.Mutex.CreateMutexCore(Boolean initiallyOwned, String name, Boolean& createdNew)
at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
at Microsoft.PowerShell.PSConsoleReadLine.DelayedOneTimeInitialize()
at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics)
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

Environment data

PS Version 7.3.6

Steps to reproduce

Open powershell

Expected behavior

Powershell opens correctly.

Actual behavior

powershell fails with the above message.

@jimmymain
Copy link
Author

jimmymain commented Aug 2, 2023

I cannot run the script because powershell will not even start.
I have uninstalled and reinstalled and that doesn't seem to resolve the issue.

@jimmymain
Copy link
Author

jimmymain commented Aug 3, 2023

I there some directory I can remove / reset to resolve this?
I have reinstalled, and renamed the powershell directories in .config and .local and no dice.

I removed /usr/local/share/poweshell too, and reinstalled and it's still the same error.

@StevenBucher98
Copy link
Collaborator

If you are able to get a working prompt, you can run Get-PSReadLineOPtion to get the HistorySavePath and delete that?

Have you tried searching for the file PSReadLineHistoryFile_2044101305 and deleting it off of your system?

@daxian-dbw is this the known mutex issue on Mac? I can't figure out how to reproduce this.

@jimmymain
Copy link
Author

I have managed to run the command suggested.
There's a lot out output, and the file in question according to the output is.
/Users/MYNAME/.local/share/powershell/PSReadLine/ConsoleHost_history.txt

I have tried to find the file PSReadLineHistoryFile_2044101305 and cannot find it anywhere on the file system.
I have deleted everything I can find powershell related, and reinstalled from the pkg.

Still the same error.

@jimmymain
Copy link
Author

Here is some of the output.

EditMode                               : Emacs
AddToHistoryHandler                    : System.Func`2[System.String,System.Object]
HistoryNoDuplicates                    : True
HistorySavePath                        : /Users/craigmain/.local/share/powershell/PSReadLine/ConsoleHost_history.txt
HistorySaveStyle                       : SaveIncrementally
HistorySearchCaseSensitive             : False
HistorySearchCursorMovesToEnd          : False
MaximumHistoryCount                    : 4096
ContinuationPrompt                     : >> 
ExtraPromptLineCount                   : 0
PromptText                             : {> }
BellStyle                              : Audible
DingDuration                           : 50

@jimmymain
Copy link
Author

jimmymain commented Aug 6, 2023

Since the reinstall all I have in ~/.local/share/powershell is an empty modules directory.
There MUST be something else I can delete to get this working again?

Windows 1995 was easier than this.
:-)

Powershell is still kind of working, but I get the missing file message every time I hit return.

Having used various methods I am pretty sure that PSReadLineHistoryFile_2044101305.* does not exist.

@jimmymain
Copy link
Author

jimmymain commented Aug 6, 2023

Is there a README or something online somewhere were I can try and remove every history or saved variable from powershell from everywhere and try install again from scratch. Very frustrating.

@StevenBucher98
Copy link
Collaborator

Ah I found previous issues folks had with the same problem, check out #1464 (comment) and see if this works for you

@StevenBucher98 StevenBucher98 added Issue-Bug It either shouldn't be doing this or needs an investigation. OS-macOS The issue happens on macOS only. labels Aug 7, 2023
@daxian-dbw daxian-dbw added Needs-Author Feedback issue-mutex The mutex creation issue on macOS and removed OS-macOS The issue happens on macOS only. Issue-Bug It either shouldn't be doing this or needs an investigation. labels Aug 7, 2023
@jimmymain
Copy link
Author

I really thought you had it there.
But alas no.

Filesystem   1024-blocks      Used Available Capacity iused      ifree %iused  Mounted on
/dev/disk1s2   488245288 165777580 307951552    35% 1017461 3079515520    0%   /System/Volumes/Data

I deleted the powerlog folder in /tmp and that did not help either.

@jimmymain
Copy link
Author

jimmymain commented Aug 8, 2023

Ok did the permissions changes on /private/tmp, and now it's working, many thanks after so many searches.

Anyway, chmod 777 /private/tmp and chmod +t /private/tmp to fix the permissions and PS now works fine

@daxian-dbw daxian-dbw added Resolution-Answered Question is answered and removed Needs-Attention 👋 labels Aug 8, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Aug 8, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue-mutex The mutex creation issue on macOS Resolution-Answered Question is answered
Projects
None yet
Development

No branches or pull requests

3 participants