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

hb-service occupies mountpoint when home folder symlinked to software RAID on macOS #680

Closed
lazd opened this issue May 12, 2020 · 6 comments
Labels

Comments

@lazd
Copy link

lazd commented May 12, 2020

Describe The Bug:

I have my OS booting from a SSD, with my home folder symlinked to a folder on a software RAID array. This lets me keep my user storage and OS storage separate so I can freely tinker with my OS, boot different versions from other drives with the same home folder, etc.

After installing hb-service, when I rebooted, I was alarmed to find my home folder completely missing and macOS awfully confused about my Keychain.

I was worried I lost my RAID array, so I checked status in Disk Utility -- it's fine, and when I navigated to it in the Finder, everything was there. However, in /Volumes/lazdRAID/, where my RAID array's mount point should be, was a bare folder. Next to it was /Volumes/lazdRAID 1/, where my array ended up mounting...

There was but one thing inside of the bare folder: /Volumes/lazdRAID/Users/lazd/.homebridge. Every time I deleted /Volumes/lazdRAID/, the whole directory structure would magically appear again with only the /Volumes/lazdRAID/Users/lazd/.homebridge inside of it.

Since nvm was hosed due to no home folder, I had to manually find plist for homebridge, stop it with launchctl, delete the pllist, delete the bare folder at /Volumes/lazdRAID/, and reboot. Then, my system was finally back to normal.

To Reproduce:

  1. Set up your home folder to link to a folder on another drive (maybe a software RAID array, maybe not?)
  2. Install hb-service
  3. Reboot
  4. Cry as your other drive's mount point is replaced by a bare folder

Expected behavior:

Well, certainly not that.

Insight

I imagine there is a bit of mkdir -p going on somewhere in hb-service, and I imagine that hb-service is starting up at too low of a runlevel, long before software RAID mounts, and long before my home folder exists. This is very bad behavior, but an understandable bug.

Environment:

  • Node.js Version: 12.6.1
  • NPM Version: 6.13.4
  • Homebridge Version: 1.0.4
  • Homebridge Config UI X Version: latest?
  • Operating System: macOS
  • Process Supervisor: launchctl / hb-service
@lazd lazd added the bug label May 12, 2020
@oznu
Copy link
Member

oznu commented May 12, 2020

Can you show the contents of this file?

/Library/LaunchDaemons/com.homebridge.server.plist

@lazd
Copy link
Author

lazd commented May 14, 2020

Unfortunately, no. I nuked it so I could get my computer to boot up again.

Whatever was there was generated by the latest version of hb-service.

@lazd
Copy link
Author

lazd commented May 15, 2020

This is definitely the line that's causing the issue: https://github.com/oznu/homebridge-config-ui-x/blob/master/src/bin/hb-service.ts#L553

And it looks like the PathState launchd option may be the answer: https://stackoverflow.com/questions/19449288/how-to-instruct-launchd-to-wait-for-volume-mount?rq=1

@oznu
Copy link
Member

oznu commented May 15, 2020

I couldn't get PathState to work how I need it to.

Instead I made a change to hb-service to not create the storage directory if the parent directory does not exist yet on macOS.

This means until /Volumes/lazdRAID/Users/lazd exists, the service will exit and re-try every couple seconds until it does.

This is currently in @test:

https://github.com/oznu/homebridge-config-ui-x/wiki/How-To-Test-Upcoming-Changes

@oznu oznu closed this as completed in 0dcbe81 May 15, 2020
@lazd
Copy link
Author

lazd commented May 15, 2020

That sounds like a workable solution, but does that mean that users will have to manually create the .homebridge folder? Perhaps something should be added to the install script to do it for them, if so.

@oznu
Copy link
Member

oznu commented May 15, 2020

It will create it for them still. It just checks for the presence of $HOME path first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants