TypeError: coercing to Unicode: need string or buffer, NoneType found

Bug #551451 reported by Paul Sladen
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
vm-builder (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

sudo vmbuilder xen ubuntu \
    --suite lucid --flavour virtual --arch amd64 \
    --part partitions.txt \
    --user ubuntu --name Ubuntu \
    --components main,universe \
    --addpkg openssh-server

2010-03-30 07:25:00,509 INFO : Calling hook: preflight_check
2010-03-30 07:25:00,514 INFO : Calling hook: set_defaults
2010-03-30 07:25:00,515 INFO : Calling hook: bootstrap
2010-03-30 07:26:43,726 INFO : Calling hook: configure_os
2010-03-30 07:26:53,850 INFO : update-alternatives: error: no alternatives for rsh.
2010-03-30 07:26:54,070 INFO : update-alternatives: error: no alternatives for rlogin.
2010-03-30 07:26:54,291 INFO : update-alternatives: error: no alternatives for rcp.
2010-03-30 07:26:56,001 INFO : Creating SSH2 RSA key; this may take some time ...
2010-03-30 07:26:57,643 INFO : Creating SSH2 DSA key; this may take some time ...
2010-03-30 07:26:58,175 INFO :
2010-03-30 07:26:58,177 INFO : Warning: Fake initctl called, doing nothing
2010-03-30 07:26:58,190 INFO :
2010-03-30 07:26:58,190 INFO : Warning: Fake initctl called, doing nothing
2010-03-30 07:27:00,334 INFO :
2010-03-30 07:27:00,335 INFO : Current default time zone: 'Etc/UTC'
2010-03-30 07:27:00,349 INFO : Local time is now: Tue Mar 30 06:27:00 UTC 2010.
2010-03-30 07:27:00,349 INFO : Universal Time is now: Tue Mar 30 06:27:00 UTC 2010.
2010-03-30 07:27:00,349 INFO :
2010-03-30 07:27:04,436 INFO : Calling hook: post_install
2010-03-30 07:27:04,442 INFO : Calling hook: preflight_check
2010-03-30 07:27:04,443 INFO : Calling hook: configure_networking
2010-03-30 07:27:04,459 INFO : Calling hook: configure_mounting
2010-03-30 07:27:04,474 INFO : Calling hook: mount_partitions
2010-03-30 07:27:04,475 INFO : Mounting target filesystems
2010-03-30 07:27:04,475 INFO : Creating filesystem: /, size: 20000, dummy: False
Traceback (most recent call last):
  File "/usr/bin/vmbuilder", line 24, in <module>
    cli.main()
  File "/usr/lib/python2.6/dist-packages/VMBuilder/contrib/cli.py", line 116, in main
    hypervisor.install_os()
  File "/usr/lib/python2.6/dist-packages/VMBuilder/hypervisor.py", line 64, in install_os
    self.call_hooks('mount_partitions', self.chroot_dir)
  File "/usr/lib/python2.6/dist-packages/VMBuilder/distro.py", line 66, in call_hooks
    call_hooks(self, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/VMBuilder/util.py", line 165, in call_hooks
    getattr(context, func, log_no_such_method)(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/VMBuilder/hypervisor.py", line 82, in mount_partitions
    fs.create()
  File "/usr/lib/python2.6/dist-packages/VMBuilder/disk.py", line 332, in create
    if not os.path.exists(self.filename):
  File "/usr/lib/python2.6/genericpath.py", line 18, in exists
    st = os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NoneType found

dpkg -l python-vm-builder
python-vm-builder 0.12.3-0ubuntu1

Revision history for this message
Paul Sladen (sladen) wrote :

Altering whether 'partitions.txt' has a newline at the end gives a different traceback:

ubuntu@ubuntu:~/build$ cat partitions.txt
root 20000

ubuntu@ubuntu:~/build$

If the newline is added, then the result is:

2010-03-30 07:32:57,831 INFO : Calling hook: post_install
Traceback (most recent call last):
  File "/usr/bin/vmbuilder", line 24, in <module>
    cli.main()
  File "/usr/lib/python2.6/dist-packages/VMBuilder/contrib/cli.py", line 115, in main
    self.set_disk_layout(hypervisor)
  File "/usr/lib/python2.6/dist-packages/VMBuilder/contrib/cli.py", line 228, in set_disk_layout
    hypervisor.add_filesystem(elements[1], type=default_filesystem, mntpnt=elements[0])
IndexError: list index out of range
ubuntu@ubuntu:~/build$ cat partitions.txt
root 20000

Revision history for this message
Thierry Carrez (ttx) wrote :

Yes, this is wrong (VMBuilder/disk.py:332):

        if not os.path.exists(self.filename):
            logging.info('Not preallocated, so we create it.')
            if not self.filename:

If self.filename is "None", then os.path.exists(self.filename) fails with the above TypeError

Changed in vm-builder (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
ericqq (phppie) wrote :

i fond the same Error in the ubuntu 10.4 beta2.0 too..............

Revision history for this message
J Bruni (jbruni) wrote :

Perhaps the following fix apply to this bug?

https://bugs.launchpad.net/ubuntu/+source/packagekit/+bug/546607

Revision history for this message
neocultura (neocultura) wrote :

sudo vmbuilder xen ubuntu --part ./part
2010-06-09 13:27:42,334 INFO : Calling hook: preflight_check
2010-06-09 13:27:42,383 INFO : Calling hook: set_defaults
2010-06-09 13:27:42,383 INFO : Calling hook: bootstrap
2010-06-09 13:51:10,410 INFO : Calling hook: configure_os
2010-06-09 13:53:01,427 INFO :
2010-06-09 13:53:01,427 INFO : Current default time zone: 'Etc/UTC'
2010-06-09 13:53:01,429 INFO : Local time is now: Wed Jun 9 11:53:01 UTC 2010.
2010-06-09 13:53:01,429 INFO : Universal Time is now: Wed Jun 9 11:53:01 UTC 2010.
2010-06-09 13:53:01,429 INFO :
2010-06-09 13:56:51,887 INFO :
2010-06-09 13:56:51,888 INFO : Current default time zone: 'Etc/UTC'
2010-06-09 13:56:51,890 INFO : Local time is now: Wed Jun 9 11:56:51 UTC 2010.
2010-06-09 13:56:51,890 INFO : Universal Time is now: Wed Jun 9 11:56:51 UTC 2010.
2010-06-09 13:56:51,890 INFO : Run 'dpkg-reconfigure tzdata' if you wish to change it.
2010-06-09 13:56:51,890 INFO :
2010-06-09 13:57:17,639 INFO : Calling hook: post_install
2010-06-09 13:57:17,680 INFO : Calling hook: preflight_check
2010-06-09 13:57:17,681 INFO : Calling hook: configure_networking
2010-06-09 13:57:17,735 INFO : Calling hook: configure_mounting
2010-06-09 13:57:17,743 INFO : Calling hook: mount_partitions
2010-06-09 13:57:17,743 INFO : Mounting target filesystems
2010-06-09 13:57:17,744 INFO : Creating filesystem: /, size: 400, dummy: False
Traceback (most recent call last):
  File "/usr/bin/vmbuilder", line 24, in <module>
    cli.main()
  File "/usr/lib/python2.6/dist-packages/VMBuilder/contrib/cli.py", line 116, in main
    hypervisor.install_os()
  File "/usr/lib/python2.6/dist-packages/VMBuilder/hypervisor.py", line 64, in install_os
    self.call_hooks('mount_partitions', self.chroot_dir)
  File "/usr/lib/python2.6/dist-packages/VMBuilder/distro.py", line 66, in call_hooks
    call_hooks(self, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/VMBuilder/util.py", line 165, in call_hooks
    getattr(context, func, log_no_such_method)(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/VMBuilder/hypervisor.py", line 82, in mount_partitions
    fs.create()
  File "/usr/lib/python2.6/dist-packages/VMBuilder/disk.py", line 332, in create
    if not os.path.exists(self.filename):
  File "/usr/lib/python2.6/genericpath.py", line 18, in exists
    st = os.stat(path)

TypeError: coercing to Unicode: need string or buffer, NoneType found

Here goes my partition file:

root 400
/mnt/ephemeral 0 /dev/sda1
swap 1 /dev/sda2

I am really new with vmbuilder and can not work out what is the problem here...

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.