← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1766335] [NEW] Running cloud-init collect-logs inside a chroot is not possible

 

Public bug reported:

When trying to debug boot issues of a GCE instance I mounted a snapshot
of it's boot disk on a running instance and tried to run `sudo chroot
/home/ubuntu/failedbootdebug/ cloud-init collect-logs`.

This results in the errors below.

Is running collect-logs inside a chroot an expected use case or should I
just gather as much as I can from the list @
http://cloudinit.readthedocs.io/en/latest/topics/capabilities.html
#cloud-init-collect-logs ?

ubuntu@failed-boot-debug:~$ sudo chroot /home/ubuntu/failedbootdebug/ cloud-init collect-logs
Traceback (most recent call last):
  File "/usr/bin/cloud-init", line 11, in <module>
    load_entry_point('cloud-init==18.2', 'console_scripts', 'cloud-init')()
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 882, in main
    get_uptime=True, func=functor, args=(name, args))
  File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2395, in log_time
    ret = func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 88, in handle_collect_logs_args
    collect_logs(args.tarfile, args.userdata)
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 81, in collect_logs
    shutil.copytree(CLOUDINIT_RUN_DIR, os.path.join(run_dir, 'cloud-init'))
  File "/usr/lib/python3.6/shutil.py", line 309, in copytree
    names = os.listdir(src)
FileNotFoundError: [Errno 2] No such file or directory: '/run/cloud-init'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport/report.py", line 546, in add_proc_info
    self['ExecutablePath'] = os.readlink('/proc/' + pid + '/exe')
FileNotFoundError: [Errno 2] No such file or directory: '/proc/1918/exe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 109, in apport_excepthook
    pr.add_proc_info(extraenv=['PYTHONPATH', 'PYTHONHOME'])
  File "/usr/lib/python3/dist-packages/apport/report.py", line 549, in add_proc_info
    raise ValueError('invalid process')
ValueError: invalid process

Original exception was:
Traceback (most recent call last):
  File "/usr/bin/cloud-init", line 11, in <module>
    load_entry_point('cloud-init==18.2', 'console_scripts', 'cloud-init')()
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 882, in main
    get_uptime=True, func=functor, args=(name, args))
  File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2395, in log_time
    ret = func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 88, in handle_collect_logs_args
    collect_logs(args.tarfile, args.userdata)
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 81, in collect_logs
    shutil.copytree(CLOUDINIT_RUN_DIR, os.path.join(run_dir, 'cloud-init'))
  File "/usr/lib/python3.6/shutil.py", line 309, in copytree
    names = os.listdir(src)
FileNotFoundError: [Errno 2] No such file or directory: '/run/cloud-init'
ubuntu@failed-boot-debug:~$

** Affects: cloud-init
     Importance: Undecided
         Status: New

** Attachment added: "collect-logs-errors.txt"
   https://bugs.launchpad.net/bugs/1766335/+attachment/5126049/+files/collect-logs-errors.txt

** Description changed:

  When trying to debug boot issues of a GCE instance I mounted a snapshot
  of it's boot disk on a running instance and tried to run `sudo chroot
  /home/ubuntu/failedbootdebug/ cloud-init collect-logs`.
  
  This results in the errors below.
  
  Is running collect-logs inside a chroot an expected use case or should I
  just gather as much as I can from the list @
  http://cloudinit.readthedocs.io/en/latest/topics/capabilities.html
- #cloud-init-collect-logs
- 
+ #cloud-init-collect-logs ?
  
  ubuntu@failed-boot-debug:~$ sudo chroot /home/ubuntu/failedbootdebug/ cloud-init collect-logs
  Traceback (most recent call last):
-   File "/usr/bin/cloud-init", line 11, in <module>
-     load_entry_point('cloud-init==18.2', 'console_scripts', 'cloud-init')()
-   File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 882, in main
-     get_uptime=True, func=functor, args=(name, args))
-   File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2395, in log_time
-     ret = func(*args, **kwargs)
-   File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 88, in handle_collect_logs_args
-     collect_logs(args.tarfile, args.userdata)
-   File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 81, in collect_logs
-     shutil.copytree(CLOUDINIT_RUN_DIR, os.path.join(run_dir, 'cloud-init'))
-   File "/usr/lib/python3.6/shutil.py", line 309, in copytree
-     names = os.listdir(src)
+   File "/usr/bin/cloud-init", line 11, in <module>
+     load_entry_point('cloud-init==18.2', 'console_scripts', 'cloud-init')()
+   File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 882, in main
+     get_uptime=True, func=functor, args=(name, args))
+   File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2395, in log_time
+     ret = func(*args, **kwargs)
+   File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 88, in handle_collect_logs_args
+     collect_logs(args.tarfile, args.userdata)
+   File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 81, in collect_logs
+     shutil.copytree(CLOUDINIT_RUN_DIR, os.path.join(run_dir, 'cloud-init'))
+   File "/usr/lib/python3.6/shutil.py", line 309, in copytree
+     names = os.listdir(src)
  FileNotFoundError: [Errno 2] No such file or directory: '/run/cloud-init'
  Error in sys.excepthook:
  Traceback (most recent call last):
-   File "/usr/lib/python3/dist-packages/apport/report.py", line 546, in add_proc_info
-     self['ExecutablePath'] = os.readlink('/proc/' + pid + '/exe')
+   File "/usr/lib/python3/dist-packages/apport/report.py", line 546, in add_proc_info
+     self['ExecutablePath'] = os.readlink('/proc/' + pid + '/exe')
  FileNotFoundError: [Errno 2] No such file or directory: '/proc/1918/exe'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
-   File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 109, in apport_excepthook
-     pr.add_proc_info(extraenv=['PYTHONPATH', 'PYTHONHOME'])
-   File "/usr/lib/python3/dist-packages/apport/report.py", line 549, in add_proc_info
-     raise ValueError('invalid process')
+   File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 109, in apport_excepthook
+     pr.add_proc_info(extraenv=['PYTHONPATH', 'PYTHONHOME'])
+   File "/usr/lib/python3/dist-packages/apport/report.py", line 549, in add_proc_info
+     raise ValueError('invalid process')
  ValueError: invalid process
  
  Original exception was:
  Traceback (most recent call last):
-   File "/usr/bin/cloud-init", line 11, in <module>
-     load_entry_point('cloud-init==18.2', 'console_scripts', 'cloud-init')()
-   File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 882, in main
-     get_uptime=True, func=functor, args=(name, args))
-   File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2395, in log_time
-     ret = func(*args, **kwargs)
-   File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 88, in handle_collect_logs_args
-     collect_logs(args.tarfile, args.userdata)
-   File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 81, in collect_logs
-     shutil.copytree(CLOUDINIT_RUN_DIR, os.path.join(run_dir, 'cloud-init'))
-   File "/usr/lib/python3.6/shutil.py", line 309, in copytree
-     names = os.listdir(src)
+   File "/usr/bin/cloud-init", line 11, in <module>
+     load_entry_point('cloud-init==18.2', 'console_scripts', 'cloud-init')()
+   File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 882, in main
+     get_uptime=True, func=functor, args=(name, args))
+   File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2395, in log_time
+     ret = func(*args, **kwargs)
+   File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 88, in handle_collect_logs_args
+     collect_logs(args.tarfile, args.userdata)
+   File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 81, in collect_logs
+     shutil.copytree(CLOUDINIT_RUN_DIR, os.path.join(run_dir, 'cloud-init'))
+   File "/usr/lib/python3.6/shutil.py", line 309, in copytree
+     names = os.listdir(src)
  FileNotFoundError: [Errno 2] No such file or directory: '/run/cloud-init'
  ubuntu@failed-boot-debug:~$

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1766335

Title:
  Running cloud-init collect-logs inside a chroot is not possible

Status in cloud-init:
  New

Bug description:
  When trying to debug boot issues of a GCE instance I mounted a
  snapshot of it's boot disk on a running instance and tried to run
  `sudo chroot /home/ubuntu/failedbootdebug/ cloud-init collect-logs`.

  This results in the errors below.

  Is running collect-logs inside a chroot an expected use case or should
  I just gather as much as I can from the list @
  http://cloudinit.readthedocs.io/en/latest/topics/capabilities.html
  #cloud-init-collect-logs ?

  ubuntu@failed-boot-debug:~$ sudo chroot /home/ubuntu/failedbootdebug/ cloud-init collect-logs
  Traceback (most recent call last):
    File "/usr/bin/cloud-init", line 11, in <module>
      load_entry_point('cloud-init==18.2', 'console_scripts', 'cloud-init')()
    File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 882, in main
      get_uptime=True, func=functor, args=(name, args))
    File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2395, in log_time
      ret = func(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 88, in handle_collect_logs_args
      collect_logs(args.tarfile, args.userdata)
    File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 81, in collect_logs
      shutil.copytree(CLOUDINIT_RUN_DIR, os.path.join(run_dir, 'cloud-init'))
    File "/usr/lib/python3.6/shutil.py", line 309, in copytree
      names = os.listdir(src)
  FileNotFoundError: [Errno 2] No such file or directory: '/run/cloud-init'
  Error in sys.excepthook:
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/apport/report.py", line 546, in add_proc_info
      self['ExecutablePath'] = os.readlink('/proc/' + pid + '/exe')
  FileNotFoundError: [Errno 2] No such file or directory: '/proc/1918/exe'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 109, in apport_excepthook
      pr.add_proc_info(extraenv=['PYTHONPATH', 'PYTHONHOME'])
    File "/usr/lib/python3/dist-packages/apport/report.py", line 549, in add_proc_info
      raise ValueError('invalid process')
  ValueError: invalid process

  Original exception was:
  Traceback (most recent call last):
    File "/usr/bin/cloud-init", line 11, in <module>
      load_entry_point('cloud-init==18.2', 'console_scripts', 'cloud-init')()
    File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 882, in main
      get_uptime=True, func=functor, args=(name, args))
    File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2395, in log_time
      ret = func(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 88, in handle_collect_logs_args
      collect_logs(args.tarfile, args.userdata)
    File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/logs.py", line 81, in collect_logs
      shutil.copytree(CLOUDINIT_RUN_DIR, os.path.join(run_dir, 'cloud-init'))
    File "/usr/lib/python3.6/shutil.py", line 309, in copytree
      names = os.listdir(src)
  FileNotFoundError: [Errno 2] No such file or directory: '/run/cloud-init'
  ubuntu@failed-boot-debug:~$

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1766335/+subscriptions


Follow ups