Containers are not starting - LXCs and other adventures

Message
Author
User avatar
hkjz
Posts: 303
Joined: Thu Apr 11, 2019 4:38 pm

Containers are not starting - LXCs and other adventures

#1 Post by hkjz »

Hello there,

i have some problem with working linux container

i use updated version

Code: Select all

$ lxc-start --version
2.0.7
but got a problemm while trying to load any Container

Code: Select all

$ sudo lxc-start -d -n NewContainer
[sudo] password for mq: 
lxc-start: tools/lxc_start.c: main: 366 The container failed to start.
lxc-start: tools/lxc_start.c: main: 368 To get more details, run the container in foreground mode.
lxc-start: tools/lxc_start.c: main: 370 Additional information can be obtained by setting the --logfile and --logpriority options.
I've read on https://github.com/lxc/lxc/issues/1779
that this problem stops with lxc version 2.1

which is accessible at
https://linuxcontainers.org/lxc/downloads/

but somehow i cannot update it by regular APT update

How to update it to vesion 2.1 through terminal?
Thank you
Last edited by hkjz on Tue Apr 30, 2019 2:34 pm, edited 1 time in total.

User avatar
timkb4cq
Developer
Posts: 3186
Joined: Wed Jul 12, 2006 4:05 pm

Re: we have LXC 2.0.7, there is 2.1

#2 Post by timkb4cq »

Debian Buster has version 3.0.3. I'll see if it will backport.
HP Pavillion TP01, AMD Ryzen 3 5300G (quad core), Crucial 500GB SSD, Toshiba 6TB 7200rpm
Dell Inspiron 15, AMD Ryzen 7 2700u (quad core). Sabrent 500GB nvme, Seagate 1TB

User avatar
timkb4cq
Developer
Posts: 3186
Joined: Wed Jul 12, 2006 4:05 pm

Re: we have LXC 2.0.7, there is 2.1

#3 Post by timkb4cq »

It does build on MX-18. Use the MX Test Repo tab in Package Installer in MX Tools to install it.
Make sure to get both lxc and lxc-templates since templates are not included in lxc 3.x

The *.mxrepo.com servers have it already. Other mirrors will update on their normal schedule over the next 12 hours or so.
HP Pavillion TP01, AMD Ryzen 3 5300G (quad core), Crucial 500GB SSD, Toshiba 6TB 7200rpm
Dell Inspiron 15, AMD Ryzen 7 2700u (quad core). Sabrent 500GB nvme, Seagate 1TB

User avatar
hkjz
Posts: 303
Joined: Thu Apr 11, 2019 4:38 pm

Re: we have LXC 2.0.7, there is 2.1

#4 Post by hkjz »

Ok,
thank you,
good to see such an interactive system,

although upgrade didn't help

i've installed second container to see if that will help

Code: Select all

You could now use you container with: lxc-start -n gentooContainer
little things you should know about your container:
=> rootfs of container is : /var/lib/lxc/gentooContainer/rootfs
=> config of container is : /var/lib/lxc/gentooContainer/config
=> timezone copyed from host
=> container has its own portage tree at /usr/portage
=> No network interface for this container
=> Connection user is root

$ sudo lxc-ls --fancy
NAME                 STATE   AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED 
gentooContainer STOPPED     0              -            -        -      false        
Container1         STOPPED     0              -            -        -      false     

$ sudo lxc-start -n gentooContainer
lxc-start: gentooContainer: lxccontainer.c: wait_on_daemonized_start: 833 No such file or directory - Failed to receive the container state
lxc-start: gentooContainer: tools/lxc_start.c: main: 330 The container failed to start
lxc-start: gentooContainer: tools/lxc_start.c: main: 333 To get more details, run the container in foreground mode
lxc-start: gentooContainer: tools/lxc_start.c: main: 336 Additional information can be obtained by setting the --logfile and --logpriority options

$ sudo lxc-start -n --logfile --logpriority gentooContainer
lxc-start: --logfile: log.c: log_open: 507 No such file or directory - Failed to open log file "/var/lib/lxc/--logfile/--logfile.log"
lxc-start: --logfile: tools/lxc_start.c: main: 290 No container config specified

