Update & Upgrade Rule / Option for Vasic UI

Hello,

I implemented a update system rule but I always get this issue.

2021-07-15 12:57:59.915 [INFO ] [t.execute string_flag_System upgrade] - upgrading openHAB 

We trust you have received the usual lecture from the local System

Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.

    #2) Think before you type.

    #3) With great power comes great responsibility.

sudo: no tty present and no askpass program specified

here is my item:

String          string_flag_System                          "System"                             <switch>

and my rule

rule "execute string_flag_System upgrade"
when
    Item string_flag_System received command "Upgrade"
then
    try {
        logInfo("execute string_flag_System upgrade", "upgrading off openHAB")
        var ScriptResponse = executeCommandLine(Duration.ofSeconds(60), "sudo","apt-get update && apt-get upgrade")
        logInfo("execute string_flag_System upgrade", "upgrading openHAB " + ScriptResponse.toString() )
        //executeCommandLine("sudo","apt-get update")
        //executeCommandLine("sudo","apt-get upgrade")
        string_flag_System.postUpdate(NULL)
    }
    catch(Throwable T)
    {
        logError("Error", "Some bad stuff happened in \"execute string_flag_System upgrade\": " + T.toString)
    }
    finally
    {

    }
end

this is my visudo file

openhab ALL=NOPASSWD: /usr/bin/apt-get upgrade, /usr/bin/apt-get update

Where is my error??

The first time you run sudo as a given user you are required to acknowledge that message telling you not to do bad stuff. So on the command line run sudo as the openhab user and press y to acknowledge the message and it won’t show up any more. Alternatively search Google and there may be a way to set a flag somewhere to suppress the message.

1 Like

I have done this via

sudo -u openhab /bin/bash
and then sudo apt-get update && apt-ge upgrade

but there is not question coming up in the bash.

Regrads