portmaster icon indicating copy to clipboard operation
portmaster copied to clipboard

Core service not starting after restart

Open ghost opened this issue 2 years ago • 24 comments

Pre-Submit Checklist:

What happened: After installing the portmaster, it would work as expected, but after a computer restart it would ask for a password to start the core service but would never start after the password was given

What did you expect to happen?: for the core service to start after the password was inputted

How did you reproduce it?:

  1. uninstall the portmaster
  2. install the portmaster rpm with zypper
  3. run the portmaster and input the password
  4. restart the computer
  5. run the portmaster and enter the password
  6. see the issue

Debug Information:

Version: 0.7.12 OS: openSUSE Tumbleweed 20211220 Kernel: 5.15.8-1

ghost avatar Dec 23 '21 13:12 ghost

Hey @BobIsMyManager, thanks for reporting this!

It sounds like the core service is not starting on boot and when triggered by the UI. Can you paste the output of systemctl status portmaster?

dhaavi avatar Dec 31 '21 11:12 dhaavi

Unit portmaster.service could not be found. even though the app does start on boot, just not the core service

ghost avatar Dec 31 '21 13:12 ghost

It seems it hasn't installed correctly. Have you tried removing and installing again?

dhaavi avatar Dec 31 '21 14:12 dhaavi

yes and it works when i reinstall it until my pc restarts where it stops working again

ghost avatar Dec 31 '21 14:12 ghost

after i install it it says Additional rpm output: portmaster: Configuring portmaster.service to launch at boot Created symlink /etc/systemd/system/multi-user.target.wants/portmaster.service -> /opt/safing/portmaster/portmaster.service. Created symlink /etc/systemd/system/portmaster.service -> /opt/safing/portmaster/portmaster.service. chcon: can't apply partial context to unlabeled file '/opt/safing/portmaster/portmaster-start' warning: %post(portmaster-0:0.7.0~1-1.x86_64) scriptlet failed, exit status 1

ghost avatar Dec 31 '21 14:12 ghost

Sounds like chcon is applying the wrong SELinux context, so probably can try manually changing it to see if it works or possibly using semanage to relabel the file.

Haven't particularly dealt with openSUSE, but could possibly help you.

VottonDev avatar Jan 14 '22 22:01 VottonDev

We are currently investigating some SELinux stuff, hopefully we'll have an update on this soon.

Tracking internally at CC#2168.

dhaavi avatar Jan 27 '22 14:01 dhaavi

I also now seem to have an issue where similarly to #487, the GUI of the app wont start. The output of trying to start the app with /opt/safing/portmaster/portmaster-start app is: Error: please set the data directory using --data=/path/to/data/dir

ghost avatar Jan 27 '22 15:01 ghost

And once i set the data directory using sudo /opt/safing/portmaster/portmaster-start --data=/opt/safing/portmaster app, this is what happens

[control] 2022/02/06 21:11:39 app/portmaster-app.zip failed with: could not get component: the requested file is not available locally
[control] 2022/02/06 21:11:41 app/portmaster-app.zip failed with: could not get component: the requested file is not available locally
[control] 2022/02/06 21:11:45 updating registry index
[control] 2022/02/06 21:11:45 app/portmaster-app.zip failed with: could not get component: the requested file is not available locally
[control] 2022/02/06 21:11:51 updating registry index
[control] 2022/02/06 21:11:51 app/portmaster-app.zip failed with: could not get component: the requested file is not available locally
[control] 2022/02/06 21:11:59 updating registry index
[control] 2022/02/06 21:11:59 app/portmaster-app.zip failed with: could not get component: the requested file is not available locally
[control] 2022/02/06 21:11:59 encountered 5 consecutive errors, giving up ...
Error: could not get component: the requested file is not available locally

edit: this was fixed after an update

ghost avatar Feb 06 '22 22:02 ghost

Ive managed to collect more info to try help you guys out:

  1. After starting the portmaster, Error: connect ECONNREFUSED 127.0.0.1:817 keeps appearing in the terminal infinitely

  2. After pressing start core service and entering the root password, this error appears

Error occurred in handler for 'api.startService': {
  error: Error: Command failed: cd "/home/BIMM"; "/usr/bin/pkexec" --disable-internal-agent /bin/bash -c "echo SUDOPROMPT; systemctl start portmaster.service --no-pager"
  Failed to start portmaster.service: Unit portmaster.service not found.

      at ChildProcess.exithandler (child_process.js:317:12)
      at ChildProcess.emit (events.js:315:20)
      at maybeClose (internal/child_process.js:1048:16)
      at Socket.<anonymous> (internal/child_process.js:439:11)
      at Socket.emit (events.js:315:20)
      at Pipe.<anonymous> (net.js:673:12) {
    killed: false,
    code: 5,
    signal: null,
    cmd: 'cd "/home/BIMM"; "/usr/bin/pkexec" --disable-internal-agent /bin/bash -c "echo SUDOPROMPT; systemctl start portmaster.service --no-pager"'
  },
  stdout: '',
  stderr: 'Failed to start portmaster.service: Unit portmaster.service not found.\n'
}
  1. When the portmaster starts and when the root password is entered, this appears
