landscape-config fails to connect to broker.

Bug #1868730 reported by Simon Poirier
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Landscape Client
Fix Released
Undecided
Unassigned

Bug Description

We've had a few reports of errors on the registration step of landscape-config, which looks like:

Request a new registration for this computer now? [Y/n]:
Traceback (most recent call last):
Failure: twisted.internet.error.ConnectError: An error occurred while connecting: 2: No such file or directory.

We know it affects:

* ubuntu focal, on new installs and upgrades.
* ubuntu xenial, is apparently also affected.

This issue is to track any additional details, up to a reproduction scenario.

Simon Poirier (simpoir)
Changed in landscape-client:
status: New → Confirmed
status: Confirmed → New
Revision history for this message
Alan MacMillan (amac8585) wrote :

we get this error:

fcntl(8, F_GETFD) = 0x1 (flags FD_CLOEXEC)
fcntl(8, F_SETFD, FD_CLOEXEC) = 0
ioctl(8, FIONBIO, [1]) = 0
epoll_wait(5, [], 2, 0) = 0
getsockopt(8, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
connect(8, {sa_family=AF_UNIX, sun_path="/var/lib/landscape/client/sockets/broker.sock"}, 47) = -1 ENOENT (No such file or directory)
shutdown(8, SHUT_RDWR) = 0
close(8) = 0
write(2, "Traceback (most recent call last"..., 147Traceback (most recent call last):
Failure: twisted.internet.error.ConnectError: An error occurred while connecting: 2: No such file or directory.
) = 147
write(2, "\n", 1
) = 1
epoll_wait(5, [], 2, 0) = 0
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f26204fdf20}, {sa_handler=0x62ffc0, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f26204fdf20}, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f26204fdf20}, {sa_handler=0x62ffc0, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f26204fdf20}, 8) = 0
rt_sigaction(SIGCHLD, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f26204fdf20}, {sa_handler=0x62ffc0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f26204fdf20}, 8) = 0
close(5) = 0
munmap(0x7f2615eb7000, 262144) = 0
munmap(0x7f261bd6d000, 262144) = 0
munmap(0x7f261bdad000, 262144) = 0
munmap(0x7f261bced000, 262144) = 0
munmap(0x7f261bc2d000, 262144) = 0
munmap(0x7f261be6d000, 262144) = 0
munmap(0x7f261bc6d000, 262144) = 0
munmap(0x7f261bd2d000, 262144) = 0
munmap(0x7f261cee6000, 262144) = 0
sigaltstack(NULL, {ss_sp=0x1a260d0, ss_flags=0, ss_size=8192}) = 0
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}, NULL) = 0
munmap(0x7f261beed000, 262144) = 0
fstat(3, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0
close(3) = 0
fstat(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 8), ...}) = 0
close(4) = 0
exit_group(0) = ?
+++ exited with 0 +++
ap005@apnc01node001:/var/lib/landscape$ ^C

when running this command:-

sudo strace landscape-config --computer-title "$(hostname)" --account-name standalone --url https://landscape.005.ncitest.bt.com/message-system --ping-url http://landscape.005.ncitest.bt.com/ping --ssl-public-key /home/ap005/landscape_server_ca.crt --registration-key=$(cat /home/ap005/deployment/adastral-ap-005-canonical/secrets/landscape-registration.txt) --silent --log-level=DEBUG

Revision history for this message
Pedro Victor Lourenço Fragola (pedrovlf) wrote :

I'm having the same issue on a Xenial client:

ii landscape-client 16.03-0ubuntu2.16.04.8 amd64 The Landscape administration system client
ii landscape-common 16.03-0ubuntu2.16.04.8 amd64 The Landscape administration system client - Common files

Request a new registration for this computer now? [Y/n]
Traceback (most recent call last):
Failure: twisted.internet.error.ConnectError: An error occurred while connecting: 2: No such file or directory.

strace 148059 07:20:40.800470 connect(3, {sa_family=AF_LOCAL, sun_path="/var/lib/landscape/client/sockets/broker.sock"}, 47) = -1 ENOENT (No such file or directory)

Simon Poirier (simpoir)
description: updated
Revision history for this message
Simon Law (simon0711) wrote :

I am having a similar issue when enrolling machine to landscape

Error log:

Please wait...
Traceback (most recent call last):
Failure: twisted.internet.error.ConnectError: An error occurred while connecting: 2: No such file or directory.

cat manager.log
2022-03-22 12:57:57,196 INFO [MainThread] Manager started with config /etc/landscape/client.conf
2022-03-22 12:57:57,635 INFO [MainThread] Manager stopped with config /etc/landscape/client.conf
2022-03-22 12:59:35,114 INFO [MainThread] Manager started with config /etc/landscape/client.conf
2022-03-22 12:59:35,530 INFO [MainThread] Manager stopped with config /etc/landscape/client.conf

cat watchdog.log
2022-03-22 12:57:56,994 INFO [MainThread] Watchdog watching for daemons.
2022-03-22 12:57:57,438 ERROR [MainThread] Can't keep landscape-monitor running. Exiting.
2022-03-22 12:57:57,438 INFO [MainThread] Stopping client...
2022-03-22 12:57:57,634 ERROR [MainThread] Couldn't request that broker gracefully shut down; killing forcefully.
2022-03-22 12:59:34,918 INFO [MainThread] Watchdog watching for daemons.
2022-03-22 12:59:35,362 ERROR [MainThread] Can't keep landscape-monitor running. Exiting.
2022-03-22 12:59:35,362 INFO [MainThread] Stopping client...
2022-03-22 12:59:35,530 ERROR [MainThread] Couldn't request that broker gracefully shut down; killing forcefully.

Revision history for this message
Simon Poirier (simpoir) wrote :

Do you have any broker.log?

Revision history for this message
Mitch Burton (mitchburton) wrote :

I've found a possible workaround, when running landscape-config fails, which should at least provide more insight into what is failing, if there are no logs.

Starting in a state where there are no landscape-client processes running, run the broker directly:

sudo -u landscape /usr/bin/python3 /usr/bin/landscape-broker

If that fails, run the main landscape-client process (as root):

sudo /usr/bin/python3 /usr/bin/landscape-client

If things seem to go okay, you can retry running landscape-config.

Unfortunately I've as of yet been unable to reproduce this one.

Revision history for this message
Juanmi Taboada (juanmitaboada) wrote (last edit ):

Hello, after a fresh install, the folder /var/lib/landscape/client/ doesn't contain the usual folders. Bootstrap didn't happen yet. In effect, the folder sockets don't exist, which provokes the broker to fail during startup.

$ sudo -u landscape /usr/bin/python3 /usr/bin/landscape-broker
2023-03-06 05:23:38,705 INFO [MainThread] Broker started with config /etc/landscape/client.conf
Traceback (most recent call last):
  File "/usr/bin/landscape-broker", line 8, in <module>
    run(sys.argv)
  File "/usr/lib/python3/dist-packages/landscape/client/broker/service.py", line 94, in run
    run_landscape_service(BrokerConfiguration, BrokerService, args)
  File "/usr/lib/python3/dist-packages/landscape/client/service.py", line 115, in run_landscape_service
    startApplication(application, False)
  File "/usr/lib/python3/dist-packages/twisted/application/app.py", line 689, in startApplication
    service.IService(application).startService()
  File "/usr/lib/python3/dist-packages/twisted/application/service.py", line 276, in startService
    service.startService()
  File "/usr/lib/python3/dist-packages/landscape/client/broker/service.py", line 79, in startService
    self.publisher.start()
  File "/usr/lib/python3/dist-packages/landscape/client/amp.py", line 45, in start
    self._port = self._reactor.listen_unix(socket_path, factory)
  File "/usr/lib/python3/dist-packages/landscape/lib/reactor.py", line 228, in listen_unix
    return self._reactor.listenUNIX(socket, factory, wantPID=True)
  File "/usr/lib/python3/dist-packages/twisted/internet/posixbase.py", line 466, in listenUNIX
    p.startListening()
  File "/usr/lib/python3/dist-packages/twisted/internet/unix.py", line 388, in startListening
    if not self.lockFile.lock():
  File "/usr/lib/python3/dist-packages/landscape/client/lockfile.py", line 42, in lock
    result = super(PatchedFilesystemLock, self).lock()
  File "/usr/lib/python3/dist-packages/twisted/python/lockfile.py", line 157, in lock
    symlink(str(os.getpid()), self.name)
FileNotFoundError: [Errno 2] No such file or directory: '9872' -> b'/var/lib/landscape/client/sockets/broker.sock.lock'

Executing:
$ sudo /usr/bin/python3 /usr/bin/landscape-client

landscape-client will execute the bootstrap (then the sockets folder should be created) and the broker would work then.

