Customize LXC container image - systemd-nspawn missing?

zaphyre

Member
Oct 6, 2020
55
4
13
35
Hi,
I am in the process of customizing a provided LXC container image (ubuntu-20.04-standard_20.04-1_amd64.tar.gz) on a PVE 6 host (pve-manager/6.2-12/b287dd27 (running kernel: 5.4.65-1-pve)). I did this process a year ago successfully with the "ubuntu-18.04-standard_18.04.1-1_amd64.tar.gz" image and now used my old notes to apply this to the new image.

After decompressing the .tar.gz to a temp directory I want to use systemd-nspawn -D /tmp/newub2004_template to "chroot" and made my changes to the image, but systemd-nspawn seems to be gone? (-bash: systemd-nspawn: command not found)

This PVE host was upgraded in the meantime from somethin 5.X to the current version.

So, is there another supported way of customizing the images? Checked https://pve.proxmox.com/pve-docs/chapter-pct.html but did not find sth about customizing the contents...
Is it safe to simply (re)install the "systemd-container" package, or does it interfere with proxmox own container system or tooling?

Thanks for any help with this!

Zaph
 
hi,

if you just want to chroot then you don't need systemd-nspawn. coreutils has the chroot binary, chroot /path/to/your/directory should work fine.
 
Hi and thanks for your reply!

As far as I understood chroot should be okay for editing lets say some config files, but what about installing packages apt install gitor call something like apt update && apt upgrade which is what I am trying to achive besides editing some config files?

So, I`d say I don't just want to chroot, do I? I understand that chrooting in my tmp work dir would not be enough? Sorry, I am lacking some knowledge here... ;)

Again thanks for help.
 
well, you can install systemd-container and it normally shouldn't interfere with PVE (if you're just going to modify some templates it's not going to cause problems).

So, is there another supported way of customizing the images? Checked https://pve.proxmox.com/pve-docs/chapter-pct.html but did not find sth about customizing the contents...
what are you trying to customize exactly? there could be alternatives
 
what are you trying to customize exactly? there could be alternatives
Thought of taking the provided Ubuntu 20.04 LTS image and
  • update packages
  • install some standard applications we always "want" added in our default containers
  • add ssh keys
  • modifiy some config files
stuff, like this...
So I would just apt install systemd-container on the pve host and give it a try. was it removed from the current version for a reason? Or is it missing somehow in my own installation maybe to the upgrade of the host?

Thanks for help!
 
was it removed from the current version for a reason? Or is it missing somehow in my own installation maybe to the upgrade of the host?
afaik it's not installed by default at all.

Thought of taking the provided Ubuntu 20.04 LTS image and
  • update packages
  • install some standard applications we always "want" added in our default containers
  • add ssh keys
  • modifiy some config files
stuff, like this...
probably an easier way of doing this is the following:
1. create ubuntu container
2. boot it & make desired modifications/updates/etc.
3. turn container into template (right click on the menu on the left)

afterwards you should have a template, which you can right click and clone to create a new container with the same settings :)
 
afaik it's not installed by default at all.


probably an easier way of doing this is the following:
1. create ubuntu container
2. boot it & make desired modifications/updates/etc.
3. turn container into template (right click on the menu on the left)

afterwards you should have a template, which you can right click and clone to create a new container with the same settings :)
Well, I wasn`t aware of this feature but this sounds definitively like the route to go - thanks for hinting me in the right direction!
 
  • Like
Reactions: Xeata_James
Wow. Just spent considerable time researching DAB and Distrobuilder and all I need to do is customize an existing container and save it. I feel both foolish and gratified at the same time.

Perfect solution.

Thanks!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!