DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Installation and Upgrading

OpenBSD Installation and Upgrading Installing and upgrading OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 29th July 2015
acampbell acampbell is offline
Real Name: Anthony Campbell
Shell Scout
 
Join Date: Sep 2014
Location: London, UK
Posts: 138
Default Boot error ERR M after snapshot upgrade

Today after an attempted snapshot upgrade I can't boot. I get

Using drive 0, partition 3
Loading ...
ERR M

I think thjs means it is looking for the kernel in the wrong partition. Any way to fix this from the boot CD?

Last edited by acampbell; 29th July 2015 at 07:31 PM.
Reply With Quote
  #2   (View Single Post)  
Old 29th July 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

It means that the first stage boot loader cannot find the "/boot" file in the root partition.

On i386 and amd64, the multistage boot process is identical. The BIOS loads the MBR program, which loads the PBR program, which on OpenBSD is the first stage bootloader, biosboot(8). This program is installed into the PBR sector by the program installboot(8), which inserts the sector locations of the second stage boot loader boot(8) into the PBR, so it can find the sectors at boot time, since it doesn't know how to read file system structures.

"ERR M" is "no magic number" -- meaning, "I went to the first sector where /boot should be located, but I didn't find it there. Something else was there instead."

Either the file was moved, or deleted. This usually occurs due to stopping the upgrade after the /boot file was replaced from the base*.tgz fileset but before bootblocks were reinstalled by the upgrade script.

You can fix this yourself. Boot the installation media, select the shell, and use installboot(8) to reinstall the PBR. Here is a very quick, UNTESTED step by step example, which assumes that the hard drive you want to repair is sd0. This example uses both /mnt and /mnt2 as mount points. Both are included in the installation media system: the RAMDISK kernel bsd.rd.

Step 1: from the shell, mount the "a" partition of your boot drive. You'll need it mounted to install bootblocks. Both bootloaders are stored in /usr/mdec, so you'll need to locate your /usr partition by reviewing the fstab(8) file in its the root partition's etc/ directory.

# mount /dev/sd0a /mnt
# cat /mnt/etc/fstab

Once you know which partition is or holds /usr, mount it and cd to the mdec directory. In this example, /usr is the "d" partition.

# mount /dev/sd0d /mnt2
# cd /mnt2/mdec

Now, reinstall both bootloaders:

# installboot -v -r /mnt sd0 biosboot boot

Once again, don't blindly type this stuff in. Be sure you understand each option. This is untested, from memory, and I may have misdirected you unintentionally. Please double-check my recommendation before executing.

Last edited by jggimi; 29th July 2015 at 08:48 PM. Reason: too, many, commas, and, I'm, not, Shatner
Reply With Quote
  #3   (View Single Post)  
Old 30th July 2015
acampbell acampbell is offline
Real Name: Anthony Campbell
Shell Scout
 
Join Date: Sep 2014
Location: London, UK
Posts: 138
Default

Thanks very much for your helpful reply. Yes, it worked, with slight modification. At first I could only mount the partitions read-only, which of course prevented installboot from writing the mbr. I followed the suggestion on the screen to run fsck and then it worked.

I'd seen Google references to reinstalling the PBR but I didn't know how to do it.
Reply With Quote
  #4   (View Single Post)  
Old 30th July 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

Quote:
Originally Posted by acampbell View Post
...At first I could only mount the partitions read-only...
Then the update script was stopped early. Not by a CTRL-C and reboot(8), but by crash or power failure.

You might consider rerunning an upgrade, to ensure you get all files from start to finish.
Reply With Quote
  #5   (View Single Post)  
Old 30th July 2015
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Quote:
Originally Posted by acampbell View Post
I'd seen Google references to reinstalling the PBR but I didn't know how to do it.
As this is a new & different subject, I have spawned a new thread to discuss this further:

http://daemonforums.org/showthread.php?t=9281

To help keep discussions clear, & to help those who read these forums who aren't native speakers of English, we ask members to please keep threads on a single subject. This also helps future readers decipher the flow of conversation and be able to search the archives for specific subjects.

This practice is covered in the forum rules.

Last edited by ocicat; 31st July 2015 at 10:18 AM. Reason: clarity
Reply With Quote
  #6   (View Single Post)  
Old 30th July 2015
acampbell acampbell is offline
Real Name: Anthony Campbell
Shell Scout
 
Join Date: Sep 2014
Location: London, UK
Posts: 138
Default

Quote:
Originally Posted by jggimi View Post
Then the update script was stopped early. Not by a CTRL-C and reboot(8), but by crash or power failure.

You might consider rerunning an upgrade, to ensure you get all files from start to finish.
I didn't notice any crash or power failure. But I have now completed the upgrade and everything went off smoothly.
Reply With Quote
  #7   (View Single Post)  
Old 30th July 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

