nmcli reports :Not authorized to control networking. when run from cron

Bug #681708 reported by RedLegoMan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

In 10.04 nmcli worked from cron. I have a PPTP vpn connection which I startup overnight via cron using the nmcli syntax:

nmcli -p con up id VPN

In 10.10 this returns the message:
"Error: Connection activation failed: Not authorized to control networking."

The command works fine from a terminal window run from the dekstop. This used to work in 10.04, but now fails in 10.10.
---
Architecture: i386
CRDA: Error: [Errno 2] No such file or directory
DistroRelease: Ubuntu 10.10
IfupdownConfig:
 auto lo
 iface lo inet loopback
Keyfiles: Error: [Errno 2] No such file or directory
Package: network-manager 0.8.1+git.20100810t184654.ab580f4-0ubuntu2
PackageArchitecture: i386
ProcEnviron:
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.35-22.35-generic 2.6.35.4
RfKill:
 0: phy0: Wireless LAN
  Soft blocked: no
  Hard blocked: no
Tags: maverick
Uname: Linux 2.6.35-22-generic i686
UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare
WifiSyslog:

Revision history for this message
Fabio Marconi (fabiomarconi) wrote :

Hello
can you please run ina terminal
apport-collect -p network-manager 681708
Thanks
Fabio

Changed in ubuntu:
status: New → Incomplete
Revision history for this message
RedLegoMan (red-lego-man) wrote : Dependencies.txt

apport information

tags: added: apport-collected
description: updated
Revision history for this message
RedLegoMan (red-lego-man) wrote : Gconf.txt

apport information

Revision history for this message
RedLegoMan (red-lego-man) wrote : IpAddr.txt

apport information

Revision history for this message
RedLegoMan (red-lego-man) wrote : IpRoute.txt

apport information

Revision history for this message
RedLegoMan (red-lego-man) wrote : IwConfig.txt

apport information

Revision history for this message
RedLegoMan (red-lego-man) wrote : PciNetwork.txt

apport information

Revision history for this message
RedLegoMan (red-lego-man) wrote : nm-system-settings.conf.txt

apport information

affects: ubuntu → network-manager (Ubuntu)
Changed in network-manager (Ubuntu):
status: Incomplete → New
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Unfortunately, there was no nmcli on 10.04, so there is no way to compare how it worked.

I'd expect you would have more error messages than that, especially if the issue is with DBUS permissions like I expect. Could you attach a file which has the whole output as you get it from cron (usually it comes as an email, you can check with 'mail', or 'cat /var/spool/mail/$USER' commands).

Otherwise, are you trying to change a connection that was marked as a system connection? If it's the case, you might want to uncheck the "Available to all users" checkbox in the connection configuration and try again.

Changed in network-manager (Ubuntu):
status: New → Incomplete
Revision history for this message
RedLegoMan (red-lego-man) wrote :

Sorry, I must have been confused about 10.04, however the problem still remains, that either from cron, or a remote session such as ssh or telnet, the command returns (and only this - unless there is someway to increase verbosity):
$ nmcli -p con up id hideipvpn
Error: Connection activation failed: Not authorized to control networking.

The connection is NOT marked a "available to all users".

However in a terminal window on the desktop itself, the command works.
When run locally in a desktop terminal :

$ nmcli -p con up id VPN
Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/44
state: VPN connecting (3)
state: VPN connecting (getting IP configuration) (4)
Connection activated

Revision history for this message
Arend van Spriel (aspriel) wrote :

You could try adding sudo in your cron script, but then you have to configure nmcli to be sudoed without password. You will probably want to have a look at /etc/dbus-1/system.d/NetworkManager.conf. This specifies what is allowed and there is a special policy configuration with attribute 'at_console' which make your command line action work, but below that is policy for default context which denies most actions. This one applies to your cron job.

You could allow same for default as for at_console, but that may depend what you consider safe on your machine.

Revision history for this message
Akshay Naik (nikefalcon) wrote :

Try using root's crontab file. 'sudo crontab -e'
That worked for my DSL connection.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for network-manager (Ubuntu) because there has been no activity for 60 days.]

Changed in network-manager (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.