devrandom / gitian-builder

Build packages in a secure deterministic fashion inside a VM
https://gitian.org/
Other
402 stars 226 forks source link

make-base-vm broken #12

Closed sipa closed 12 years ago

sipa commented 12 years ago

On a recent version of gitian-builder:

bin/make-base-vm -arch i386
2012-05-14 13:26:14,827 INFO    : Calling hook: preflight_check
2012-05-14 13:26:14,827 INFO    : Cleaning up
2012-05-14 13:26:14,827 ERROR   : The path to the first-boot script is invalid: /home/pw/git/gitian-builder/target-bin/bootstrap-fixup. Make sure you are providing a full path.
Traceback (most recent call last):
  File "/usr/bin/vmbuilder", line 24, in <module>
    cli.main()
  File "/usr/lib/python2.7/dist-packages/VMBuilder/contrib/cli.py", line 216, in main
    distro.build_chroot()
  File "/usr/lib/python2.7/dist-packages/VMBuilder/distro.py", line 81, in build_chroot
    self.call_hooks('preflight_check')
  File "/usr/lib/python2.7/dist-packages/VMBuilder/distro.py", line 67, in call_hooks
    call_hooks(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/util.py", line 158, in call_hooks
    getattr(plugin, func, log_no_such_method)(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/plugins/firstscripts/__init__.py", line 40, in preflight_check
    raise VMBuilderUserError('The path to the first-boot script is invalid: %s. Make sure you are providing a full path.' % firstboot)
VMBuilder.exception.VMBuilderUserError: The path to the first-boot script is invalid: /home/pw/git/gitian-builder/target-bin/bootstrap-fixup. Make sure you are providing a full path.
sipa commented 12 years ago

And in older versions:

bin/make-base-vm -arch i386
[sudo] password for pw: 
2012-05-14 13:58:10,583 INFO    : Calling hook: preflight_check
2012-05-14 13:58:10,584 INFO    : Calling hook: set_defaults
2012-05-14 13:58:10,585 INFO    : Calling hook: bootstrap
Write failed: Broken pipe
2012-05-14 14:06:16,758 INFO    : Calling hook: configure_os
Extracting templates from packages: 100%
2012-05-14 14:09:39,598 INFO    : update-alternatives: error: no alternatives for rsh.
2012-05-14 14:09:39,648 INFO    : update-alternatives: error: no alternatives for rlogin.
2012-05-14 14:09:39,697 INFO    : update-alternatives: error: no alternatives for rcp.
2012-05-14 14:09:44,182 INFO    : Creating SSH2 RSA key; this may take some time ...
2012-05-14 14:09:44,276 INFO    : Creating SSH2 DSA key; this may take some time ...
2012-05-14 14:09:44,912 INFO    : 
2012-05-14 14:09:44,912 INFO    : Warning: Fake initctl called, doing nothing
2012-05-14 14:09:44,912 INFO    : 
2012-05-14 14:09:44,912 INFO    : Warning: Fake initctl called, doing nothing
2012-05-14 14:09:49,425 INFO    : 
2012-05-14 14:09:49,425 INFO    : Current default time zone: 'Etc/UTC'
2012-05-14 14:09:49,427 INFO    : Local time is now:      Mon May 14 12:09:49 UTC 2012.
2012-05-14 14:09:49,427 INFO    : Universal Time is now:  Mon May 14 12:09:49 UTC 2012.
2012-05-14 14:09:49,427 INFO    : 
Extracting templates from packages: 100%
2012-05-14 14:11:05,064 INFO    : 
2012-05-14 14:11:05,065 INFO    : Current default time zone: 'Etc/UTC'
2012-05-14 14:11:05,066 INFO    : Local time is now:      Mon May 14 12:11:05 UTC 2012.
2012-05-14 14:11:05,066 INFO    : Universal Time is now:  Mon May 14 12:11:05 UTC 2012.
2012-05-14 14:11:05,066 INFO    : Run 'dpkg-reconfigure tzdata' if you wish to change it.
2012-05-14 14:11:05,067 INFO    : 
2012-05-14 14:11:28,687 INFO    : stop: Unknown instance: 
2012-05-14 14:11:52,518 INFO    : Updating certificates in /etc/ssl/certs... WARNING: Skipping duplicate certificate ca-certificates.crt
2012-05-14 14:11:52,577 INFO    : 0 added, 1 removed; done.
2012-05-14 14:11:52,578 INFO    : Running hooks in /etc/ca-certificates/update.d....done.
2012-05-14 14:11:59,171 INFO    : restart: Unknown instance: 
2012-05-14 14:11:59,768 INFO    : start: Unknown parameter: JOB
2012-05-14 14:12:20,703 INFO    : umount: /tmp/tmpk1DXi7/dev: device is busy.
2012-05-14 14:12:20,703 INFO    :         (In some cases useful info about processes that use
2012-05-14 14:12:20,703 INFO    :          the device is found by lsof(8) or fuser(1))
2012-05-14 14:12:20,703 INFO    : Cleaning up
2012-05-14 14:12:20,703 ERROR   : Process (['umount', '/tmp/tmpk1DXi7/dev']) returned 1. stdout: , stderr: umount: /tmp/tmpk1DXi7/dev: device is busy.
    (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

Traceback (most recent call last):
  File "/usr/bin/vmbuilder", line 24, in <module>
    cli.main()
  File "/usr/lib/python2.7/dist-packages/VMBuilder/contrib/cli.py", line 216, in main
    distro.build_chroot()
  File "/usr/lib/python2.7/dist-packages/VMBuilder/distro.py", line 84, in build_chroot
    self.call_hooks('configure_os')
  File "/usr/lib/python2.7/dist-packages/VMBuilder/distro.py", line 67, in call_hooks
    call_hooks(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/util.py", line 165, in call_hooks
    getattr(context, func, log_no_such_method)(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/plugins/ubuntu/distro.py", line 155, in configure_os
    self.suite.unmount_dev()
  File "/usr/lib/python2.7/dist-packages/VMBuilder/plugins/ubuntu/dapper.py", line 118, in unmount_dev
    run_cmd('umount', '%s/dev' % self.context.chroot_dir)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/util.py", line 120, in run_cmd
    raise VMBuilderException, "Process (%s) returned %d. stdout: %s, stderr: %s" % (args.__repr__(), status, mystdout.buf, mystderr.buf)
VMBuilder.exception.VMBuilderException: Process (['umount', '/tmp/tmpk1DXi7/dev']) returned 1. stdout: , stderr: umount: /tmp/tmpk1DXi7/dev: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
devrandom commented 12 years ago

I think these are two separate issues.

The issue with debootstrap not unmounting the target /dev is known (and can't be worked around in gitian). I don't have access to my notes on this, but I think it started in Ubuntu Oneiric and is caused by crond starting in the target chroot. I found a workaround, but don't have it handy.

I'm not sure what the firstboot script issue is. Does the file exist?

Perhaps try lxc mode for now? It might be a few days until I have access to my development machine.

sipa commented 12 years ago

Ok, with --lxc it's exactly the same:

./bin/make-base-vm --suite lucid --arch i386 --lxc
[sudo] password for pw: 
2012-05-15 11:35:01,337 INFO    : Calling hook: preflight_check
2012-05-15 11:35:01,351 INFO    : Calling hook: set_defaults
2012-05-15 11:35:01,351 INFO    : Calling hook: bootstrap
2012-05-15 11:42:57,855 INFO    : Calling hook: configure_os
Extracting templates from packages: 100%
2012-05-15 11:46:17,906 INFO    : update-alternatives: error: no alternatives for rsh.
2012-05-15 11:46:17,955 INFO    : update-alternatives: error: no alternatives for rlogin.
2012-05-15 11:46:18,005 INFO    : update-alternatives: error: no alternatives for rcp.
2012-05-15 11:46:22,954 INFO    : Creating SSH2 RSA key; this may take some time ...
2012-05-15 11:46:23,238 INFO    : Creating SSH2 DSA key; this may take some time ...
2012-05-15 11:46:23,785 INFO    : 
2012-05-15 11:46:23,785 INFO    : Warning: Fake initctl called, doing nothing
2012-05-15 11:46:23,785 INFO    : 
2012-05-15 11:46:23,786 INFO    : Warning: Fake initctl called, doing nothing
2012-05-15 11:46:27,942 INFO    : 
2012-05-15 11:46:27,943 INFO    : Current default time zone: 'Etc/UTC'
2012-05-15 11:46:27,944 INFO    : Local time is now:      Tue May 15 09:46:27 UTC 2012.
2012-05-15 11:46:27,944 INFO    : Universal Time is now:  Tue May 15 09:46:27 UTC 2012.
2012-05-15 11:46:27,944 INFO    : 
Extracting templates from packages: 100%
2012-05-15 11:47:32,805 INFO    : 
2012-05-15 11:47:32,805 INFO    : Current default time zone: 'Etc/UTC'
2012-05-15 11:47:32,806 INFO    : Local time is now:      Tue May 15 09:47:32 UTC 2012.
2012-05-15 11:47:32,807 INFO    : Universal Time is now:  Tue May 15 09:47:32 UTC 2012.
2012-05-15 11:47:32,807 INFO    : Run 'dpkg-reconfigure tzdata' if you wish to change it.
2012-05-15 11:47:32,807 INFO    : 
2012-05-15 11:47:51,776 INFO    : stop: Unknown instance: 
2012-05-15 11:48:12,042 INFO    : Updating certificates in /etc/ssl/certs... WARNING: Skipping duplicate certificate ca-certificates.crt
2012-05-15 11:48:12,101 INFO    : 0 added, 1 removed; done.
2012-05-15 11:48:12,102 INFO    : Running hooks in /etc/ca-certificates/update.d....done.
2012-05-15 11:48:18,682 INFO    : restart: Unknown instance: 
2012-05-15 11:48:19,194 INFO    : start: Unknown parameter: JOB
2012-05-15 11:48:22,138 INFO    : umount: /tmp/tmp_Xv7BM/dev: device is busy.
2012-05-15 11:48:22,138 INFO    :         (In some cases useful info about processes that use
2012-05-15 11:48:22,138 INFO    :          the device is found by lsof(8) or fuser(1))
2012-05-15 11:48:22,138 INFO    : Cleaning up
2012-05-15 11:48:22,138 ERROR   : Process (['umount', '/tmp/tmp_Xv7BM/dev']) returned 1. stdout: , stderr: umount: /tmp/tmp_Xv7BM/dev: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

Traceback (most recent call last):
  File "/usr/bin/vmbuilder", line 24, in <module>
    cli.main()
  File "/usr/lib/python2.7/dist-packages/VMBuilder/contrib/cli.py", line 216, in main
    distro.build_chroot()
  File "/usr/lib/python2.7/dist-packages/VMBuilder/distro.py", line 84, in build_chroot
    self.call_hooks('configure_os')
  File "/usr/lib/python2.7/dist-packages/VMBuilder/distro.py", line 67, in call_hooks
    call_hooks(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/util.py", line 165, in call_hooks
    getattr(context, func, log_no_such_method)(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/plugins/ubuntu/distro.py", line 155, in configure_os
    self.suite.unmount_dev()
  File "/usr/lib/python2.7/dist-packages/VMBuilder/plugins/ubuntu/dapper.py", line 118, in unmount_dev
    run_cmd('umount', '%s/dev' % self.context.chroot_dir)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/util.py", line 120, in run_cmd
    raise VMBuilderException, "Process (%s) returned %d. stdout: %s, stderr: %s" % (args.__repr__(), status, mystdout.buf, mystderr.buf)
VMBuilder.exception.VMBuilderException: Process (['umount', '/tmp/tmp_Xv7BM/dev']) returned 1. stdout: , stderr: umount: /tmp/tmp_Xv7BM/dev: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
devrandom commented 12 years ago

Here is the workaround for the debootstrap issue:

Modify /usr/share/pyshared/VMBuilder/plugins/ubuntu/dapper.py as follows:

def unmount_dev(self):
    self.context.cancel_cleanup(self.unmount_dev)
    run_cmd('chroot', '%s' % self.context.chroot_dir, '/etc/init.d/cron','stop')
    run_cmd('sleep', '5')
    run_cmd('umount', '%s/dev' % self.context.chroot_dir)
devrandom commented 12 years ago

e82c0b47601be678d6bab33d69a01480b67e5fb3 should have fixed this.

devrandom commented 12 years ago

Closing for now, but I hear that there may be a similar issue still lingering. If that can be reproduced, we can reopen.