How to recover network

How to admin and use Linux system
Post Reply
User avatar
azo
Site Admin
Posts: 11
Joined: Mon Jun 10, 2019 9:23 am

How to recover network

Post by azo »

Linux version: Ubuntu 16.04 server amd64, VirtualBox VM

Occasionally network access stopped to work on the server.
Command ifconfig gives only lo interface.
ifconfig.lo.png
ifconfig.lo.png (6.24 KiB) Viewed 239 times
First attempt was to change network adapter in VM settings.
I even changed MAC and added an extra network adapter.
No result yet
VirtualBox. network settings
VirtualBox. network settings
VM settings.png (18.51 KiB) Viewed 239 times
It looks there was some problem with network drivers.
No Internet connection.

When I need to fix something in Windows and nothing works, I normally get Windows installer (CD .. or even USB stick).
I goggled possibility to do similar things using Linux live CD.

"The easiest way is boot from an installation media and then use chroot" (https://askubuntu.com/questions/319798/ ... -on-ubuntu)

And I found good explanation on that:
http://ubuntu.fliplinux.com/1836.html (Russian) - exactly related to the subject
https://help.ubuntu.com/community/LiveCdRecovery (English)

The idea was to re-install network manager

In case of having Internet connection, it would be done in the following way

Code: Select all

sudo apt-get install network-manager
Without Internet (network does not work), I needed to get Ubuntu 16.4 iso image. Old Gitlab server has the same version.

When I boot from Live CD, I found single HDD and its main partition as /dev/sda1.
fdisk output
fdisk output
sda1.png (58.08 KiB) Viewed 239 times
In terminal window I executed the following commands

Code: Select all

sudo mount /dev/sda1 /mnt
sudo mount --bind /sys /mnt/sys
sudo mount --bind /proc /mnt/proc
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo cp /etc/resolv.conf /mnt/etc/
sudo chroot /mnt
chroot.png
chroot.png (30.52 KiB) Viewed 239 times
Now further installations will be applied to real HDD, and not to live (temp) system

Internet connection works on the Live (temp) system
two network interfaces.png
two network interfaces.png (61.53 KiB) Viewed 239 times
First I had to install latest updates to current Ubuntu 16.4

Code: Select all

sudo apt-get update
sudo apt-get upgrade (desired... but probably not really necessary)
Upgrade may take a while since more than 1 Gbytes should be downloaded and installed.

Then network manager can be (re)installed

Code: Select all

sudo apt-get install network-manager
This command did not work. There was error message with recommendation to execute 'sudo dpkg --configure -a'
After that command (executed for a while), I tried to install network manager again
dpkg.png
dpkg.png (11.5 KiB) Viewed 239 times

Code: Select all

sudo dpkg --configure -a

Code: Select all

sudo apt-get install network-manager
I restarted the server without Live CD. And it appeared network is working!!!

Normally I install Midnight Commander (mc). I like GUI. And that allows me to browse files easily.

Code: Select all

sudo apt-get install mc
That is all.
Post Reply