Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

brew services. Cant start service. get "Bootstrap failed: 5: Input/output error"

running brew services start mongodb-community which yields:

Bootstrap failed: 5: Input/output error
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/<myUserName>/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist` exited with 5.

when I run launchctl load -w /Users/<myUserName>/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

yields

Load failed: 5: Input/output error

I recently upgraded macOs to BigSur 11.5.2.

Ive uninstall and reinstalled homebrew and xcode.

like image 267
dasqueel Avatar asked Aug 29 '21 18:08

dasqueel


Video Answer


9 Answers

try this

brew services restart <[email protected]>

like image 140
mari Avatar answered Oct 18 '22 07:10

mari


I am able to run mongodb through homebrew. I believe this solved my issue:

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

followed by

launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

like image 31
dasqueel Avatar answered Oct 18 '22 06:10

dasqueel


I saw this issue with MySQL and the solution was my current profile was not the owner of my homebrew folder.

I had to change it because I have a second profile set up for another work space, but they share the same homebrew path.

I would suggest anyone who sees this error try running

sudo chown -R $(whoami) $(brew --prefix)/*

And then seeing if that will resolve it. Again I didn't have this issue with MongoDB, but I saw this exact error with MySQL when my profile didn't own the brew folder.

like image 23
marcus.salinas Avatar answered Oct 18 '22 06:10

marcus.salinas


To see the real errors, you need to run the service without brew

I had a similar problem, but instead of mongodb, I could not start apache(httpd).

$ brew services start httpd                                                                                                                                                        
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 
/Users/john/Library/LaunchAgents/homebrew.mxcl.httpd.plist` exited with 
5.
FAIL: 1

Unfortunately brew doesn't show the user what causes this error. At first I tried to use the tips from the answers in this thread, but neither reinstalling apache nor unload -w/load -w helped. I also found nothing in the brew logs. I decided to investigate apache itself. To do this I ran apache without brew:

$ /opt/homebrew/Cellar/httpd/2.4.51/bin/apachectl start
httpd: Syntax error on line 66 of /opt/homebrew/etc/httpd/httpd.conf: Cannot load /opt/homebrew/Cellar/[email protected]/5.6.40_3/lib/httpd/modules/libphp5.so into server: dlopen(/opt/homebrew/Cellar/[email protected]/5.6.40_3/lib/httpd/modules/libphp5.so, 0x000A): tried: '/opt/homebrew/Cellar/[email protected]/5.6.40_3/lib/httpd/modules/libphp5.so' (no such file), '/usr/local/lib/libphp5.so' (no such file), '/usr/lib/libphp5.so' (no such file)
FAIL: 1

Then it was finally clear what was the reason why httpd service was not starting. It turned out that after the php upgrade, the php version had changed and I forgot to write the new php version in the apache configuration file. I quickly fixed this and apache started up.

like image 9
Volex Avatar answered Oct 18 '22 06:10

Volex


Try this if you tried to restart your service, but it still doesn't work

  1. stop your service
brew services stop mongodb-community
  1. restart your macOS
  2. start your service again
brew services start mongodb-community
like image 8
Pagorn Avatar answered Oct 18 '22 08:10

Pagorn


It seems that the mongodb-community is already started. So do restart it instead of starting, by the following command:

brew services restart mongodb-community
like image 6
Md Aman Ullah Avatar answered Oct 18 '22 07:10

Md Aman Ullah


I faced a similar problem with postgresql 11 and restarting the service did not help. The issue arose when my MacBook restarted abruptly.

After checking the ports and trying out all the possible solutions, I decided to look into the logs.

tail -n 100 /usr/local/var/log/[email protected]

This gave me the last 100 lines of the log where I found this:

FATAL:  lock file "postmaster.pid" already exists
HINT:  Is another postmaster (PID 479) running in data directory "/usr/local/var/postgresql@11"?

Clearly, the issue was with postmaster.pid so I deleted it:

rm /usr/local/var/postgresql@11/postmaster.pid

Started the postgres service again:

brew services start postgresql@11

and voila! It worked.

like image 5
mansoor.khan Avatar answered Oct 18 '22 06:10

mansoor.khan


I had similar error in regard to postgres.

$ brew services start postgresql
Bootstrap failed: 5: Input/output error
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/yrk/Library/LaunchAgents/homebrew.mxcl.postgresql.plist` exited with 5.

I've tried restart and it looked promising:

$ brew services restart postgres
Stopping `postgresql`... (might take a while)
==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)

But there still was a problem when trying to connect:

 $ psql -d postgres -U apiuser
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
    Is the server running locally and accepting connections on that socket?

Checking postgres log as mentioned by @mansoor.khan helped, in my case it was: tail /usr/local/var/log/postgres.log.

And the issue was clear:

$ tail /usr/local/var/log/postgres.log
2022-05-19 14:18:46.029 CEST [32374] FATAL:  database files are incompatible with server
2022-05-19 14:18:46.029 CEST [32374] DETAIL:  The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.3.
2022-05-19 14:18:56.071 CEST [32676] FATAL:  database files are incompatible with server
2022-05-19 14:18:56.071 CEST [32676] DETAIL:  The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.3.
2022-05-19 14:19:06.111 CEST [32885] FATAL:  database files are incompatible with server
2022-05-19 14:19:06.111 CEST [32885] DETAIL:  The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.3.
2022-05-19 14:19:16.128 CEST [33102] FATAL:  database files are incompatible with server
2022-05-19 14:19:16.128 CEST [33102] DETAIL:  The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.3.
2022-05-19 14:19:26.166 CEST [33434] FATAL:  database files are incompatible with server
2022-05-19 14:19:26.166 CEST [33434] DETAIL:  The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.3.

Now the problem is: how to revert to previous version or upgrade old data to new version of postgres DB, but this is for another topic.

like image 4
yrk Avatar answered Oct 18 '22 07:10

yrk


run something like launchctl remove homebrew.mxcl.mongodb-community before the load command solved my problem

like image 1
HelloThere Avatar answered Oct 18 '22 07:10

HelloThere