Hello fellow lemmings

I am a long-time i3 user and have decided to switch to Sway. I have encountered a weird error which has left me utterly bamboozled.

I am using Ubuntu 24.04 which has gone from 20.04 -> 22.04 -> 24.04. It has Ubuntu-Gnome, i3 and Sway currently installed.

The issue

The error that I’m facing is when I’m using Sway, I simply don’t have sudo access.

This is what the error looks like

$ sudo visudo
[sudo] password for xavier666:
Sorry, user xavier666 is not allowed to execute '/usr/sbin/visudo' as root on <HOSTNAME>.

When I switch back to i3, my permissions are fine for the same user. I have not done any crazy modifications to the sudoer’s file as far as I can remember.

PS: I have added a command to no-sudo xavier666 ALL = NOPASSWD: /usr/bin/brightnessctl

The “fix”

I temporarily solved it by adding xavier666 ALL=(ALL:ALL) ALL to the sudoer’s file.

IMO, I think this should not be required. I don’t remember ever adding the default user to the file for all the installations that I have done. (But this is the first time I’ve installed Sway)

Logs/Outputs

Running sudo -l without the fix (on Sway)

Matching Defaults entries for xavier666 on <HOSTNAME>:
    env_reset, mail_badpass,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin,
    use_pty

User xavier666 may run the following commands on <HOSTNAME>:
    (root) NOPASSWD: /usr/bin/brightnessctl

When I run the same command on i3, i get this (ALL : ALL) ALL extra line in the output. And when I run sudo -l with my fix on Sway, (ALL : ALL) ALL is present and the permission issue is fixed.

What is causing Sway to remove the root permission for the user?

Note: I’m just asking for the standard sudo behaviour. I’m not trying to run GUI applications as root.

  • mazzilius_marsti@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    21 hours ago

    Hmm let’s try to isolate the bug to know if it’s sway or gdm messing up:

    Try to disable gdm: sudo systemctl disable gdm.service

    Logout/restart. You should be at the TTY, enter username and password to login. Then simply type sway

    Now, test your sudo commands within this sway session. Do you still get the same bug?

    • xavier666@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      8 hours ago

      I found something interesting, thanks to my friend

      • I removed the fix mentioned above. Now user does not have sudo access inside sway
      • I ran the command exec su - xavier666. It asked for my user password and the command was accepted.
      • My groups output looks normal (xavier666 is now part of sudo) and my permissions are fine
      • However, the problem reappears after a reboot

      It is as if this user is an imposter with incorrect privileges 📮

      • A_norny_mousse@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        6 hours ago

        It is as if this user is an imposter with incorrect privileges

        No, this rather points to sway/wayland.

        Once again:

        • you will need to figure out how wayland sessions in general start up on your system
        • file /usr/bin/sway if that command says it’s some sort of text/scii/script, open it in an editor and see what it does. It might give you first clues.
    • xavier666@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      13 hours ago

      Great suggestion. I tried this method just now.

      Unfortunately, I’m still getting the same bug.

      The main difference between the two sessions is the output of the groups command

      In pure tty

      $ groups
      xavier666 adm cdrom sudo dip plugdev lpadmin lxd sambashare
      

      The moment I enter into sway from inside the tty

      $ groups 
      xavier666 root