LinuxMint 19 dconf write results in "could not connect" / "connection refused"

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
jayalan
Level 1
Level 1
Posts: 13
Joined: Sat Jan 13, 2018 12:33 am
Location: UK

LinuxMint 19 dconf write results in "could not connect" / "connection refused"

Post by jayalan »

dconf write has worked fine on previous versions of LinuxMint (17 and 18 versions).
And, it also works fine in a current shell on LinuxMint 19.

However, trying to use dconf write inside a here document, launching a shell as a different user, now results in an error!

Example, open a terminal and paste the following, replacing <YOUR_USER_NAME>:

Code: Select all

sudo -u <YOUR_USER_NAME> bash << EOBLOCK
dconf write /org/nemo/preferences/show-full-path-titles true
EOBLOCK
In LinuxMint 19, this results in the following error:

Code: Select all

error: Could not connect: Connection refused

Usage:
  dconf write KEY VALUE 

Write a new value to a key

Arguments:
  KEY         A key path (starting, but not ending with '/')
  VALUE       The value to write (in GVariant format)
Anyone have any idea what might be going wrong please?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Flemur
Level 20
Level 20
Posts: 10097
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: LinuxMint 19 dconf write results in "could not connect" / "connection refused"

Post by Flemur »

jayalan wrote: Sun Jul 08, 2018 2:28 pm Example, open a terminal and paste the following, replacing <YOUR_USER_NAME>:

Code: Select all

sudo -u <YOUR_USER_NAME> bash << EOBLOCK
dconf write /org/nemo/preferences/show-full-path-titles true
EOBLOCK
In LinuxMint 19, this results in the following error:

error: Could not connect: Connection refused
I know this isn't what you want to hear, but it worked for me (Mint 19 <-- Mint 18.3) ; I ran dconf-editor and it showed me that "/org/nemo/preferences/show-full-path-titles" was checked. (And I guess it created the tags, or whatever they're called, since I don't have nemo).

Could you do what you need to do with dconf-editor?

Edit: this turned the setting off:

Code: Select all

dconf write /org/nemo/preferences/show-full-path-titles false
So, Q: Do you need the EOBLOCK stuff? (I don't even know what it it...)
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
jayalan
Level 1
Level 1
Posts: 13
Joined: Sat Jan 13, 2018 12:33 am
Location: UK

Re: LinuxMint 19 dconf write results in "could not connect" / "connection refused"

Post by jayalan »

@Flemur, thanks for the answer, and for trying the setting.

As I mentioned,
And, it also works fine in a current shell on LinuxMint 19.
In other words, running the following command alone does work just fine:

Code: Select all

dconf write /org/nemo/preferences/show-full-path-titles true
The problem is when trying to run dconf within a new shell, inside a "here document", i.e. inside a block:

Code: Select all

sudo -u <YOUR_USER_NAME> bash << EOBLOCK
...
EOBLOCK
Or, it will also fail in the same way, if just running the following commands, i.e. launch a new shell as any user and run the dconf write:

Code: Select all

sudo -u <YOUR_USER_NAME> bash
dconf write <WHATEVER_SETTING>
Yes, I do need to launch a new shell as a different user, because I use this concept to configure users' settings.

The problem seems to be that dbus is not running, or the new shell cannot connect to dbus, when launching a new shell.
Not sure why, and not sure what might have changed from previous versions to the latest linuxmint 19.

Thinking about this over the last couple of hours, I can use better solutions, like creating a dconf user database in a different way, or setting global settings in a key file.

However, I would still like to know if anyone has any idea, or how I might figure out, this problem of dconf/dbus inside a sub-shell.
Locked

Return to “Other topics”