$ cd /var/lib/lxc; ls
gentooContainer  --logfile  lxc-monitord.log  myContainter

$ cd --logfile
bash: cd: --: invalid option
cd: usage: cd [-L|[-P [-e]] [-@]] [dir]

$ ls ./--logfile
--logfile.log

$ sudo cat ./--logfile/--logfile.log
[sudo] password for mq: 
lxc-start --logfile 20190430115545.944 ERROR    lxc_start - tools/lxc_start.c:main:290 - No container config specified

any ideas?

User avatar
timkb4cq
Developer
Posts: 3186
Joined: Wed Jul 12, 2006 4:05 pm

Re: we have LXC 2.0.7, there is 2.1

#5 Post by timkb4cq »

Did you try

Code: Select all

sudo lxc-start -n gentooContainer -F
(-F means run in foreground) as the error messages suggested?
Your second command

Code: Select all

sudo lxc-start -n --logfile --logpriority gentooContainer
is not properly constructed.
-n is directly followed by the container name, not other switches. --logfile takes a filename and --logpriority takes a value.

Code: Select all

sudo lxc-start -n gentooContainer  --logfile mylogfile --logpriority debug
should work better.
HP Pavillion TP01, AMD Ryzen 3 5300G (quad core), Crucial 500GB SSD, Toshiba 6TB 7200rpm
Dell Inspiron 15, AMD Ryzen 7 2700u (quad core). Sabrent 500GB nvme, Seagate 1TB

User avatar
hkjz
Posts: 303
Joined: Thu Apr 11, 2019 4:38 pm

Re: we have LXC 2.0.7, there is 2.1

#6 Post by hkjz »

Code: Select all

$ sudo lxc-start -n gentooContainer -F
lxc-start: gentooContainer: lsm/apparmor.c: apparmor_prepare: 974 Cannot use generated profile: apparmor_parser not available
  lxc-start: gentooContainer: start.c: lxc_init: 899 Failed to initialize LSM
                                                                             lxc-start: gentooContainer: start.c: __lxc_start: 1917 Failed to initialize container "gentooContainer"
lxc-start: gentooContainer: tools/lxc_start.c: main: 330 The container failed to start
lxc-start: gentooContainer: tools/lxc_start.c: main: 336 Additional information can be obtained by setting the --logfile and --logpriority options




$ sudo lxc-start -n gentooContainer  --logfile mylogfile --logpriority debug
lxc-start: gentooContainer: lxccontainer.c: wait_on_daemonized_start: 833 No such file or directory - Failed to receive the container state
lxc-start: gentooContainer: tools/lxc_start.c: main: 330 The container failed to start
lxc-start: gentooContainer: tools/lxc_start.c: main: 333 To get more details, run the container in foreground mode
lxc-start: gentooContainer: tools/lxc_start.c: main: 336 Additional information can be obtained by setting the --logfile and --logpriority options

Code: Select all

$ sudo lxc-start -n gentooContainer  --logfile mylogfile --logpriority debug
what does 'mylogfile' and 'debug' states for? new files?

User avatar
timkb4cq
Developer
Posts: 3186
Joined: Wed Jul 12, 2006 4:05 pm

Re: we have LXC 2.0.7, there is 2.1

#7 Post by timkb4cq »

Code: Select all

apparmor_parser not available
Do you have apparmor installed? You will have a /sbin/apparmor file if you do.
hkjz wrote: what does 'mylogfile' and 'debug' states for? new files?
The --logfile <name> option creates a logfile with the file name you give it. A file name is required - there is no default. I just used "mylogfile".
Run

Code: Select all

man lxc-start
to see the list of parameters that --logpriority can take. debug seemed the most appropriate in this case - but you might want to log different level of messages.
HP Pavillion TP01, AMD Ryzen 3 5300G (quad core), Crucial 500GB SSD, Toshiba 6TB 7200rpm
Dell Inspiron 15, AMD Ryzen 7 2700u (quad core). Sabrent 500GB nvme, Seagate 1TB

User avatar
hkjz
Posts: 303
Joined: Thu Apr 11, 2019 4:38 pm

