Can't do a manual fsck on root system [SOLVED]

Lenovo B50-10 running Ubuntu 18.04

A mate sent me his Lenovo laptop to fix as it wouldn’t boot and indicated a manual fsck was necessary.
It boots straight into the GRUB screen (without pressing the Shift key). I selected “Advanced options for Ubuntu” and then selected “Recovery Mode” expecting to see another screen with a recovery mode menu so I could choose manual fsck, but it did an auto-fsck on /dev/sda2 and outputted two pages of stuff, exiting with Code 4 (which is just “File system errors left uncorrected”).

Then followed the advice to run a manual fsck without the -a or -p options, finishing with “File system check of root file system failed. Requires a manual fsck.”

That it is performing fsck automatically at boot is making things difficult so I checked that the boot order is USB first then booted with an Ubuntu 20.04 USB in place with a view to running fsck from that - but this was ignored and it went into the usual routine.

I found the GRUB command line screen (typing c at one point) but none of the commands I could think of were recognised.

Any ideas, anyone?


EDIT 1: Discovered that Legacy Boot was not enabled! I can now boot from a USB and will be able to back up files before messing with the system.

run fsck from a Live-CD/Live-USB
Identify partitions

sudo fdisk -l

Make sure they are unmounted:
Code: [Select]

for n in /dev/sda* ; do umount $n ; done

then run fsck on them (substitute X to suit):

fsck /dev/sdaX

or fix an hard drive related issue called bad blocks you may have (this will take a long time).

fsck -cy /dev/sdaX

or

fsck -C0 -p -f -v /dev/sdaX

Many thanks Sezo - that worked perfectly.

Keith