LXC-Docker fails on dependencies - installation

Installing on Ubuntu 13.06 x64, it's an OpenVZ virtual machine.
Followed the script to the letter, and received a couple errors...
root#dev:/# sudo apt-get install linux-image-extra-`uname -r`
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-image-extra-2.6.32-042stab081.3
E: Couldn't find any package by regex 'linux-image-extra-2.6.32-042stab081.3'
root#dev:/#
though I am able to to:
root#dev:/# uname -r
2.6.32-042stab081.3
root#dev:/#
Then when I attempt to install I receive the following (this is a second attempt, so obviously stripped down)
root#dev:/# sudo apt-get install lxc-docker
Reading package lists... Done
Building dependency tree
Reading state information... Done
lxc-docker is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up lxc (0.9.0-0ubuntu3.4) ...
start: Job failed to start
invoke-rc.d: initscript lxc-net, action "start" failed.
dpkg: error processing lxc (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of lxc-templates:
lxc-templates depends on lxc (>= 0.8.0~rc1-4ubuntu43); however:
Package lxc is not configured yet.
dpkg: error processing lxc-templates (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of lxc-docker-0.6.3:
lxc-docker-0.6.3 depends on lxc; however:
Package lxc is not configured yet.
dpkg: error processing lxc-docker-0.6.3 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of lxc-docker:
lxc-docker depends on lxc-docker-0.6.3; however:
Package lxc-docker-0.6.3 is not configured yet.
dpkg: error processing lxc-docker (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
lxc
lxc-templates
lxc-docker-0.6.3
lxc-docker
E: Sub-process /usr/bin/dpkg returned an error code (1)
root#dev:/#

There are two distinct problems here.
Missing linux-image-extra-$(uname -r) package.
This is because the Docker installation script makes the bold assumption that if you are running kernel e.g. 3.8.0-30, it was installed from the package linux-image-3.8.0-30, and there should be a package linux-image-extra-3.8.0-30 containing extra files (including the AUFS module, which is necessary to run Docker). If you are running a kernel which is not a stock Ubuntu kernel, this assumption will be false, the linux-image-extra-... package won't exist, and the script will fail miserably.
However, if you know that you have AUFS support in your kernel (or that the AUFS module for your kernel is installed one way or another), you can safely skip this step.
Admittedly, the install script should investigate a bit more about your environment, and try to install this -extra- package only when it makes sense.
Cannot install lxc package inside an OpenVZ container.
The postinstall script of the lxc package tries to start the lxc-net service, which tries to setup the lxcbr0 bridge. I don't have an OpenVZ environment here to test this, but I think that you cannot create a bridge within an OpenVZ environment. Therefore, the service fails to start, and the postinstall script reports a failure, and the lxc package cannot be recorded as "installed", and the Docker package (lxc-docker) doesn't want to install if its dependencies are not correctly installed.
You can work around this by preventing the service from starting; for instance by doing:
echo exit 101 | sudo tee /usr/sbin/policy-rc.d
sudo chmod +x /usr/sbin/policy-rc.d
However, I am almost sure that you won't be able to run Docker within OpenVZ, because you won't be able to run containers inside OpenVZ. Again, I don't have an OpenVZ environment to test; but I would be very surprised if that worked.
I strongly suggest to run Docker on a more recent kernel (e.g. 3.8), and not inside OpenVZ.
However, if you absolutely need to run Docker within OpenVZ, there is a way to do it; but it is very hackish. There will be a performance hit, and there might be side-effects. If you want to try anyway, you can check Sekexe. It will let you start arbitrary processes within a user-mode-linux kernel. I have used it successfully to run Docker tests within Travis CI. I wouldn't recommend it for anything else, though.

I was playing a bit with sekexe, but I totally agree with jpetazzo; it's cool but not for production. Instead I started using debootstrap + chrooted jails to have a similar Docker-ish experience (but not as cool as docker of course).
You might want to check this: http://coderofsalvation.github.io/debootstrap-container
I'm using this now on an OpenVZ VPS to separate packages/projects in tidy containers. Disclaimer: I am the author.

Related

libboost1.74-dev is not installing on Ubuntu 16.04

My current boost package is libboost-all-dev(default version 1.58.0.1) which is very old for my current need. So I tried -
sudo apt-get install libboost1.74 libboost1.74-dev
It showed me error of somekind -
libboost1.74 is already the newest version (1.74-0~16~ubuntu16.04.1).
The following NEW packages will be installed:
libboost1.74-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/9,325 kB of archives.
After this operation, 139 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 393826 files and directories currently installed.)
Preparing to unpack .../libboost1.74-dev_1.74-0~16~ubuntu16.04.1_amd64.deb ...
Unpacking libboost1.74-dev (1.74-0~16~ubuntu16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/libboost1.74-dev_1.74-0~16~ubuntu16.04.1_amd64.deb (--unpack):
trying to overwrite '/usr/include/boost/exception_ptr.hpp', which is also in package libboost1.58-dev:amd64 1.58.0+dfsg-5ubuntu3.1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libboost1.74-dev_1.74-0~16~ubuntu16.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
However I tried several times before to manually install boost libraries. They does not seem to work though so I deleted them manually. Is this problem related to my manual deletion process? Or maybe I am doing something wrong?
The message makes it clear that you need to uninstall 1.58 first:
trying to overwrite '/usr/include/boost/exception_ptr.hpp', which is also in package libboost1.58-dev

udocker & ubuntu:20.04 image

on my debian jessie I installed most recent udocker. In udocker I pulled ubuntu:20.04 image and when starting installing packages into that container, got this error below. Any help, please ?
Setting up libapparmor1:amd64 (2.13.3-7ubuntu5.1) ...
Setting up libcap2:amd64 (1:2.32-1) ...
Setting up libargon2-1:amd64 (0~20171227-0.2) ...
Setting up libdevmapper1.02.1:amd64 (2:1.02.167-1ubuntu1) ...
Setting up libjson-c4:amd64 (0.13.1+dfsg-7ubuntu0.3) ...
Setting up libcryptsetup12:amd64 (2:2.2.2-3ubuntu2) ...
Setting up libip4tc2:amd64 (1.8.4-3ubuntu2) ...
Setting up libkmod2:amd64 (27-1ubuntu2) ...
Setting up systemd-timesyncd (245.4-4ubuntu3.1) ...
groupadd: failure while writing changes to /etc/group
adduser: `/sbin/groupadd -g 101 systemd-timesync' returned error code 10. Exiting.
dpkg: error processing package systemd-timesyncd (--configure):
installed systemd-timesyncd package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of systemd:
systemd depends on systemd-timesyncd | time-daemon; however:
Package systemd-timesyncd is not configured yet.
Package time-daemon is not installed.
Package systemd-timesyncd which provides time-daemon is not configured yet.
dpkg: error processing package systemd (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
systemd-timesyncd
systemd
E: Sub-process /usr/bin/dpkg returned an error code (1)
root#lxg1213:~#
I guess you want to have the local time in your docker container (because your docker host have the synced time)?
export DEBIAN_FRONTEND noninteractive
apt-get install -y tzdata
ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime && dpkg-reconfigure --frontend noninteractive tzdata
Well, I try to answer: udocker is not supported by IT department. That is why I am getting these errors when updating packages.

Why is /var/lib/dpkg/status missing on a BitBake-generated OS?

I have installed apt onto a system built by BitBake by adding the apt package to the IMAGE_INSTALL variable in my recipe.
apt-get and apt-cache now execute on the built system, but if I try to do anything useful with them (such as apt-get update or apt-cache search), I get the following error:
E: Could not open file /var/lib/dpkg/status - open (2: No such file or directory)
E: The package lists or status file could not be parsed or opened
After some preliminary searching, I found this exchange on the Yocto Project mailing list:
Hi,
I have some requirement with apt-get in yocto genearted rootfs.
I built the yocto source code with enabling the apt package.
But after booting the image on my machine and run the "apt-get" command for installing some package it gives the following error.
Could not open the file /var/lib/dpkg/status open(2: no such a file or directory).
The package lists or status files could not be parsed or opened.
This error is because you need to add package-management to EXTRA_IMAGE_FEATURES in local.conf,
PACKAGE_CLASSES ?= "package_deb"
EXTRA_IMAGE_FEATURES = "debug-tweaks package-management"
I've added package-management but don't see any different output.
After a touch /var/lib/dpkg/status, apt-get update returns the following:
Reading package lists...Done
How can I get apt into a functioning state through the use of BitBake metadata?
I have found a similar thread from the NXP website.
You would need to set up your own web server and provide all those packages and add the server URL to the source list. SourceList
In addition, you have to update the package manifest by running bitbake package-index and add PACKAGE_CLASSES ?= " package_deb" to conf/local.conf
I have successfully set up OPKG before. The steps are similar, you can find it here

how can install mkinitrd in ubuntu-14.04

root#akshit-Vostro-1550:/boot# mkinitrd -o initrd.img-2.6.32 2.6.32
mkinitrd: command not found
apt-get install mkinitrd-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mkinitrd-tools
/initrd images contains device driver which needed to load rest of the operating system later on. Not all computer requires initrd, but it is safe to create one./
After a little research I found out that in Ubuntu mkinitramfs command is used instead of mkinitrd.
Refer to this question

Bad Exit Status from rpmbuild on Mac OSX

I'm working on packaging up some work into an rpm. I am doing this on Mac OSX after brew installing rpm. I have a basic .spec file, but I am getting an error and have been unable to diagnose it:
$ rpmbuild -ba myapp.spec
Executing(%prep): %{__spec_prep_cmd} /usr/local/Cellar/rpm/5.4.10/var/tmp/rpm-tmp.14478
error: Bad exit status from /usr/local/Cellar/rpm/5.4.10/var/tmp/rpm-tmp.14478 (%prep)
RPM build errors:
Bad exit status from /usr/local/Cellar/rpm/5.4.10/var/tmp/rpm-tmp.14478 (%prep)
The spec files is as follows:
Name: myapp
Version: 0.1.0
Release: 1
Summary: Web service to do stuff
URL: http://myapp.com
BuildRoot: %{_tmppath}/myapp-build-root
%description
My app
%prep
%build
%install
%pre
%preun
%postun
%clean
%files
%defattr(-,www-data,www-data,-)
%doc
This is my first time building an rpm, what am I doing wrong, and how can I fix this. Thanks in advance!
I ran into the same issue today. For no obvious reason the %prep macro fails, even without any content.
Running your spec on my Ubuntu box seems to work just fine after adding those two values:
License: yourLicense
Group: yourGroup
I have reason to believe, that rpm didn't get installed correctly on my box via homebrew. I think I aborted the process at some point, then forgot about it over lunch, but rpmbuild was available to use from within my script and I ran into the issue above.
I will try doing a clean install of the rpm formula in verbose mode to see whether my assumption is correct.
Update:
I've installed rpm successfully, but it took an awful long time:
/usr/local/Cellar/rpm/5.4.10: 187 files, 9.7M, built in 92.4 minutes
Nevertheless, it keeps on failing with the same error
rpmbuild -ba so.spec
Executing(%prep): %{__spec_prep_cmd} /usr/local/Cellar/rpm/5.4.10/var/tmp/rpm-tmp.69701
error: Bad exit status from /usr/local/Cellar/rpm/5.4.10/var/tmp/rpm-tmp.69701 (%prep)
With the content of /usr/local/Cellar/rpm/5.4.10/var/tmp/rpm-tmp.69701 saying:
%{__spec_prep_template}%{__spec_prep_post}

Resources