Cobbler Error: MAAS on VirtualBox

Asked by Software Developer on 2012-07-06

I am trying to test MAAS using VirtualBOX.

I am following the tutorial at https://wiki.ubuntu.com/SecurityTeam/TestingMAAS . The 'sudo cobbler check' fails with
ERROR: exception.TypeError . For more information look in server logs.

Looking in cobbler.log, I see:
a stacktrace of python error relating to checking of dnsmasq service.

Any ideas, what might be causing this ?

Question information

Language:
English Edit question
Status:
Answered
For:
MAAS Edit question
Assignee:
No assignee Edit question
Last query:
2012-07-12
Last reply:
2013-03-20
Gavin Panella (allenap) said : #1

Could you paste the full stack trace of the error you're seeing?

@Gavin: Actually, I am testing on another location ( physical ) and I can't ssh to that. I will be able to give the stacktrace by Monday ( 9th July 2012 ), morning. Hope thats OK ? [ However, in the mean time, I'll try it on my system as well. See, if I can trigger the same error. If yes, I'll post the stacktrace immediately ]

Below is the stacktrace of the error from cobbler.log, which I get when I run $sudo cobbler check.

Mon Jul 9 11:41:07 2012 - DEBUG | REMOTE CLI Authorized; user(?)
Mon Jul 9 11:41:07 2012 - INFO | check
Mon Jul 9 11:41:07 2012 - INFO | running: dnsmasq --help
Mon Jul 9 11:41:07 2012 - INFO | received on stdout:
Mon Jul 9 11:41:07 2012 - DEBUG | received on stderr: /bin/sh: 1: dnsmasq: Permission denied

Mon Jul 9 11:41:07 2012 - INFO | running: /etc/init.d/dnsmasq status /dev/null 2>/dev/null
Mon Jul 9 11:41:07 2012 - INFO | received on stdout:
Mon Jul 9 11:41:07 2012 - DEBUG | received on stderr:
Mon Jul 9 11:41:07 2012 - INFO | Exception occured: <type 'exceptions.TypeError'>
Mon Jul 9 11:41:07 2012 - INFO | Exception value: not enough arguments for format string
Mon Jul 9 11:41:07 2012 - INFO | Exception Info:
  File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 1944, in _dispatch
    return method_handle(*params)
   File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 133, in check
    return self.api.check(logger=self.logger)
   File "/usr/lib/python2.7/dist-packages/cobbler/api.py", line 660, in check
    return check.run()
   File "/usr/lib/python2.7/dist-packages/cobbler/action_check.py", line 63, in run
    self.check_service(status,"dnsmasq")
   File "/usr/lib/python2.7/dist-packages/cobbler/action_check.py", line 130, in check_service
    status.append(_("service %s is not running%s") % which,notes)

Looks like a permission issue. But why, I am running with sudo ?

Gavin Panella (allenap) said : #4

Very odd. Can you try doing `dnsmasq --help` in the shell? If that fails, please paste the output of `ls -l /usr/sbin/dnsmasq`.

Gavin Panella (allenap) said : #5

By the way, are you using https://wiki.ubuntu.com/SecurityTeam/TestingMAAS because you specifically want to test security? Or is it so you can try out MAAS with virtual machines? If neither, then https://wiki.ubuntu.com/ServerTeam/MAAS is a better place to start.

@Gavin: Sorry for the delay in the reply.

No, I am not testing MAAS security. My objective is only to use MAAS on Virtual machines, so that I can try out a few things before I go to production. I have a few juju charms that I want to test.

----------------
$ dnsmasq --help prints usage options for dnsmasq. [ It is installed, if thats what you wanted to check ]
I can provide the exact output, but I guess its the standard help message for dnsmasq, so won't help you. If not, let me know.

$ ls -l /usr/sbin/dnsmasq gives the output:
-rwxr-xr-x 1 root root 199984 Dec 12 2011 /usr/sbin/dnsmasq

Let me know, if you require any more info.

Anatoli Lau (alau40) said : #7

I'm installing MAAS on real machines and having the same response for "cobbler check" in the log I get

Thu Jul 19 17:40:44 2012 - INFO | running: dnsmasq --help
Thu Jul 19 17:40:44 2012 - INFO | received on stdout:
Thu Jul 19 17:40:44 2012 - DEBUG | received on stderr: /bin/sh: 1: dnsmasq: Permission denied

Thu Jul 19 17:40:44 2012 - INFO | running: /etc/init.d/dnsmasq status /dev/null 2>/dev/null
Thu Jul 19 17:40:44 2012 - INFO | received on stdout:
Thu Jul 19 17:40:44 2012 - DEBUG | received on stderr:
Thu Jul 19 17:40:44 2012 - INFO | Exception occured: <type 'exceptions.TypeError'>
Thu Jul 19 17:40:44 2012 - INFO | Exception value: not enough arguments for format string
Thu Jul 19 17:40:44 2012 - INFO | Exception Info:
  File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 1944, in _dispatch
    return method_handle(*params)
   File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 133, in check
    return self.api.check(logger=self.logger)
   File "/usr/lib/python2.7/dist-packages/cobbler/api.py", line 660, in check
    return check.run()
   File "/usr/lib/python2.7/dist-packages/cobbler/action_check.py", line 63, in run
    self.check_service(status,"dnsmasq")
   File "/usr/lib/python2.7/dist-packages/cobbler/action_check.py", line 130, in check_service
    status.append(_("service %s is not running%s") % which,notes)

