Re: How to recover a root partition with damaged boot blocks

2023-04-06 Thread Thomas Mueller
> things to do:

> - reinstall bootxx_ffsvN -- make sure you're installing the right
>   ffsvN.  you can use "dumpfs  | head -2", and it should
>   say FFSv1 or FFSv2 here.  that's "installboot" that you may have
>   already done, but perhaps used the wrong one?

> - re-copy /boot.  cp /usr/mdec/boot /

> - re-copy your /netbsd (where ever it came from)

> - uefi wants a MSDOS partition with /efi/boot/bootx64.efi, so if
>   you haven't provided that it won't work.  if you have enough
>   space at the start or end of the disk you probably can do this,  
>   as it only needs to be pretty tiny.  i did this on a system where
>   root started at sector 2048, and i was able to create about 700KB
>   file system, and bootx64.efi is only about 230KB.  it normally is
>   ok with mbr _or_ gpt partitions here.

> - check that the fdisk (gpt?) and disklabel are OK.  ie, run both
>   "fdisk wd0" and "disklabel wd0" and compare to your working
>   system, see if anything stands out.

HTH,


> .mrg.

Now I couldn't boot NetBSD from either amd64 or i386 installation, there is a 
breakpoint trap 1, so I never get to login.  But I was able to boot into an old 
FreeBSD 11.1-STABLE from 2017.

I still have a working but old Seamonkey and xpdf, and icewm; also mutt, mpop 
and msmtp.  Seamonkey fumbles on some websites that a newer Seamonkey might 
work on.

I have fat32-formatted partition with /efi/boot/bootx64.efi , but I don't get 
any uefi in the boot menu except for UEFI shell.
 
Where do I copy the boot kernels to, and how do I get uefi to get the correct 
one?  How do I get uefi to find the desired boot partition?

Motherboard is old (June 2011), does not always recognize the USB stick that I 
want to boot from.

Tom



Re: How to recover a root partition with damaged boot blocks

2023-04-05 Thread Lloyd Parkes




On 5/04/23 18:00, matthew green wrote:


ps see "man 7 entropy" for how to fix the problem you observed.


FWIW I have PR 57254 in Gnats that provides a patch to /etc/rc.d/entropy 
so that whenever the system boots with insufficient entropy appropriate 
messages are logged. It doesn't change the behaviour of anything, it 
just adds more log messages in quite a useful way if I do say so myself.


The intention is to catch any unforeseen ways that entropy might be 
forgotten about. I was thinking of custom image builds, but losing 
/var/db/entopy-file during a power cut is an excellent scenario as well.


Cheers,
Lloyd


re: How to recover a root partition with damaged boot blocks

2023-04-05 Thread matthew green
things to do:

- reinstall bootxx_ffsvN -- make sure you're installing the right
  ffsvN.  you can use "dumpfs  | head -2", and it should
  say FFSv1 or FFSv2 here.  that's "installboot" that you may have
  already done, but perhaps used the wrong one?

- re-copy /boot.  cp /usr/mdec/boot /

- re-copy your /netbsd (where ever it came from)

- uefi wants a MSDOS partition with /efi/boot/bootx64.efi, so if
  you haven't provided that it won't work.  if you have enough
  space at the start or end of the disk you probably can do this,
  as it only needs to be pretty tiny.  i did this on a system where
  root started at sector 2048, and i was able to create about 700KB
  file system, and bootx64.efi is only about 230KB.  it normally is
  ok with mbr _or_ gpt partitions here.

- check that the fdisk (gpt?) and disklabel are OK.  ie, run both
  "fdisk wd0" and "disklabel wd0" and compare to your working
  system, see if anything stands out.

HTH,


.mrg.

ps see "man 7 entropy" for how to fix the problem you observed.


How to recover a root partition with damaged boot blocks

2023-04-04 Thread Thomas Mueller
How do you recover a partition with boot blocks rendered nonbootable?

There was a split-second power outage during a high-wind event that damaged the 
root partition, rendered it nonbootable.

I built the computer in June 2011, one of the early UEFI-capable motherboards.

I was able to recover the file system with fsck_ffs (ffsv2, I believe) but not 
make it bootable again. 

User data on /home partition was recovered all intact.  I also have a NetBSD 
installation on the other computer (June 2013)

NetBSD version is 9.99.82 amd64, which I also have on the other (June 2013) 
computer.  I also have NetBSD 9.99.82 on each computer for both amd64 and i386.

I tried to rebuild the OS to NetBSD-current amd64 from i386 installation.  That 
was working up to the install stages, when build was stopped due to lack of 
entropy at 9 hours 10 minutes (not a selling point for NetBSD).

The affected partition can be mounted and read, but when I try to boot, the 
computer immediately reboots, no error messages.  

I normally boot with a version of the Super Grub2 disk image.  When, at the 
grub2 command prompt, I type "knetbsd /netbsd-99982" and then "boot", computer 
immediately reboots with no error message.

I also tried to boot by UEFI but could not even get that to set up right.  I 
read "man boot" many times.

I checked /boot and /usr/mdec, even ran installboot from NetBSD-i386 
installation, but nothing worked.  Is there any way to recover?

Tom