Author Topic: [SOLVED] kwrite does not work in superuser mode  (Read 2839 times)

Offline baupres

  • Full Member
  • ***
  • Posts: 50
[SOLVED] kwrite does not work in superuser mode
« on: April 23, 2010, 04:58:55 PM »
Hi all,
I have just installed PCLOS2010 kde and I have found that kwrite only works in standard user mode. If i try to use via Konsole in su mode it shows the following:
Code: [Select]
kwrite /etc/modprobe.conf
kwrite(3457): Session bus not found

KCrash: Application 'kwrite' crashing...
sock_file=/root/.kde4/socket-localhost.localdomain/kdeinit4__0
Warning: connect() failed: : No existe el fichero o el directorio
KCrash cannot reach kdeinit, launching directly.
drkonqi(3458): Session bus not found
Is there any fix to this?
« Last Edit: August 26, 2010, 04:28:19 AM by Texstar »

Offline Texstar

  • Administrator
  • Super Villain
  • *****
  • Posts: 12655
Re: kwrite does not work in superuser mode
« Reply #1 on: April 23, 2010, 05:11:14 PM »
Hi all,
I have just installed PCLOS2010 kde and I have found that kwrite only works in standard user mode. If i try to use via Konsole in su mode it shows the following:
Code: [Select]
kwrite /etc/modprobe.conf
kwrite(3457): Session bus not found

KCrash: Application 'kwrite' crashing...
sock_file=/root/.kde4/socket-localhost.localdomain/kdeinit4__0
Warning: connect() failed: : No existe el fichero o el directorio
KCrash cannot reach kdeinit, launching directly.
drkonqi(3458): Session bus not found
Is there any fix to this?

dbus-launch kwrite

Thanks to everyone who donates. You keep the servers running.
Follow me on Twitter for the latest development info.

Offline baupres

  • Full Member
  • ***
  • Posts: 50
Re: [solved] kwrite does not work in superuser mode
« Reply #2 on: April 23, 2010, 05:26:39 PM »
Thanks a lot.
Why is this for? Is it going to be the new standard procedure, or is it a temporary fix?
Many thanks to all the developers for the new version of PCLOS 2010. Its superb.
« Last Edit: April 23, 2010, 05:28:52 PM by baupres »

Offline Texstar

  • Administrator
  • Super Villain
  • *****
  • Posts: 12655
Re: [solved] kwrite does not work in superuser mode
« Reply #3 on: April 23, 2010, 05:33:00 PM »
Thanks a lot.
Why is this for? Is it going to be the new standard procedure, or is it a temporary fix?
Many thanks to all the developers for the new version of PCLOS 2010. Its superb.

That is just the way it works in KDE 4.4.x now for some reason.

Thanks to everyone who donates. You keep the servers running.
Follow me on Twitter for the latest development info.

Offline exploder

  • Hero Member
  • *****
  • Posts: 1148
Re: [solved] kwrite does not work in superuser mode
« Reply #4 on: April 23, 2010, 05:45:36 PM »
Quote
That is just the way it works in KDE 4.4.x now for some reason.

I read that this was for security reasons.

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: [solved] kwrite does not work in superuser mode
« Reply #5 on: April 23, 2010, 05:48:38 PM »
Texstar:

Serious question here, so bear with me. Running MiniMe 2010 with the 2.6.33.2-pclos1.bfs kernel, when I enter:

[root@littleboy ~]# kwrite /etc/fstab

for output, I get;

kwrite(2972)/kdecore (services) KMimeTypeFactory::parseMagic: Now parsing  "/usr/share/mime/magic"
kwrite(2972)/kdecore (services) KMimeTypeFactory::parseMagic: Now parsing  "/root/.local/share/mime/magic"


while kwrite opens the asked for document. No error messages, no stalling. This works so fast I do not see the messages, shown above, until after I close kwrite.

The question: Is this dbus-launch kwrite command needed, in some cases, because of hardware differences, or is there something installed in the full version, that's causing the problem, that is not installed in the MiniMe release?
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline DeBaas

  • Hero Member
  • *****
  • Posts: 1532
    • PCLinuxOS.nl
Re: [solved] kwrite does not work in superuser mode
« Reply #6 on: April 24, 2010, 02:30:01 PM »
Did'nt know there was a problem, I always use (example) "kdesu kwrite /etc/fstab" to edit something in root modus.

Ed

Offline barryc

  • Sr. Member
  • ****
  • Posts: 321
Re: [solved] kwrite does not work in superuser mode
« Reply #7 on: May 01, 2010, 10:59:45 PM »
...and yet it works perfectly in Konqueror Superuser mode.  Right click on fstab and selct "open with .." and select kwrite from the dialog box.
Naturally, this does NOT work in Dolphin Superuser mode.  Weird.  Konqueror (SU mode) also lets you edit the file and save it from the embedded
advanced text editor (Preview).  I can't even preview the file in Dolphin (SU mode).

Oh, yes, I'm using pclos 2010 with the 2.6.32.12-pclos1.bfs kernel on a 7 year old desktop, AMD Athlon XP 2800+, 2 gig ram, 1 40 gig maxtor ide drive
and 1 300 gig maxtor sata drive, nvidia 6200 video card.

So, I use Konqueror as my file manager.  Can't see any benefit in Dolphin.
You gotta have balls to play golf.

Offline Texstar

  • Administrator
  • Super Villain
  • *****
  • Posts: 12655
Re: [solved] kwrite does not work in superuser mode
« Reply #8 on: May 02, 2010, 03:56:34 AM »
Did'nt know there was a problem, I always use (example) "kdesu kwrite /etc/fstab" to edit something in root modus.

