debian – Rescue Tip: Wrong library file installation damaged Ubuntu 18.04 after upgrade

There was an old Ubuntu 14.04 instance which I attempted to upgrade to 18.04. Some Dependencies where somehow not upgraded anyway.

So I attempted to install corresponding deb file from Ubuntu server (as it was not in repo)

The following packages have unmet dependencies:
 dpkg : Breaks: libdpkg-perl (< 1.18.11) but 1.18.4ubuntu1 is to be installed
        Breaks: libdpkg-perl:i386 (< 1.18.11)
 libc-bin : Depends: libc6 (< 2.25) but 2.27-3ubuntu1.2 is to be installed
 locales : Depends: libc-bin (> 2.27)

I accidentally installed wrong version of libc6 which result to damage the instance.

root@myself:~# dpkg -i libc6_2.27-3ubuntu1_amd64.deb 
dpkg: warning: downgrading libc6:amd64 from 2.31-0ubuntu9.2 to 2.27-3ubuntu1
(Reading database ... 110607 files and directories currently installed.)
Preparing to unpack libc6_2.27-3ubuntu1_amd64.deb ...
/usr/bin/perl: error while loading shared libraries: cannot open shared object file: No such file or directory
dpkg: error processing archive libc6_2.27-3ubuntu1_amd64.deb (--install):
 subprocess new pre-installation script returned error exit status 127
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Errors were encountered while processing:

Now I cannot access ssh

Login via Lish Gateway(Linode SH), I get the following message and it doesn’t accept any login.

 * Stopping flush early job output to logs                               ( OK )
 * Starting SystemD login management service                             ( OK )
 * Starting system logging daemon                                        ( OK )
 * Starting Bridge socket events into upstart                            ( OK )
 * Starting Bridge file events into upstart                              ( OK )
 * Setting up X socket directories...                                    ( OK )
 * Stopping cold plug devices                                            ( OK )
 * Stopping log initial device creation                                  ( OK )
 * Stopping System V initialisation compatibility                        ( OK )
 * Starting configure network device security                            ( OK )
 * Starting System V runlevel compatibility                              ( OK )
 * Starting OpenSSH server                                               ( OK )
 * Starting regular background program processing daemon                 ( OK )
 * Starting save kernel messages                                         ( OK )
 * Stopping save kernel messages                                         ( OK )
 * Starting configure virtual network devices                            ( OK )
 * Starting MySQL Server                                                 (fail)
 * Restoring resolver state...                                           ( OK )
 * Stopping MySQL Server                                                 ( OK )                                                                         
 * The apache2 configtest failed.                                              
Output of config test was:                                                     
/usr/sbin/apache2: error while loading shared libraries: cannot open shared object file: No such
Action 'configtest' failed.                                                    
The Apache error log may have more information.                                
 * Stopping System V runlevel compatibility                              ( OK )
Ubuntu 18.04.1 LTS nmd2 ttyS0                                             
nmd2 login:                                                                   

So attempting a rescue mode is the only option. It seems libcrypt dependency is causing the error.

How to solve this in rescue mode. Any advice please.