Fedora 25 ships with OpenJDK pre-installed, but since I am not running any Java applications, I would like to uninstall it. When I try to run dnf remove it wants to uninstall many other packages, that I assume depend on Java, like Libre Office.
I tested how a lack of Java would affect my applications by running chmod 000 to effectively deny access to the binary (/usr/bin/java), and so far Libre Office worked just fine for my workflow. However, I would rather uninstall the whole package.
Is there a way that I can remove the OpenJDK and maybe create a dummy in its place?
How keen and passionate are you regarding its removal? You may have no direct use for Java, but dnf is giving you a list of packages that do depend on Java in some fashion. That translates to a degree of risk in Java's removal. Your technique of denying everything use of /usr/bin/java is essentially statistical; you will never wholly prove that you can get away without a Java runtime. You can only establish that, so far, nothing really bad has happened. Tomorrow, crap can hit the fans.
If you're just tidying up the place, and are not keen or passionate otherwise, then in light of what dnf reports, I'd suggest to let the bear sleep in the cave and go about other projects. So you have some underutilized binaries occupying disk space. Maybe not such a big deal.
If, in your case, it is a big deal (to wit: you are KEEN!!! and PASSIONATE!!!) then you are going to have to do a risk assessment and figure out the particular ways how each of those packages which dnf cites depends on Java. Perhaps it is a short list - ten or fifteen items. Perhaps the nature of dependency is a very loose coupling - some scripts in the package execute Java applications. Perhaps, for each of those packages, there are Java-less re-installation alternatives. As a Gentoo user, I'm beyond my ken when it comes to the specifics of spelunking package dependencies in Fedora distributions, but there are a lot of Fedora folk around here, though.
The "dummy" would be another java-like run time. Take care!
I realized that those were actually dependencies of Libre Office. If I run dnf repoquery --installed --whatrequires java-openjdk... the only package that requires it is actually Libre Office, so I think the effects should be predictable or at least restricted to it.
What I meant by dummy was something that makes dnf think Java is installed, so Libre Office's dependencies are met.
Libre Office works without Java for the most part, at least that's what I've heard and on some Linux distros there is actually a version that has been compiled without Java support.
That is reassuring. While spelunking Fedora dependencies is not my strong suite, I can spelunk here in Gentoo land. Libreoffice can be built without java support - you give up the non-linear solver in libreoffice calc, the (media)-wiki publisher in writer, java and javascript scripting - impacting, I think, the ability to bind Unified Network Objects (UNO) written in those languages as libreoffice UNO components. The data access application, lbase, builds without Java support, but is unstable. Those matters taken into hand, we in Gentoo land can pass in a -java use flag to Portage when it comes to build libreoffice and do without Java - and those features. Can't see that the principle would be all that different in Fedora land, just the practice. Haven't used Fedora since 10, when yum ruled, but seem to dimly recall that you could be selective about what a rpm installs, so long as the RPM packagers gave you the choices. Hope this helps.
If I run straight dnf mark install libreoffice it gives me an error telling me that libreoffice is not installed. If I run it with the package that is apparently depending on Java (libreoffice-core), the first command succeeds but when I attempt deleting Java, I get the same result like before, where it tries to uninstall Libre Office too.
I guess I could build Libre Office without Java myself, but I was never really lucky with compiling software myself.
It only lists as available but not installed. When I attempt to install it, I get a bunch of new packages including the full version of the OpenJDK, not just the headless version:
apache-commons-logging noarch 1.2-6.fc25 fedora 85 k
flute noarch 1.3.0-15.OOo31.fc24 fedora 65 k
java-1.8.0-openjdk x86_64 1:1.8.0.131-1.b12.fc25 updates 232 k
libbase noarch 1.1.3-15.fc24 fedora 128 k
libfonts noarch 1.1.3-18.fc24 fedora 195 k
libformula noarch 1.1.3-15.fc24 fedora 319 k
liblayout noarch 0.2.10-12.fc24 fedora 657 k
libloader noarch 1.1.3-14.fc24 fedora 101 k
libreoffice x86_64 1:5.2.6.2-6.fc25 updates 78 k
libreoffice-base x86_64 1:5.2.6.2-6.fc25 updates 2.6 M
librepository noarch 1.1.3-14.fc24 fedora 68 k
libserializer noarch 1.1.2-15.fc24 fedora 38 k
pentaho-libxml noarch 1.1.3-14.fc24 fedora 87 k
pentaho-reporting-flow-engine noarch 1:0.9.4-12.fc24 fedora 288 k
postgresql-jdbc noarch 9.4.1209-5.fc25 fedora 504 k
sac noarch 1.3-23.fc24 fedora 22 k
ttmkfdir x86_64 3.0.9-48.fc24 fedora 56 k
xml-commons-apis noarch 1.4.01-20.fc24 fedora 232 k
xorg-x11-fonts-Type1 noarch 7.5-16.fc24 fedora 522 k
afaik a jre is not enough for LibreOffice, you need a jdk, but mostly for Base. There used to be a hack to convert the java-based db to SQLite, but I haven't seen that in a while. If you don't use Base though, you don't really need java.
I would just not install the metapackage but install just core, common and the parts of LibreOffice you need, avoiding Base. In that case I would expect that jdk doesn't even pop up as a dependency.
I don't quite get what you mean. If I mark libreoffice-core it wants to remove Libre Office anyways, when I try to remove Java. I would maybe need to install libreoffice first before I could mark that and that would force me to install the full Java and I feel like it would be same story like now with libreoffice-core and the headless Java.
I have a working installation of Libre Office and these packages that contain 'java' in their name installed:
You have the jdk on your system, but you only need it for the database functionality in Base.
The jre can be installed with other parts of LibreOffice if you don't install Base but want other lesser used functionality to work in Sheets or third party spell checking for instance, but if you go full hunspell, and don't need some functionality in sheets and diagrams iirc, then you can break the dep and go without jre also.
You'll have to break deps anyway because the jdk is marked as dep. If you however can live with those small limitations and don't install Base, it'll work just fine. LibreOffice will not crash, the functionality that is affected will not even pop up.
You can't install LibreOffice without jdk without breaking deps though, that much is certain.
Best thing to do is to get the deps list of all the individual packages you want from LibreOffice, and install those and the LibreOffice packages of your choice without dep resolution.
So if I understood this right: I need the JDK for Base but for the rest the JRE should be sufficient? I haven't even installed Base, so why does it need the JDK and not instead use the JRE? And how is the situation without any form of Java (nor JDK nor JRE)?
The problem is that even libreoffice-core requires the JDK:
Yeah but you ignore the java and install all other deps. It should still work except Base and some marginal functionality as mentioned above. That's why you have to install without deps. You break the deps to avoid java, knowing that not everything will work, but it will also not crash normally, so it's alright if you don't need that functionality.
Just remove the java packages without dep resolution, and see what happens to your Libre-Office. If it still works like you want, then you're done.
I see, but won't that cause dnf to install it again when I run it next time or install updates for Libre Office? Or will dnf think it is still installed because it never uninstalled it itself? Oh and if it thinks that it's still installed, won't dnf install it again, when there are Java updates?
No dnf will update packages, no resolve dependencies unless you install or remove dependent packages, or unless you do a dist-upgrade or switch repos. You just have to check the list of proposed packages with such operations. If it reinstalls the jdk or jre, you just repeat the rpm -e as above afterwards.