Score:1

Ubuntu unable to boot, stuck in GRUB command line

pa flag

I'm relatively new to Ubuntu. I am single-booting it on a relatively new Lenovo laptop (factory installed with Ubuntu) and am stuck at the GRUB command line (GRUB 2.04). When I try to ls, I get:

(proc) (hd0) (hd0.gpt3) (hd0.gpt2) (hd0.gpt1) error: failure reading sector 0x951800 from 'hd0'. error: failure reading sector 0x951800 from 'hd0'.

And when I try to ls further into these, everything seems to be an unknown file system. I have a liveUSB (though when I run from it I get these errors), from which I was able to produce a boot info summary here and ran sudo fdisk -l with output here. Any tips on what I should do? I've got some files that I would love to keep if possible.

Score:1
st flag

What is your /etc/fstab?

That is probably missing.

But, better... The "how" to get it back:

Manually remount all of the partitions by hand using a live CD.

mkdir /mnt/root
sudo mount /dev/nvme0n1p3 /mnt/root
sudo mount /dev/nvme0n1p2 /mnt/root/boot
sudo mount /dev/nvme0n1p1 /mnt/root/boot/efi

Now, inspect the /mnt/root/etc/fstab file and see that it has entries for the root partition (which it doesn't seem to know about). If that stuff is missing, then you will have to put it back.

Install arch-install-scripts and then:

sudo genfstab /mnt/root

Check the output to the screen and see that it is pointing all of the partitions to the right mount points. You should see the UUID's of the drives being listed OR the direct /dev/nvme0n1p(number) names. You can see the UUID's by typing: blkid

If it is then just run the command again but like this:

sudo genfstab /mnt/root > /mnt/root/etc/fstab

Reboot the machine and you should be back in like Flynn.

Anaïs Ahmed avatar
pa flag
When I try running `sudo mount /dev/nvme0n1p3 /mnt/root` I get `mount: /mnt/root: can't read superblock on /dev/nvme0n1p3`. I haven't run any commands past that one.
sean avatar
st flag
@AnaïsAhmed try `sudo mount -t ext4 /dev/nvm0n1p3 /mnt/root` you may have to specify -t vfat for the others
sean avatar
st flag
@AnaïsAhmed On your machine it looks like the EFI is p1, the Ubuntu root is p3, and I have no idea why you have a Windows Recovery Partition on p2 but it's useless. (Because you don't have Windows partition.) Ignore the instructions to mount '/boot' right out and check that /mnt/root/boot and see if you have files in there before you mount. I'm guessing you have "boot on root" rather than boot to be it's own partition.
sean avatar
st flag
@AnaïsAhmed priority ATM is to get back into the root most of all... From there you an rebuild the boot loaders and do everything else you need to do IF you have to.
Anaïs Ahmed avatar
pa flag
When I try `sudo mount -t ext4 /dev/nvm0n1p3 /mnt/root` I get `mount: /mnt/root: special device /dev/nvm0n1p3 does not exist.`. Incidentally, I tried running `blkid` and got [this output](https://pastebin.com/v1RnszUD) - not sure if it's relevant or not, but I thought I'd mention. Thanks so much for your help. I think I have a Windows recovery partition on p2 because Lenovo probably installs it by default on their machines.
sean avatar
st flag
@AnaïsAhmed Yeah, this is just a strange layout to me. Did you install this Ubuntu yourself or was it pre-installed? I ask because there are no ext4, btrfs, or xfs partitions in the list. It seems like this is "dual boot" installed OVER a vfat filesystem. This is ugly, kludgy, and never worked in the first place. (I am surprised you can even still do this.) Ubuntu should be installed into it's own partitions on secure filesystems.
sean avatar
st flag
@AnaïsAhmed Past a certain point it's faster to reload this machine, and you're about there. If you can boot a Live CD of Ubuntu and get networking you can transfer all the data off via network or external drive. I'd just wipe all these partitions out and reload the machine to return it to a predictable known state.
sean avatar
st flag
@AnaïsAhmed NM on the comment about the "factory installed", yep... Ok, so the root is actually -t vfat. This is bad, ugly, it doesn't work I don't care what anyone says of it, lol. It likely was not installed properly in the first place and they're using some 'cooked up' version of Ubuntu not the standard distro. Essentially, they're just making more work for you. If you haven't got anything on this machine reload it with real Ubuntu Desktop LTS and blow it completely up and erase it all. You don't need their software.
sean avatar
st flag
@AnaïsAhmed Ubuntu "standard" installer will only put root partition on ext4, zfs, or xfs. LVM + ext4 + encryption is usually the standard for a laptop installation. Don't use xfs or zfs unless you know what they're doing, as they're much more complicated beasts.
Anaïs Ahmed avatar
pa flag
I just realized I mistyped the command - `sudo mount -t ext4 /dev/nvme0n1p3 /mnt/root` gives me `mount: /mnt/root: wrong fs type, bad option, bad superblock on /dev/nvme0n1p3, missing codepage or helper program, or other error.` whereas `sudo mount -t vfat /dev/nvme0n1p3 /mnt/root` gives me `mount: /mnt/root: can't read superblock on /dev/nvme0n1p3.`. It seems less and less likely that I will be able to recover my files.
Anaïs Ahmed avatar
pa flag
By the way, when I go to try re-installing Ubuntu I get a message letting me know that `/dev/nvme0n1` has mounted partitions, and asks if I want to unmount before continuing. Am I safe to unmount?
sean avatar
st flag
@AnaïsAhmed That filesystem is simply gone. And, all this takes is is one bad power-cycling event and vfat dies. This is WHY you do not use it and you use a journaling filesystem like ext4 or xfs on a laptop. It writes a journal of writes to the disk while it's working so even if it gets a power down abruptly it can rebuild the entire filesystem from the log. Yeah, you have to destroy all of those partitions. You should select "destroy all" and pick LVM + ext4 + encryption (or not if you don't value security, personal choice). Let it set up the partitions automatically.
sean avatar
st flag
@AnaïsAhmed That will give you a /boot /root /boot/efi on two partitions with a swap file located on the root device. If the swap file is too small you can enlarge it after the fact. (I think it defaults to something like 4GB, it should be the size of memory.) But, that is very easy to do so don't let it trouble you.
sean avatar
st flag
@AnaïsAhmed you might be able to recover the partition with the `testdisk` program installed on a live CD. (you may have to actually install it to run it), but I'm guessing that probably won't work. It's not just a disk error, but likely that things are "gone". You could try it, maybe it will work... It certainly can't do more damage than is already there. But, I usually only use that program to fix a partition that is deleted (no corruption). AKA - I am the one that deleted it. :D
I sit in a Tesla and translated this thread with Ai:

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.