Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

dpkg: error processing package

I am using a GCP trial account and trying to install some packages on the VM instances. But I am getting the following error for any package I install. OS image: debian-11-bullseye-v20231010

invoke-rc.d: initscript jenkins, action "start" failed.
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2023-11-08 05:43:35 UTC; 7ms ago
Process: 3607 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
Main PID: 3607 (code=exited, status=1/FAILURE)
CPU: 9ms
dpkg: error processing package jenkins (--configure):
installed jenkins package post-installation script subprocess returned error exit status 1

1 1 710
1 REPLY 1

Hi @Priya346,

Welcome to the Google Cloud Community!

You seem to have skipped installing Java on your VM. If you have no important data in the VM, you may reset the VM for a fresh instance. Then, kindly follow the steps below:

1. Install Java [1].

 

$ sudo apt update
$ sudo apt install fontconfig openjdk-17-jre
$ java -version

 

2. Once Java is installed, you may now install Jenkins.

The following commands are for the Long Term Support (LTS) release [2]:

 

$ sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
  https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
$ echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
  https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
  /etc/apt/sources.list.d/jenkins.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install jenkins

 

3. Start Jenkins [3]:

 

$ sudo systemctl enable jenkins
$ sudo systemctl start jenkins

 

4. Check the status of Jenkins:

 

sudo systemctl status jenkins

 

You should see an output similar to the one below:

 

Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-11-13 16:19:01 +03; 4min 57s ago

 

I hope this answers your question. Thank you. 😃

[1]. https://www.jenkins.io/doc/book/installing/linux/#installation-of-java
[2]. https://www.jenkins.io/doc/book/installing/linux/#long-term-support-release
[3]. https://www.jenkins.io/doc/book/installing/linux/#start-jenkins