Re: we have LXC 2.0.7, there is 2.1

#8 Post by hkjz »

indeed i havent

I've installed apparmor-profiles together with Suggested packages:
apparmor-profiles-extra apparmor-utils

Code: Select all

$ sudo apt install apparmor-profiles
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  apparmor libapparmor-perl
Suggested packages:
  apparmor-profiles-extra apparmor-utils
The following NEW packages will be installed:
  apparmor apparmor-profiles libapparmor-perl
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 689 kB of archives.
After this operation, 2,426 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.es.debian.org/debian stretch/main amd64 libapparmor-perl amd64 2.11.0-3+deb9u2 [82.2 kB]
Get:2 http://ftp.es.debian.org/debian stretch/main amd64 apparmor amd64 2.11.0-3+deb9u2 [525 kB]
Get:3 http://ftp.es.debian.org/debian stretch/main amd64 apparmor-profiles all 2.11.0-3+deb9u2 [81.1 kB]
Fetched 689 kB in 0s (692 kB/s)              
Preconfiguring packages ...
Selecting previously unselected package libapparmor-perl.
(Reading database ... 264142 files and directories currently installed.)
Preparing to unpack .../libapparmor-perl_2.11.0-3+deb9u2_amd64.deb ...
Unpacking libapparmor-perl (2.11.0-3+deb9u2) ...
Selecting previously unselected package apparmor.
Preparing to unpack .../apparmor_2.11.0-3+deb9u2_amd64.deb ...
Unpacking apparmor (2.11.0-3+deb9u2) ...
Selecting previously unselected package apparmor-profiles.
Preparing to unpack .../apparmor-profiles_2.11.0-3+deb9u2_all.deb ...
Unpacking apparmor-profiles (2.11.0-3+deb9u2) ...
Processing triggers for systemd (232-25+deb9u11) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up libapparmor-perl (2.11.0-3+deb9u2) ...
Setting up apparmor (2.11.0-3+deb9u2) ...
Created symlink /etc/systemd/system/sysinit.target.wants/apparmor.service → /lib/systemd/system/apparmor.service.
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
diff: /var/lib/apparmor/profiles/.apparmor.md5sums: No such file or directory
Setting up apparmor-profiles (2.11.0-3+deb9u2) ...
Processing triggers for systemd (232-25+deb9u11) ...

Code: Select all

$ sudo apt install apparmor-profiles-extra
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  apparmor-profiles-extra
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 8,598 B of archives.
After this operation, 45.1 kB of additional disk space will be used.
Get:1 http://ftp.es.debian.org/debian stretch/main amd64 apparmor-profiles-extra all 1.11 [8,598 B]
Fetched 8,598 B in 0s (32.2 kB/s)                  
Selecting previously unselected package apparmor-profiles-extra.
(Reading database ... 264434 files and directories currently installed.)
Preparing to unpack .../apparmor-profiles-extra_1.11_all.deb ...
Unpacking apparmor-profiles-extra (1.11) ...
Setting up apparmor-profiles-extra (1.11) ..

Code: Select all

$ sudo apt install apparmor-utils
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  python3-apparmor python3-libapparmor
Suggested packages:
  vim-addon-manager
The following NEW packages will be installed:
  apparmor-utils python3-apparmor python3-libapparmor
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 312 kB of archives.
After this operation, 951 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.es.debian.org/debian stretch/main amd64 python3-libapparmor amd64 2.11.0-3+deb9u2 [78.2 kB]
Get:2 http://ftp.es.debian.org/debian stretch/main amd64 python3-apparmor amd64 2.11.0-3+deb9u2 [130 kB]
Get:3 http://ftp.es.debian.org/debian stretch/main amd64 apparmor-utils amd64 2.11.0-3+deb9u2 [103 kB]
Fetched 312 kB in 0s (528 kB/s)     
Selecting previously unselected package python3-libapparmor.
(Reading database ... 264447 files and directories currently installed.)
Preparing to unpack .../python3-libapparmor_2.11.0-3+deb9u2_amd64.deb ...
Unpacking python3-libapparmor (2.11.0-3+deb9u2) ...
Selecting previously unselected package python3-apparmor.
Preparing to unpack .../python3-apparmor_2.11.0-3+deb9u2_amd64.deb ...
Unpacking python3-apparmor (2.11.0-3+deb9u2) ...
Selecting previously unselected package apparmor-utils.
Preparing to unpack .../apparmor-utils_2.11.0-3+deb9u2_amd64.deb ...
Unpacking apparmor-utils (2.11.0-3+deb9u2) ...
Setting up python3-libapparmor (2.11.0-3+deb9u2) ...
Setting up python3-apparmor (2.11.0-3+deb9u2) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up apparmor-utils (2.11.0-3+deb9u2) ...
Made check, all in place

Code: Select all

/sbin
$ ls a*
acpi_available  agetty  apm_available  apparmor_parser  autologin
After checking status ive got

Code: Select all

$ sudo apparmor_status
[sudo] password for mq: 
apparmor module is loaded.
apparmor filesystem is not mounted.
'apparmor filesystem is not mounted.'

and during executing start command, something happened,
something changed,
What i've got is:

Code: Select all

$ sudo lxc-start -n gentooContainer -F
lxc-start: gentooContainer: lsm/apparmor.c: run_apparmor_parser: 808 Failed to run apparmor_parser on "/var/lib/lxc/gentooContainer/apparmor/lxc-gentooContainer_<-var-lib-lxc>": Warning: unable to find a suitable fs in /proc/mounts,
                                         Use is it mounted? --subdomainfs to override.
                                                                       lxc-start: gentooContainer: lsm/apparmor.c: remove_apparmor_namespace: 776 No such file or directory - Error removing AppArmor namespace
 lxc-start: gentooContainer: lsm/apparmor.c: apparmor_prepare: 980 Failed to load generated AppArmor profile
     lxc-start: gentooContainer: start.c: lxc_init: 899 Failed to initialize LSM
                                                                                lxc-start: gentooContainer: start.c: __lxc_start: 1917 Failed to initialize container "gentooContainer"
lxc-start: gentooContainer: tools/lxc_start.c: main: 330 The container failed to start
lxc-start: gentooContainer: tools/lxc_start.c: main: 336 Additional information can be obtained by setting the --logfile and --logpriority options
At the first sight:
'unable to find a suitable fs in /proc/mounts,
Use is it mounted? --subdomainfs to override.'

Code: Select all

/proc
$ ls -l
lrwxrwxrwx  1 root       root                    11 Apr 30 14:39 mounts -> self/mounts
logs doesnt bring anything new

Code: Select all

$ sudo lxc-start -n gentooContainer  --logfile mylogfile --logpriority debug
lxc-start: gentooContainer: lxccontainer.c: wait_on_daemonized_start: 833 No such file or directory - Failed to receive the container state
lxc-start: gentooContainer: tools/lxc_start.c: main: 330 The container failed to start
lxc-start: gentooContainer: tools/lxc_start.c: main: 333 To get more details, run the container in foreground mode
lxc-start: gentooContainer: tools/lxc_start.c: main: 336 Additional information can be obtained by setting the --logfile and --logpriority options

User avatar
timkb4cq
Developer
Posts: 3186
Joined: Wed Jul 12, 2006 4:05 pm

Re: we have LXC 2.0.7, there is 2.1

#9 Post by timkb4cq »

I'm not really familiar with lxc or apparmor, but perhaps the apparmor daemon isn't running?
try

Code: Select all

sudo /etc/init.d/apparmor start
There will be more information in the mylogfile file that the --logfile mylogfile command created. You can look at it from the command line with

Code: Select all

less mylogfile
HP Pavillion TP01, AMD Ryzen 3 5300G (quad core), Crucial 500GB SSD, Toshiba 6TB 7200rpm
Dell Inspiron 15, AMD Ryzen 7 2700u (quad core). Sabrent 500GB nvme, Seagate 1TB

User avatar
hkjz
Posts: 303
Joined: Thu Apr 11, 2019 4:38 pm

Re: we have LXC 2.0.7, there is 2.1

