safing / portmaster-packaging

Portmaster packages and installers
GNU General Public License v3.0
49 stars 23 forks source link

Can't install on fedora silverblue #56

Open JeremiahSecrist opened 2 years ago

JeremiahSecrist commented 2 years ago

Pre-Submit Checklist:

What happened: Program failed to install. After install the prerequisites needed for protmaster and rebooted I downloaded the rpm and run rpm-ostree install /path/to/rpm During the installation it failed giving the following error. I understand silver-blue is more edge case scenario. That being said I'm willing to help test an any way possible.

What did you expect to happen?: The program to install properly.

How did you reproduce it?: Simply by downloading and installing into fedora silver-blue

Debug Information: error: Running %post for portmaster: bwrap(/bin/sh): Child process killed by signal 1; run journalctl -t 'rpm-ostree(portmaster.post)' for more information

Portmaster.log

S7venLights commented 1 year ago

@Pryka Oh right I missed the step to create the service as I didn't copy the full instructions.

Tried to do it now but when I get to the command:

sudo systemctl enable --now portmaster
Failed to enable unit: Unit file portmaster.service does not exist.

It seems like Silverblue stores the systemd files in a different spot but this is what happens when I try use that spot:

sudo cp /var/home/D24/Desktop/portmaster/portmaster.service /usr/lib/systemd/system/
cp: cannot create regular file '/usr/lib/systemd/system/portmaster.service': Read-only file system

anyway I'll restart now and see if the /etc/systemd/system/portmaster.service does work. [It didn't]

@Pryka how did you manage this?

S7venLights commented 1 year ago

Anyone else know how I can solve this?

CheariX commented 1 year ago

You could try try:

sudo cp /var/home/D24/Desktop/portmaster/portmaster.service /etc/systemd/system/
S7venLights commented 1 year ago
sudo cp /var/home/D24/Desktop/portmaster/portmaster.service /etc/systemd/system/

Yeah that's what I did originally as the website instructs, and that landed me at the error I mentioned:

sudo systemctl enable --now portmaster
Failed to enable unit: Unit file portmaster.service does not exist.

Just now, I've also edited the paths in the portmaster.service file to match my paths so far as I can find. But same error

WinkelCode commented 1 year ago

Hey everyone, I wrote a script that installs Portmaster to /var/lib/safing-portmaster (or another path), configures SELinux, adds the path for .desktop files, and sets up the services. I tested it in Fedora Kinoite, but I think it should work in Silverblue too.

I recommend testing it in a VM first, and only running it if you understand what each part does.

Script: https://gist.github.com/WinkelCode/dffeb181a4c7903cbc463169324f61b8

Right now the main shortcomings are:

1. Complicated way of adding .desktop files and icons (couldn't find a global lookup directory that isn't Flatpak and is read-write on Kinoite) Edit: Hey, not so sketchy after all, that's how flatpak does it as well! (Script in /etc/profile.d)

  1. Untested self-update functionality, not sure if/where we should put systemd unit and .desktop files in a known location.
  2. It's only tested on Kinoite, and should work with a clean install. If it were a "production-ready" script, it would need better error handling/prevention (for example it can fail if certain folders don't exit yet, again, use only if you understand how it works).
travier commented 1 year ago

As anyone tried repackaging the RPM content without the scripts so that it installs via rpm-ostree?

S7venLights commented 1 year ago

Ooo exciting, and I've recently rebased to Kionite.

Do you think the script will solve the error I had before? (Posted above)

WinkelCode commented 1 year ago

Ooo exciting, and I've recently rebased to Kionite.

Do you think the script will solve the error I had before? (Posted above)

With my script (unrelated to the .rpm) I ran into issues where systemd would return vague "this service does not exist" errors. In my case it was because it acts weird when symlinking in units from different filesystems. However that shouldn't be the issue in your case. I wonder if you maybe missed a path or it's a permissions thing, since it came from your home directory? Try my command:

