-
-
Save zany130/ba610a7391fcee4e4e7a20cbd06bc754 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash | |
######################################################################################################################## | |
### credits to WinkelCode for orginal script and the portmaster team for the awesome software! | |
### See | |
### https://gist.github.com/zany130/ba610a7391fcee4e4e7a20cbd06bc754?permalink_comment_id=5758560#gistcomment-5758560 | |
### for installation steps from S7venLights | |
### you may have issues with portmaster service starting on reboot and SElinux see installation steps for details. | |
######################################################################################################################## | |
set -e # Exit on error | |
if [ "$EUID" -ne 0 ]; then | |
echo "To ensure correct permissions, this script must be run as root." | |
exit 1 | |
fi | |
# Paths to use for portmaster install Must not include trailing slash | |
data_dir="/var/lib/portmaster" | |
log_dir="/var/lib/portmaster/logs" | |
bin_dir="/var/lib/portmaster/bin" | |
systemd_dir="/etc/systemd/system" | |
autostart_dir="/etc/xdg/autostart" | |
exports_dir="${bin_dir}/exports" | |
# =================================== | |
# STEP 1: Install Portmaster | |
# (install all necessary files) | |
# =================================== | |
# Create directory for binaries | |
mkdir -p "${bin_dir}" | |
cd "${bin_dir}" | |
# Download Portmaster UpdateManager utility | |
echo "[+] Downloading Portmaster UpdateManager..." | |
wget https://updates.safing.io/latest/linux_amd64/updatemgr/updatemgr | |
chmod a+x updatemgr | |
# Download latest binaries | |
echo "[+] Downloading Portmaster binaries..." | |
./updatemgr download https://updates.safing.io/stable.v3.json "${bin_dir}" | |
chmod a+x "${bin_dir}/portmaster" # Ensure binary is executable | |
chmod a+x "${bin_dir}/portmaster-core" # Ensure binary is executable | |
# Download latest data files | |
echo "[+] Downloading Portmaster data files..." | |
mkdir -p "${data_dir}"/intel | |
./updatemgr download https://updates.safing.io/intel.v3.json "${data_dir}/intel" | |
# (Optional) | |
# If the SELinux module is enabled, set correct SELinux context for the Portmaster core binary. | |
# This ensures the binary can be executed properly under SELinux policies, avoiding permission issues. | |
if command -v semanage >/dev/null 2>&1; then | |
echo "[ ] Fixing SELinux permissions" | |
semanage fcontext -a -t bin_t -s system_u "$(realpath "${bin_dir}")" || : | |
restorecon -R "${bin_dir}/portmaster-core" 2>/dev/null >&2 || :1 | |
fi | |
# Clean up | |
rm -f "${bin_dir}/updatemgr" | |
# Done | |
echo "[i] At this point, Portmaster is installed." | |
echo " You can start manually running the Portmaster daemon with:" | |
echo " ${bin_dir}/portmaster-core --log-stdout" | |
echo " To start User Interface, run:" | |
echo " ${bin_dir}/portmaster" | |
# =================================== | |
# STEP 2: Register Portmaster service | |
# (for systemd-based systems) | |
# =================================== | |
mkdir -p "${exports_dir}/units" | |
echo "[+] Registering Portmaster service" | |
cat <<EOF > "${systemd_dir}/portmaster.service" | |
[Unit] | |
Description=Portmaster by Safing | |
Documentation=https://safing.io | |
Documentation=https://docs.safing.io | |
Before=nss-lookup.target network.target shutdown.target | |
After=systemd-networkd.service | |
Conflicts=shutdown.target | |
Conflicts=firewalld.service | |
Wants=nss-lookup.target | |
[Service] | |
Type=simple | |
Restart=on-failure | |
RestartSec=10 | |
RestartPreventExitStatus=24 | |
LockPersonality=yes | |
MemoryDenyWriteExecute=yes | |
MemoryLow=2G | |
NoNewPrivileges=yes | |
PrivateTmp=yes | |
PIDFile=${data_dir}/core-lock.pid | |
Environment=LOGLEVEL=info | |
Environment=PORTMASTER_ARGS= | |
EnvironmentFile=-/etc/default/portmaster | |
ProtectSystem=true | |
ReadWritePaths=${data_dir} | |
RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6 | |
RestrictNamespaces=yes | |
ProtectHome=read-only | |
ProtectKernelTunables=yes | |
ProtectKernelLogs=yes | |
ProtectControlGroups=yes | |
PrivateDevices=yes | |
AmbientCapabilities=cap_chown cap_kill cap_net_admin cap_net_bind_service cap_net_broadcast cap_net_raw cap_sys_module cap_sys_ptrace cap_dac_override cap_fowner cap_fsetid cap_sys_resource cap_bpf cap_perfmon | |
CapabilityBoundingSet=cap_chown cap_kill cap_net_admin cap_net_bind_service cap_net_broadcast cap_net_raw cap_sys_module cap_sys_ptrace cap_dac_override cap_fowner cap_fsetid cap_sys_resource cap_bpf cap_perfmon | |
StateDirectory=portmaster | |
WorkingDirectory=${data_dir} | |
ExecStart=${bin_dir}/portmaster-core --log-dir=${log_dir} --bin-dir ${bin_dir} --data-dir ${data_dir} -- $PORTMASTER_ARGS | |
ExecStopPost=-${bin_dir}/portmaster-core -recover-iptables | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
systemctl daemon-reload | |
systemctl enable portmaster | |
ln -s "${systemd_dir}/portmaster.service" "${exports_dir}/units/portmaster.service" | |
# =================================== | |
# STEP 3: Register Portmaster UI | |
# (for desktop environments) | |
# =================================== | |
# Install Portmaster UI start script | |
echo "[+] Installing Portmaster UI start script" | |
cat <<EOF > "${bin_dir}/portmaster-ui-start.sh" | |
#!/bin/sh | |
WEBKIT_DISABLE_COMPOSITING_MODE=1 ${bin_dir}/portmaster "$@" | |
EOF | |
chmod a+x "${bin_dir}/portmaster-ui-start.sh" | |
# Register Portmaster UI in the system | |
echo "[+] Registering Portmaster UI .desktop file" | |
mkdir -p "${exports_dir}/share/applications" | |
cat <<EOF > "${exports_dir}/share/applications/portmaster.desktop" | |
[Desktop Entry] | |
Name=Portmaster | |
GenericName=Application Firewall | |
Exec=${bin_dir}/portmaster-ui-start.sh --with-prompts --with-notifications | |
Icon=portmaster | |
StartupWMClass=portmaster | |
Terminal=false | |
Type=Application | |
Categories=System | |
EOF | |
# Register Portmaster UI to automatically start on login | |
echo "[+] Registering Portmaster UI to start on login" | |
mkdir -p "${autostart_dir}" | |
cat <<EOF > "${autostart_dir}/portmaster-autostart.desktop" | |
[Desktop Entry] | |
Name=Portmaster | |
GenericName=Application Firewall Notifier | |
Exec=${bin_dir}/portmaster-ui-start.sh --with-prompts --with-notifications --background | |
Icon=portmaster | |
Terminal=false | |
Type=Application | |
Categories=System | |
NoDisplay=true | |
EOF | |
# Register Portmaster icon | |
echo "[+] Registering Portmaster icon" | |
wget https://raw.githubusercontent.com/safing/portmaster-packaging/master/linux/portmaster_logo.png -O "${exports_dir}/share/icons/portmaster.png" | |
# Adding install_location to XDG_DATA_DIRS to show desktop entries (applies after next login)" | |
echo "-> Adding '${exports_dir}' to \$XDG_DATA_DIRS to show desktop entries (applies after next login)" | |
echo "XDG_DATA_DIRS=${exports_dir}/share:\$XDG_DATA_DIRS" >/etc/profile.d/zzz-portmaster-to-xdg-data-dirs.sh # We prepend 'zzz' since profile.d scripts aren't numbered on Fedora, and we want to run after any other scripts that modify XDG_DATA_DIRS. |
On Bazzite, this command will fix the portmaster.service failing to start in systemd due to SELinux permissions
sudo chcon -t bin_t /var/lib/portmaster/bin/portmaster-core
This should be covered by https://gist.github.com/zany130/ba610a7391fcee4e4e7a20cbd06bc754#file-install_portmaster_to_var_v2-sh-L47 I think maybe the if fails, and it doesn't run it?
I'll be honest, I'm not very familiar with SELinux (although I should because my Bazzite system does use it lol). I think that part came from the Safing manual install script https://wiki.safing.io/en/Portmaster/Install/Linux#manual-installation-script
Thanks for this script it mostly worked for me :)
My install guide/advice (for the benefit of others):
@zany130 points 7-10 is the only NB bit for you and tell me if pont 15 is correct?
- BACKUPS NB: I went into my V1 Portmaster and did a manual export of the global settings from within the portmaster UI (I suggest first setting Portmaster to prompt mode (this will ensure no apps can make connections without you explicitly allowing them when you reconnect in V2). Backup some specific app configs via the UI option 'Export settings' or better yet open the 'Apps and Profiles' tab, open an app you want to backup, click the 'more' button and choose export app profile. Note: you can't re-open PortmasterV1 after V2 is installed so make sure you export config backups for all the apps you want to now. Unfortunately you have to do this 1 app at a time.
- I downloaded this script (above) using the 'Download Zip' button top right of github
- I saved it, extracted it, right clicked on it, properties, permissions, checked 'allow executing file as program'
- Closed all apps to avoid internet activity during/after install as portmaster v1 may stop working after V2 installs. Note: once the script reaches '[ ] Fixing SELinux permissions' you can disconnect from the internet if you want to be sure of no leaks after install.
- In a KDE distro you are able to copy the directory of a file by selecting it and hitting: ctrl+alt+c
- open a Terminal/command line and input: sudo and ctrl+shift+c to paste your directory the command should look like this:
sudo path/to/your/file/install_portmaster_to_var_V2.sh
Hit enter and this is what a normal install should look like (note it doesn't show progress for all downloads so it may seem frozen but it's probably not):
sudo /var/home/user/Applications/Portmaster/V2/install_portmaster_to_var_V2.sh
[+] Downloading Portmaster UpdateManager...
Saving 'updatemgr.1'
HTTP response 200 [https://updates.safing.io/latest/linux_amd64/updatemgr/updatemgr]
updatemgr.1 100% [======================================================================>] 4.75M 429.99KB/s
[Files: 1 Bytes: 4.75M [397.45KB/s] Redirects: 0 Todo: 0 Errors: 0 ]
[+] Downloading Portmaster binaries...
2025-09-13 22:01:27.633 BOF βΆ
2025-09-13 22:01:27.634 running 2.0.20 dev build (linux/amd64; built with go1.24.2 [gc -cgo] from 70da66b1209293ceda0b5519dc54e4b5e97b4737 [clean] at 2025-06-13T10:21:54Z)
2025-09-13 22:01:31.591 INF tes/module:345 βΆ 001 updates/Downloader: downloading new version: Portmaster Binaries 2.0.25
2025-09-13 22:01:34.735 INF downloader:193 βΆ 002 updates/Downloader: downloaded and verified assets.zip
2025-09-13 22:04:08.883 INF downloader:193 βΆ 003 updates/Downloader: downloaded and verified portmaster
2025-09-13 22:06:39.131 INF downloader:193 βΆ 004 updates/Downloader: downloaded and verified portmaster-core
2025-09-13 22:06:46.885 INF downloader:193 βΆ 005 updates/Downloader: downloaded and verified portmaster.zip
2025-09-13 22:06:46.971 INF es/upgrade:127 βΆ 006 updates/Downloader: update complete (v2.0.25 from 2025-09-05 12:31:00.856184125 +0300 +0300)
2025-09-13 22:06:46.990 EOF β
[+] Downloading Portmaster data files...
2025-09-13 22:06:47.083 BOF βΆ
2025-09-13 22:06:47.083 running 2.0.20 dev build (linux/amd64; built with go1.24.2 [gc -cgo] from 70da66b1209293ceda0b5519dc54e4b5e97b4737 [clean] at 2025-06-13T10:21:54Z)
2025-09-13 22:06:47.896 INF tes/module:345 βΆ 001 updates/Downloader: downloading new version: Portmaster Intel 20250901.0.0
2025-09-13 22:06:48.244 INF downloader:193 βΆ 002 updates/Downloader: downloaded and verified main-intel.yaml
2025-09-13 22:06:48.418 INF downloader:193 βΆ 003 updates/Downloader: downloaded and verified notifications.yaml
2025-09-13 22:06:48.589 INF downloader:193 βΆ 004 updates/Downloader: downloaded and verified news.yaml
2025-09-13 22:06:48.762 INF downloader:193 βΆ 005 updates/Downloader: downloaded and verified index.dsd
2025-09-13 22:07:58.535 INF downloader:193 βΆ 006 updates/Downloader: downloaded and verified base.dsdl
2025-09-13 22:08:20.476 INF downloader:193 βΆ 007 updates/Downloader: downloaded and verified intermediate.dsdl
2025-09-13 22:08:21.332 INF downloader:193 βΆ 008 updates/Downloader: downloaded and verified urgent.dsdl
2025-09-13 22:09:39.803 INF downloader:193 βΆ 009 updates/Downloader: downloaded and verified geoipv4.mmdb
2025-09-13 22:11:03.784 INF downloader:193 βΆ 010 updates/Downloader: downloaded and verified geoipv6.mmdb
2025-09-13 22:11:03.935 INF es/upgrade:127 βΆ 011 updates/Downloader: update complete (v20250901.0.0 from 2025-09-01 00:00:29.793935909 +0000 UTC)
2025-09-13 22:11:03.960 EOF β
[ ] Fixing SELinux permissions
[i] At this point, Portmaster is installed.
You can start manually running the Portmaster daemon with:
/var/lib/portmaster/bin/portmaster-core --log-stdout
To start User Interface, run:
/var/lib/portmaster/bin/portmaster
[+] Registering Portmaster service
[+] Installing Portmaster UI start script
[+] Registering Portmaster UI .desktop file
[+] Registering Portmaster UI to start on login
[+] Registering Portmaster icon
Saving '/var/lib/portmaster/bin/exports/share/icons/portmaster.png'
HTTP response 200 [https://raw.githubusercontent.com/safing/portmaster-packaging/master/linux/portmaster_logo.png]
/var/lib/portmaster/ 100% [======================================================================>] 30.62K --.-KB/s
[Files: 1 Bytes: 30.62K [54.98KB/s] Redirects: 0 Todo: 0 Errors: 0 ]
-> Adding '/var/lib/portmaster/bin/exports' to $XDG_DATA_DIRS to show desktop entries (applies after next login)
- At this point you can reboot and Portmaster V2 should start at boot. But in my case it didn't work properly. At boot, the portmaster service was running but the notifier service in the quick tray icons was showing red and if I tried to open portmaster UI from there, it didn't open.
- I then tried to manually start the UI from terminal:
var/lib/portmaster/bin/portmaster-core --log-stdout
2025-09-13 22:28:10.892 BOF βΆ
2025-09-13 22:28:10.892 running Portmaster 2.0.25 (linux/amd64; built with go1.24.7 [gc -cgo] from a66544959c689599ab118b34ffd94ea261aa86c9 [clean] at 2025-09-05T08:17:28Z)
error creating an instance: create database module: failed to create/check database dir "/var/lib/portmaster/databases": could not create dir /var/lib/portmaster/databases: mkdir /var/lib/portmaster/databases: permission denied
- So I ran with Sudo:
[sudo] password for user:
2025-09-13 22:29:50.232 BOF βΆ
2025-09-13 22:29:50.232 running Portmaster 2.0.25 (linux/amd64; built with go1.24.7 [gc -cgo] from a66544959c689599ab118b34ffd94ea261aa86c9 [clean] at 2025-09-05T08:17:28Z)
error creating an instance: create updates module: create update target directory: /var/lib/portmaster/download_binaries
- I ran the command @JoshuaMacklin suggested:
sudo chcon -t bin_t /var/lib/portmaster/bin/portmaster-core
and then manual start
sudo /var/lib/portmaster/bin/portmaster-core --log-stdout
immediatly portmaster V2 came online and launched
So @zany130 seems there's an issue to iron out there.
- I imported my v1 exported settings successfully. I suggest setting Portmaster to prompt mode (this will ensure no apps can make connections without you explicitly allowing them).
- Reconnecting to the internet is safe now
- I was going to experiment with copying the V1 files to the V2 directory to get all my app configs brought over but there were some different file types in the database directory, so I decided not to risk it.
- Instead I can import my manual app settings exported from V1, as seen in step 1. To do so, go to the 'Apps and Profiles' tab, click the 'Manage' button top right and import profile. But if you exported settimgs and not profiles:
Then the app you want to restore may have to have run at least once, then in the 'Apps and Profiles' tab click on the app you want to restore, click on it's settings tab, click import settings, click in the empty box before clicking the 'choose' button. (Note if portmaster is in prompt mode and the app is making many connection attempts, you may experience an issue where the portmaster UI freezes and you can't get to the import button, to resolve, either close the app or allow the prompts manually until the UI loads)
14.2 If you don't want to use 'Prompt mode' you can turn it off once you're happy with your config imports.
15: When you're ready (happy the new install is stable) you can remove the old v1 portmaster @winkelcode script files by running:
sudo rm -rf /var/lib/safing-portmaster
- To totally remove this portmaster install run these commands:
systemctl disable --now portmaster.service
sudo rm -rf /var/lib/portmaster
sudo rm /etc/systemd/system/portmaster.service
sudo rm /etc/profile.d/zzz-portmaster-to-xdg-data-dirs.sh
17: To restore V1 you can probably just re-run the Winkelcode script
That's it, enjoy!
Oh yeah, now that you mention it, I remember getting the database error, yeah, it looks like it tries to create a folder for it and fails (maybe because of selinux?), not really sure what can be done to the script to cover that
i think what i did in my case was i manually created the folder it was expecting i don't rember doing any extra selinux stuff. Honestly, I think I asked ChatGPT for help on that lol
If anyone finds a way to fix it in the script, let me know so I can add it. I'll try to find time to look into it more. Maybe we need to do more SELinux fixes like JoshuaMacklin said
Thanks for the detailed instructions btw @S7venLights good stuff!
Pleasure :) least I could do, you did the heavy lifting. Is my point 15 correct? Maybe @WinkelCode knows what to do about SElinux?
i think point 15 is fine i never tested to see what happens if you have both installed, but i think my script replaces all systemd services and autostart files so it shouldnt be a problem (nothing will call the old v1 portmaster)
EDIT: Oh yeah, the old script did everything in an exports folder, so it's all self-contained in /var/lib/safing-portmaser
I guess if you still had its systemd service loaded, it could cause issues, so it might be best to remove the exports folder or, at the very least, disable the service before hand.
And then uninstalling should be a matter of removing the old Portmaster files, as you said. I'm going to see if I can link to your post for the instruction in the op so it's more visible
it might be best to remove the exports folder or, at the very least, disable the service before hand.
As in before installing V2?
I suppose if one did that they'd risk leaks while downloading v2?
Everything seems to be running fine the way I did it. The only portmaster running on my system is the one from your V2 directory.
If I run systemctl list-units --type=service
I only see 1 portmaster.service
Hmmm I've just had an issue trying to open the UI now.
Right clicked on the tray icon to open.
Window launches, but it's balck and I can't close it (non-responsive)
I tried to troubleshoot:
user@bazzite:/var/home/user$ var/lib/portmaster/bin/portmaster-core --log-stdout
bash: var/lib/portmaster/bin/portmaster-core: No such file or directory
user@bazzite:/var/home/user$ /var/lib/portmaster/bin/portmaster-core
error creating an instance: create updates module: create update target directory: /var/lib/portmaster/download_binaries
user@bazzite:/var/home/user$ sudo /var/lib/portmaster/bin/portmaster-core
[sudo] password for user:
error creating an instance: create updates module: create update target directory: /var/lib/portmaster/download_binaries
user@bazzite:/var/home/user$ sudo chcon -t bin_t /var/lib/portmaster/bin/portmaster-core
user@bazzite:/var/home/user$ sudo /var/lib/portmaster/bin/portmaster-core
error creating an instance: create updates module: create update target directory: /var/lib/portmaster/download_binaries
I then ended the portmaster process (Not portmaster-core) in System Monitor and tried to relaunch in CLI:
user@bazzite:/var/lib/portmaster/bin/portmaster
(portmaster:1058708): libayatana-appindicator-WARNING **: 17:49:10.422: libayatana-appindicator is deprecated. Please use libayatana-appindicator-glib in newly written code.
[2025-09-14][15:49:10][portmaster::portmaster][DEBUG] not yet connected to Portmaster API, calling on_disconnect()
[2025-09-14][15:49:10][portmaster::portmaster::websocket][DEBUG] Trying to connect to websocket endpoint
[2025-09-14][15:49:10][portmaster::portmaster::websocket][INFO] Successfully connected to portmaster
[2025-09-14][15:49:10][portmaster::portmaster][DEBUG] connection to portmaster established, calling handlers
[2025-09-14][15:49:10][portmaster::portmaster][DEBUG] number of registered handlers: 1
[2025-09-14][15:49:10][portmaster::portmaster][DEBUG] executing handler.on_connect()
[2025-09-14][15:49:10][portmaster::portmaster][DEBUG] calling registered handler: main-handler
[2025-09-14][15:49:10][portmaster][INFO] connection established, creating main window
[2025-09-14][15:49:10][portmaster::window][DEBUG] [tauri] creating main window
[2025-09-14][15:49:10][portmaster][DEBUG] created main window
[2025-09-14][15:49:10][portmaster::portapi::client][DEBUG] Sending websocket frame: 0|qsub|query runtime:subsystems/
[2025-09-14][15:49:10][portmaster::portapi::client][DEBUG] Sending websocket frame: 1|qsub|query runtime:spn/status
[2025-09-14][15:49:10][portmaster::portapi::client][DEBUG] Sending websocket frame: 2|qsub|query config:spn/enable
[2025-09-14][15:49:10][portmaster::portapi::client][DEBUG] Sending websocket frame: 3|sub|query runtime:modules/core/event/shutdown
[2025-09-14][15:49:10][portmaster::portapi::client][DEBUG] Sending websocket frame: 4|qsub|query notifications:
[2025-09-14][15:49:10][portmaster::traymenu][DEBUG] SPN status update: disabled
[2025-09-14][15:49:10][portmaster::window][DEBUG] [tauri] main window page loaded: http://127.0.0.1:817/ui/modules/portmaster/
[2025-09-14][15:49:11][portmaster::window][DEBUG] [tauri] main window page loaded: http://127.0.0.1:817/ui/modules/portmaster/
[2025-09-14][15:49:11][reqwest::connect][DEBUG] starting new connection: http://127.0.0.1:817/
[2025-09-14][15:49:11][tungstenite::handshake::client][DEBUG] Client handshake done.
[2025-09-14][15:49:11][cookie_store::cookie_store][DEBUG] inserting Set-Cookie 'Cookie { cookie_string: Some("Portmaster-API-Token=cVkrvsKA31kjky-ygFaXFGJNlYETOcvQFe_DSCG-ZLU; Path=/; HttpOnly; SameSite=Strict"), name: Indexed(0, 20), value: Indexed(21, 64), expires: None, max_age: None, domain: None, path: Some(Indexed(71, 72)), secure: None, http_only: Some(true), same_site: Some(Strict), partitioned: None }'
[2025-09-14][15:49:11][portmaster::portmaster::commands][DEBUG] [tauri:rpc:should_show] application should show after bootstrap
[2025-09-14][15:49:11][reqwest::connect][DEBUG] starting new connection: http://127.0.0.1:817/
[2025-09-14][15:49:11][reqwest::connect][DEBUG] starting new connection: http://127.0.0.1:817/
[2025-09-14][15:49:11][reqwest::connect][DEBUG] starting new connection: http://127.0.0.1:817/
[2025-09-14][15:49:12][reqwest::connect][DEBUG] starting new connection: http://127.0.0.1:817/
Gdk-Message: 17:49:12.821: Error 71 (Protocol error) dispatching to Wayland display.
π I've had this issue before
But when launching from the start menu it launched fine π€
Ahh looking over my script it replaces
/etc/profile.d/zzz-portmaster-to-xdg-data-dirs.sh
with the new locations of all the files not appends
So that's why the system no longer sees the old service file because it's not longer on the system path
I actually did that accidentally but it works out perfectly π that file is what allows custom locations for the systems service and all that without it the custom files don't get loaded
(technically since in my script it installs the service to /etc/systemd
the service will still be found even if that file doesn't exist but the old script put the service in the exports folder so needed the file)
As for your issue opening the app I just had something similar after installing a update to port master
I fixed it by re running the install script that should replace everything with the latest files.
On Bazzite, this command will fix the portmaster.service failing to start in systemd due to SELinux permissions
sudo chcon -t bin_t /var/lib/portmaster/bin/portmaster-core