Something happened. Your first symptom indicated the upgrade script was stopped after the base fileset replaced the /boot file. Your newest reported symptom indicated a mechanical reboot, rather than an operator initiated reboot by command.
  1. ERR M = /boot moved but bootblocks not rewritten
  2. fsck(8) required = filesystems not successfully dismounted
Reply With Quote
  #8   (View Single Post)  
Old 3rd August 2015
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: France
Posts: 405
Default

Well, same problem for me today.

I tried to install OpenBSD 5.7 on the ThinkPad, which is dualboot OpenBSD 5.6/Windows 7.
But no way.

I first tried an install with a few modifications in the partition.
But after the reboot, the ERR M message appeared.

Then I tried a stock install, no change at all.
Still the ERR M message.

These two installs were made with http source.
Now I'm gonna try a full CD install, just to see...
__________________
ThinkPad W500 P8700 6GB HD3650 - faultry
ThinkStation P700 2x2620v3 32GB 1050ti 3xSSD 1xHDD
Reply With Quote
  #9   (View Single Post)  
Old 3rd August 2015
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: France
Posts: 405
Default

Ok, I tried a full CD install and no difference, still the ERR M message !

It's late now, I'll follow jggimi's directives tomorrow...
__________________
ThinkPad W500 P8700 6GB HD3650 - faultry
ThinkStation P700 2x2620v3 32GB 1050ti 3xSSD 1xHDD
Reply With Quote
Old 3rd August 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

Quote:
Originally Posted by LeFrettchen View Post
...which is dualboot OpenBSD 5.6/Windows 7...
Without knowing anything else, I'll take a wild guess that FAQ 14.8 applies.

I don't know that for sure. It's just a guess that the LBA of /boot is beyond your BIOS's capability to address directly. OpenBSD's first stage bootloader depends on BIOS services for I/O.
Reply With Quote
Old 6th August 2015
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: France
Posts: 405
Default

Pfeeew...

I struggled 2 days with OpenBSD, trying to reinstall the bootloader.
I tried a lot of things, jggimi's directives, even found an old post from ocicat on Linuxquestions, nothing worked.

Then I tried to install EasyBCD in Windows.
EasyBCD is a software that helps to control and configure the BCD/BOOTMGR bootloader.

And finally, it works !
__________________
ThinkPad W500 P8700 6GB HD3650 - faultry
ThinkStation P700 2x2620v3 32GB 1050ti 3xSSD 1xHDD
Reply With Quote
Old 22nd September 2016
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: France
Posts: 405
Default

Same player, shoot again

I finally found the motivation to upgrade my OpenBSD 5.7, on my dualboot machine.

I upgraded 5.7 to 5.8, no problem.
I upgraded 5.8 to 5.9, OK.
I upgraded 5.9 to 6.0, and...
Code:
Loading...
ERR M
Crap !

So, one more time, I used EasyBSD to create a new boot partition (grub style).
And now, OpenBSD can boot and works fine

Well, and I find OpenBSD 6.0 faster/more reactive.
Seems smoother for an internet/office use than 5.7.
__________________
ThinkPad W500 P8700 6GB HD3650 - faultry
ThinkStation P700 2x2620v3 32GB 1050ti 3xSSD 1xHDD
Reply With Quote
Old 23rd September 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

Could you do me a favor and post the output of fdisk(8) and disklabel(8) for your boot drive? If, for example, that drive is sd0, I'd like to see the output of # fdisk sd0 and # disklabel sd0, because as I've noted previously, ERR M is a very specific configuration error produced by biosboot(8):
Code:
     ERR M    Bad magic.  The ELF ``magic number'' \7fELF in boot(8)'s header
              was not found.  This indicates that the first block of boot(8)
              was not read correctly.  This could be due to disk corruption,
              failing to run installboot(8), giving an invalid boot(8) program
              as the boot argument to installboot(8), or incorrect geometry
              translation.
Reply With Quote
Old 23rd September 2016
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: France
Posts: 405
Default

Here you are :
Code:
$ doas fdisk wd0 
Disk: wd0       geometry: 41345/240/63 [625142448 Sectors]
Offset: 0       Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
*0: 07      0   1   1 -  20000   0  63 [          63:   302400000 ] NTFS        
 1: A6  20000   1   1 -  41344 239  63 [   302400063:   322736337 ] OpenBSD     
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
Code:
$ doas disklabel wd0 
# /dev/rwd0c:
type: ESDI
disk: ESDI/IDE disk
label: WDC WD3200BEKT-6
duid: 932fde05f364ec7a
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 240
sectors/cylinder: 15120
cylinders: 41345
total sectors: 625142448
boundstart: 302400063
boundend: 625136400
drivedata: 0 

