Score:0

How to set DNS on an Ubuntu 18.04 Server (with a broken upgrade)

cn flag

I am in a little bit of a tough situation. I upgraded my Ubuntu server from 16.04 to 18.04 but upgrade didn't go well. Now, it shows version 18.04 LTS on "lsb_release -a", and cannot install any packages because Apache doesn't want to upgrade to the default version on 18.04.

That is a Jira Server (v18.12 to be exact). As far as I understand, I cannot change the Apache version because of that. Now, when I try to install any packages, I get

root@jira:/# apt-get install netplan
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 apache2 : Depends: apache2-bin (= 2.4.18-2ubuntu3.17) but 2.4.29-1ubuntu4.21 is to be installed
           Depends: apache2-data (= 2.4.18-2ubuntu3.17) but 2.4.29-1ubuntu4.21 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

apt --fix-broken install

command shows me this.

root@jira:/# apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libasprintf0v5 liblua5.1-0 libxft2 libxxf86dga1 rename sgml-base xml-core
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  apache2
Suggested packages:
  www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following packages will be upgraded:
  apache2
1 upgraded, 0 newly installed, 0 to remove and 263 not upgraded.
139 not fully installed or removed.
Need to get 0 B/95.1 kB of archives.
After this operation, 26.6 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 99235 files and directories currently installed.)
Preparing to unpack .../apache2_2.4.29-1ubuntu4.21_amd64.deb ...
Restoring lost conffile /etc/apache2/mods-available/cern_meta.load.
/var/lib/dpkg/tmp.ci/preinst: line 149: /etc/apache2/mods-available/cern_meta.load: No such file or directory
dpkg: error processing archive /var/cache/apt/archives/apache2_2.4.29-1ubuntu4.21_amd64.deb (--unpack):
 new apache2 package pre-installation script subprocess returned error exit status 1
insserv: warning: script 'K01jira' missing LSB tags and overrides
insserv: warning: script 'jira' missing LSB tags and overrides
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "start" failed.
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; generated)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Mon 2022-02-21 19:09:14 CET; 7ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 21408 ExecStart=/etc/init.d/apache2 start (code=exited, status=2)

Feb 21 19:09:14 jira systemd[1]: Starting LSB: Apache2 web server...
Feb 21 19:09:14 jira apache2[21408]: /etc/init.d/apache2: 46: .: Can't open /etc/apache2/envvars
Feb 21 19:09:14 jira apache2[21408]: /etc/init.d/apache2: 57: .: Can't open /etc/apache2/envvars
Feb 21 19:09:14 jira apache2[21408]: ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars
Feb 21 19:09:14 jira systemd[1]: apache2.service: Control process exited, code=exited status=2
Feb 21 19:09:14 jira systemd[1]: apache2.service: Failed with result 'exit-code'.
Feb 21 19:09:14 jira systemd[1]: Failed to start LSB: Apache2 web server.
Errors were encountered while processing:
 /var/cache/apt/archives/apache2_2.4.29-1ubuntu4.21_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Jira works fine! The problem is, server cannot send any email notifications at the moment. And I cannot ping anywhere (even google.com) from the console. I narrowed the situation down to the fact that I don't have any DNS servers configured on that box. And looking for a way to define any DNS servers without installing any packages.

May be there is an oldschool way to edit a conf file and bring back the internet?

I am a linux newbee and searching didn't give me much. Already spent hours on this and decided to ask for your opinion.

Thanks for your help!

David avatar
cn flag
You say it did not go well. What happened? What errors? A filed upgrade is a non working system.
ru flag
Can you ping 8.8.8.8?
user535733 avatar
cn flag
The output `insserv: warning: script 'K01jira' missing LSB tags and overrides` and `insserv: warning: script 'jira' missing LSB tags and overrides` suggests that the shown problem is caused by Jira's poor code -- we stopped using those trouble-prone sysvinit scripts a very long time ago. Please file a bug report with Jira. As a tweak, you could fix the missing LSB tags and override fields in those two scripts. It's not too difficult, though it does require learning how those tags work.
cn flag
@David during upgrade package upgrades failed is what happened... :(
cn flag
@ThomasWard yes, I can. I have internet, but no DNS at the moment...
cn flag
@user535733 your saying that makes it sound reeeaaally eeeeasy :) But I don't think I can go for that right now. What I need is a short term solution to provide internet access to Jira services on that box. Any way to set DNS configuration would be greatly helpful at this point...
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.