You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 16.04非sudo启动Wireshark等应用显示缩放异常求助

Fixing Scaling Issues for Apps like Wireshark/GNS3 on Ubuntu 16.04 (Dell XPS 13 9370)

Hey there, let's work through this frustrating scaling problem you're hitting. The key clue here is that apps work fine with sudo but break as a regular user—this almost always boils down to environment variable differences or permission-related conflicts that mess with display settings. Here are actionable fixes to try, ordered from quick tests to more permanent solutions:

1. Test with Correct XDG_RUNTIME_DIR

Root uses a different XDG_RUNTIME_DIR than your regular user, which can cause apps to misread display scaling configs. Try launching the app from your user terminal with this variable explicitly set:

XDG_RUNTIME_DIR=/run/user/$(id -u) wireshark

If this fixes the scaling, you can make it permanent by editing the app's .desktop file (usually in /usr/share/applications/ or ~/.local/share/applications/). Find the Exec= line and prepend the variable:

Exec=env XDG_RUNTIME_DIR=/run/user/$(id -u) wireshark %U

2. Force GTK/Qt Scaling Values

Sometimes regular user profiles don't pass the correct scaling flags to Qt/GTK apps. Try setting these environment variables temporarily first:

export GTK_SCALE=1
export QT_SCALE_FACTOR=1
wireshark

If this works, add the two export lines to your ~/.profile or ~/.bashrc file so they apply every time you log in.

3. Fix X Server Access Permissions

Occasionally, regular users don't have proper access to the X server, leading to display glitches when running apps that need special privileges (but not root). Try this quick test:

xhost si:localuser:$USER
wireshark

If scaling works now, add that xhost command to your ~/.xsessionrc file to auto-apply it on login. Avoid using xhost + (it's insecure, as it opens your X server to all users).

Running apps like Wireshark with sudo is not just a security risk—it's the root cause of your environment mismatch. Instead, use Polkit to grant necessary permissions while keeping the app running as your regular user:

For Wireshark:

  1. Add your user to the wireshark group:
    sudo usermod -aG wireshark $USER
    
  2. Create a Polkit rule file to authorize Wireshark:
    sudo nano /etc/polkit-1/rules.d/50-wireshark.rules
    
    Paste this content:
    polkit.addRule(function(action, subject) {
        if (action.id == "org.wireshark.chcap" && subject.isInGroup("wireshark")) {
            return polkit.Result.YES;
        }
    });
    
  3. Log out and back in, then launch Wireshark as your regular user—scaling should work, and you'll still have full capture permissions.

For GNS3/Packet Tracer:

Similar logic applies: look for official documentation on granting non-root permissions via Polkit or dedicated user groups. For GNS3, you can add your user to the uucp and dialout groups (common for serial/network access) and check GNS3's settings to avoid running as root.

Final Notes

The Polkit/group-based method is the best long-term fix because it avoids the environment variable mismatches that come with sudo. If none of these work, double-check that your Ubuntu 16.04 has all the latest display-related updates (run sudo apt update && sudo apt upgrade), as older versions sometimes had scaling bugs with small-form-factor 1080p screens like the XPS 13's.

内容的提问来源于stack exchange,提问作者Julscoob

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 03:15:56