install_location="/var/lib/safing-portmaster" # Must not include trailing slash
sed -i "s|/opt/safing/portmaster|${install_location}|g" "$temp_dir/portmaster.service" # Change last path to where the unit file is

Make sure that the target path doesn't have a trailing slash, there is a spot in the file where it is written without it.

Edit: Fixed text errors

Edit 2: More text fixes (I just woke up lol)

WinkelCode commented 1 year ago

As anyone tried repackaging the RPM content without the scripts so that it installs via rpm-ostree?

Given my script works great (at least on my test system), I've been thinking about just writing an .rpm package from scratch. I've done exactly this for Silverblue/Kinoite before.

Looks like they use some type of universal Linux package generator right now, which seems like a weird decision given how simple this package really is (most of the heavy lifting is done by the built-in updater). I might take a look and see if I can finally make it properly patch the paths on ostree distros.

S7venLights commented 1 year ago

Given my script works great (at least on my test system), I've been thinking about just writing an .rpm package from scratch. I've done exactly this for Silverblue/Kinoite before.

Is Flatpak possible? Since Silverblue and Kionite are designed to use flatpak?

S7venLights commented 1 year ago

With my script (unrelated to the .rpm) I ran into issues where systemd would return vague "this service does not exist" errors. In my case it was because it acts weird when symlinking in units from different filesystems. However that shouldn't be the issue in your case. I wonder if you maybe missed a path or it's a permissions thing, since it came from your home directory? Try my command:

At what point of the process must I use your command? To be clear: I already have Portmaster installed and working using @Pryka 's advice: "Just follow official guide - https://docs.safing.io/portmaster/install/linux#manual-install-and-launching and change all directories in commands to some folder in your home dir instead /opt/ "

But it doesn't autostart at boot, since I couldn't do step to create the systemd service as I get this error:

$ sudo cp /var/home/User/Desktop/portmaster/portmaster.service /usr/lib/systemd/system/

cp: cannot create regular file '/usr/lib/systemd/system/portmaster.service': Read-only file system
WinkelCode commented 1 year ago

With my script (unrelated to the .rpm) I ran into issues where systemd would return vague "this service does not exist" errors. In my case it was because it acts weird when symlinking in units from different filesystems. However that shouldn't be the issue in your case. I wonder if you maybe missed a path or it's a permissions thing, since it came from your home directory? Try my command:

At what point of the process must I use your command? To be clear: I already have Portmaster installed and working using @Pryka 's advice: "Just follow official guide - https://docs.safing.io/portmaster/install/linux#manual-install-and-launching and change all directories in commands to some folder in your home dir instead /opt/ "

But it doesn't autostart at boot, since I couldn't do step to create the systemd service as I get this error:

$ sudo cp /var/home/D24/Desktop/portmaster/portmaster.service /usr/lib/systemd/system/

cp: cannot create regular file '/usr/lib/systemd/system/portmaster.service': Read-only file system

Ohh, I see now.

Copy portmaster.service into /etc/systemd/system/ then enable it.

My command is run against the unmodified .service file, it just replaces all the paths automatically. If you've already done it manually, there is no problem.

S7venLights commented 1 year ago

Yeah I did that before (as the website suggests) And the Portmaster.service file does copy to /etc/systemd/system/ But then I run the following:

sudo systemctl daemon-reload
sudo systemctl enable --now portmaster
Failed to enable unit: Unit file portmaster.service does not exist.

Anyway I'll try run your script

S7venLights commented 1 year ago

So it installed and launched at boot! now I'm just copying in my preferences and rebooting to test :) :) :)

S7venLights commented 1 year ago

Used Your script and it's all working now, thanks many much! :) :) :)

S7venLights commented 1 year ago

@WinkelCode any chance you can help with this: https://github.com/the-weird-aquarian/Battery-Notifier/issues/1#issuecomment-1424480150