Ed


I just right click and edit as root from Dolphin.


Thanks to everyone who donates. You keep the servers running.
Follow me on Twitter for the latest development info.

Offline barryc

  • Sr. Member
  • ****
  • Posts: 321
Re: [solved] kwrite does not work in superuser mode
« Reply #9 on: May 02, 2010, 08:24:35 PM »
Hmmm.  You're right Tex.  In Dolphin (user mode) it does work using your method.  In Dolphin (super user mode) no dice.
Have you tried that?  I made a menu entry for Dolphin Super User Mode -- Run as a different user and it won't preview a file
or allow use of Kwrite to edit the file.
You gotta have balls to play golf.

Offline travisN000

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1758
Re: kwrite does not work in superuser mode
« Reply #10 on: May 02, 2010, 10:00:00 PM »
Hi all,
I have just installed PCLOS2010 kde and I have found that kwrite only works in standard user mode. If i try to use via Konsole in su mode it shows the following...

Is there any fix to this?

dbus-launch kwrite


As a more permanent work-around for those that use Konsole in su mode; you can edit /root/.bashrc and append the following line to the end of the file:

Code: [Select]
alias kwrite="dbus-launch kwrite"
If accessing kwrite as root is impeding your ability to do this, a quick console one-liner (as root) will add it for you:
Code: [Select]
echo -e '\nalias kwrite="dbus-launch kwrite"\n' >> /root/.bashrc

Once the above is performed, you can then issue your kwrite commands as usual from the root console.
 ;D


PLEASE NOTE that this does not fix the issues with Dolphin, nor does it work with the commands issued via the su command (ie. su -c "kwrite /etc/fstab")

EDIT:..  disregard the above disclaimer regarding the su command and use the following:

Code: [Select]
echo -e '\nalias su="su -"\n' >> /etc/bashrc
Code: [Select]
echo -e '\nalias kwrite="dbus-launch kwrite"\n' >> /root/.bashrc
« Last Edit: May 11, 2010, 06:53:44 AM by travisn000 »

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: [solved] kwrite does not work in superuser mode
« Reply #11 on: May 02, 2010, 11:57:06 PM »
Seriously, am I the only one who's found this?



Click the Manage Profiles... option.



You'll have two selections, Shell and Root Shell. Choose Root Shell then click the Edit Profile button. You really want to do this because the default sux.



Note the Command: su -

Click the Appearance tab.



I chose the Black on Light Yellow, as this has been the traditional root shell for years. Choose what you like, and set the font you want with the Edit Font... button. Click Apply, then OK.

You'll now have the three selections shown. Check to see which is the new one by clicking Edit Profile... --> Appearance
and when you have the right one, click your choice under Show in Menu, so you see the green check mark.



Click Apply and OK again.



From the File menu, You now have a Root Shell entry. Select it.



Type your root password, press the Enter key.



You can now switch back and forth between tabs; normal user, or root terminal.

Type that tricky kwrite /etc/fstab command in the root terminal, and press the Enter key.



Typing exit in either tab, and pressing Enter, will close that tab only, leaving the other.

The message under the opened kwrite is;

kwrite(21963)/kdecore (services) KMimeTypeFactory::parseMagic: Now parsing  "/usr/share/mime/magic"
kwrite(21963)/kdecore (services) KMimeTypeFactory::parseMagic: Now parsing  "/root/.local/share/mime/magic"


whatever that means. It pops up each time you have kwrite call a file as root, but the file is always opened. Works the same with kate.

kate(22287)/kdecore (services) KMimeTypeFactory::parseMagic: Now parsing  "/usr/share/mime/magic"
kate(22287)/kdecore (services) KMimeTypeFactory::parseMagic: Now parsing  "/root/.local/share/mime/magic"


Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline tuxalish

  • Hero Member
  • *****
  • Posts: 567
  • Voulez vous couchez avec moi?
Re: [solved] kwrite does not work in superuser mode
« Reply #12 on: May 03, 2010, 12:26:35 AM »
Quote from old-polack
Quote
Seriously, am I the only one who's found this?

Perhaps not o-p, but you're the only one who has shared this with the rest of us peons! Thank you so much...just set mine up.  :-* 




I don't need no steenking Windows --tuxalish

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: [solved] kwrite does not work in superuser mode
« Reply #13 on: May 03, 2010, 02:06:46 AM »
Quote from old-polack
Quote
Seriously, am I the only one who's found this?


Perhaps not o-p, but you're the only one who has shared this with the rest of us peons! Thank you so much...just set mine up.  :-*  


In KDE versions previous to KDE4, I could right click on the desktop, choose Create New... --> Link to Application, then for a command, enter konsole --type su to have a desktop icon that produced the root shell. That no longer works, so I started poking buttons and links to find something similar in KDE4. Except for the annoying mime magic message, in every other way this is it.  ;D

One can also put a Konsole launcher widget on the panel. Right click on the panel, or click the cashew, and choose Add Widgets... Scroll the choices until you see this widget;



Double click it, and it's on your panel. When you left click the widget in the panel, you get this;

 

When I click the top choice, I get my root shell, directly. It still has the two entries under the File menu, but in this case it's the root shell as the first tab. I use this to initially open either shell, a lot. Much quicker than slogging through the menu.  ;D ;D

Right clicking the panel widget offers this;



The top choice is the same settings window as shown in the other post.

For me, this is the neatest thing I've found so far, in KDE4.  ;D
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: [solved] kwrite does not work in superuser mode
« Reply #14 on: May 03, 2010, 02:48:36 AM »
thanks old-polack, a good how to  ;)