0

I tried running sudo -i but not working keeps saying :-

Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=@.host --user to connect to bus of other user.


Here is the message i receive after the prompt

Please help thanks :)

  • 3
    What exactly are you expecting the command to do? the prompt string suggests it is giving you a root login shell - the errors suggest an issue with your root account's shell configuration. Have you added stuff to /root/.bashrc or /root/.profile? – steeldriver Jan 28 '24 at 02:21
  • I want to use the command to upgrade my permission level because some other commands won´t run unless that error is fixed.But i´ve not added nothing to /root/.bashrc or /root/.profile please teach me how to. – Joseph Jan 28 '24 at 02:56
  • What about /etc/{prof,bash}*? You can also try resetting your root user with sudo bash -c 'mv /root /root.bak; mkdir /root; chmod 700 /root' – Daniel T Jan 28 '24 at 03:22
  • I tried the first command /etc/{prof,bash}* it was denied and the other command sudo bash -c 'mv /root /root.bak; mkdir /root; chmod 700 /root' couldn´t fix it. – Joseph Jan 28 '24 at 03:35
  • The first wasn't a command. I was asking you whether you modified the files /etc/profile /etc/bash.bashrc or anything inside /etc/profile.d . Please also make sure you did not change any files or directories starting with "sudo" inside /etc. If in doubt, look at the last modified time – Daniel T Jan 28 '24 at 05:08
  • 1
    https://askubuntu.com/questions/1374347/error-running-systemd-as-user-failed-to-connect-to-bus-dbus-session-bus-addr – Rinzwind Jan 28 '24 at 08:51
  • @Rinzwind In that question, they are trying to have root start a daemon as a user. In this question, sudo -i shouldn't require connecting to the user systemd instance. The "quick solution" part of the top answer there somewhat introduces a security hazard. I don't think it's related. – Daniel T Jan 28 '24 at 09:07

0 Answers0