28th March 2017, 7:20
(27th March 2017, 15:08)rocky7x Wrote: Hi,
You have an error in the script: the script does not start with !# but with #! (first line)
... Also you do not start the script with sudo since you already have sudo in the script. So when you run the script, run it with your user.
Hi & thanks rocky
Yes & yes -- massive brainfade on my part apparently; no idea how i managed to somehow type the hashbang backwards then not notice it. Also the redundant sudo was silly. Thanks for both catches. However, even with those errors fixed, the basic problem continued unchanged; i still could not run any of my bash scripts, as every time this error msg resulted [same as in my initial post above]:
Code:
bash: /usr/bin/sudo: Permission denied
(27th March 2017, 15:08)rocky7x Wrote: .. I think you also have an error in the restart command: the network manager should be referred to as service, so it should be:
Code:systemctl restart network-manager.service
No. I do understand your point, & indeed that was one of the strings i initially tried last year when i wrote my script [you can still see this string, commented out, in my earlier post's codebox]. When i researched it last year i found many opinions in favour of your one, but also many in favour of my one, which is what i selected. Here's the important point though:
My script [even despite my silly hashbang error] USED to work just fine on Tower, & STILL works just fine on Lappy. I cannot pinpoint exactly when the problem initiated on Tower, but certainly something changed that stops my scripts working [on Tower; still all of them are good on Lappy]... & based on hours of testing on this today, i now have a clue of the root cause [read on].
I compared the permissions of Tower's /usr/bin/sudo against Lappy's - identical. Ditto i compared /bin/bash permissions - also identical. I wondered if maybe something crazy had happened to cause my file-system to have become mounted with the noexec option, but checking mount confirmed this was not so.
In a beautiful coincidence, new kernels became available in Update Manager. I had already been wondering if the root cause might have been some bug/regression in both 4.8.0-42 & -41, & so i was considering rebooting Tower with the same 4.4.0-67 as used by Lappy. Once i saw the new kernels, i decided to install & try these, then if still no good, to try the older 4.4.0-x series per Lappy. So I installed the brand new 4.8.0-44 in Tower, rebooted into it... & now my bash scripts once more run properly in Tower!! Yay... but what a strange thing to have occurred.
Now i just hope the random network connection failures have also been fixed in this new kernel... that was after all the reason for creating this thread. For now i'm marking it as Solved.