Drop cap_sys_nice check

This commit is contained in:
Patrick Nicolas
2025-11-19 14:16:15 +01:00
parent 7c2057ec9e
commit bc1c0b9e93
6 changed files with 2 additions and 133 deletions
+2 -2
View File
@@ -119,7 +119,7 @@ jobs:
- name: Prepare
run: |
apt-get update
apt-get install --yes curl wget sudo jq cmake gcc g++ git pkgconf libboost-all-dev libkirigami-dev gettext libarchive-dev nlohmann-json3-dev qcoro-qt6-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev libvulkan-dev libssl-dev librsvg2-dev extra-cmake-modules libcap-dev
apt-get install --yes curl wget sudo jq cmake gcc g++ git pkgconf libboost-all-dev libkirigami-dev gettext libarchive-dev nlohmann-json3-dev qcoro-qt6-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev libvulkan-dev libssl-dev librsvg2-dev extra-cmake-modules
- uses: actions/cache@v4
with:
@@ -373,7 +373,7 @@ jobs:
- name: Install dependencies
run: |
apt update
apt install --yes libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libboost-all-dev librsvg2-bin dpkg-dev pkg-config debhelper-compat build-essential lintian cmake libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git wget libssl-dev qcoro-qt6-dev librsvg2-dev libarchive-dev npm
apt install --yes libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev pkexec libboost-all-dev librsvg2-bin dpkg-dev pkg-config debhelper-compat build-essential lintian cmake libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git wget libssl-dev qcoro-qt6-dev librsvg2-dev libarchive-dev npm
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.3.2/KTX-Software-4.3.2-Linux-x86_64.deb
sudo dpkg --install KTX-Software-4.3.2-Linux-x86_64.deb
-5
View File
@@ -57,7 +57,6 @@ option(WIVRN_FEATURE_RENDERDOC "Support renderdoc" OFF)
set(WIVRN_FEATURE_SOLARXR OFF) # Will be added back when merged in upstream Monado
option(WIVRN_FEATURE_STEAMVR_LIGHTHOUSE "Enable SteamVR Lighthouse driver" OFF)
option(WIVRN_CHECK_CAPSYSNICE "Check if CAP_SYS_NICE is available at startup" ON)
set(WIVRN_CSS "${CMAKE_SOURCE_DIR}/images/wivrn-local.css" CACHE STRING "Stylesheet to use to render SVGs" )
option(WIVRN_SHOW_IMGUI_DEMO_WINDOW "Show the Dear ImGui demo window in the client" OFF)
@@ -173,10 +172,6 @@ if (WIVRN_BUILD_DASHBOARD)
find_package(QCoro6 REQUIRED COMPONENTS Core Network Qml)
qcoro_enable_coroutines()
if (WIVRN_CHECK_CAPSYSNICE)
pkg_check_modules(libcap REQUIRED IMPORTED_TARGET libcap)
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
-4
View File
@@ -79,10 +79,6 @@ target_link_libraries(wivrn-dashboard
wivrn-external
)
if (WIVRN_CHECK_CAPSYSNICE)
target_link_libraries(wivrn-dashboard PRIVATE PkgConfig::libcap)
endif()
install(TARGETS wivrn-dashboard ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES io.github.wivrn.wivrn.metainfo.xml
-43
View File
@@ -126,21 +126,6 @@ Kirigami.ApplicationWindow {
]
}
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("The server does not have CAP_SYS_NICE capabilities")
// type: Kirigami.MessageType.Warning
type: Kirigami.MessageType.Information
showCloseButton: true
visible: DashboardSettings.show_system_checks && !WivrnServer.capSysNice
actions: [
Kirigami.Action {
text: i18n("Fix it")
onTriggered: WivrnServer.grant_cap_sys_nice()
}
]
}
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("Firewall may not allow port 9757")
@@ -155,34 +140,6 @@ Kirigami.ApplicationWindow {
]
}
Kirigami.InlineMessage {
id: restart_capsysnice
Layout.fillWidth: true
text: i18n("The CAP_SYS_NICE capability will be used when the server is restarted")
type: Kirigami.MessageType.Information
showCloseButton: true
visible: false
actions: [
Kirigami.Action {
text: i18nc("restart the server", "Restart now")
onTriggered: {
WivrnServer.restart_server();
restart_capsysnice.visible = false;
}
}
]
Connections {
target: WivrnServer
function onCapSysNiceChanged(value) {
if (WivrnServer.serverStatus != WivrnServer.Stopped)
restart_capsysnice.visible = true;
}
function onServerStatusChanged(value) {
restart_capsysnice.visible = false;
}
}
}
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("NVIDIA GPUs require at least driver version 565.77, current version is %1", VulkanInfo.driverVersion)
-69
View File
@@ -31,10 +31,6 @@
#include <nlohmann/json.hpp>
#include <unistd.h>
#if WIVRN_CHECK_CAPSYSNICE
#include <sys/capability.h>
#endif
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_raii.hpp>
@@ -45,24 +41,6 @@ static QString server_path()
return QCoreApplication::applicationDirPath() + "/wivrn-server";
}
#if WIVRN_CHECK_CAPSYSNICE
static bool has_cap_sys_nice()
{
auto caps = cap_get_file(server_path().toStdString().c_str());
if (not caps)
return false;
cap_flag_value_t value{};
if (cap_get_flag(caps, CAP_SYS_NICE, CAP_EFFECTIVE, &value) < 0)
return false;
cap_free(caps);
return value == CAP_SET;
}
#endif
wivrn_server::wivrn_server(QObject * parent) :
QObject(parent)
{
@@ -75,12 +53,6 @@ wivrn_server::wivrn_server(QObject * parent) :
const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames();
if (services.contains("io.github.wivrn.Server"))
on_server_dbus_registered();
#if WIVRN_CHECK_CAPSYSNICE
m_capSysNice = has_cap_sys_nice();
#else
m_capSysNice = true;
#endif
}
wivrn_server::~wivrn_server()
@@ -290,47 +262,6 @@ void wivrn_server::on_server_dbus_unregistered()
start_server();
}
void wivrn_server::grant_cap_sys_nice()
{
#if WIVRN_CHECK_CAPSYSNICE
if (not setcap_process)
{
setcap_process = std::make_unique<QProcess>();
setcap_process->setProgram("pkexec");
setcap_process->setArguments({"setcap", "CAP_SYS_NICE=+ep", server_path()});
setcap_process->setProcessChannelMode(QProcess::MergedChannels);
setcap_process->start();
QObject::connect(setcap_process.get(), &QProcess::finished, this, [this](int exit_code, QProcess::ExitStatus exit_status) {
// Exit codes:
// 0: setcap successful
// 1: setcap failed
// 126: pkexec: not authorized or authentication error
// 127: pkexec: dismissed by user
if (exit_status == QProcess::NormalExit and exit_code == 0)
{
if (not has_cap_sys_nice())
{
qDebug() << "pkexec setcap returned successfully but the server does not have the CAP_SYS_NICE capability";
}
else
{
qDebug() << "setcap sucessful";
capSysNiceChanged(m_capSysNice = true);
}
}
else
{
qWarning() << "setcap exited with status" << exit_status << "and code" << exit_code;
}
setcap_process.release()->deleteLater();
});
}
#endif
}
void wivrn_server::open_server_logs()
{
QString path = get_server_log_dir();
-10
View File
@@ -151,7 +151,6 @@ class wivrn_server : public QObject
std::unique_ptr<QDBusPendingCallWatcher> get_all_properties_call_watcher;
QProcess * server_process = nullptr;
std::unique_ptr<QProcess> setcap_process;
public:
wivrn_server(QObject * parent = nullptr);
@@ -173,7 +172,6 @@ public:
// Server information
Q_PROPERTY(Status serverStatus READ serverStatus NOTIFY serverStatusChanged)
Q_PROPERTY(bool capSysNice READ capSysNice NOTIFY capSysNiceChanged)
Q_PROPERTY(bool headsetConnected READ isHeadsetConnected NOTIFY headsetConnectedChanged)
Q_PROPERTY(bool sessionRunning READ isSessionRunning NOTIFY sessionRunningChanged)
Q_PROPERTY(QString jsonConfiguration READ jsonConfiguration WRITE setJsonConfiguration NOTIFY jsonConfigurationChanged)
@@ -181,7 +179,6 @@ public:
Q_INVOKABLE void start_server();
Q_INVOKABLE void stop_server();
Q_INVOKABLE void restart_server();
Q_INVOKABLE void grant_cap_sys_nice();
Q_INVOKABLE void open_server_logs();
// Authentication
@@ -223,11 +220,6 @@ public:
return m_serverStatus;
}
bool capSysNice() const
{
return m_capSysNice;
}
bool isHeadsetConnected() const
{
return m_headsetConnected;
@@ -355,7 +347,6 @@ private:
void refresh_server_properties();
Status m_serverStatus{Status::Stopped};
bool m_capSysNice{};
bool m_headsetConnected{};
bool m_sessionRunning{};
QString m_jsonConfiguration{};
@@ -381,7 +372,6 @@ private:
Q_SIGNALS:
void serverStatusChanged(Status);
void capSysNiceChanged(bool);
void headsetConnectedChanged(bool);
void sessionRunningChanged(bool);
void jsonConfigurationChanged(QString);