Local Community

Local is requesting permission to modify /etc/hosts file

Hi,
I installed Local on Ubuntu 20.04 and anytime i try to create a site i get this error: “Local is requesting administrative privileges to modify your /etc/hosts file”. When i look at this logs this is what i see
{“thread”:“main”,“class”:"",“stack”:{},“level”:“error”,“message”:“Unable to start
site.”,“timestamp”:“2020-07-12T15:26:44.438Z”}
{“thread”:“main”,“class”:“o”,“message”:“Stopping ngrok for
flint.local”,“level”:“info”,“timestamp”:“2020-07-12T15:26:45.871Z”}
{“thread”:“main”,“class”:“Process”,“process”:“mailhog”,“pid”:94577,“level”:“info”,“message”:“Killing
process”,“timestamp”:“2020-07-12T15:26:45.872Z”}
{“thread”:“main”,“class”:“Process”,“process”:“phpFpm”,“pid”:94578,“level”:“info”,“message”:“Killing
process”,“timestamp”:“2020-07-12T15:26:45.873Z”}
{“thread”:“main”,“class”:“Process”,“process”:“nginx”,“pid”:94581,“level”:“info”,“message”:“Killing
process”,“timestamp”:“2020-07-12T15:26:45.874Z”}
{“thread”:“main”,“class”:“Process”,“process”:“mysql”,“pid”:94583,“level”:“info”,“message”:“Killing
process”,“timestamp”:“2020-07-12T15:26:45.875Z”}
{“thread”:“main”,“class”:"",“stack”:{},“level”:“error”,“message”:“Unable to provision
site.”,“timestamp”:“2020-07-12T15:26:45.876Z”}
{“thread”:“main”,“reason”:{},“p”:{},“level”:“warn”,“message”:“Unhandled
Rejection.”,“timestamp”:“2020-07-12T15:26:47.412Z”}
{“thread”:“main”,“reason”:{“error”:{“killed”:false,“code”:127,“signal”:null,“cmd”:“cd
“/home/koficypher”; “/usr/bin/pkexec” --disable-internal-agent /bin/bash -c “echo SUDOPROMPT;
setcap cap_net_bind_service=+ep %%resourcesPath%%/lightning-services/nginx-
1.16.0+3/bin/linux/sbin/nginx””},“stdout”:"",“stderr”:“pkexec must be setuid
root\n”,“exitCode”:127},“p”:{},“level”:“warn”,“message”:“Unhandled Rejection.”,“timestamp”:“2020-
07-12T15:26:47.421Z”}
{“thread”:“main”,“class”:"",“message”:“Deleting
%%site.runData%%”,“level”:“info”,“timestamp”:“2020-07-12T15:26:47.499Z”}
{“thread”:“main”,“class”:“HostsFileService”,“level”:“info”,“message”:“Updating hosts
with”,“timestamp”:“2020-07-12T15:26:48.442Z”}
{“thread”:“main”,“class”:“HostsFileService”,“error”:{“killed”:false,“code”:127,“signal”:null,“cmd”:“cd
“/home/koficypher”; export ELECTRON_RUN_AS_NODE=“1”; “/usr/bin/pkexec” --disable-
internal-agent /bin/bash -c “echo SUDOPROMPT; export
ELECTRON_RUN_AS_NODE=\“1\”;/opt/Local/local
%%appPath%%/main/dns/workers/updateHostsFileWorker.js””},“stdout”:"",“stderr”:“pkexec must be
setuid root\n”,“exitCode”:127,“level”:“error”,“message”:“Could not update hosts.”,“timestamp”:“2020-
07-12T15:26:48.458Z”}

From the logs you can see that local is trying to use pkexec to run a command as root to modify the /etc/hosts file but this doesnt seem to work. The command flag --disable-internal-agent is used to disable its default behaviour as running as root but this also doesnt work.

At this point i have tried the ff giving sudo permission to the /etc/bin/pkexec file and also giving the hosts file’s ownership to the current user and not root.
Please assist.

PS: I have no firewall or any program blocking access to the hosts file

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.