You need to run cobbler with sudo permissions.

So, sudo cobbler check.

Anatoli Lau (alau40) said : #9

I did it with sudo.

root@m1:~# sudo cobbler check
### ERROR ###
Unexpected remote error, check the server side logs for further info
<type 'exceptions.TypeError'>:not enough arguments for format string

and in the log

Thu Jul 19 18:39:22 2012 - INFO | check
Thu Jul 19 18:39:22 2012 - INFO | running: dnsmasq --help
Thu Jul 19 18:39:22 2012 - INFO | received on stdout:
Thu Jul 19 18:39:22 2012 - DEBUG | received on stderr: /bin/sh: 1: dnsmasq: Permission denied

Thu Jul 19 18:39:22 2012 - INFO | running: /etc/init.d/dnsmasq status /dev/null 2>/dev/null
Thu Jul 19 18:39:22 2012 - INFO | received on stdout:
Thu Jul 19 18:39:22 2012 - DEBUG | received on stderr:
Thu Jul 19 18:39:22 2012 - INFO | Exception occured: <type 'exceptions.TypeError'>
Thu Jul 19 18:39:22 2012 - INFO | Exception value: not enough arguments for format string
Thu Jul 19 18:39:22 2012 - INFO | Exception Info:
  File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 1944, in _dispatch
    return method_handle(*params)
   File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 133, in check
    return self.api.check(logger=self.logger)
   File "/usr/lib/python2.7/dist-packages/cobbler/api.py", line 660, in check
    return check.run()
   File "/usr/lib/python2.7/dist-packages/cobbler/action_check.py", line 63, in run
    self.check_service(status,"dnsmasq")
   File "/usr/lib/python2.7/dist-packages/cobbler/action_check.py", line 130, in check_service
    status.append(_("service %s is not running%s") % which,notes)

Jeroen T. Vermeulen (jtv) said : #10

So Cobbler is trying to report that service “which” is not running “notes,” but breaking at that point because the authors forgot to parenthesize (which, notes). :/

That's not the core problem though, just a distraction. Might it be worth it to edit /usr/lib/python2.7/dist-packages/cobbler/action_check.py, line 130, so that it says «% (which,notes))” where it currently says «% which,notes)» ? At least that way we'll get to see the proper error message.

Well, the error seems to be:

Thu Jul 19 18:39:22 2012 - DEBUG | received on stderr: /bin/sh: 1: dnsmasq:
Permission denied

ie you don't have permission to run dnsmasq. What permissions does it have?
Can you run it manually?

Anatoli Lau (alau40) said : #12

I'm running it with root through the sudo. It should be more than suffusion.

Do you have apparmour installed? Did you run dnsmasq manually like I asked?

Anatoli Lau (alau40) said : #14

If you talk about post #4, you didn't addressed to me, any way I did it with the same result:

root@m1:~# dnsmasq --help
Usage: dnsmasq [options]

Valid options are:
-a, --listen-address=ipaddr Specify local address(es) to listen on.
-A, --address=/domain/ipaddr Return ipaddr for all hosts in specified domains.
-b, --bogus-priv Fake reverse lookups for RFC1918 private address ranges.
-B, --bogus-nxdomain=ipaddr Treat ipaddr as NXDOMAIN (defeats Verisign wildcard).
-c, --cache-size=cachesize Specify the size of the cache in entries (defaults to 150).
-C, --conf-file=path Specify configuration file (defaults to /etc/dnsmasq.conf).
-d, --no-daemon Do NOT fork into the background: run in debug mode.
-D, --domain-needed Do NOT forward queries with no domain part.
-e, --selfmx Return self-pointing MX records for local hosts.
-E, --expand-hosts Expand simple names in /etc/hosts with domain-suffix.
-f, --filterwin2k Don't forward spurious DNS requests from Windows hosts.
-F, --dhcp-range=ipaddr,ipaddr,time Enable DHCP in the range given with lease duration.
-g, --group=groupname Change to this group after startup (defaults to dip).
-G, --dhcp-host=<hostspec> Set address or hostname for a specified machine.
    --dhcp-hostsfile=<filename> Read DHCP host specs from file.
    --dhcp-optsfile=<filename> Read DHCP option specs from file.
    --tag-if=tag-expression Evaluate conditional tag expression.
-h, --no-hosts Do NOT load /etc/hosts file.
-H, --addn-hosts=path Specify a hosts file to be read in addition to /etc/hosts.
-i, --interface=interface Specify interface(s) to listen on.
-I, --except-interface=int Specify interface(s) NOT to listen on.
-j, --dhcp-userclass=set:<tag>,<class> Map DHCP user class to tag.
    --dhcp-circuitid=set:<tag>,<circuit>Map RFC3046 circuit-id to tag.
    --dhcp-remoteid=set:<tag>,<remote> Map RFC3046 remote-id to tag.
    --dhcp-subscrid=set:<tag>,<remote> Map RFC3993 subscriber-id to tag.
