MacOSX bare metal agent as service not working (OD-1081)
bufferUnderrun opened 3 years ago

Hi,

We're trying to install onedev bare metal agent on MacOSX (Ventura 13.1) to build IOS App using XCode.

Console agent ./agent.sh console works great.

So we want to install as service so it can start on macos boot without user interaction.

sudo ./agent.sh install

Detected Mac OSX:
Installing the mac@builder daemon...

Then, sudo ./agent.sh start

Starting mac@builder with launchd...
Waiting for mac@builder..................
WARNING: mac@builder may have failed to start.
         The log file "/Users/one-dev/Desktop/agent/logs/console.log" may contain further information.

There is nothing in the log which is not created.

Need help to install agent as service in macos.

Thanks

  • bufferUnderrun changed title 3 years ago
    Previous Value Current Value
    MacOSX agent daemon not working
    MacOSX agent as service not working
  • bufferUnderrun changed title 3 years ago
    Previous Value Current Value
    MacOSX agent as service not working
    MacOSX bare metal agent as service not working
  • Robin Shen commented 3 years ago

    Please upgrade to build #3263 and then reinstall agent to see if it works.

  • Robin Shen commented 3 years ago

    Note that agent needs to be re-downloaded from server.

  • bufferUnderrun commented 3 years ago

    i upgrade to 7.9.2 and reinstall agent from link provided by server.

    Still not working as service, the executable ends with "see logs/console.log" which not exists.

  • Robin Shen commented 3 years ago

    What your Mac cpu arch?

  • Robin Shen commented 3 years ago

    Also please download JSW test package: https://download.tanukisoftware.com/wrapper/3.5.51/wrapper-delta-pack-3.5.51-st.tar.gz

    Extract it, change to bin directory, edit testwrapper to uncomment RUN_AS_USER, and specify a user, then run ./testwrapper install to see what happens (you may run ./testwrapper remove to uninstall it)

  • bufferUnderrun commented 3 years ago

    Intel Core i7 Core architecture. We've also test on M1 Arm64 and still not working.

    After adding our user RUN_AS_USER=one-dev to testwrapper :

    1. ./testwrapper console [OK]
    2. sudo ./testwrapper install [OK]
    3. sudo ./testwrapper start [ERROR] same as above except the log file is created but always empty.
  • Robin Shen commented 3 years ago

    I tested both on my Mac (Intel cpu, Ventura 13.1), and a fresh started Mac2 instance on AWS (arm cpu, Ventura 13.1), and OneDev agent can be installed as service and started without any issues.

  • Robin Shen commented 3 years ago

    Please make sure you've specified path to java executable via property "wrapper.java.command" in "conf/wrapper.conf" if root user can not find java in its path

  • bufferUnderrun commented 3 years ago

    The wrapper.java.command seems correct and we test with the fullpath java value. Still not working.

    BUT

    All console tests we did before was with user role.

    • ./agent.sh console [OK]
    • sudo ./agent.sh console [ERROR] crash in few seconds

    So it seems the issue come from the root env.

    We enabled debug log in the wrapper.conf and the run the console.

    You can see log attached with a NPE : console.log and agent.log

  • bufferUnderrun commented 3 years ago

    Agent running as service trying to clean temp directory ends by a NPE ?

    maybe a issue in right management as service run by root do not access to the user directory even with the correct RUN_AS_USER in the agent.sh ?

  • Robin Shen commented 3 years ago

    This is a permission issue. Please make sure the RUN_AS_USER owns the agent install dir and all content under it recursively.

  • Robin Shen changed state to 'Closed' 3 years ago
    Previous Value Current Value
    Open
    Closed
  • Robin Shen commented 3 years ago

    Closing. Feel free to reopen if there are more issues.

  • bufferUnderrun changed state to 'Open' 3 years ago
    Previous Value Current Value
    Closed
    Open
  • bufferUnderrun commented 3 years ago

    We tried on a fresh MacOS X.

    • install jdk 19
    • install git
    • download onedev agent
    • set RUN_AS_USER variable

    same : ./agent.sh console working but sudo ./agent.sh start failed

    Robin, could you provide your steps ?

    Maybe we are doing something wrong but quite frankly we don't know what...

  • Robin Shen commented 3 years ago

    The only difference might be JDK. I installed jdk using brew and guess it is not JDK 19. OneDev only supports up to JDK 17 LTS version.

  • Robin Shen commented 3 years ago

    Also does the RUN_AS_USER owns the agent directory and everything underneath it?

  • bufferUnderrun commented 3 years ago

    OpenJDK17 installed with brew.

    We can reproduce.

    • agent console [OK]
    • agent install && agent start [ERROR]
    • agent start (only) [OK]

    see screenshoot

    image.png

    we can give you ssh access for this macos test.

  • Robin Shen changed confidential 3 years ago
    Previous Value Current Value
    false
    true
  • Robin Shen commented 3 years ago

    Yes, please give me ssh access and I will check it tomorrow. I've made this issue confidential so that others can not see sensitive info.

  • bufferUnderrun commented 3 years ago

    Thanks.

    My coworker is preparing the macosx. Once done we'll send you credencials and you'll able to connect when you want

  • Robin Shen commented 3 years ago

    OK, will test it later today.

  • Robin Shen commented 3 years ago

    Found the problem. When files are extracted to Downloads or Desktop (may also include some other Mac managed folders), Mac sets extended attributes ('@' in permission bits of some file when you run ls -l <agent dir>/bin), which prevents the agent process from writing into it.

    To solve the issue, just extract agent package into a different folder, for instance, /Users/macbuildsession/agent. If you copy existing agent directory from Desktop to some other place, you will need to run sudo xattr -cr ./agent to remove extended attributes.

  • Robin Shen commented 3 years ago

    I removed login information, and will make the issue public again.

  • Robin Shen changed confidential 3 years ago
    Previous Value Current Value
    true
    false
  • Robin Shen commented 3 years ago

    I will also add a note in agent installation guide for this.

  • bufferUnderrun commented 3 years ago

    That was very vicious... THANKS Robin !!

  • bufferUnderrun changed state to 'Closed' 3 years ago
    Previous Value Current Value
    Open
    Closed
issue 1/1
Type
Bug
Priority
Normal
Assignee
Affected Versions
Not Found
Issue Votes (0)
Watchers (3)
Reference
OD-1081
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover