LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   stuck at grub rescue (attempt to read or write outside of partition) (https://www.linuxquestions.org/questions/linux-newbie-8/stuck-at-grub-rescue-attempt-to-read-or-write-outside-of-partition-4175731388/)

cloudman16 11-30-2023 08:02 AM

stuck at grub rescue (attempt to read or write outside of partition)
 
I recently made the switch to linux I chose alpine and fedora:
I was making a partition using cfdisk with alpinelinux on a 1Tb hard drive, I declared the type to linux filesystem and wrote changes to disk. My pc immediately rebooted and entered grub mode with the following message:: error: attempt to read or write outside of partition
entering grub rescue.
I need some help to get back to my partition or something?

yancek 11-30-2023 10:52 AM

Is the 1TB disk you refer to an external or non operating system disk? Creating and formatting a partition won't do what happened in your case and I would not expect the computer to automatically reboot after making a partition change which is what it seems you are saying. Did you use the entire disk to create/format a partition. And again, what if anything was on the disk?

mrmazda 12-01-2023 12:50 AM

Seems to me the partition table change may have invalidated a previously installed Grub, and it may need to be reinstalled if there's still a good OS installation on the disk. If there is none, then wiping 30 or so sectors following the MBR sector could be helpful until such time as you install an OS. Answers to yancek's questions should be telling.

cloudman16 12-01-2023 05:41 AM

hi yancek the drive is not an external I was partitioning the pc's internal drive(hdd), I partitioned 128Gib of the drive...
I recently tried rescuing grub with setting the:>set prefix and >set boot commands it still responds the same error "attempt to read or write outside of partition"
let me share more of the grub rescue:
###Note### The following is the current configs, I had made a lot of changes these are not default###NOTE###

Code:

error: attempt to read or write outside of partition
entering grub rescue
>ls
(hd0) (hdo,gpt3) (hd0,gpt2) (hd0,gpt1)
>ls (hd0,gpt3)
filesystem: ext2

> set
root=hd0,gpt3
cmdpath=(hd0,gpt1)/EFI/BOOT
prefix=(hd0,gpt3)/boot/grub
boot=hd0,gpt3
>insmod normal
error: attempt to read or write outside of partition
>

so this is my list of partitions in the drive(I think)
what other crucial information can I provide?

mrmazda 12-01-2023 05:53 AM

fdisk -l or parted -l input/output would be useful. So would efibootmgr input/output, and content of the installed system's fstab.

zeebra 12-01-2023 06:30 AM

The best way to go about such a situation is to not panic, and to use a "live cd" or a specialized live cd called a "rescue cd".. It just happens to be that Slackware is an excellent rescue disk (not a cd, but dvd/usb).. With this you can boot the Kernel on the disk, with any available partition as your /root, and set up a full environment to get things fixed.

The best way to go about it, is to use such a disk to boot your pc, then:
1. Analyze the partition situation (intact? content still there?)
2. Repair your bootloader
3. If that doesn't work, repair the rest of your boot sequence (Kernel/init)
4. If that doesn't work, rescue any content you need from the partition(s) or some other more advanced solutions/attempts at repair

cloudman16 12-04-2023 02:49 PM

I have live boot and managed to get my important files safe on a usb and just restarted from the beginning. thanks guys zeebra, mrmazda & ywncek

zeebra 12-05-2023 07:50 AM

Quote:

Originally Posted by cloudman16 (Post 6468435)
I have live boot and managed to get my important files safe on a usb and just restarted from the beginning. thanks guys zeebra, mrmazda & ywncek

That's great. Good to hear!

Conventional wisdom says to ALWAYS use backups when doing major system operations. And that's true for everyone. I can't say how many times I've gotten myself into such situations (and out quite often too), but my experience verifies to me the correctness of the conventional wisdom. And still also.. No matter how many times you've done these things, and feel 100% sure everything will be fine (you know these things in and out), you should still ALWAYS make backups when doing major system operations.


All times are GMT -5. The time now is 06:23 PM.