16 partitions:
#                size           offset  fstype [fsize bsize  cpg]
  a:          2097121        302400063  4.2BSD   2048 16384    1 # /
  b:          6801912        304497184    swap                   # none
  c:        625142448                0  unused                   
  d:          8388576        311299104  4.2BSD   2048 16384    1 # /tmp
  e:        248853280        376283104  4.2BSD   2048 16384    1 # /var
  f:          4194304        340631520  4.2BSD   2048 16384    1 # /usr
  g:          2097152        344825824  4.2BSD   2048 16384    1 # /usr/X11R6
  h:         20971520        346922976  4.2BSD   2048 16384    1 # /usr/local
  i:        302400000               63    NTFS                   
  j:          4194304        367894496  4.2BSD   2048 16384    1 # /usr/src
  k:          4194304        372088800  4.2BSD   2048 16384    1 # /usr/obj
  l:         20943840        319687680  4.2BSD   2048 16384    1 # /home
__________________
ThinkPad W500 P8700 6GB HD3650 - faultry
ThinkStation P700 2x2620v3 32GB 1050ti 3xSSD 1xHDD
Reply With Quote
Old 23rd September 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

Thank you. Windows is allocated to the lower 144 GiB of the wd(4) drive, with OpenBSD allocated to the upper 153 GiB. The second stage bootloader, /boot, will be located within your 1GiB root partition. This is above the 128 GiB limit (137.4 GB) of INT 13h BIOS addressing prior to ATA-6. However, you have reported that the first stage bootloader is able to -- intermittently -- read the second stage bootloader. Therefore your computer has ATA-6 hardware.

I surmise that your BIOS has its own addressing limitation that falls somewhere within the root partition's location in the 145th GiB, and it is just luck whether the second stage bootloader is stored above or below this limit. You might check to see if your vendor has an updated BIOS, as the limitation might have been corrected. If not, the only way to eliminate your EasyBCD circumvention is to reallocate storage so that the root partition is located below the BIOS addressing limit.

Last edited by jggimi; 23rd September 2016 at 01:08 PM. Reason: typo, added comment regarding wd(4), as this is ATA/IDE hardware
Reply With Quote
Old 23rd September 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

And just as a follow up, I looked at CHS geometry. CHS drive geometry mapping has been virtual, and been meaningless for decades, but is still reported by drive electronics as it has been used by some BIOS firmwares for boot.

Drive geometry does not appear to be a factor in this problem.. The root partition starts at CHS 20000/1/1 and ends at 20138/45/1. Those cylinder numbers in hex are 0x4e20 and 0x4eaa.
Reply With Quote
Old 23rd September 2016
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: France
Posts: 405
Default

Thanks jggimi, the situation is clearer now.
And yes, my BIOS is outdated, have to upgrade it.
I'll tell you if anything change...

Just one question : is there an OpenBSD tool to check the BIOS version ?
I used dmidecode, but it's only in ports...
__________________
ThinkPad W500 P8700 6GB HD3650 - faultry
ThinkStation P700 2x2620v3 32GB 1050ti 3xSSD 1xHDD
Reply With Quote
Old 23rd September 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

On OpenBSD, dmesg(8) is the most common way to determine this. For example, my ThinkPad X220 is using Lenovo's BIOS version 1.42.
Code:
bios0 at mainbus0: date 02/18/16, BIOS32 rev. 0 @ 0xfc200, SMBIOS rev. 2.6 @ 0xdae9c000 (66 entries)
bios0: vendor LENOVO version "8DET72WW (1.42 )" date 02/18/2016
bios0: LENOVO 4291G26
And one of my Alix systems is using a BIOS defined only by its date:
Code:
bios0 at mainbus0: date 01/15/14, BIOS32 rev. 0 @ 0xfd0e4
Reply With Quote
Old 23rd September 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

I had a maths error in CHS geometry, but it did not change cylinder numbers. The ending sector is at 20138/168/40.

Reply With Quote
Old 24th September 2016
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: France
Posts: 405
Default

Quote:
Originally Posted by jggimi View Post
On OpenBSD, dmesg(8) is the most common way to determine this.
Arf

Obviously too easy for me
__________________
ThinkPad W500 P8700 6GB HD3650 - faultry
ThinkStation P700 2x2620v3 32GB 1050ti 3xSSD 1xHDD
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
post-upgrade error | library pthread.13.3 not found daemonfowl OpenBSD Installation and Upgrading 6 29th March 2012 04:31 PM
Best way to upgrade from -release to snapshot Carpetsmoker OpenBSD General 5 26th July 2009 08:51 PM
upgrade installworld error carpman FreeBSD Installation and Upgrading 11 8th February 2009 05:36 PM
freebsd 7.1 upgrade buildworld error map7 FreeBSD Installation and Upgrading 9 30th October 2008 06:54 PM
Dual-boot laptop won't boot OpenBSD after upgrade to 4.3 kbeaucha OpenBSD Installation and Upgrading 17 30th May 2008 02:40 PM


All times are GMT. The time now is 10:42 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick