You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04 LTS安装Jenkins失败:无法启动LSB开机自启服务

Fixing Jenkins Startup Failure: "Failed to start LSB: Start Jenkins at boot time"

Hey there, let's work through this Jenkins startup issue you're facing. That error message is a common one, and it typically stems from a few key problems—let's go through each fix step by step.

1. Verify Java Version Compatibility

Jenkins 2.107.2 requires Java 8 (either OpenJDK or Oracle JDK) to run properly. If your system has a newer Java version (9+), this will almost certainly cause startup failures.

First, check your current Java version:

java -version

If it's not Java 8, install OpenJDK 8:

sudo apt install openjdk-8-jre-headless

Then set Java 8 as your default version:

sudo update-alternatives --config java

Select the option corresponding to OpenJDK 8 when prompted.

2. Check for Port Conflicts

Jenkins uses port 8080 by default. If another application is hogging this port, Jenkins won't be able to start up.

Check if port 8080 is occupied:

sudo lsof -i :8080
# Or alternatively:
sudo netstat -tulpn | grep 8080

If you see a process using the port, you have two options:

  • Kill the conflicting process (replace <PID> with the process ID from the output):
    sudo kill -9 <PID>
    
  • Change Jenkins' default port:
    Edit the Jenkins config file:
    sudo nano /etc/default/jenkins
    
    Find the line HTTP_PORT=8080 and change it to a free port (e.g., HTTP_PORT=8081). Save the file, then restart Jenkins:
    sudo systemctl restart jenkins
    

3. Inspect Jenkins Logs & Fix Permissions

Detailed logs will often tell you exactly what's going wrong. Let's check two key log sources:

Systemd Service Logs

sudo journalctl -u jenkins

Jenkins Application Logs

tail -n 50 /var/log/jenkins/jenkins.log

If you see permission errors (e.g., "Permission denied" when writing to logs or directories), fix the ownership and permissions:

sudo chown -R jenkins:jenkins /var/log/jenkins
sudo chmod -R 755 /var/log/jenkins

4. Refresh Systemd Configuration

Sometimes the systemd service definition can get messed up during installation. Refresh it and re-enable the service:

sudo systemctl daemon-reload
sudo systemctl enable jenkins
sudo systemctl start jenkins

After trying these steps, check if Jenkins is running with:

sudo systemctl status jenkins

内容的提问来源于stack exchange,提问作者Gaspar Cheng

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 07:19:59