Git Product home page Git Product logo

Comments (12)

MikeMcQuaid avatar MikeMcQuaid commented on May 21, 2024 1

@logopk need to figure out a way to detect that from code.

from homebrew-services.

oasissoman avatar oasissoman commented on May 21, 2024 1

When I ssh into a remote mac brew services restart does not work.

Apparently since end of September with the introduction of systemctl and the warning about user/* and gui/* domains(9f7d575)

brew services restart node_exporter --debug only shows a repeated

▶ brew services stop node_exporter --debug
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading node_exporter from API
==> /bin/launchctl list homebrew.mxcl.node_exporter
{
	"StandardOutPath" = "/usr/local/var/log/node_exporter.log";
	"LimitLoadToSessionType" = "Aqua";
	"StandardErrorPath" = "/usr/local/var/log/node_exporter.err.log";
	"Label" = "homebrew.mxcl.node_exporter";
	"OnDemand" = true;
	"LastExitStatus" = 0;
	"PID" = 40425;
	"Program" = "/usr/local/opt/node_exporter/bin/node_exporter_brew_services";
	"ProgramArguments" = (
		"/usr/local/opt/node_exporter/bin/node_exporter_brew_services";
	);
};
Stopping `node_exporter`... (might take a while)
Warning: running over SSH, using user/* instead of gui/* domain!
Hide this warning by setting HOMEBREW_SERVICES_NO_DOMAIN_WARNING.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> /bin/launchctl list homebrew.mxcl.node_exporter
{
	"StandardOutPath" = "/usr/local/var/log/node_exporter.log";
	"LimitLoadToSessionType" = "Aqua";
	"StandardErrorPath" = "/usr/local/var/log/node_exporter.err.log";
	"Label" = "homebrew.mxcl.node_exporter";
	"OnDemand" = true;
	"LastExitStatus" = 0;
	"PID" = 40425;
	"Program" = "/usr/local/opt/node_exporter/bin/node_exporter_brew_services";
	"ProgramArguments" = (
		"/usr/local/opt/node_exporter/bin/node_exporter_brew_services";
	);
};
==> /bin/launchctl list homebrew.mxcl.node_exporter
{
	"StandardOutPath" = "/usr/local/var/log/node_exporter.log";
	"LimitLoadToSessionType" = "Aqua";
	"StandardErrorPath" = "/usr/local/var/log/node_exporter.err.log";
	"Label" = "homebrew.mxcl.node_exporter";
	"OnDemand" = true;
	"LastExitStatus" = 0;
	"PID" = 40425;
	"Program" = "/usr/local/opt/node_exporter/bin/node_exporter_brew_services";
	"ProgramArguments" = (
		"/usr/local/opt/node_exporter/bin/node_exporter_brew_services";
	);
};
....loooooop

Any idea why and how I can further troubleshoot this?

Native on the machine it works without a problem.

▶ brew config
HOMEBREW_VERSION: 4.1.20-11-g6de29c2
ORIGIN: https://github.com/Homebrew/brew
HEAD: 6de29c2f65c909bcc38432feafdaa71322d8bf78
Last commit: 12 hours ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: ec3a0feb573154833c186388cbd3f8b11d213813
Core tap last commit: 8 hours ago
Core tap branch: master
Core tap JSON: 14 Nov 08:15 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 2.6.10 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.10_1/bin/ruby
CPU: octa-core 64-bit haswell
Clang: 13.0.0 build 1300
Git: 2.42.1 => /usr/local/bin/git
Curl: 8.1.2 => /usr/bin/curl
macOS: 12.7.1-x86_64
CLT: 14.2.0.0.1.1668646533
Xcode: 13.2.1
▶ brew services restart node_exporter --debug
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading node_exporter from API
==> /bin/launchctl list homebrew.mxcl.node_exporter
{
	"StandardOutPath" = "/usr/local/var/log/node_exporter.log";
	"LimitLoadToSessionType" = "Aqua";
	"StandardErrorPath" = "/usr/local/var/log/node_exporter.err.log";
	"Label" = "homebrew.mxcl.node_exporter";
	"OnDemand" = true;
	"LastExitStatus" = 0;
	"PID" = 10832;
	"Program" = "/usr/local/opt/node_exporter/bin/node_exporter_brew_services";
	"ProgramArguments" = (
		"/usr/local/opt/node_exporter/bin/node_exporter_brew_services";
	);
};
==> /bin/launchctl list homebrew.mxcl.node_exporter
{
	"StandardOutPath" = "/usr/local/var/log/node_exporter.log";
	"LimitLoadToSessionType" = "Aqua";
	"StandardErrorPath" = "/usr/local/var/log/node_exporter.err.log";
	"Label" = "homebrew.mxcl.node_exporter";
	"OnDemand" = true;
	"LastExitStatus" = 0;
	"PID" = 10832;
	"Program" = "/usr/local/opt/node_exporter/bin/node_exporter_brew_services";
	"ProgramArguments" = (
		"/usr/local/opt/node_exporter/bin/node_exporter_brew_services";
	);
};
==> /bin/launchctl list homebrew.mxcl.node_exporter
{
	"StandardOutPath" = "/usr/local/var/log/node_exporter.log";
	"LimitLoadToSessionType" = "Aqua";
	"StandardErrorPath" = "/usr/local/var/log/node_exporter.err.log";
	"Label" = "homebrew.mxcl.node_exporter";
	"OnDemand" = true;
	"LastExitStatus" = 0;
	"PID" = 10832;
	"Program" = "/usr/local/opt/node_exporter/bin/node_exporter_brew_services";
	"ProgramArguments" = (
		"/usr/local/opt/node_exporter/bin/node_exporter_brew_services";
	);
};
Stopping `node_exporter`... (might take a while)
==> /bin/launchctl print gui/501/homebrew.mxcl.node_exporter

==> /bin/launchctl print gui/501/homebrew.mxcl.node_exporter

==> Successfully stopped `node_exporter` (label: homebrew.mxcl.node_exporter)
==> Successfully started `node_exporter` (label: homebrew.mxcl.node_exporter)
``


from homebrew-services.

logopk avatar logopk commented on May 21, 2024

Once I replace

"user/#{Process.uid}"

with

"gui/#{Process.uid}"
in homebrew-services/lib/service/system.rb everything works... :-)

from homebrew-services.

MikeMcQuaid avatar MikeMcQuaid commented on May 21, 2024

"gui/#{Process.uid}"
in homebrew-services/lib/service/system.rb everything works... :-)

This will only work if a user is already logged in. That said: I think it would be a good idea to make this behaviour either configurable or detect the cases like yours in which it could/should work.

Will review PRs!

from homebrew-services.

logopk avatar logopk commented on May 21, 2024

AFAIK User-Services will run only if a user has been logged in once. This works in my case for gitlab-runner and node-exporter (as LauchAgents).

rsyslogd runs as root without login (as LaunchDaemon)

from homebrew-services.

MikeMcQuaid avatar MikeMcQuaid commented on May 21, 2024

When I ssh into a remote mac brew services restart does not work.

We would need to add an option to allow you to force the usage of gui/* in that case. You cannot start services that way reliably unless the same user is already logged into a GUI session.

Again: this could be perhaps be detected automatically and handled via code.

from homebrew-services.

kevinm6 avatar kevinm6 commented on May 21, 2024

We would need to add an option to allow you to force the usage of gui/* in that case. You cannot start services that way reliably unless the same user is already logged into a GUI session.

Again: this could be perhaps be detected automatically and handled via code.

Hi @MikeMcQuaid and thanks for the amazing software.
I kinda have the same issue when I ssh into my other Mac where I have local taps with brew services configured.
Should it be possible to add maybe a ENV var that handle this?

Maybe something like this: (using a ENV var HOMEBREW_FORCE_SSH_GUI)

def domain_target
  if root?
    "system"
  elsif ((ssh_tty = ENV.fetch("HOMEBREW_SSH_TTY", nil).present?) || ENV.fetch("HOMEBREW_SUDO_USER", nil).present?)
 && ENV.fetch("HOMEBREW_FORCE_SSH_GUI", nil).nil?
 
    if @output_warning.blank? && ENV.fetch("HOMEBREW_SERVICES_NO_DOMAIN_WARNING", nil).blank?
      if ssh_tty
        opoo "running over SSH, using user/* instead of gui/* domain!"
      else
        opoo "running through sudo, using user/* instead of gui/* domain!"
      end
      unless Homebrew::EnvConfig.no_env_hints?
        puts "Hide this warning by setting HOMEBREW_SERVICES_NO_DOMAIN_WARNING."
        puts "Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`)."
      end
      @output_warning = true
    end
    "user/#{Process.uid}"
  else
    "gui/#{Process.uid}"
  end
end

(Sorry but I don’t know Ruby that much)

from homebrew-services.

logopk avatar logopk commented on May 21, 2024

When I ssh into a remote mac brew services restart does not work.

We would need to add an option to allow you to force the usage of gui/* in that case. You cannot start services that way reliably unless the same user is already logged into a GUI session.

Again: this could be perhaps be detected automatically and handled via code.

@MikeMcQuaid Thanks for your support. Just to clarify: I am logged in (with the same user) on the remote machine. When I ssh into the machine from remote (VPN or so) the problem starts.

from homebrew-services.

oasissoman avatar oasissoman commented on May 21, 2024

بمجرد استبدال

"user/#{Process.uid}"

مع.

"gui/#{Process.uid}"في homebrew-services/lib/service/system.rb كل شيء يعمل...:-)

https://github.com/Homebrew/homebrew-core

from homebrew-services.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.