The recent LTS release of Ubuntu introduced some more strict apparmor policies that are affecting many packages. To fix it is quite simple, add a file so apparmor don't deny Unityhub actions.
You can do it by yourself or use the script utility I wrote. For the script checkout Using the script
If you installed using the .deb
distribution, your Unity Hub binary file is probably at /opt/unityhub/unityhub-bin
, so you can just copy-paste the snippet to /etc/apparmor.d/unityhub
You should open it as root/with sudo and your text editor of preference:
sudo vim /etc/apparmor.d/unityhub
or
sudo nano /etc/apparmor.d/unityhub
or
sudo gedit /etc/apparmor.d/unityhub
and so on...
Write the following (assuming your Unity Hub binary path is /opt/unityhub/unityhub-bin
which is the default, otherwise change it to match your binary path):
abi <abi/4.0>,
include <tunables/global>
profile unityhub /opt/unityhub/unityhub-bin flags=(unconfined) {
userns,
# Site-specific additions and overrides. See local/README for details.
include if exists <local/unityhub>
}
Now restart apparmor
sudo systemctl restart apparmor.service
Check if everything is ok
systemctl status apparmor.service
If so then you are good to go!
You can use the script to write the apparmor rule for you:
First download it
wget 'https://gist.githubusercontent.com/0xdeadbad/5ef3a38c8cf6efc264d9a6f11f50e5b8/raw/4cad833d3f22a9715e337994434bf89be31ac102/apparmor-addrule.sh'
Make it executable
chmod +x ./apparmor-addrule.sh
Run it with the desired executable, it works with any executable (must be run as root/with sudo):
sudo ./apparmor-addrule.sh /opt/unityhub/unityhub-bin
You can use only the executable name that is in $PATH, but for unity specifically /opt/unityhub/unityhub-bin
isn't in $PATH, so use the full binary path (OBS.: /opt/unityhub/unityhub
is a shell script that invokes /opt/unityhub/unityhub-bin
).
Now restart apparmor
sudo systemctl restart apparmor.service
Check if everything is ok
systemctl status apparmor.service
If so then you are good to go!
Hi,
Thanks for your work.
Now, I still have a problem, cannot login, the unity hub wont direct login after filled the username and password from google chrome.
Thanks