I’ve read through the posts of which I’m aware in the forums concerning hosts
file issues, but cannot see this particular issue.
Issue in brief
On a Mac running OS X 10.11.6, when running LBF under a non-admin user account (i.e. a day-to-day working account per best security practice), LBF will only successfully ask for admin credentials to update the hosts
file on the first occasion in each session. On all subsequent occasions in that session, LBF appears to attempt to update the hosts
file using the current user’s credentials, which fails because the current user is not in the sudoers list.
System
Observed on 2 separate Macs, each running OS X 10.11.6 and Local by Flywheel 2.1.2.
Also observed running LBF 2.2.0 (pre-release) on the same system.
Other software
No anti-virus running.
Little Snitch installed but the issue persists whether or not Little Snitch is active.
OS X Firewall active but the issue persists if the firewall is disabled.
Desktop Server installed but not running. DS, when running, can successfully update the hosts file as necessary. DS sites use *.dev; LBF uses *.local
Steps to reproduce issue
LBF application installed by downloading and copying to /Applications folder. See later for attempt to resolve by reinstalling.
- Attempt #1 - application was installed and configured under an Administrator account
- Attempt #2 - application was installed and configured under a non-administrator account
Obviously, in both occasions I logged in to my day-to-day non-administrator account to attempt to use the app and create/modify sites.
Both the above produce the same results, i.e. the issue persists.
- Login to a non-administrator account
- Launch LBF and do one of the following:
- Create a new site
- Remove an existing site
- Click the ‘Fix It’ button in the orange “Warning! Missing hosts entry. This site may be inaccessible.” banner.
- LBF then:
- Sends a notification via OS X Notification Centre saying: "Host Redirection - Local by Flywheel is requesting administrative privileges to modify your /etc/hosts file
- Creates a pop-up saying "Local by Flywheel wants to make changes. Type an administrator’s name and password to allow this.
- Accepts the Administrator’s username and password and proceeds with the new site/removing old site/fixing existing site
- The site is then created successfully and the hosts file is modified appropriately
- Next, attempt to do one of the actions again (create, remove or ‘fix’ a site)
- LBF will then:
- Send a notification again via OS X Notification Centre saying: "Host Redirection - Local by Flywheel is requesting administrative privileges to modify your /etc/hosts file
- NO pop-up is created asking for admin credentials (I checked in other Spaces, behind other app windows, and so on)
- A popup is created saying “Uh-oh! Could not update hosts file - Local ran into a problem when trying to update the hosts file. Please contact support if this persists.”
- The new site is created (or existing site removed, as appropriate)
- The hosts file is NOT modified.
- In the case of a new site being created, the orange banner appears saying “Warning! Missing hosts entry. This site may be inaccessible.”
- Clicking on the “Fix it” button simply causes the same two notifications above, i.e.
- Another notification via OS X Notification Centre saying: "Host Redirection - Local by Flywheel is requesting administrative privileges to modify your /etc/hosts file
- A popup saying “Uh-oh! Could not update hosts file - Local ran into a problem when trying to update the hosts file. Please contact support if this persists.”
- Clicking on the “Fix it” button simply causes the same two notifications above, i.e.
- This situation persists until the LBF is quit and relaunched
Attempted solutions / workarounds
- Restarting an individual site does NOT solve the issue
- Restarting the local machine from within LBF does NOT solve the issue
- Restarting the Mac does NOT solve the issue
- Completely uninstalling PBF and VB does NOT solve the issue
- Repairing permissions (via terminal) does NOT solve the issue
- The only workaround is to stop all sites, quit LBF and relaunch the application. You can then have one further successful new site/remove site/fix site attempt, before the issue occurs again.
Logs & Notes
It appears that, the first time PBF needs to modify the hosts
file, it successfully asks for administrator credentials and proceeds with modifying the file as needed. On each subsequent occasion where the hosts
file should be modified, it seems that although LBF sends a Notification that it has requested administrator credentials, in fact it hasn’t done so and attempt to modify the hosts
file using the current user’s credentials.
Because the current user in this scenario is not an administrator, this attempt fails:
{ stdout: '',
stderr: 'Brian is not in the sudoers file. This incident will be reported.\n',
LBF seems unaware of this and reports a generic ‘problem’ with modifying the hosts
file.
I have the log file if you’d like it.
Comments
Is this thing built on Electron? I only ask because this whole thing sounds very much like an ongoing issue with Atom, Brave and maybe other such software. With those, the only time they need admin credentials is to autoupdate the app itself, and there’s a known issue where the app will download the new version of itself, attempt to install it using the current user’s credentials (thus failing without notification), and the cycle endlessly repeats itself. The first the poor user tends to know is that they rapidly run out of disk space, as the aborted downloads sit in /private/var/folders and with ~400MB being added every few minutes it doesn’t take long to build up.
Looking forward to a resolution for this - I’d very much like to move over to LBF completely but this is sadly not possible at present.