(portmaster-app_v0-2-2:2972): LIBDBUSMENU-GLIB-WARNING **: 22:13:22.002: About to Show called on an item wihtout submenus.  We're ignoring it.

Hopefully this can help you guys figure out whats causing this issue 😃

ghost avatar Feb 06 '22 22:02 ghost

It looks like you're still missing the portmaster.service file. Can you try following the manual install instructions from here?

dhaavi avatar Feb 11 '22 12:02 dhaavi

This is what happens when i run sudo /opt/safing/portmaster/portmaster-start core. Here is a snippet of what is being spammed in console

220211 17:41:04.685 les/worker:098 ▶ INFO 620 nameserver: service-worker dns resolver requested restart: stopped conflicting name service with pid 718 - restarting now
220211 17:41:04.685 r/takeover:118 ▶ WARN 621 nameserver: killed conflicting service with PID 718 over [::1]:53

https://user-images.githubusercontent.com/70704875/153641629-378e4275-4932-4419-a665-b8dc67dcaec6.mov

ghost avatar Feb 11 '22 17:02 ghost

It looks like you have another service running on port 53 - is it possible to disable that?

Also, the Portmaster should not go into a loop like this, will investigate.

dhaavi avatar Feb 11 '22 17:02 dhaavi

I disabled the service on port 53 and now things seem to work now! Screenshot_20220211_175935

ghost avatar Feb 11 '22 18:02 ghost

It seems that when I start the core service by pressing the button on the portmaster, it doesnt work, but when I start it manually in the command line, it does work.

ghost avatar Feb 11 '22 19:02 ghost

Another weird bug that seems to be related to this issue (this happens every time I restart my system):

20220326_12h58m24s_grim

And when trying to execute sudo chcon -t bin_t /opt/safing/portmaster/portmaster-start to fix this according to the portmaster docs, I get this error:

chcon: can't apply partial context to unlabeled file '/opt/safing/portmaster/portmaster-start'

ghost avatar Mar 27 '22 12:03 ghost

I disabled the service on port 53 and now things seem to work now!

Great!

It seems that when I start the core service by pressing the button on the portmaster, it doesnt work, but when I start it manually in the command line, it does work.

How are you trying to start it?

Another weird bug that seems to be related to this issue (this happens every time I restart my system):

The Portmaster is a system service, so you might need to use sudo systemctl status portmaster.

And when trying to execute sudo chcon -t bin_t /opt/safing/portmaster/portmaster-start to fix this according to the portmaster docs, I get this error:

We are still getting this (SELinux) sorted out and we will update the docs when ready.

dhaavi avatar Mar 28 '22 15:03 dhaavi

How are you trying to start it?

When starting the core service with sudo /opt/safing/portmaster/portmaster-start core or sudo systemctl enable --now portmaster it works as intended, but when trying to start it by pressing the button below, nothing happens. 20220328_17h50m11s_grim

The Portmaster is a system service, so you might need to use sudo systemctl status portmaster.

The same thing still happens 20220328_17h51m38s_grim

ghost avatar Mar 28 '22 16:03 ghost

Edited: sorry I didn't read through the whole issue comments so my comment didn't apply. I'll try to reproduce the systemctl issue. This is really weird since systemd does find the service file when trying to enable it.

Can you post the output of ls -lah /etc/systemd/system/portmaster.service please?

ppacher avatar Mar 29 '22 07:03 ppacher

Can you post the output of ls -lah /etc/systemd/system/portmaster.service please?

lrwxrwxrwx 1 root root 41 Mar 25 17:56 /etc/systemd/system/portmaster.service -> /opt/safing/portmaster/portmaster.service

ghost avatar Mar 29 '22 16:03 ghost

Now when executing sudo systemctl --user start portmaster I get the response: Failed to connect to bus: No medium found

EDIT: using sudo systemctl enable --now portmaster works fine

ghost avatar Mar 31 '22 18:03 ghost

Is this still an issue?

ppacher avatar Sep 15 '22 13:09 ppacher

Probably, some things have changed over time so I'll get back to you on that once I update portmaster.

somerandomguy24 avatar Sep 15 '22 16:09 somerandomguy24

Yep, the issue is still here. When using the guide for SELinux, there are no entries when running journalctl -u portmaster. Plus, when running sudo chcon -t bin_t /opt/safing/portmaster/portmaster-start, I get there response:

chcon: can't apply partial context to unlabeled file '/opt/safing/portmaster/portmaster-start'

somerandomguy24 avatar Sep 15 '22 17:09 somerandomguy24