Sudo edit always leaves file unchanged, opens blank file in Kate

Hey there folks,

Fresh install of the latest Garuda-dr460nized build, I got to setting up my environment to more closely resemble the customizations on my desktop. Wanted to change the background of the login screen, and editing the conf:

╰─λ sudo -e /usr/share/sddm/themes/Sweet/theme.conf.user
[sudo] password for tomcat:
sudo: /usr/share/sddm/themes/Sweet/theme.conf.user unchanged

Then a blank file opens in Kate. I've tried resetting default config using Garuda-Assistant, and also setting the EDITOR environment variable, but no luck. Default text editor is Neovim. I haven't been able to find anything else about this in the forums, so I'm kind of stuck. Any ideas or nudges in the right direction are greatly appreciated!

Kernel: 6.3.7-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 13.1.1
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=ea06c931-175a-4922-9061-c8702dd4ea90 rw rootflags=subvol=@
quiet rd.luks.uuid=f2827761-64a2-40c8-ac80-d880c9928664 quiet splash
rd.udev.log_priority=3 vt.global_cursor_default=0 loglevel=3 ibt=off
Desktop: KDE Plasma v: 5.27.5 tk: Qt v: 5.15.9 wm: kwin_x11 vt: 1 dm: SDDM
Distro: Garuda Linux base: Arch Linux
Type: Laptop System: System76 product: Pangolin v: pang12
serial: <superuser required> Chassis: type: 10 serial: <superuser required>
Mobo: System76 model: Pangolin v: pang12 serial: <superuser required>
UEFI: American Megatrends LLC. v: ARB928_V00.01_T0025ASY1_ms
date: 04/20/2023
ID-1: BAT0 charge: 69.3 Wh (99.0%) condition: 70.0/70.0 Wh (100.0%)
volts: 13.2 min: N/A model: AMD Battery Li-ion Real Battery type: Li-ion
serial: <filter> status: charging
Device-1: hidpp_battery_0 model: Logitech Wireless Gaming Mouse
serial: <filter> charge: 55% (should be ignored) rechargeable: yes
status: discharging
Info: model: AMD Ryzen 7 6800U with Radeon Graphics bits: 64 type: MT MCP
arch: Zen 3+ gen: 4 level: v3 note: check built: 2022 process: TSMC n6 (7nm)
family: 0x19 (25) model-id: 0x44 (68) stepping: 1 microcode: 0xA404102
Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB
L3: 16 MiB desc: 1x16 MiB
Speed (MHz): avg: 1686 high: 2700 min/max: 1600/4767 boost: enabled
scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 2107 2: 1600
3: 1687 4: 2040 5: 1570 6: 1600 7: 1600 8: 1362 9: 1361 10: 2700 11: 1600
12: 1600 13: 1597 14: 1427 15: 1609 16: 1524 bogomips: 86235
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Vulnerabilities: <filter>
Device-1: AMD Rembrandt [Radeon 680M] vendor: Emdoor Digital driver: amdgpu
v: kernel arch: RDNA-2 code: Navi-2x process: TSMC n7 (7nm) built: 2020-22
pcie: gen: 4 speed: 16 GT/s lanes: 16 ports: active: eDP-1 empty: DP-1,
DP-2, DP-3, DP-4, DP-5, DP-6, DP-7, HDMI-A-1 bus-ID: 05:00.0
chip-ID: 1002:1681 class-ID: 0300 temp: 38.0 C
Display: x11 server: X.Org v: 21.1.8 with: Xwayland v: 23.1.2
compositor: kwin_x11 driver: X: loaded: amdgpu unloaded: modesetting
alternate: fbdev,vesa dri: radeonsi gpu: amdgpu display-ID: :0 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
s-diag: 582mm (22.93")
Monitor-1: eDP-1 mapped: eDP model: ChiMei InnoLux 0x1521 built: 2020
res: 1920x1080 hz: 144 dpi: 142 gamma: 1.2 size: 344x193mm (13.54x7.6")
diag: 394mm (15.5") ratio: 16:9 modes: max: 1920x1080 min: 640x480
API: OpenGL v: 4.6 Mesa 23.1.2 renderer: AMD Radeon Graphics (rembrandt
LLVM 15.0.7 DRM 3.52 6.3.7-zen1-1-zen) direct-render: Yes
Device-1: AMD Rembrandt Radeon High Definition Audio driver: snd_hda_intel
v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 05:00.1
chip-ID: 1002:1640 class-ID: 0403
Device-2: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Emdoor Digital
driver: snd_pci_acp6x v: kernel alternate: snd_pci_acp3x, snd_rn_pci_acp3x,
snd_pci_acp5x, snd_acp_pci, snd_rpl_pci_acp6x, snd_pci_ps,
snd_sof_amd_renoir, snd_sof_amd_rembrandt pcie: gen: 4 speed: 16 GT/s
lanes: 16 bus-ID: 05:00.5 chip-ID: 1022:15e2 class-ID: 0480
Device-3: AMD Family 17h/19h HD Audio vendor: Emdoor Digital
driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
bus-ID: 05:00.6 chip-ID: 1022:15e3 class-ID: 0403
Device-4: Tenx USB AUDIO driver: hid-generic,snd-usb-audio,usbhid
type: USB rev: 1.1 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 3-1:2
chip-ID: 1130:1620 class-ID: 0300
API: ALSA v: k6.3.7-zen1-1-zen status: kernel-api tools: N/A
Server-1: PipeWire v: 0.3.71 status: active with: 1: pipewire-pulse
status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: f000
bus-ID: 01:00.0 chip-ID: 10ec:8168 class-ID: 0200
IF: enp1s0 state: up speed: 100 Mbps duplex: full mac: <filter>
Device-2: MEDIATEK MT7921K Wi-Fi 6E 80MHz driver: mt7921e v: kernel pcie:
gen: 2 speed: 5 GT/s lanes: 1 bus-ID: 02:00.0 chip-ID: 14c3:0608
class-ID: 0280
IF: wlp2s0 state: down mac: <filter>
IF-ID-1: wg-mullvad state: unknown speed: N/A duplex: N/A mac: N/A
Device-1: MediaTek Wireless_Device driver: btusb v: 0.8 type: USB rev: 2.1
speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 3-3:3 chip-ID: 0e8d:0608
class-ID: e001 serial: <filter>
Report: bt-adapter ID: hci0 rfk-id: 0 state: up address: <filter>
Local Storage: total: 1.82 TiB used: 20.51 GiB (1.1%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: SSD 980 PRO 1TB
size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s
lanes: 4 tech: SSD serial: <filter> fw-rev: 5B2QGXA7 temp: 34.9 C
scheme: GPT
ID-2: /dev/nvme1n1 maj-min: 259:1 vendor: Samsung model: SSD 980 PRO 1TB
size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s
lanes: 4 tech: SSD serial: <filter> fw-rev: 5B2QGXA7 temp: 34.9 C
scheme: GPT
ID-1: / raw-size: 300 GiB size: 300 GiB (100.00%) used: 13.89 GiB (4.6%)
fs: btrfs dev: /dev/dm-0 maj-min: 254:0
mapped: luks-f2827761-64a2-40c8-ac80-d880c9928664
ID-2: /boot/efi raw-size: 501 MiB size: 500 MiB (99.80%)
used: 720 KiB (0.1%) fs: vfat dev: /dev/nvme1n1p2 maj-min: 259:4
ID-3: /home raw-size: 631.02 GiB size: 631.02 GiB (100.00%)
used: 6.62 GiB (1.0%) fs: btrfs dev: /dev/dm-1 maj-min: 254:1
mapped: luks-71e8b3e9-99aa-4911-abbf-c7b327fb2aa7
ID-4: /var/log raw-size: 300 GiB size: 300 GiB (100.00%)
used: 13.89 GiB (4.6%) fs: btrfs dev: /dev/dm-0 maj-min: 254:0
mapped: luks-f2827761-64a2-40c8-ac80-d880c9928664
ID-5: /var/tmp raw-size: 300 GiB size: 300 GiB (100.00%)
used: 13.89 GiB (4.6%) fs: btrfs dev: /dev/dm-0 maj-min: 254:0
mapped: luks-f2827761-64a2-40c8-ac80-d880c9928664
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 30.59 GiB used: 0 KiB (0.0%) priority: 100
dev: /dev/zram0
System Temperatures: cpu: 44.1 C mobo: N/A gpu: amdgpu temp: 39.0 C
Fan Speeds (RPM): N/A
Processes: 472 Uptime: 5m wakeups: 356 Memory: available: 30.59 GiB
used: 4.61 GiB (15.1%) Init: systemd v: 253 default: graphical
tool: systemctl Compilers: gcc: 13.1.1 Packages: pm: pacman pkgs: 1503
libs: 484 tools: octopi,paru pm: appimage pkgs: 0 Shell: Zsh v: 5.9
running-in: konsole inxi: 3.3.27
Garuda (2.6.16-1):
System install date:     2023-06-09
Last full system update: 2023-06-11
Is partially upgraded:   No
Relevant software:       snapper NetworkManager dracut
Windows dual boot:       No/Undetected
Failed units:

Edit: formatting

I'd start from (man sudo)

2.   The editor specified by the policy is run to edit the temporary files.  The sudoers policy uses the SUDO_EDITOR, VISUAL and EDITOR environment variables (in that order).
     If none of SUDO_EDITOR, VISUAL or EDITOR are set, the first program listed in the editor sudoers(5) option is used.

checking those variables, /etc/sudo.conf, /etc/sudoers and /etc/sudoers.d/editor.
Note that you need sudo to even list the last one, and if you ever need to edit sudoers, do sudo visudo and double check that you're not locking yourself out (this applies to all of them).

Not sure if the XDG file associations or other DE settings play a part too.

I have Defaults editor=/usr/bin/micro in /etc/sudoers.d/editor, EDITOR also /usr/bin/micro, the other two not set.

But really, unless you see something obvious hold on and do not trust me, I don't know.

Also check out Sudo - ArchWiki.


Thank you for your response!

If I'm understanding correctly, you have Defaults editor=/usr/bin/micro set in /etc/sudoers.d/editor and no other variable set in /etc/sudo.conf, or /etc/sudoers. That appears to be the same configuration on my end.

If I type, for example, SUDO_EDITOR=nvim sudoedit /usr/share/sddm/themes/Sweet/theme.conf.user, then the config file opens in nvim without issue. If, however, I only type the sudo -e example above, even if I first type export EDITOR=nvim, then it just returns with sudoedit: /usr/share/sddm/themes/Sweet/theme.conf.user unchanged, and then Kate opens up an empty file. I'm stumped.

I tried creating a drop-in config in /etc/sudoers.d/sudo_editor: Defaults sudo_editor=rvim as in this example, however visudo detected syntax error. I also tried in all CAPS, but it was still incorrect, so I deleted the file. needed to hit Enter at the end to start a new line. visudo accepted it, however still no change with the Kate situation. Again, not really sure where to go from here.

Kate won't work here as most KDE/Plasma apps won't accept elevated status (i.e. run as root/sudo) because of security concerns.


This is right. It is unfortunate that Kate would become the default for sudoedit, but my guess is that was not done intentionally. Changing the editor to something other than Kate will allow you to use the command normally.

sudoedit checks a few environment variables in a somewhat non-intuitive order to decide what text editor to run.

EDITOR           Default editor to use in -e (sudoedit) mode if neither SUDO_EDITOR nor VISUAL is set.
SUDO_EDITOR      Default editor to use in -e (sudoedit) mode.
VISUAL           Default editor to use in -e (sudoedit) mode if SUDO_EDITOR is not set.

In your case, probably SUDO_EDITOR is not set, so the value of VISUAL is being used. Check and see for yourself:

echo $VISUAL

If it says kate, then probably we have cracked the case. :male_detective:

The easiest way to fix this is to set a value for SUDO_EDITOR.

export SUDO_EDITOR=micro
sudoedit /usr/share/sddm/themes/Sweet/theme.conf.user

In my example here, the file /usr/share/sddm/themes/Sweet/theme.conf.user now opens with the micro editor.

To make it work permanently, set the SUDO_EDITOR environment variable with whatever method you are using for your other environment variables.


Thank you for your detailed reply!

The output of echo $VISUAL is indeed kate, so I think that's definitely progress! The SUDO_EDITOR environment variable also is not set, so you are correct on both counts.

I'm still having trouble setting the SUDO_EDITOR in a way that makes the change permanent, though. I've tried the drop in file in sudoers.d/SUDO_EDITOR. If I set it to Defaults editor=/usr/bin/micro, visudo accepts it, but it sets the EDITOR environment variable. visudo does not accept Defaults sudo_editor=/usr/bin/micro. however simply setting export SUDO_EDITOR=micro does indeed work, and solves the problem with Kate opening erroneously.

I'd use either /etc/environment (system) or one of ~/.bashrc / ~/.bash_profile (user) but there may be other ways.


Try adding it to your .zshrc, then reboot or log out/log back in to test.


Thank you all so much for your help! I've added Defaults EDITOR=rvim to ~/.zshrc , then source ~/.zshrc to pull the config. Kate no longer opens with sudo -e

I'd also like to add in case anyone else ever has this issue that Garuda-Assistant changed the default shell that shows up in inxi, but not the shell that is invoked when logging into Konsole. I still get fish. Thus, I also added setenv EDITOR rvim to ~/.config/fish/ and then source ~/.config/fish/, then sudoedit opens in vim instead of Kate!

Thanks again all, have a wonderful day!

This is actually a setting in Konsole itself. Check the Konsole profile, there is a space to set a custom command to be run which is set to /bin/fish, allowing Fish to run in the terminal without changing the system shell.

This should be sourced automatically when you log in, if ZSH is your system shell. Test and see; you shouldn't have to run this command manually at all after a fresh login, and adding it to your Fish config should not be needed either.


This is a setting in Konsole itself

Ah, I see. Thank you. I'll take a look.

source ~/.zshrc

This was just to test without reebooting/relogging in. I should have specified.

Thank you so much for your help! I still have much to learn.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.