Running an Installer in Cosmic: Understanding the Workaround
When working in the Cosmic environment, you may encounter a challenge when attempting to run applications as the root user. This is because Wayland, which Cosmic uses as its display server, enforces security features that prevent apps from running as root by default. While this security feature is essential for the overall stability and safety of your system, there are specific cases, like running an installer, where a workaround is necessary.
The Challenge: Root Restrictions on Wayland
Wayland’s design prioritizes security and sandboxing, which is why it blocks graphical applications from launching as root. This can pose a problem when using system installers like Calamares, which often require elevated permissions to perform system-wide changes.
For most regular applications, disabling these security restrictions is not recommended, as it increases the risk of exposing your system to security vulnerabilities. However, for trusted applications such as installers, temporarily bypassing this restriction is acceptable.
The Workaround: Allowing Root to Run Graphical Applications
To allow an installer to run in Cosmic on Wayland, you can use the following command to disable the root restriction for your session:
xhost +SI:localuser:root
This command grants root permission to access the display server, effectively bypassing the Wayland restriction. It’s important to note that this solution should only be used for trusted applications like installers, and it should not be left enabled for general use.
Applying the Workaround: Running Calamares on OpenMandriva
Once you’ve run the xhost
command, you can execute the Calamares installer either by selecting it from the menu or by running it manually from the terminal with elevated permissions. To do this, use the following command:
pkexec calamares
When root permission is no longer needed, root permission to launching GUI app can be reverted by:
xhost -SI:localuser:root
Why the Workaround is Necessary
While it might seem cumbersome to disable a security feature, this is a deliberate design choice in Cosmic Wayland to ensure that applications cannot unintentionally gain root privileges. By using xhost
in specific, trusted scenarios like installing an operating system, you maintain the security benefits of Wayland while still being able to perform necessary system-level operations.
This solution can also be applied to other applications like gparted - which also require to be run as root.
We are working on making it possible to run the Calamares installer without having to use workarounds in future versions of the COSMIC desktop.