Support adding custom debs from a local apt repository

Bug #468809 reported by Daniel Kulesz
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
vm-builder (Ubuntu)
Confirmed
Wishlist
Unassigned

Bug Description

Currently, I see no way for adding custom DEB-packages to a VM when building it with ubuntu-vm-builder. I thought of two workarounds for this problem:

- use apt-proxy to create a local mirror first, include the packages there (which involves creating an own package site since only ftp, http and rsync are supported) and pass --mirror to ubuntu-vm-builder
- mount the VM archive afterwards (using i.e. vmware-mount.pl), chroot into it and makes the changes within the image. Apart from the annoying scripting work, you have to make sure the packages are removed from apt's cache after installation. Even if you do so it, results in a larger image size, so you would need to shrink the resulting image again.

Both workarounds are not satisfying, therefore I wish ubuntu-vm-builder would support a "--add-dpkg" option as well.

Revision history for this message
Chuck Short (zulcss) wrote :

It already does this:

    --addpkg=PKG Install PKG into the guest (can be specfied multiple
                        times).

Regards
chuck

Changed in vm-builder (Ubuntu):
status: New → Invalid
Revision history for this message
Mathias Gug (mathiaz) wrote :

I think that the reporter suggests to be able to add a custom/local apt repository and be able to install a debian package from it using the addpkg option from vmbuilder.

Is that a correct statement?

Changed in vm-builder (Ubuntu):
status: Invalid → Incomplete
importance: Undecided → Wishlist
summary: - Support adding custom debs
+ Support adding custom debs from a local apt repository
Revision history for this message
Daniel Kulesz (kuleszdl) wrote :

Exactly! The --addpkg switch just adds packages from the repositories, which are specified by --mirror. Therefore only debs from official repositories can be added.

Now when I have a package which is not available in any repository (a custom deb), I didn't find a simple way to include it in the built VM, except using one of those workarounds I mentioned. I even don't want to setup an own, local apt repository? I just want to include a filename (or path) in my local filesystem, and have the debs included from there.

Revision history for this message
Mathias Gug (mathiaz) wrote : Re: [Bug 468809] Re: Support adding custom debs from a local apt repository

On Mon, Nov 02, 2009 at 08:01:44PM -0000, Daniel Kulesz wrote:
>
> Now when I have a package which is not available in any repository (a
> custom deb), I didn't find a simple way to include it in the built VM,
> except using one of those workarounds I mentioned. I even don't want to
> setup an own, local apt repository? I just want to include a filename
> (or path) in my local filesystem, and have the debs included from there.
>

You can probably use the finish script option to copy your debs into the root
filesystem and then dpkg install them via a chroot.

Revision history for this message
Daniel Kulesz (kuleszdl) wrote :

Ok - I didn't know this option did exist (the documentation is incomplete, but this has been already reported). The proposed solution sounds better than my initial workaround thoughts, but still it sounds like tinkering. I would have to script copying the files into the filesystem, chrooting into it and then running dpkg for installing them.

Does it really makes sense to re-implement this? I mean, vm-builder does already the same, just limited to packages available on the mirror.

Revision history for this message
Nick Barcet (nijaba) wrote :

Actually what you would have to do is:

1/ use the --copy option to copy your deb in the image
2/ use the --execscript to launch a script that
  * chroot $1
  * dpkg -i <yourdeb>

Does not sounds like much tinkering to me, but agree that we could consider this a wishlist item to allow for a --add-deb option. Not very hard to implement, btw.

On the documentation chapter, both --copy and --execscript do appear when I either do a 'man vmbuilder' or 'sudo vmbuilder kvm ubuntu --help', so I do not really understand your remark.

Nick Barcet (nijaba)
Changed in vm-builder (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Sergey Svishchev (svs) wrote :

Create a custom sources.list.tmpl. debootstrap will warn about missing GPG key (if your repo is signed), though.

Revision history for this message
Cristian Klein (cristiklein) wrote :

I just discovered the --ppa option. I guess it could solve the OP's use-case, if he can afford uploading his packages to a PPA.

Revision history for this message
Daniel Kulesz (kuleszdl) wrote :

Actually, "--ppa" sounds as complicated as "--mirror" to me. You have to do (too) much effort to build an ppa first. The workaround proposed by Nick sounds better in this respect, but still I think that it has the disadvantage that it is tinkering, because you copy in deb files which - even when you remove them after installation - result in an unclean, not size-optimized image.

Summarizing, we have two workarounds:
a) using --mirror or --ppa: Leaves image clean, but requires additional setup effort
b) using a self-scripted solution: Leaves image unclean, but requires only few additional setup effort

What I was thinking about is a solution, that leaves the image clean and requires NO additional setup effort except using the "--add-dpkg" switch. This would be a very basic but clean solution. Of course, internally it could be combined, i.e. vmbuilder could setup its own ppa, copy the specified deb files there and do rest like if the user provided the "--ppa" switch him/herself.

Revision history for this message
Cristian Klein (cristiklein) wrote :
Revision history for this message
Daniel Kulesz (kuleszdl) wrote :

If I understand this correctly, your patch is only loosely related to the original intention of this bug and the discussion, as it only allows adding items to the sources.list and thus requires a PPA-site or manual copying of .deb-files into the VM?

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.