I'm trying to install openjdk-7-jdk
on Ubuntu Trusty (with apt
or aptitude
), but it seems to depend on systemd
, which I'd like to avoid. But also, I can't see systemd
in the output of debtree
or apt-rdepends
. Why is that so? Does openjdk-7-jdk
depend on systemd
or not?
To give you the bigger picture, I'm provisioning a server. And it all happens when installing elasticsearch
. It wants java
, and java
wants systemd
. But after installing systemd
, it can't enable elasticsearch
, since it comes with init script, not systemd unit file. It sees systemctl
and supposes it's to be used, not service
.
UPD It doesn't need systemd
until I do apt update
. Before apt update
:
# apt-cache policy openjdk-7-jdk
openjdk-7-jdk:
Installed: (none)
Candidate: 7u101-2.6.6-0ubuntu0.14.04.1
Version table:
7u101-2.6.6-0ubuntu0.14.04.1 0
500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
7u51-2.4.6-1ubuntu4 0
500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
# apt-cache policy systemd
systemd:
Installed: (none)
Candidate: (none)
Version table:
After apt update
:
# apt-cache policy openjdk-7-jdk
openjdk-7-jdk:
Installed: (none)
Candidate: 7u121-2.6.8-1ubuntu0.14.04.1
Version table:
7u121-2.6.8-1ubuntu0.14.04.1 0
500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
7u51-2.4.6-1ubuntu4 0
500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
# apt-cache policy systemd
systemd:
Installed: (none)
Candidate: 204-5ubuntu20.20
Version table:
204-5ubuntu20.20 0
500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
Aren't they switching Ubuntu Trusty to systemd
?
Also, the OS is running in lxc container, but I doubt that has to do with this. And it's a fresh install, so to say. I create container, log in, apt update
, apt install openjdk-7-jdk
, and it wants systemd
.
/etc/apt/sources.list
:
deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
And nothing in /etc/apt/sources.list.d
.
There is a package of openjdk-7-jdk available for Ubuntu 14.04 (Trusty). 14.04 is based on Upstart, not trusty. Therefore, the package must run 14.04 without the systemd init system.
The systemd package you referring to is systemd from trusty-updates. From that page, you can download and review the packages that Debian added to make the package.
In compressed archive, you'll find this in the README file:
systemd provides a number of packages, of which OpenJDK must depend on one. You can confirm that the
systemd-sysv
package is not a dependency.I'm aware of no circumstance in which installing standard packages on Ubuntu 14.04 would result in switching the system to use systemd as the init system without the user explicitly opting in.
Should your 14.04 system somehow end up with both Upstart and systemd installed, you can interrupt the boot process, enter the grub menu and modify the kernel command line to add
init=/sbin/upstart
to boot it back with Upstart, and then uninstall or change what you need to.To solve the problem with elasticsearch not starting, use http://packages.ubuntu.com to find a version of elasticsearch from
trusty
or earlier, and copy the "init.d" script from there. This fix will persist through upgrades of elasticsearch that you may do.I think you are caught an odd state because even though you are using 14.04, some package maintainers are moving to expect
systemd
. I don't think you're going to find a better fix than the workaround like that.It turned out,
systemd
was pulled in as a recommendation, namely:http://packages.ubuntu.com/trusty-updates/openjdk-7-jdk
http://packages.ubuntu.com/trusty-updates/openjdk-7-jre
http://packages.ubuntu.com/trusty-updates/libgtk-3-0
http://packages.ubuntu.com/trusty/libcolord1 (recommends colord)
http://packages.ubuntu.com/trusty/colord
http://packages.ubuntu.com/trusty-updates/policykit-1
http://packages.ubuntu.com/trusty-updates/libpam-systemd
http://packages.ubuntu.com/trusty-updates/systemd-services
And here we can see the difference in behavior between LXC containers and physical servers. LXC containers usually come with basic set of packages. Things like these might be missing:
man
,less
,ping
,vi
,curl
.The point being,
systemd-services
depends onsystemd
orsystemd-shim
(>= 3). After fresh Ubuntu install you usually havesystemd-shim
installed. So installingopenjdk-7-jdk
doesn't pull insystemd
package.In case of LXC container, neither of those two is installed, so when asking
apt
to installopenjdk-7-jdk
it choses the first one:systemd
package.One way to fight it is install
systemd-shim
before installingopenjdk-7-jdk
. Which I like more, since the other one (apt install --no-install-recommends openjdk-7-jdk
) might reject some useful dependencies.See this mailing list discussion for more details.
See this question for details on tracing back dependencies.