Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Editing /etc/sysctl.conf with Gedit

  1. #1

    Default Editing /etc/sysctl.conf with Gedit

    I'm trying to edit /etc/sysctl.conf with Gedit to change swappiness and I get the following error:

    Code:
    xxxxxx@linux-2t4v:/> sudo gedit /etc/sysctl.conf
    Unable to init server: Could not connect: Connection refused
    
    (gedit:29752): Gtk-WARNING **: cannot open display: 
    xxxxxx@linux-2t4v:/>
    Any help appreciated

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,943

    Default Re: Editing /etc/sysctl.conf with Gedit

    Apparently gedit is a GUI program. Do not use sudo, but kdesu or gnomesu (depending on what you use) e.g. from Execute command or a terminal. Or stay in the CLI and use vi.
    Henk van Velden

  3. #3
    Join Date
    Oct 2014
    Location
    Italy
    Posts
    1,804

    Default Re: Editing /etc/sysctl.conf with Gedit

    Quote Originally Posted by hcvv View Post
    Apparently gedit is a GUI program. Do not use sudo, but kdesu or gnomesu (depending on what you use) e.g. from Execute command or a terminal. Or stay in the CLI and use vi.
    Or stay in the CLI and use nano.
    Leap 15.1 Gnome on i7 4720HQ + Geforce GTX960M
    testing Leap 15.2Beta

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,943

    Default Re: Editing /etc/sysctl.conf with Gedit

    Quote Originally Posted by OrsoBruno View Post
    Or stay in the CLI and use nano.
    I agree that more user friendly CLI editors then vi will exist. But as I never used them, I didn't know their names. If the OP wants to edit from the CLI, nano is probably the better tool.
    Henk van Velden

  5. #5

    Default Re: Editing /etc/sysctl.conf with Gedit

    Thanks gentlemen,

    I will try your suggestions; however I would ultimately prefer a gui text editor. BTW, I have always been able to edit system files in Ubuntu with gedit, 7+ years. I don't know why I can't do it in openSUSE. Is there any gui based text editor that will edit system files? I don't want to make any mistakes with these.

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,943

    Default Re: Editing /etc/sysctl.conf with Gedit

    Quote Originally Posted by heidiheidi View Post
    I don't know why I can't do it in openSUSE. Is there any gui based text editor that will edit system files? I don't want to make any mistakes with these.
    Did you try kdesu or gnomesu as I advised? When you did and failed, we would like to see what happened. When you didn't try, you should not ask why you can't do it.

    I use KDE and never had any problem in doing e.g.
    Code:
    kdesu kwrite /etc/hosts
    Henk van Velden

  7. #7
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    12,025
    Blog Entries
    2

    Default Re: Editing /etc/sysctl.conf with Gedit

    Quote Originally Posted by heidiheidi View Post
    Thanks gentlemen,

    I will try your suggestions; however I would ultimately prefer a gui text editor. BTW, I have always been able to edit system files in Ubuntu with gedit, 7+ years. I don't know why I can't do it in openSUSE. Is there any gui based text editor that will edit system files? I don't want to make any mistakes with these.
    Ubuntu applies a different security system.
    Ubuntu doesn't really support using "su" like we do here in openSUSE, and has a different "sudo" security policy in part to compensate.
    I haven't checked, but Ubuntu might looser security for sysctl.conf.
    In general and not just because I use openSUSE, I feel the more traditional ways openSUSE applies security is clearer so less prone to mis-understanding and mistake.

    You should also be able to launch any graphical app like gedit from a root console (created with "su") which would then be able to edit files like sysctl.conf.
    This would work in any openSUSE running any Desktop, or even IceWM which does not formally run a Desktop.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  8. #8

    Default Re: Editing /etc/sysctl.conf with Gedit

    Quote Originally Posted by tsu2 View Post
    Ubuntu applies a different security system.
    Ubuntu doesn't really support using "su" like we do here in openSUSE, and has a different "sudo" security policy in part to compensate.
    I haven't checked, but Ubuntu might looser security for sysctl.conf.
    In general and not just because I use openSUSE, I feel the more traditional ways openSUSE applies security is clearer so less prone to mis-understanding and mistake.

    You should also be able to launch any graphical app like gedit from a root console (created with "su") which would then be able to edit files like sysctl.conf.
    This would work in any openSUSE running any Desktop, or even IceWM which does not formally run a Desktop.

    TSU
    Thank you sir,

    Good answer! This is a new build with many issues. I had a lot to do.

    What I ultimately did was to cat sysctl.conf, copy it into gedit, edit the file, then sudo cp the file back into root.. I am greatful for everyone's help and I will investigate all the suggestions when my workload diminishes. You're right Ubuntu doesn't like su.

    BTW, su complained a lot, but it let me do it:

    Code:
    xxxxxx@linux-2t4v:~> su
    Password: 
    linux-2t4v:/home/xxxxxx # gedit /etc/sysctl.conf
    
    (gedit:17943): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
    
    (gedit:17943): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
    Error creating proxy: The connection is closed (g-io-error-quark, 18)
    Error creating proxy: The connection is closed (g-io-error-quark, 18)
    Error creating proxy: The connection is closed (g-io-error-quark, 18)
    Error creating proxy: The connection is closed (g-io-error-quark, 18)
    Error creating proxy: The connection is closed (g-io-error-quark, 18)
    
    (gedit:17943): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
    
    (gedit:17943): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
    
    (gedit:17943): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
    
    ** (gedit:17943): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-position not supported
    
    (gedit:17943): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
    linux-2t4v:/home/xxxxxx #

  9. #9
    Join Date
    Oct 2014
    Location
    Italy
    Posts
    1,804

    Default Re: Editing /etc/sysctl.conf with Gedit

    Quote Originally Posted by heidiheidi;2782051
    BTW, su complained a lot, but it let me do it:

    [CODE
    xxxxxx@linux-2t4v:~> su
    Password:
    linux-2t4v:/home/xxxxxx # gedit /etc/sysctl.conf

    (gedit:17943): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

    (gedit:17943): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
    Error creating proxy: The connection is closed (g-io-error-quark, 18)
    ...
    [/CODE]
    Apparently (from other posts) you are using Gnome.
    If you had done:
    Code:
    gnomesu gedit /etc/sysctl.conf
    as suggested by hcvv in post #2 you would have done your job with just a few irrelevant warnings.
    You used "su" within the context of your "normal" user, hence the errors you see.
    To open a session for user "root" you have to use:
    Code:
    su -
    <root password>
    gedit /etc/sysctl.conf
    including the trailing dash, or "su --login" in the long form. See "man su" for further details.
    Leap 15.1 Gnome on i7 4720HQ + Geforce GTX960M
    testing Leap 15.2Beta

  10. #10

    Default Re: Editing /etc/sysctl.conf with Gedit

    [QUOTE=OrsoBruno;2782095]Apparently (from other posts) you are using Gnome.
    If you had done:
    Code:
    gnomesu gedit /etc/sysctl.conf
    as suggested by hcvv in post #2 you would have done your job with just a few irrelevant warnings.

    Oops, now I get it. I was scanning post #2 way too fast. I've never used gnomesu before; I must have thought it was an editor.

    Oh, snap.

    It works pretty good too; although it does complain a little:

    xxxxxx@linux-2t4v:~> gnomesu gedit /etc/sysctl.conf

    (gnomesu:25465): GLib-GObject-WARNING **: The property GtkButton:use-stock is deprecated and shouldn't be used anymore. It will be removed in a future version.

    (gnomesu:25465): GLib-GObject-WARNING **: The property GtkSettings:gtk-button-images is deprecated and shouldn't be used anymore. It will be removed in a future version.

    (gnomesu:25465): Gtk-WARNING **: gtk_window_set_titlebar() called on a realized window
    Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

    ** (gedit:25472): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-position not supported
    xxxxxx@linux-2t4v:~>
    Gnome 3, Leap or Tumbleweed, depending on which breaks last.

    "Jane let me off this crazy thing." George Jetson

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •