I was trying to install java using the following command:
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
during the installation for some reason my micro-instance in EC2 kept on freezing, I guess I am not the only one having this issue as it's posted on the aws forum as well. Now when I try to do the whole thing again I get:
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
However, when I try to run sudo dpkg --configure -a, it is just stuck in here:
Setting up sun-java6-bin (6.26-1lucid1) ...
for about an hour or so... WHat should I do now to get java in place?
It could be that the repository you added doesn't have the 'right' version of java6, personally I would use canonical's repository.
First I would try to uninstall the packages and repo
sudo apt-get remove sun-java6-jre sun-java6-plugin sun-java6-fonts
sudo remove-apt-repository ppa:ferramroberto/java
And then use canonical's aptitude repository.
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
I thinks its the same Bug: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/634487
issue fix
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
pd#admin:~$ sudo dpkg --configure -a
dpkg: error: parsing file '/var/lib/dpkg/updates/0024' near line 0: newline in field name `#padding'
pd#admin:~$ sudo rm /var/lib/dpkg/updates/0024
pd#admin:~$ sudo dpkg --configure -a
pd#admin:~$ sudo apt-get install appname_mention_here
Reading package lists... Done
Building dependency tree
Reading state information... Done
Now its working the installation....!
Simply use Open JDK like so...
sudo apt-get install openjdk-6-jre-headless
since you can only ssh into anyway... :)
Related
I'm trying to install java on my docker to be able to use a node module (... yes ...)
I've been searching and I found multiple way of doing it but it always throw an error so, I'm gonna show you what I use for now
RUN apt-get update
RUN apt-get install -y --no-install-recommends software-properties-common
RUN add-apt-repository -y ppa:openjdk-r/ppa
RUN apt-get update
RUN apt-get install -y openjdk-8-jdk
RUN apt-get install -y openjdk-8-jre
RUN update-alternatives --config java
RUN update-alternatives --config javac
switching grom java 8 to java 11 throw the same error:
W: The repository 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu impish Release' does not have a Release file.
E: Failed to fetch http://ppa.launchpad.net/openjdk-r/ppa/ubuntu/dists/impish/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
If someone could help me understand what I'm missing that could be cool !
This is a way to stop the problem. The reason why I why trying to use this RUN add-apt-repository -y ppa:openjdk-r/ppa is because without I was getting this error
E: Sub-process /usr/bin/dpkg returned an error code (1)
But after some research I found this way of using java inside my docker:
RUN apt-get -y update
RUN mkdir -p /usr/share/man/man1/
RUN apt-get install -y openjdk-8-jdk
RUN apt-get install -y openjdk-8-jre
RUN update-alternatives --config java
RUN update-alternatives --config javac
The second line fixed the problem by creating the right folder
I am trying to install the 'rJava' package in my RStudio docker image using my Dockerfile:
FROM rocker/tidyverse:3.6.1
RUN mkdir -p /rstudio
RUN mkdir -p /rscripts
RUN apt-get update && \
apt-get install -y openjdk-11-jdk && \
apt-get install -y liblzma-dev && \
apt-get install -y libbz2-dev
RUN R -e "install.packages(c('rJava','mailR'))"
Following this SO post I added the above part with the apt-get commands but still I get the same error:
java libs :
'-L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm'
checking whether Java run-time works... ./configure: line 3766:
/usr/bin/java: No such file or directory no configure: error: Java
interpreter '/usr/bin/java' does not work ERROR: configuration failed
for package ‘rJava’
So there is a missing file or directory but I don't know what changes I should make.
[EDIT 1]:
So, following Dirk's suggestion, I entered in the rstudio container and ran apt-get install r-cran-rjava which seems to work.
But when I install rJava package I get a new error:
error: Cannot compile a simple JNI program. Make sure you have Java
Development Kit installed and correctly registered in R. If in doubt,
re-run "R CMD javareconf" as root.
I tried to enter again in the container and run R CMD javareconf but that did not change the error. I also tried the following commands found on this article:
sudo apt-get install default-jre
sudo apt-get install default-jdk
But I still get:
Cannot compile a simple JNI program.
I found a github repo suggesting to add these steps in the Dockerfile before installing R package rJava and it worked:
RUN apt-get -y update && apt-get install -y \
default-jdk \
r-cran-rjava \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/
This is a duplicate of similar answers I have already given in the Debian / Ubuntu context. The fact that you are using Docker does not matter: you should still simply install the binary!
edd#rob:~$ docker run --rm -ti r-base bash
root#ef4bb9726a21:/# apt update -qq
73 packages can be upgraded. Run 'apt list --upgradable' to see them.
root#ef4bb9726a21:/# apt install --no-install-recommends -y r-cran-rjava
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ca-certificates-java default-jre default-jre-headless java-common libasound2 libasound2-data libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libdbus-1-3 libdrm-amdgpu1 libdrm-common
libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libedit2 libgif7 libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 liblcms2-2 libllvm10 libnspr4 libnss3 libpciaccess0 libpcsclite1
libsensors-config libsensors5 libsqlite3-0 libvulkan1 libx11-xcb1 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-sync1 libxdamage1 libxfixes3 libxi6 libxshmfence1 libxtst6 libxxf86vm1 libz3-4
openjdk-11-jre openjdk-11-jre-headless
[.... many lines skipped ....]
Running hooks in /etc/ca-certificates/update.d...
done.
done.
root#ef4bb9726a21:/# R
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
[...some lines skipped...]
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(rJava)
>
The reason why Dirk's answer doesn't work for you is because you're using rocker/tidyverse as a base image instead of the r-base that Dirk is using.
In the rocker/tidyverse documentation on Docker Hub they are discouraging the use of apt install --no-install-recommends -y r-cran-rjava:
do not use apt-get install r-cran-* to install R packages on this stack. The requested R version and all R packages are installed from source in the version-stable stack. Installing R packages from apt (e.g. the r-cran-* packages) will install the version of R and versions of the packages that were built for the stable debian release (e.g. debian:stretch), giving you a second version of R and different packages. Please install R packages from source using the install.packages() R function (or the install2.r script), and use apt only to install necessary system libraries (e.g. libxml2). If you would prefer to install only the latest verions of packages from pre-built binaries using apt-get, consider using the r-base stack instead.
Since rJava is supposed to be installed with apt install r-cran-rjava, but the rocker/... base images explicitly tell you not to do that, it looks like you will not be able to use rJava with any of the rocker/... base images..
im trying to install openjdk-8-jdk as suggested here with the command:
sudo apt-get install openjdk-8-jdk
but apt dosnt find the package. i did find it at packages.debian.org manualy and tried to tell apt to also load from there, as suggested on the mirrors page of that package by adding the following line to /etc/apt/sources.list
deb http://ftp.de.debian.org/debian sid main
but apt still cant find the package. i also tried to change the
url to http://deb.debian.org/debian
sid to buster or buster-backports
main to unstable, non-free, contrib (or a list of some or all of those)
combinations of all of the above
still no luck.
add the following line to /etc/apt/sources.list
deb http://deb.debian.org/debian/ sid main
install openjdk8
//Update the repositories
$ sudo apt-get update
$ sudo apt-get install -y openjdk-8-jdk
In fact, I think it is better to search for your question first before ask.
How to install openjdk-8-jdk on Debian 10 (Buster)?
I'm trying to install java7 via ppa (RUN add-apt-repository ppa:webupd8team/java -y) in my docker image but it fails with this error:
returned a non-zero code: 127
The following are suggested ways to install correctly but it's not working. I've tried both ppas as well.
RUN apt-get install python-software-properties -y
RUN add-apt-repository ppa:webupd8team/java -y
#RUN add-apt-repository ppa:eugenesan/java -y
RUN apt-get update
RUN apt-get install oracle-java7-installer -y
Here is the log output:
Step 28 : RUN add-apt-repository ppa:webupd8team/java -y
---> Running in b278761a4209
[91m/bin/sh: 1: add-apt-repository: not found
[0m
So...I need to find out where/if this command exist in a helper lib or what:
add-apt-repository
add-apt-repository appears to be a part of the python-software-properties install. I don't see any real errors in that step except for these messages which pop up in other areas of the build. So I assume that if I can resolve this issue the aforementioned python step will install as needed:
[91mdebconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
[0m[91mdebconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
[0m[91mdpkg-preconfigure: unable to re-open stdin:
So. How to set a term or dialog up? I thought the -y allowed this
The -y in your apt-get install commands is telling apt-get to "assume yes", which isn't the same as running in non-interactive mode.
You're seeing the "unable to initialize frontend: Dialog" messages because Debian is running apt-get in interactive mode. To tell it to run in non-interactive mode, add this line to the start of your Dockerfile:
ENV DEBIAN_FRONTEND noninteractive
Now your commands will be running in non-interactive mode, so apt-get won't try and pop any dialogs up.
As for your actual error, you're right, add-apt-repository is a part of the python-software-properties. Try putting your apt-get update -y command above your apt-get install python-software-properties command.
RUN apt-get update -y && \
apt-get install python-software-properties -y && \
add-apt-repository ppa:webupd8team/java -y && \
apt-get update -y && \
apt-get install oracle-java7-installer -y && \
oracle-java7-set-default
Note, you'll need to do two apt-get update -y commands, one before you start (always a good habit to get into) and one after you've added the oracle java PPA.
apt-get manual
Docker ENV docs
add-apt-repository command is a part of software-properties-common pakage. Install software-properties-common, not python-software-properties.
Then you can add ppa:webupd8team repository. But there is still a problem.
Set the accepted-oracle-license-v1-1 and install java. Below sample Dockerfile will work perfectly.
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:webupd8team/java -y
RUN apt-get update
RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
RUN apt-get install oracle-java7-installer -y
Way #1
Somebody said this way not working but i tested it works.
ENV DEBIAN_FRONTEND noninteractive
yes | apt-get install package-1 package-2
Way #2
ENV DEBIAN_FRONTEND noninteractive
apt-get install -y package-1 package-2
I have been using django-pipeline successfully for a couple of months. Now I have installed virtual-env for the first time on a clean system. Everything is accordingly set and all pip installs are done within my environment.
python manage.py collectstatic
Now I get an error when I am collecting my static files, it says
File "/vc/cb-env/local/lib/python2.7/site-packages/pipeline/compressors/__init__.py", line 247, in execute_command
raise CompressorError(error)
pipeline.compressors.CompressorError: [warning] /usr/bin/yui-compressor: No java runtime was found
[warning] /usr/bin/yui-compressor: No JAVA_CMD set for run_java, falling back to JAVA_CMD = java
Even though both yui-compressor as well as latest java were installed previously:
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java7-installer -y
sudo apt-get install yui-compressor -y
By the look of it, because I had installed java as root, my environment doesn't seem to find it.
What can I do?
Not a direct solution but after some research and chat with the maker of django-pipeline it seems that Yui-Compressor is deprecated anyway and replaced by Yuglify.
Hence its best to keep the django settings.py as it is and simply install Yuglify instead.
sudo apt-get install npm
(switch your virtualenv's environment)
npm install yuglify
The settings.py needs to change only one line:
PIPELINE_YUI_BINARY = '/vc/{your-project-env}/site/{your-project}/node_modules/yuglify/bin/yuglify'
Thats it and it works.
UPDATE:
In the latest django-pipeline You can't set the YUI binary to Yuglify anymore.
You have explicitely declare the yuglify binary. But otherwise nothing changes:
PIPELINE_YUGLIFY_BINARY = "/vc/{yourproject-env}/node_modules/yuglify/bin/yuglify"