I have published a possible solution for this situation, which enables the broker to bootstrap the landscape-client folder:
https://github.com/CanonicalLtd/landscape-client/pull/140

Changed in landscape-client:
status: New → Fix Committed
Revision history for this message
Alan Baghumian (alanbach) wrote :
Download full text (5.4 KiB)

Hello there,

I just had to go through this issue, was this ever released?

$ sudo landscape-config --computer-title $(hostname) --account-name standalone -p <token> --url https://lds.int.hrizn.cloud/message-system --ping-url http://lds.int.hrizn.cloud/ping
enabled

This script will interactively set up the Landscape client. It will
ask you a few questions about this computer and your Landscape
account, and will submit that information to the Landscape server.
After this computer is registered it will need to be approved by an
account administrator on the pending computers page.

Please see https://landscape.canonical.com for more information.

The Landscape client communicates with the server over HTTP and
HTTPS. If your network requires you to use a proxy to access HTTP
and/or HTTPS web sites, please provide the address of these
proxies now. If you don't use a proxy, leave these fields empty.

HTTP proxy URL:
HTTPS proxy URL:

Landscape has a feature which enables administrators to run
arbitrary scripts on machines under their control. By default this
feature is disabled in the client, disallowing any arbitrary script
execution. If enabled, the set of users that scripts may run as is
also configurable.

Enable script execution? [y/N]:

You may provide an access group for this computer e.g. webservers.

Access group:

You may provide tags for this computer e.g. server,precise.

Tags [vstack,jammy]:
Please wait...

Request a new registration for this computer now? [Y/n]: y
Traceback (most recent call last):
Failure: twisted.internet.error.ConnectError: An error occurred while connecting: 2: No such file or directory.

$ sudo systemctl status landscape-client.service
○ landscape-client.service - Landscape client daemons
     Loaded: loaded (/lib/systemd/system/landscape-client.service; enabled; vendor preset: enabled)
     Active: inactive (dead) (Result: exec-condition) since Sat 2023-09-23 19:02:42 UTC; 2min 55s ago
  Condition: start condition failed at Sat 2023-09-23 19:02:42 UTC; 2min 55s ago
       Docs: man:landscape-client(1)
             man:landscape-config(1)
    Process: 12314 ExecCondition=/usr/bin/landscape-config --is-registered (code=exited, status=5)
        CPU: 279ms

Sep 23 19:02:42 juju-b096f0-92-lxd-0 systemd[1]: Starting Landscape client daemons...
Sep 23 19:02:42 juju-b096f0-92-lxd-0 landscape-config[12314]: Registered: False
Sep 23 19:02:42 juju-b096f0-92-lxd-0 landscape-config[12314]: Config Path: /etc/landscape/client.conf
Sep 23 19:02:42 juju-b096f0-92-lxd-0 landscape-config[12314]: Data Path /var/lib/landscape/client
Sep 23 19:02:42 juju-b096f0-92-lxd-0 systemd[1]: landscape-client.service: Skipped due to 'exec-condition'.
Sep 23 19:02:42 juju-b096f0-92-lxd-0 systemd[1]: Condition check resulted in Landscape client daemons being skipped.

ubuntu@juju-b096f0-92-lxd-0:~$ /usr/bin/landscape-config --is-registered

Registered: False
Config Path: /etc/landscape/client.conf
Data Path /var/lib/landscape/client

ubuntu@juju-b096f0-92-lxd-0:~$ echo $?
5

ubuntu@juju-b096f0-92-lxd-0:~$ dpkg -l | grep landscape
ii landscape-client 23.02-0ubuntu1~22.04.1 a...

Read more...

Revision history for this message
Mark Cunningham (mdscunningham) wrote :

Looking at the changelog, it appears the fix for this was released in August to the self-hosted-23.03 stable PPA.

landscape-client (23.08-0ubuntu1) mantic; urgency=medium

  * New upstream release 23.08
    ...
    - Broker is able to bootstrap the landscape-client folder (LP: #1868730)
    ...

 -- Kevin Nasto ... Thu, 17 Aug 2023 13:41:21 -0500

---
landscape-client | 23.08+git6296-0ubuntu0 | landscape-23.03 | bionic | amd64
landscape-client | 23.08+git6296-0ubuntu0 | landscape-23.03 | focal | amd64
landscape-client | 23.08+git6296-0ubuntu0 | landscape-23.03 | jammy | amd64
---

Changed in landscape-client:
status: Fix Committed → Fix Released
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.