In the entrypoint script of a docker -based on alpine linux-, I have the following lines:
#!/bin/sh
echo "============== START ============"
echo $#
NOLOAD=0
FILE=""
RET=1
if [ ! -f /initialized ]; then
echo "not initialized"
apk add --virtual .init-deps bash
echo "bash installed"
echo "Building from server"
apk add --virtual .init-deps git
echo "git installed"
bash load_git.sh "${GIT_SERVER}" "${GIT_USERNAME}" "${GIT_PASSWORD}" "${GIT_BRANCH}"
RET=$?
echo cloning done
fi
echo "just before purging all dependencies"
apk --purge del .init-deps
I expect bash to install, as well as git and the run the load_git.sh script using bash. I am literary logging every other line, but am getting some strange results -before the load_git.sh script is even run:
============== START ============
not initialized
(1/6) Installing ncurses-terminfo-base (6.1_p20191130-r0)
(2/6) Installing ncurses-terminfo (6.1_p20191130-r0)
(3/6) Installing ncurses-libs (6.1_p20191130-r0)
(4/6) Installing readline (8.0.1-r0)
(5/6) Installing bash (5.0.11-r1)
Executing bash-5.0.11-r1.post-install
(6/6) Installing .init-deps (20200109.202215)
Executing busybox-1.31.1-r8.trigger
OK: 18 MiB in 24 packages
bash installed
Building from server
(1/12) Installing ca-certificates (20191127-r0)
(2/12) Installing nghttp2-libs (1.40.0-r0)
(3/12) Installing libcurl (7.67.0-r0)
(4/12) Installing expat (2.2.9-r1)
(5/12) Installing pcre2 (10.34-r1)
(6/12) Installing git (2.24.1-r0)
(7/12) Upgrading .init-deps (20200109.202215 -> 20200109.202216)
(8/12) Purging bash (5.0.11-r1)
Executing bash-5.0.11-r1.pre-deinstall
(9/12) Purging readline (8.0.1-r0)
(10/12) Purging ncurses-libs (6.1_p20191130-r0)
(11/12) Purging ncurses-terminfo (6.1_p20191130-r0)
(12/12) Purging ncurses-terminfo-base (6.1_p20191130-r0)
Executing busybox-1.31.1-r8.trigger
Executing ca-certificates-20191127-r0.trigger
OK: 25 MiB in 25 packages
git installed
/init.sh: line 17: bash: not found
cloning done
outside if statement to get source
just before purging all dependencies
Build failed, starting shell
I can't wrap my head around the fact that upon installing git it also purging bash, this makes no sense at all.
EDIT: this only happens when starting the docker over an ssh connection in a synology nas, when using a local docker image and starting it locally it works perfectly fine.
It looks what's happening here is that the apk add --virtual .init-deps option creates a virtual package and makes it depend on the other packages that just got installed. When you do it a second time, it creates a new virtual package that depends (only) on the second set of packages, and upgrades the virtual package to the new version; when you do that, the first set of packages gets automatically uninstalled.
There are two easy workarounds here: either remove this --virtual .init-deps option, from both lines, or combine all of your installation into a single apk add line.
(It's usually not great practice to download packages on container startup, particularly since deleting and recreating containers is a fairly routine operation. Better practice would be to do this once in the image's Dockerfile
RUN apk add bash git
but also to consider whether you actually need either of these tools to run the application packaged in your image.)
I tried reproducing this and managed with the script below on a remote machine:
#!/bin/sh
if [ ! -f /initialized ]; then
apk add --virtual .init-deps bash
apk add --virtual .init-deps git
bash -c "bash works"
fi
But consecutive runs have varying results:
ubuntu#dev:~$ docker run c81a2d3a5f6b
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/6) Installing ncurses-terminfo-base (6.1_p20191130-r0)
(2/6) Installing ncurses-terminfo (6.1_p20191130-r0)
(3/6) Installing ncurses-libs (6.1_p20191130-r0)
(4/6) Installing readline (8.0.1-r0)
(5/6) Installing bash (5.0.11-r1)
Executing bash-5.0.11-r1.post-install
(6/6) Installing .init-deps (20200109.224208)
Executing busybox-1.31.1-r8.trigger
OK: 15 MiB in 20 packages
(1/12) Installing ca-certificates (20191127-r0)
(2/12) Installing nghttp2-libs (1.40.0-r0)
(3/12) Installing libcurl (7.67.0-r0)
(4/12) Installing expat (2.2.9-r1)
(5/12) Installing pcre2 (10.34-r1)
(6/12) Installing git (2.24.1-r0)
(7/12) Upgrading .init-deps (20200109.224208 -> 20200109.224209)
(8/12) Purging bash (5.0.11-r1)
Executing bash-5.0.11-r1.pre-deinstall
(9/12) Purging readline (8.0.1-r0)
(10/12) Purging ncurses-libs (6.1_p20191130-r0)
(11/12) Purging ncurses-terminfo (6.1_p20191130-r0)
(12/12) Purging ncurses-terminfo-base (6.1_p20191130-r0)
Executing busybox-1.31.1-r8.trigger
Executing ca-certificates-20191127-r0.trigger
OK: 22 MiB in 21 packages
/test.sh: line 5: bash: not found
ubuntu#dev:~$ docker run c81a2d3a5f6b
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/6) Installing ncurses-terminfo-base (6.1_p20191130-r0)
(2/6) Installing ncurses-terminfo (6.1_p20191130-r0)
(3/6) Installing ncurses-libs (6.1_p20191130-r0)
(4/6) Installing readline (8.0.1-r0)
(5/6) Installing bash (5.0.11-r1)
Executing bash-5.0.11-r1.post-install
(6/6) Installing .init-deps (20200109.224207)
Executing busybox-1.31.1-r8.trigger
OK: 15 MiB in 20 packages
OK: 15 MiB in 20 packages
bash works
So I think this is a timing problem in apk
Related
Executing pip install --no-dependencies pyarrow==4.0.1,
I see
Looking in indexes: ...
Collecting pyarrow==4.0.1
Using cached ...
Installing build dependencies ...
Why is it still "Installing build dependencies"? Installing the numpy dependency (somehow it started compiling it) failed shortly afterwards, so I'd like to skip that step.
I have a system that is due to be upgraded but I'm having conflicts with apt-get -f install:
apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
login sysvinit-utils util-linux
Suggested packages:
kbd util-linux-locales
The following packages will be upgraded:
login sysvinit-utils util-linux
3 upgraded, 0 newly installed, 0 to remove and 106 not upgraded.
13 not fully installed or removed.
Need to get 0 B/1775 kB of archives.
After this operation, 1886 kB of additional disk space will be used.
Do you want to continue? [Y/n]
E: Sub-process false returned an error code (1)
E: Prior errors apply to /var/cache/apt/archives/sysvinit-utils_2.96-7_arm64.deb
E: Prior errors apply to /var/cache/apt/archives/util-linux_2.36.1-8_arm64.deb
E: Prior errors apply to /var/cache/apt/archives/login_1%3a4.8.1-1_arm64.deb
debconf: apt-extracttemplates failed: No such file or directory
(Reading database ... 9765 files and directories currently installed.)
Preparing to unpack .../sysvinit-utils_2.96-7_arm64.deb ...
Unpacking sysvinit-utils (2.96-7) over (2.88dsf-59) ...
dpkg: error processing archive /var/cache/apt/archives/sysvinit-utils_2.96-7_arm64.deb (--unpack):
trying to overwrite '/lib/init/vars.sh', which is also in package initscripts 2.88dsf-59
Errors were encountered while processing:
/var/cache/apt/archives/sysvinit-utils_2.96-7_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I don't understand why it says E: Sub-process false returned an error code (1) after I confirm installation of the packages. Can anyone help me with this?
initscripts is a purely virtual package, so it is safe to give dpkg permission to overwrite it. Open the terminal and type:
sudo dpkg -i --force-overwrite /var/cache/apt/archives/sysvinit-utils_2.96-7_arm64.deb
If you're not using dpkg directly and using an apt front-end like apt or apt-get, the following command defines the same custom dpkg option to use as the previous command.
sudo apt-get -o Dpkg::Options::="--force-overwrite" install sysvinit-utils
Try to flush the cache and reinstall then :
apt autoremove
apt clean
apt autoclean
apt update
apt install -f
if it doesn't help, try to remove the problematic packages and reinstall them normally.
I have created a new virtual instance of Ubuntu 18.10
On this fresh installation, I then installed Anaconda as per the installation instructions (using curl, which I also installed).
The next thing I did (quite literally) after verifying conda was correctly installed was to install xeus-cling via
conda install xeus-cling -c QuantStack -c conda-forge
After downloading all the packages, the install fails with this error:
Executing transaction: failed ERROR conda.core.link:_execute(502): An
error occurred while installing package 'QuantStack::gcc-7-7.2.0-2'.
LinkError: post-link script failed for package
QuantStack::gcc-7-7.2.0-2 running your command again with -v will
provide additional information location of failed script:
/home/anaconda/anaconda3/bin/.gcc-7-post-link.sh
==> script messages <==
Attempting to roll back.
Rolling back transaction: done
LinkError: post-link script failed for package
QuantStack::gcc-7-7.2.0-2 running your command again with -v will
provide additional information location of failed script:
/home/anaconda/anaconda3/bin/.gcc-7-post-link.sh
==> script messages <==
I have repeated this several times, and the error is always the same. Any idea how to resolve the problem? It looks like an issue with the version of gcc, but I'm not sure how to resolve/fix it.
Other conda packages (i.e. SciJava) install without problems (tested in other instances of this process).
Ran into the same issue and resolved it by running
sudo apt-get update
sudo apt-get install -y build-essential
I ran into it on the anaconda3 docker image - so your mileage may vary.
I'm running on Windows 10 Enterprise, build 1703. I have Anaconda 4.4.0 and Python 3.6 installed. I'm running bash and Ubuntu Linux was installed o.k.
I'm trying to install Ruby for Jekyll (https://jekyllrb.com/docs/windows/#installing-jekyll).
The install command is:
sudo apt-get install ruby2.3 ruby2.3-dev build-essential
and it gives the error:
root#bigsur:/mnt/c/Windows/System32# sudo apt-get install ruby2.3 ruby2.3-dev build-essential
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
root#bigsur:/mnt/c/Windows/System32#
root#bigsur:/mnt/c/Windows/System32#
root#bigsur:/mnt/c/Windows/System32# sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of python3.5:
python3.5 depends on python3.5-minimal (= 3.5.2-2ubuntu0~16.04.3); however:
Version of python3.5-minimal on system is 3.5.2-2ubuntu0~16.04.1.
python3.5 depends on libpython3.5-stdlib (= 3.5.2-2ubuntu0~16.04.3); however:
Package libpython3.5-stdlib:amd64 is not installed.
dpkg: error processing package python3.5 (--configure):
dependency problems - leaving unconfigured
Setting up libapt-inst2.0:amd64 (1.2.24) ...
dpkg: unrecoverable fatal error, aborting:
unable to truncate for updated status of 'libapt-inst2.0:amd64': Invalid argument
root#bigsur:/mnt/c/Windows/System32#
Any help will be greatly appreciated.
Charles
I read many posts on the Internet that said the best way to install Jekyll was to install by way of a linux subsystem. I now realize that this is bad advice. After running into trouble (see above), I started over. I found that Build 1703 of Windows 10 Enterprise already had the infrastructure to install Jekyll with the instructions at: https://jekyllrb.com/docs/installation/. I followed these instructions and I now have a clean installation of Jekyll. Don't bother installing Ubuntu. You don't need it, and you will save over 700 MBytes of disc space.
Charles
I am trying to build an ASP.NET5 application via Bluemix Pipeline using a shell script to configure a runtime that supports .NET builds with DNVM. When building the application we need to get dependencies from Mono 4.0 (such as kestrel) but the latest Mono available via apt-get is 3.2. I tried to resolve this by adding the Mono deb repository in /etc/apt/sources.list so that an apt-get update would fetch the latest Mono package but due to a permission error we are not allowed to alter sources.list nor add or alter any files in /etc/apt/sources.list.d/*.
For example, running:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo -i tee /etc/apt/sources.list.d/mono-xamarin.list
Will result in:
sudo: no tty present and no askpass program specified
Not using sudo will give a permission issue and I think we have exhausted all possible workarounds such as ssh -t -t and forth.
Does anyone have any suggestions on a workaround for this or an alternative method to run a shell script where a .NET build with DNVM and all dependencies would be supported? Using another language or cf push in this case is not an option, we really want to push .NET through pipeline at any cost.
When experimenting with the pipeline I wasn't able to get it working with Mono either, but if you can get away with just the CoreCLR on Linux then you should be able to. Kestrel, for example, doesn't require Mono anymore.
This was a build script from the beta7 timeframe but it should be close to what's needed to use RC1 now:
#!/bin/bash
sudo apt-get update
sudo apt-get -y install libunwind8 gettext libssl-dev libcurl3-dev zlib1g
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
dnvm install 1.0.0-beta7 -r coreclr -a x64
cd src/dotnetstarter
dnu restore
dnu build
cd ../../test/dotnetstarter.tests
dnu restore
dnu build
dnx test
cd ../../src/dotnetstarter
dnu publish --runtime ~/.dnx/runtimes/dnx-coreclr-linux-x64.1.0.0-beta7
The app was https://github.com/IBM-Bluemix/asp.net5-helloworld and I added the dotnetstarter.tests project which I was trying to run in the pipeline (the dnx test step). The last publish step isn't required but is included to show it was working.
Thanks to opiethehokie, this is the working script:
#!/bin/bash
echo --- UPDATING DEPENDENCIES! ---
sudo apt-get update
echo --- DOWNLOADING PACKAGES! ---
sudo apt-get -y install libunwind8 gettext libssl-dev libcurl3-dev zlib1g libcurl4-openssl-dev libicu-dev uuid-dev
echo --- DOWNLOADING DNVM! ---
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
echo --- INSTALLING DNVM! ---
dnvm install 1.0.0-rc1-final -r coreclr -a x64
echo --- EXECUTING RESTORE! ---
cd /path-to-project-folder
dnu restore
echo --- EXECUTING BUILD! ---
dnu build
echo --- PUBLISH BUILD (OPTIONAL)! ---
dnu publish --runtime ~/.dnx/runtimes/dnx-coreclr-linux-x64.1.0.0-*`