LXC don't start

Jayz

Active Member
Apr 30, 2019
27
1
43
46
Hello,
I converted openvz to lxc without any fails. When I press Start, container don`t start.
Version Ubuntu is 6.06 inside container.
I included support old version Ubuntu in file /usr/share/perl5/PVE/LXC/Setup/Ubuntu.pm
Code:
my $known_versions = {
    '20.04' => 1, # focal LTS
    '19.10' => 1, # eoan
    '19.04' => 1, # disco
    '18.10' => 1, # cosmic
    '18.04' => 1, # bionic LTS
    '17.10' => 1, # artful
    '17.04' => 1, # zesty
    '16.10' => 1, # yakkety
    '16.04' => 1, # xenial LTS
    '15.10' => 1, # wily
    '15.04' => 1, # vivid
    '14.04' => 1, # trusty LTS
    '12.04' => 1, # precise LTS
    '10.04' => 1, # lucid LTS
    '8.04' => 1, # hardy LTS
    '6.06' => 1, # dapper LTS
};


if ($version eq '6.06' || $version eq '8.04' || $version eq '10.04' || $version eq '12.04' || $version eq '14.04') {

pveversion -v
Code:
proxmox-ve: 6.2-1 (running kernel: 5.4.41-1-pve)
pve-manager: 6.2-4 (running version: 6.2-4/9824574a)
pve-kernel-5.4: 6.2-2
pve-kernel-helper: 6.2-2
pve-kernel-5.0: 6.0-11
pve-kernel-5.4.41-1-pve: 5.4.41-1
pve-kernel-5.0.21-5-pve: 5.0.21-10
pve-kernel-5.0.18-1-pve: 5.0.18-3
pve-kernel-5.0.15-1-pve: 5.0.15-1
ceph-fuse: 12.2.11+dfsg1-2.1+b1
corosync: 3.0.3-pve1
criu: 3.11-3
glusterfs-client: 5.5-3
ifupdown: 0.8.35+pve1
ksm-control-daemon: 1.3-1
libjs-extjs: 6.0.1-10
libknet1: 1.15-pve1
libproxmox-acme-perl: 1.0.4
libpve-access-control: 6.1-1
libpve-apiclient-perl: 3.0-3
libpve-common-perl: 6.1-2
libpve-guest-common-perl: 3.0-10
libpve-http-server-perl: 3.0-5
libpve-storage-perl: 6.1-8
libqb0: 1.0.5-1
libspice-server1: 0.14.2-4~pve6+1
lvm2: 2.03.02-pve4
lxc-pve: 4.0.2-1
lxcfs: 4.0.3-pve2
novnc-pve: 1.1.0-1
proxmox-mini-journalreader: 1.1-1
proxmox-widget-toolkit: 2.2-1
pve-cluster: 6.1-8
pve-container: 3.1-6
pve-docs: 6.2-4
pve-edk2-firmware: 2.20200229-1
pve-firewall: 4.1-2
pve-firmware: 3.1-1
pve-ha-manager: 3.0-9
pve-i18n: 2.1-2
pve-qemu-kvm: 5.0.0-2
pve-xtermjs: 4.3.0-1
qemu-server: 6.2-2
smartmontools: 7.1-pve2
spiceterm: 3.1-1
vncterm: 1.6-1
zfsutils-linux: 0.8.4-pve1

aa-status
Code:
apparmor module is loaded.
5 profiles are loaded.
5 profiles are in enforce mode.
   /usr/bin/lxc-start
   lxc-container-default
   lxc-container-default-cgns
   lxc-container-default-with-mounting
   lxc-container-default-with-nesting
0 profiles are in complain mode.
0 processes have profiles defined.
0 processes are in enforce mode.
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.

lxc-start -n 107 -F -l DEBUG -o /tmp/lxc-107.log
Code:
lxc-start: 107: conf.c: run_buffer: 323 Script exited with status 1
lxc-start: 107: start.c: lxc_init: 804 Failed to run lxc.hook.pre-start for container "107"
lxc-start: 107: start.c: __lxc_start: 1903 Failed to initialize container "107"
lxc-start: 107: tools/lxc_start.c: main: 308 The container failed to start
lxc-start: 107: tools/lxc_start.c: main: 314 Additional information can be obtained by setting the --logfile and --logpriority options

cat /tmp/lxc-107.log
Code:
lxc-start 107 20200813134005.236 INFO     lsm - lsm/lsm.c:lsm_init:29 - LSM security driver AppArmor
lxc-start 107 20200813134005.236 INFO     conf - conf.c:run_script_argv:340 - Executing script "/usr/share/lxc/hooks/lxc-pve-prestart-hook" for container "107", config section "lxc"
lxc-start 107 20200813134005.810 DEBUG    conf - conf.c:run_buffer:312 - Script exec /usr/share/lxc/hooks/lxc-pve-prestart-hook 107 lxc pre-start produced output: unable to open file '/etc/init/tty1.conf.tmp.5183' - No such file or directory

lxc-start 107 20200813134005.811 DEBUG    conf - conf.c:run_buffer:312 - Script exec /usr/share/lxc/hooks/lxc-pve-prestart-hook 107 lxc pre-start produced output: error in setup task PVE::LXC::Setup::pre_start_hook

lxc-start 107 20200813134005.820 ERROR    conf - conf.c:run_buffer:323 - Script exited with status 1
lxc-start 107 20200813134005.820 ERROR    start - start.c:lxc_init:804 - Failed to run lxc.hook.pre-start for container "107"
lxc-start 107 20200813134005.820 ERROR    start - start.c:__lxc_start:1903 - Failed to initialize container "107"
lxc-start 107 20200813134005.820 INFO     conf - conf.c:run_script_argv:340 - Executing script "/usr/share/lxc/hooks/lxc-pve-poststop-hook" for container "107", config section "lxc"
lxc-start 107 20200813134006.379 INFO     conf - conf.c:run_script_argv:340 - Executing script "/usr/share/lxcfs/lxc.reboot.hook" for container "107", config section "lxc"
lxc-start 107 20200813134006.881 ERROR    lxc_start - tools/lxc_start.c:main:308 - The container failed to start
lxc-start 107 20200813134006.881 ERROR    lxc_start - tools/lxc_start.c:main:314 - Additional information can be obtained by setting the --logfile and --logpriority options

Please help.
 
hi,

it's usually not as simple as just adding the version in there, since there are a lot of differences between versions in terms of systemd/init and some other deprecated/obsolete things, which we handle in the setup routines differently based on version.

in your case it seems to fail while opening a tmp copy of /etc/init/tty1.conf which could mean the directory or file doesn't exist.

but why do you need to run this ancient OS in the first place? perhaps there's a better alternative...
 
hi,

it's usually not as simple as just adding the version in there, since there are a lot of differences between versions in terms of systemd/init and some other deprecated/obsolete things, which we handle in the setup routines differently based on version.

in your case it seems to fail while opening a tmp copy of /etc/init/tty1.conf which could mean the directory or file doesn't exist.

but why do you need to run this ancient OS in the first place? perhaps there's a better alternative...
At this momment no better alternative. Also I have more than 1 old openvz containers. I need to convert and start their.
Early I did it successfully with 10 ubuntu, but with 6 ubuntu first time.
 
This is old Proxmox VE from I migrate this old openvz container
pveversion -v
Code:
pve-manager: 1.9-26 (pve-manager/1.9/6567)
running kernel: 2.6.32-6-pve
proxmox-ve-2.6.32: 1.9-55+ovzfix-1
pve-kernel-2.6.32-6-pve: 2.6.32-55+ovzfix-1
qemu-server: 1.1-32
pve-firmware: 1.0-14
libpve-storage-perl: 1.0-19
vncterm: 0.9-2
vzctl: 3.0.29-3pve1
vzdump: 1.2-16
vzprocps: 2.0.11-2
vzquota: 3.0.11-1
pve-qemu-kvm: 0.15.0-2
ksm-control-daemon: 1.0-6
 
I can start this container, added /etc/init directory manually inside. But if I run console in Proxmox web gui, I see only black screen.tty_2020-08-14 15-20-13.png

This is Console mode - Default (tty)
If I choose Console mode - shell, I see container content as root without login, it`s not secure.
How I can repair tty console?
 
Assuming that you mean you can start the container successfully, i.e., no errors on startup, I would like to suggest a (possibly silly) fix. It seems that there is a bug in the GUI's console that results in the container showing a blank terminal screen at first. However if you press enter, the container login prompt appears. Can you confirm whether or not this is the issue?
 
Yes, I can start without any errors.
I know this bug and i press enter button without result.
 
I found solution:
1. Open web proxmox ve, in container Options-TTY count- change from 2 to 0
2. Start container
3. In proxmox console pct enter containerID
4. mkdir /etc/init
5. Open file /etc/inittab and add to the end of file - 1:2345:respawn:/sbin/getty 38400 tty1
6. Stop container
7. Open web proxmox ve, in container Options-TTY count- change from 0 to 2
8. Start container and ejoy