the "/boot/efi" partition used to boot is not exclusive to Linux: it is shared with Windows, and thus you can (and should) provide it to utility tools that fix boot. It is usually on /dev/sda2. You canls -l /boot/efifrom a functioning linux to check its content.
The command to "install" grub requires to provide the disk, not a specific partition (e.g. /dev/sda, not /dev/sda2)
The following lines are a crude hint, the full operation might require some other mounting.
First, create a live USB/CD system, and boot on it.
Then we mount the dead system to be able to work with it:
1 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B /mnt$i; done
And we chroot to act as if we were on the dead system:
1 chroot /mnt
Then we mount the EFI partition:
1 mount /dev/sda2 /boot/efi
And finally we execute the "grub-install" command: The bootloader-id argument will be the name appearing in the EFI boot list if you go to the boot menu. Type the following command very carefully, a lot of people online seem to have errors simply due to typos:
" BASIC CONFIG
set encoding=utf-8
syntax on
set nu
set rnu
set hls
set sm
set smarttab
set nocompatible
set scrolloff=30
set backspace=indent,eol,start " backspace over everything in insert mode
set ignorecase " do case insensitive search
set incsearch " show incremental search results as you type
" STYLE
" colorscheme peachpuff
highlight LineNr ctermfg=black ctermbg=grey
let g:indentLine_color_term = 239
" MAPPING
noremap <space> :
nnoremap <F2> za " Enable folding with F2
" Always show statusline
set laststatus=2
set t_Co=256"
set foldmethod=indent
set foldlevel=99
set tabstop=4
set softtabstop=4
set shiftwidth=4
set textwidth=79
set wrapmargin=0
set expandtab
set autoindent
set fileformat=unix
" web
au BufNewFile,BufRead *.html,*.css,*js
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2
autocmd BufRead,BufNewFile /etc/nginx/sites-*/* setfiletype conf
" to test
" Bind key to run python3
" map :w\|!python3 %
" " Bind key to run doctests in a python3 module
" map :w\|!python3 -m doctest %
" " Bind key to run doctests with verbose output
" map :w\|!python3 -m doctest -v %
" " Bind key to run pep8 Python style checker
" map :w\|!pep8 %
Happened to me as I changed my DATA HDD. because I added it to /etc/fstab
and the disk wasn't the same anymore, the system would drop into emergency
mode.
Once connected, try mounting all mount points and see errors: