I have a set of scripts which finishes up client machine deployment after executing a fairly generic NetRestore image.
The main script runs under root privileges, and then calls another, "user" script with sudo -iu $PROPER_USER ...
The problem is, sudo fails on this step and doesn't actually execute the script. I get this error:
sudo: unable to execute /bin/bash: Bad address
What does this mean, and how can I fix this? One thing that comes to mind is that I'm changing the hostname earlier in the script, using networksetup -setcomputername ...
Best Answer
Never mind about the networking. It was not even close.
The
Bad address
message comes from the kernel and indicates that a the process attempted to open a terminal (pty/tty) which does not exist.I'm not sure why adding
sleep
fixed the issue (unreliably), but going back to no-sleep version of my scripts and adding:Defaults !requiretty
to
/etc/sudoers
works so far.Cheers!