#10 Post by hkjz »

OK.
but umm...
where does the output --LOGFILEs are saved?


start command was a proper thing
now i have moduls loaded

Code: Select all

$ sudo apparmor_status
apparmor module is loaded.
59 profiles are loaded.
24 profiles are in enforce mode.
   /usr/bin/irssi
   /usr/bin/lxc-start
   /usr/bin/pidgin
   /usr/bin/pidgin//launchpad_integration
   /usr/bin/pidgin//sanitized_helper
   /usr/bin/totem
   /usr/bin/totem-audio-preview
   /usr/bin/totem-video-thumbnailer
   /usr/lib/cups/backend/cups-pdf
   /usr/sbin/apt-cacher-ng
   /usr/sbin/cups-browsed
   /usr/sbin/cupsd
   /usr/sbin/cupsd//third_party
   /usr/sbin/haveged
   /usr/sbin/ntpd
   /usr/sbin/tcpdump
   gst_plugin_scanner
   libreoffice-senddoc
   libreoffice-soffice//gpg
   libreoffice-xpdfimport
   lxc-container-default
   lxc-container-default-cgns
   lxc-container-default-with-mounting
   lxc-container-default-with-nesting
35 profiles are in complain mode.
   /usr/lib/dovecot/anvil
   /usr/lib/dovecot/auth
   /usr/lib/dovecot/config
   /usr/lib/dovecot/deliver
   /usr/lib/dovecot/dict
   /usr/lib/dovecot/dovecot-auth
   /usr/lib/dovecot/dovecot-lda
   /usr/lib/dovecot/dovecot-lda///usr/sbin/sendmail
   /usr/lib/dovecot/imap
   /usr/lib/dovecot/imap-login
   /usr/lib/dovecot/lmtp
   /usr/lib/dovecot/log
   /usr/lib/dovecot/managesieve
   /usr/lib/dovecot/managesieve-login
   /usr/lib/dovecot/pop3
   /usr/lib/dovecot/pop3-login
   /usr/lib/dovecot/ssl-params
   /usr/sbin/avahi-daemon
   /usr/sbin/dnsmasq
   /usr/sbin/dnsmasq//libvirt_leaseshelper
   /usr/sbin/dovecot
   /usr/sbin/identd
   /usr/sbin/mdnsd
   /usr/sbin/nmbd
   /usr/sbin/nscd
   /usr/sbin/smbd
   /usr/sbin/smbldap-useradd
   /usr/sbin/smbldap-useradd///etc/init.d/nscd
   /usr/{sbin/traceroute,bin/traceroute.db}
   klogd
   libreoffice-oopslash
   libreoffice-soffice
   ping
   syslog-ng
   syslogd
11 processes have profiles defined.
0 processes are in enforce mode.
0 processes are in complain mode.
11 processes are unconfined but have a profile defined.
   /usr/sbin/avahi-daemon (2482) 
   /usr/sbin/avahi-daemon (2483) 
   /usr/sbin/cups-browsed (2317) 
   /usr/sbin/cupsd (2337) 
   /usr/sbin/haveged (2349) 
   /usr/sbin/nmbd (2393) 
   /usr/sbin/ntpd (2651) 
   /usr/sbin/smbd (2791) 
   /usr/sbin/smbd (2819) 
   /usr/sbin/smbd (2820) 
   /usr/sbin/smbd (2866) 
so now we are step closer,
but still there is something,

Code: Select all

$ sudo lxc-start -f -n myContainter
lxc-start: myContainter: lxccontainer.c: wait_on_daemonized_start: 842 Received container state "ABORTING" instead of "RUNNING"
lxc-start: myContainter: tools/lxc_start.c: main: 330 The container failed to start
lxc-start: myContainter: tools/lxc_start.c: main: 333 To get more details, run the container in foreground mode
lxc-start: myContainter: tools/lxc_start.c: main: 336 Additional information can be obtained by setting the --logfile and --logpriority options
you dont know this stuff but you are doing great!
Last edited by hkjz on Tue Apr 30, 2019 12:56 pm, edited 1 time in total.

Post Reply

Return to “MX Repositories”