[SOLVED] LXC Config File

Editor

Member
Apr 26, 2017
86
1
8
Turkey
Hello,

I want to make some changes in the configuration file of LXC Centos container.

I changed this file "lxc-centos" (in /usr/share/lxc/templates) and I did reboot server but it did not work.

Could you specify the location of this file?
Thanks
 

tom

Proxmox Staff Member
Staff member
Aug 29, 2006
13,898
460
103
I think this is a state secret, why does nobody say it? Is not this an open source project?
You question is quite/totally unclear.

The topic of the thread is "LXC config file" but then you talk about yum.

Please try to ask a clear question.
 
  • Like
Reactions: fireon

dietmar

Proxmox Staff Member
Staff member
Apr 28, 2005
16,529
328
103
Austria
www.proxmox.com
Also, it is impossible to change the content of an existing container by modifying a container template generation config file.
 

Editor

Member
Apr 26, 2017
86
1
8
Turkey
Hello again,

I want to make some changes in the CentOS configuration file, so I need to auto-install some packages. I want to automate this process with the configuration file instead of manually loading them.

I can change the data in the container via API, for example; IP address, hostname, password.. If I can change, then I think I can install the some packages in the container with automatically. am I wrong @tom ?
 

dcsapak

Proxmox Staff Member
Staff member
Feb 1, 2016
4,074
368
88
31
Vienna

Editor

Member
Apr 26, 2017
86
1
8
Turkey
Last edited:

dcsapak

Proxmox Staff Member
Staff member
Feb 1, 2016
4,074
368
88
31
Vienna
For this reason I need a LXC config file. Why do not you tell me?
i believe there is a misunderstanding

the 'lxc-config' files you refer to are part of creating lxc containers, but we do not use this
instead our templates are 'simply' a rootfs packed in a tar.gz

for debian based containers, there is our 'dab' (debian appliance builder),
for centos (for which the templates we take from the lxc project) you would have to do it yourself

make a container
save all your changes which should persist across containers
delete all things which are container specific (e.g. hostname, ip config, etc.)
and backup that container as a tar.gz

now you can use that template for new containers

Could you make changes in the container with the API? For example; can you install CentOS package with API? I know we can not do it.
you can not install packages via the api or set the password on an existing container
but you can set a hostname/ip/password/ssh-key on container creation and use that, for example with ssh

using the commandline tools you can execute arbitrary commands in an container:
Code:
pct exec <ID> -- apt install git
 

Editor

Member
Apr 26, 2017
86
1
8
Turkey
using the commandline tools you can execute arbitrary commands in an container:
Code:
pct exec <ID> -- apt install git
That's it! but the installation process requests confirmation.

Code:
pct exec <ID> -- yum install git
Total download size: 7 k
Installed size: 2.0 M     
Is this ok [y/d/N]:
Is it possible confirmation? For example;

Code:
pct exec <ID> -- yum install git -y
when i do this; I getting this error message:
Code:
pct exec <ID> -- yum install git -y
Unknown option: y                                                                                                                                                                                                          
400 unable to parse option                                                                                                                                                                                                 
pct exec <vmid> [<extra-args>]
How can this be overcome?
 
Last edited:

dcsapak

Proxmox Staff Member
Staff member
Feb 1, 2016
4,074
368
88
31
Vienna
this should work, what is your pveversion -v ? (maybe try to upgrade to the latest version)
 

Editor

Member
Apr 26, 2017
86
1
8
Turkey
this should work, what is your pveversion -v ? (maybe try to upgrade to the latest version)
proxmox-ve: 5.1-43


proxmox-ve: 5.1-38 (running kernel: 4.13.13-5-pve)
pve-manager: 5.1-43 (running version: 5.1-43/bdb08029)
pve-kernel-4.13.4-1-pve: 4.13.4-26
pve-kernel-4.13.8-2-pve: 4.13.8-28
pve-kernel-4.13.13-4-pve: 4.13.13-35
pve-kernel-4.13.13-2-pve: 4.13.13-33
pve-kernel-4.10.17-2-pve: 4.10.17-20
pve-kernel-4.13.8-3-pve: 4.13.8-30
pve-kernel-4.13.8-1-pve: 4.13.8-27
pve-kernel-4.13.13-5-pve: 4.13.13-38
pve-kernel-4.13.13-3-pve: 4.13.13-34
pve-kernel-4.13.13-1-pve: 4.13.13-31
pve-kernel-4.10.17-3-pve: 4.10.17-23
libpve-http-server-perl: 2.0-8
lvm2: 2.02.168-pve6
corosync: 2.4.2-pve3
libqb0: 1.0.1-1
pve-cluster: 5.0-19
qemu-server: 5.0-20
pve-firmware: 2.0-3
libpve-common-perl: 5.0-25
libpve-guest-common-perl: 2.0-14
libpve-access-control: 5.0-7
libpve-storage-perl: 5.0-17
pve-libspice-server1: 0.12.8-3
vncterm: 1.5-3
pve-docs: 5.1-16
pve-qemu-kvm: 2.9.1-6
pve-container: 2.0-18
pve-firewall: 3.0-5
pve-ha-manager: 2.0-4
ksm-control-daemon: 1.2-2
glusterfs-client: 3.8.8-1
lxc-pve: 2.1.1-2
lxcfs: 2.0.8-1
criu: 2.11.1-1~bpo90
novnc-pve: 0.6-4
smartmontools: 6.5+svn4324-1
zfsutils-linux: 0.7.4-pve2~bpo9
openvswitch-switch: 2.7.0-2
 

dcsapak

Proxmox Staff Member
Staff member
Feb 1, 2016
4,074
368
88
31
Vienna
works here:
Code:
# pct exec 300 -- apt -y install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
git is already the newest version (1:2.11.0-3+deb9u2).
0 upgraded, 0 newly installed, 0 to remove and 34 not upgraded.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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 your own in 60 seconds.

Buy now!