Mac Terminal is stuck - terminal

I get this message every time I open the terminal on my Mac:
Saving session...
...copying shared history...
...saving history...
...completed.
[Process completed]
No matter what I do it always appears. I have closed out of the application, created a new window, even shut down my computer and restarted the whole system. Nevertheless, this message still appears and I cannot enter anything into the terminal. I am getting concerned because I have the feeling I royally messed something up.
EDIT: I found the fix, I needed to go to Terminal->Preferences and make it so the Shell opens with
/bin/sh
in the Command(complete path).
Now to figure out how to reset the Default login shell

Related

Multipass totally broken on MacOS & multipassd error logs

The com.canonical.multipassd service is constantly logging errors on my Mac and multipass won't work at all, even after reinstalling, rebooting, and updating my Mac.
In an attempt to use my GPU in a Linux VM through multipass, I tried to install the AMDGPU driver for my card (Radeon Pro 5300 4GB). I had installed multipass through brew and made some progress, but the ./amdgpu-install process was returning various errors as a result of missing dependencies. Having started to resolve the missing dependencies, in an attempt to build the driver again, the build just stopped halfway through and I couldn't terminate the process or get the VM to respond at all (didn't take a screenshot sorry).
Because of this, I closed the VM shell and tried to get multipass to shut down the VM. Multipass stopped responding altogether - the application just spun, and it didn't respond at all in terminal. I force quit multipass in Activity Monitor. That still didn't fix it, so I (somewhat stupidly) force quit 'hyperkit' and 'multipassd'. This is where everything went really wrong.
Having force quit 'multipassd', I tried to re-open multipass, but it returned the error below
list failed: cannot connect to the multipass socket
Please ensure multipassd is running and '/var/run/multipass_socket' is accessible
I looked this up and tried a few suggested solutions. I uninstalled multipass with Brew. I deleted the application, and reinstalled with brew. I also tried brew remove multipass, and tried installing using the .pkg from the multipass website. When that didn't fix it, I restarted my computer and reset NVRAM on startup. That also didn't make a difference, so I have just updated my Mac to MacOS 11.4, and it is still not fixed.
The console logs suggest that multipassd is still doing something, as it is continually logging in the system.log:
May 26 09:39:15 <myName> com.apple.xpc.launchd[1] (com.canonical.multipassd[2131]): Service exited with abnormal code: 1
May 26 09:39:15 <myName> com.apple.xpc.launchd[1] (com.canonical.multipassd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
In the multipass log, this message is also being generated about once every 10 seconds:
[error] [daemon] Caught an unhandled exception: Invalid MAC address
[warning] [Qt] QMutex: destroying locked mutex
These messages are being generated even after resetting NVRAM and rebooting. I think they're the cause of my issue launching multipass, but I haven't found any solution to stop them, and I can't identify any process that is still running related to multipass. As far as brew is concerned, multipass is not installed, but it's logs are still filling up...
Happy to provide console or terminal output if needed - nothing else on my Mac seems to be broken, I just can't use multipass now. I do have a time machine backup, so if that is guaranteed to fix it, I might just resort to the backup, but I'm not sure that would necessarily fix it, and I would rather find an alternative solution.
As this has probably made clear, I'm very new to Linux and VMs... any solutions greatly appreciated!
Fixed it!! I hadn't properly uninstalled it - the 'proper' uninstall script can be run using
sudo sh "/Library/Application Support/com.canonical.multipass/uninstall.sh"
Reinstalling multipass after running this command worked fine.

iTerm and terminal fail immediately on Mac - 'BrokenPipe'

This happened right after I tried to install pyenv and then virtualenvrapper.
As soon as I open iTerminal I get a "Broken Pipe" message and macOS terminal also shuts down immediately.
I have been trying to debug my .bash_profile but uncommenting one after another but without avail
I tried updating homebrew and bash but no change (using a previously open iterm session)
I restarted my computer with the unfortunate effect that I can't access iterm or terminal now (all old sessions closed)
I am quite at loss here now, I have no clue why this happened and how to go about fixing it without having a functioning terminal.
I'd appreciate any advice or pointers.
Following #user1934428 advice I added set -x to all the bash startup files, unfortunately was still met with the same problem. Changing the startup shell in the terminal preferences didn't work.
Thankfully when using emacs ansi-term I was able to get some information/feedback message:
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
Following the link I found that default shell has been changed to zsh Catalina. So I went and followed the instructions on the support page and changed the default shell back to bash, which fixed the problem. I am not quite sure why this problem occurred initially since the Broken Pipe Error appeared before I updated to Catalina.
Anyways changing the default shell back to bash shell fixed everything

XQuartz $DISPLAY problems, cannot open xclock locally, cannot ssh -X

I am trying to solve a cascading series of bugs that started with me not able to copy to my macOS clipboard from remote ssh and has lead me to realize my X11 situation is seriously messed up. I have read a few other stackoverflow threads and they do not address my particular problems.
First my setup is macOS Mojave 10.14.5. I have xquartz 2.7.11 installed from the website. When I run echo $DISPLAY locally (on macOS) I get /private/tmp/com.apple.launchd.waagOnO6Qm/org.macosforge.xquartz:0.
Since I don't know where the error actually is I will list two problems I can identify currently.
Two problems:
If I run xclock locally nothing happens inside my terminal. I do notice that an "active" dot appears under the XQuartz dock icon for a second and then disappears. But after this happens my terminal still just hangs at xclock as though it is running.
If I try to ssh -X remote into a remote machine my terminal is locked out. I cannot keyboard interrupt. I ran this with -vvv to try to debug and I see that it hangs with xauth:
debug2: client_x11_get_proto: /opt/X11/bin/xauth -f /var/folders/jw/ltyk9x9n0_xb61jhdnct27fr0000gn/T//ssh-vcqwT7qh5yk2/xauthfile generate /private/tmp/com.apple.launchd.waagOnO6Qm/org.macosforge.xquartz:0 MIT-MAGIC-COOKIE-1 untrusted timeout 1260 2>/dev/null
Attempts to Solve
Other related stack threads have suggested reinstalling XQuartz, which I have done, both manually and with Homebrew. I have logged back out and in following reinstallation.
This thread suggested I solve my xauth problem by deleting .XAuthority file and recreating it. However, when I
xauth generate :0 . trusted
My XQuartz pops up a window saying XQuartz quit unexpectedly which I can provide the Report for if it helps. Then in the terminal it says
xauth: (argv):1: unable to open display ":0". Also I'm not sure this is the problem anyway because my .XAuthority file already contained an entry that it looks like this is trying to produce:
$HOST/unix:0 MIT-MAGIC-COOKIE-1 db7738324ca3662767b20b97b4a68680
Though it is concerning that running xauth is causing my xquartz to repeatedly quit unexpectedly (this dialog box is appearing multiple times).
This has been very frustrating to debug because I am not sure where the problem is, with xauth or xquartz somehow even though it is newly installed. Further, existing StackOverflow threads I have found detail the problem only with ssh -X but clearly I'm having problems locally, given that I can't even run xclock.
Any help is greatly appreciated.
The dot appearing and disappearing quickly indicates that the server process is terminating. This means that either the server crashed, the managing client (eg ~/.xinitrc) terminated, or we failed to even start xinit.
Almost every case I have ever seen of this has been due to someone doing something wrong in their init scripts (eg: ~/.bash*, ~/.profile, ~/.xinitrc).
Remove those and try again, then bisect to figure out the underlying issue.
However, the crash dialog from your "ssh" case indicates that it is likely the server crashing. You will need to look at the crash log for more information (or provide it here if you want help with that).

Heroku CLI only works from root

I'm not sure why, but I can only run the Heroku CLI from root, not from a user.
When I run from user I get
>>heroku -v
and that's it. Nothing comes, nothing happens, it just freezes.
However when I open a new terminal window and change to root, it works fine
>>sudo su
Password:
>>heroku -v
heroku-cli/6.15.26 (darwin-x64) node-v9.6.1
>>
I have already tried uninstalling and reinstalling over and over again, I've used the Heroku direct download, as well as Homebrew, but I can't get it to work. I'm not really sure what I did to break my CLI, but how do I fix it? Where should I even look to see what the actual problem is?
UPDATES:
I've also changed shell types, and that did nothing to fix the issue either. The shell lists Terminal -- node /usr/local/bin/heroku -v at the top, if that helps.
As per the comments below, we tried copying the directory that the root user uses into my .local/share but this did not solve the problem either.
Further, I opened my activity monitor, and any time I try to run Heroku, it shows that node is taking up 95-100% of my CPU.
Spent nearly 12 days chatting with heroku staff. It turns out if your .netrc file is long (mine was 1.9 million lines), their parser has issues reading it.
Solution:
$ rm ~/.netrc
$ heroku login
Once the file is removed and you re-login it will create a new .netrc file without issues.
Why this happens:
My crontab uses an expect script to login to the blank environment. If you login over, and over and over, the .netrc file becomes huge.

bash process running in the background

I'm connecting to a remote server running Ubuntu 16.04 using ssh. I'm running nodemon in a bash session but my network connection drops out if I walk away from my computer or close my laptop. This locks up my sessions and I have to close the terminal window. When I reconnect I'm unable to restart nodemon because it's running as a process in the background.
Is there a way to re-open the bash window that locked up? What I've been doing is killing the nodemon process or restarting the system. I'm hoping there's a simpler way.
Use GNU screen. It runs a virtual terminal that stays open even if you loose your connection.
On the server, enter screen -S myscreen and do your normal command line work. When you disconnect, just open a new ssh connection to the server an execute screen -r myscreen. Your old session will be there as if you never left it.
You can manually leave the screen whithout killing it, by pressing ctrla and then d.
I would recommend installing the utility 'screen.'
You can install it in Ubuntu with:
apt-get install screen
Or in Red Hat / CentOS with:
yum install screen
Then you can just enter the command screen to start a session. Then you can start whatever script you need to stay running regardless of disconnects. Ctrl-A+Ctrl-D detaches you from the session. Then screen -r reconnects to it. You can also preceed a command with screen -d -m and that process will start in a screen session.

Resources