Can't launch editor as root

OS 11.1 KDE 4.2. I am trying to edit some configuration files, and I am finding that I cannot pull up a text editor (kwrite or kate) if I in root. The only way I can open one up with root privileges is via

kdesu kate/kwrite

I could access kate as root in 10.3, so not sure why this is happening here. Browsed through KDE settings and Yast, but couldn’t find any obvious settings.

Any advice appreciated.

If you browse to the file with “File Manager - Super User Mode,” right-click on the filename and select “Open with KWrite,” does that work? From your question, I assume that you’re in a Konsole (or equivalent) at a command-line interface, logged in as root (“su”) and that you manually enter “kwrite [filename]” in the terminal.

If not, and I’ve got it backwards (not unusual for me), try it that way and see what happens.

Hi, thanks for the suggestion. I was actually in a konsole as root and entering kwrite manually.

I tried what you suggested (entered dolphin as super-user), but when I tried to open the file I wanted, it gave me:

KDEInit could not launch ‘/usr/bin/kwrite’

So, no joy there either. My workaround at the moment is to open kwrite with kdesu, and then open the files I need through kwrites menus. Clunky, but it’s all I have at the moment.

Will welcome any further suggestions.

Thanks!

Two other suggestions, actually.

  1. In your Konsole, before you su to root, enter “which kwrite” to get the path. Then su to root and enter that full path. See if you get an error message. If it starts up and runs, there you go.

1-1/2. You can also try an “echo $PATH” to see if /usr/bin (if that’s where kwrite is at) is in your path, but I can’t imagine that it wouldn’t be. I can’t see how your system would even be usable if it wasn’t.

  1. Try restarting. When I was using KDE 4.1, I’d get weird problems like this from time to time. A restart might help. Not to depress you, but this is one reason why I backed off of KDE 4. I was tired of crap like this. (And losing my taskbar or KMenu for no apparent reason. And then losing my sound and never getting it back. And … you get the idea.)

Finally (OK, this is a third suggestion), it’d be a lot of work and a pain, but you could revert back to KDE 3.59 until they get all the bugs worked out of KDE 4. I personally don’t think it’s ready for prime time yet.

…or you could install and use a relatively user-firendly CLI text editor like nano or pico instead.

That’s an idea. I use nano when I have to go into a machine remotely with ssh. But to be honest, it’s still clunky compared to KWrite, which has things like multiple find and replace, and easy cut and paste.

Thanks for the suggestions.

Kwrite is in /usr/bin, which is in the path.

I still get the problem, after restarting as before. No error message, but terminal just hangs after entering kwrite as root (with or without full path).

I must say, besides this and maybe a few other small problems (my sound card shuts off at times until an app needs to make a sound, then it pops back on and makes the sound, then goes dead again, but I digress), I have found KDE 4 (I am at 4.2 now) pretty good. It works better with my laptop, although, to be fair, that might simply be improvements between 10.3 and 11.1, rather than the newer KDE. Anyway, I am afraid I am stuck with 4.2 for now, because I am spending too much time organizing the system (not bugs, necessarily, but installing apps and suchlike), rather than actually doing work!

Pardon the meandering above, but any further ideas most welcome, and thanks very much for help thus far.

p.s. I installed nano which seems a good way for quick access to edit files from root…

in a terminal

su -
password

konqueror

(will open k as root - replace application name as required eg: dolphin)

Hi,
Thanks for the suggestion. Terminal also hangs when I try launching either konqueror or dolphin from root. I suppose this will apply to all applications. I wonder if there is some sort of conflict with happening because KDE wants to launch gui password prompt because it is going into super user mode.

Just to add some more information about the problem, sudo doesn’t appear to work either:

user@linux-48ic:~> sudo kwrite
root's password:
kwrite: cannot connect to X server
user@linux-48ic:~> sudo dolphin
<unknown program name>(6927)/: KUniqueApplication: Cannot find the D-Bus session server

<unknown program name>(6926)/: KUniqueApplication: Pipe closed unexpectedly.

Perhaps these problems are linked?

but did you try

su -
password

not the same as sudo

Yes, I did,sorry for not making it clearer. Terminal hangs when I do that.

user@linux-48ic:~> su
Password:
linux-48ic:/home/user # dolphin
(hanging cursor here, no prompt)

please notice

su - (do you see the space and then the -

No, I hadn’t, sorry.

And it works, actually, for Dolphin and Kwrite.

Not sure exactly what or why that extra hyphen works, but it did, so thank you!

mazibuko wrote:
> OS 11.1 KDE 4.2. I am trying to edit some configuration files, and I am
> finding that I cannot pull up a text editor (kwrite or kate) if I in
> root.

what do you mean by that? for example, how do you become root?
that is, do you log into KDE (or GNOME) as root, then open a
terminal/console and can’t launch kate?

or what? (hopefully you say that you log in as a regular user and
THEN become root in a terminal by (for example) typing “su -” and
entering the root password…)

i ask, because you should NEVER log into KDE (etc) as root–never EVER!

doing so can be the cause of many strange problems…just like the
one you have now…or, the next time you log in as yourself you find
you can no longer do some things…


have fun

The most likely cause of your problem is that the user you are logged in as has explicit authority over the current XSession and as such kate running as root has no way to connect to the current session owned by the user.
Instead of using su, sudo instead use kdesu so to launch kate it would be:
kdesu kate

opensuse 11.0

i know about this problem since kde 4.1.x still going on in 4.2. It must have to with right’s mgmt, because all works, if you logged in as root. The only thing that i saw was the fact, that the process kwrite/kate still is running and that a second try will also start a second hanging process :frowning:

There is no work around like console in su mode and konqueror/kwrite start. i also had to change to nano

i remember something else, that worked for me: used konqueror-kde3 in su-mode. This worked flawlessly

Hi All, thanks for continued feedback.

Have Fun: I haven’t been logging into KDE as root, but under my user name. The problem I was having was going into root through a terminal, and trying to pull up kate or kwrite or Dolphin or Konqueror (etc.) with a command from the terminal afterwards.

Silenuz and Gorgonz, it sounds like the rights over the session is the reason. I did use kdesu kwrite to get the text editor up while trying to figure out this problem, which worked fine. I suppose entering root with

su -

rather than

su

as suggested by caf4926 also tackles the same problem. I am not very clued up on command line, but from what I can see the “-” (based on Linux Command Directory: su) logs into the user’s environment, which allows authority over the Xsession as root. Or something like that…

Thanks again.

Try to install mousepad it is a nice editor almost like kate and runs using su to root. I had this issue also of kate/kwrite. that can only be run using with kdesu
I use mousepad as my default text editor since I am using xfce but can be installed with kde also.

Thanks, that works nicely.