-J, --dhcp-ignore=tag:<tag>... Don't do DHCP for hosts with tag set.
    --dhcp-broadcast[=tag:<tag>...] Force broadcast replies for hosts with tag set.
-k, --keep-in-foreground Do NOT fork into the background, do NOT run in debug mode.
-K, --dhcp-authoritative Assume we are the only DHCP server on the local network.
-l, --dhcp-leasefile=path Specify where to store DHCP leases (defaults to /var/lib/misc/dnsmasq.leases).
-L, --localmx Return MX records for local hosts.
-m, --mx-host=host_name,target,pref Specify an MX record.
-M, --dhcp-boot=<bootp opts> Specify BOOTP options to DHCP server.
-n, --no-poll Do NOT poll /etc/resolv.conf file, reload only on SIGHUP.
-N, --no-negcache Do NOT cache failed search results.
-o, --strict-order Use nameservers strictly in the order given in /etc/resolv.conf.
-O, --dhcp-option=<optspec> Specify options to be sent to DHCP clients.
    --dhcp-option-force=<optspec> DHCP option sent even if the client does not request it.
-p, --port=number Specify port to listen for DNS requests on (defaults to 53).
-P, --edns-packet-max=<size> Maximum supported UDP packet size for EDNS.0 (defaults to 4096).
-q, --log-queries Log DNS queries.
-Q, --query-port=number Force the originating port for upstream DNS queries.
-R, --no-resolv Do NOT read resolv.conf.
-r, --resolv-file=path Specify path to resolv.conf (defaults to /etc/resolv.conf).
-S, --server=/domain/ipaddr Specify address(es) of upstream servers with optional domains.
    --local=/domain/ Never forward queries to specified domains.
-s, --domain=<domain>[,<range>] Specify the domain to be assigned in DHCP leases.
-t, --mx-target=host_name Specify default target in an MX record.
-T, --local-ttl=time Specify time-to-live in seconds for replies from /etc/hosts.
    --neg-ttl=time Specify time-to-live in seconds for negative caching.
    --max-ttl=time Specify time-to-live in seconds for maximum TTL to send to clients.
-u, --user=username Change to this user after startup. (defaults to nobody).

-------------------------
root@m1:~# ls -l /usr/sbin/dnsmasq
-rwxr-xr-x 1 root root 199984 Dec 12 2011 /usr/sbin/dnsmasq
-------------------------
root@m1:~# sudo cobbler check
### ERROR ###
Unexpected remote error, check the server side logs for further info
<type 'exceptions.TypeError'>:not enough arguments for format string
-------------------------

root@m1:~# tail -n 23 /var/log/cobbler/cobbler.log
Wed Jul 25 16:46:16 2012 - DEBUG | REMOTE CLI Authorized; user(?)
Wed Jul 25 16:46:16 2012 - INFO | check
Wed Jul 25 16:46:16 2012 - INFO | running: dnsmasq --help
Wed Jul 25 16:46:16 2012 - INFO | received on stdout:
Wed Jul 25 16:46:16 2012 - DEBUG | received on stderr: /bin/sh: 1: dnsmasq: Permission denied

Wed Jul 25 16:46:16 2012 - INFO | running: /etc/init.d/dnsmasq status /dev/null 2>/dev/null
Wed Jul 25 16:46:16 2012 - INFO | received on stdout:
Wed Jul 25 16:46:16 2012 - DEBUG | received on stderr:
Wed Jul 25 16:46:16 2012 - INFO | Exception occured: <type 'exceptions.TypeError'>
Wed Jul 25 16:46:16 2012 - INFO | Exception value: not enough arguments for format string
Wed Jul 25 16:46:16 2012 - INFO | Exception Info:
  File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 1944, in _dispatch
    return method_handle(*params)
   File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 133, in check
    return self.api.check(logger=self.logger)
   File "/usr/lib/python2.7/dist-packages/cobbler/api.py", line 660, in check
    return check.run()
   File "/usr/lib/python2.7/dist-packages/cobbler/action_check.py", line 63, in run
    self.check_service(status,"dnsmasq")
   File "/usr/lib/python2.7/dist-packages/cobbler/action_check.py", line 130, in check_service
    status.append(_("service %s is not running%s") % which,notes)

Anatoli Lau (alau40) said : #15

I don't have apparmour installed ether.

Anatoli Lau (alau40) said : #16

Any other suggestions?

What happens if you run:

sudo service dnsmasq restart

Qinyuan Li (li-qinyuan01) said : #18

i am trying to install MAAS on VirtuallBox and getting exatcly the same problem.
I tried to run:
sudo service dnsmasq restart
and then
 sudo cobbler check
i get the same error wie befor
### ERROR ###
Unexpected remote error, check the server side logs for further info

Have the problem been solved?
What causing this ?
Thanks

Can you help with this problem?

Provide an answer of your own, or ask Software Developer for more information if necessary.

To post a message you must log in.