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 September 2016
Valus Valus is offline
Port Guard
 
Join Date: Feb 2015
Location: EU
Posts: 19
Default /boot accidentaly deleted

Hi all,
I wanted to upgrade openbsd 5.9 to 6.0 and accidenataly overwrote /boot
Code:
cp bsd60.rd /boot
On other server I have openbsd 6.0 the same architecture
Code:
OpenBSD 6.0 (GENERIC) #1: Fri Sep 23 08:54:37 CEST 2016
    root@stable-60-amd64.mtier.org:/binpatchng/work-binpatch60-amd64/src/sys/arch/amd64/compile/GENERIC
real mem = 520081408 (495MB)
avail mem = 499953664 (476MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0x1ffffec0 (10 entries)
bios0: vendor Seabios version "0.5.1" date 01/01/2007
bios0: Red Hat KVM
Can I use boot from 6.0 and copy it to 5.9 and after reboot to start upgrade?
Thanks.
Valus
Reply With Quote
  #2   (View Single Post)  
Old 29th September 2016
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,520
Default

Yes.

You can either move the disk drive between systems, or boot install media on the broken system.

The amd64 architecture uses a two-stage bootloader. The first stage is biosboot(8), which loads the second stage bootloader boot(8) -- the file you accidentally deleted.

The biosboot(8) first stage bootloader must know where on the disk the second stage bootloader is located. Whenever you move, change, or recover the secondstage bootloader, biosboot(8) will need to be reinstalled -- it is stored in the partition boot record, and is booted by the master boot record.

We install biosboot(8) and boot(8) with the installboot(8) program. Review the installboot(8) man page before proceeding with either "HowTo" below. They are both from memory, and I may have made a mistake.

If you move the drive to your running system

In this example, the drive to be repaired is sd5. Replace this disk drive with the actual drive type and number.

  1. # mount /dev/sd5a /mnt
  2. # cd /usr/mdec
  3. # installboot -v -r /mnt sd5 biosboot boot
If you boot install media on the broken system

In this example, the drive to be repaired is wd2. Replace this disk drive with the actual drive type and number.
  1. Select (S)hell after booting the install media.
  2. # mount /dev/wd2a /mnt
  3. # cd /mnt/usr/mdec
  4. # installboot -v -r /mnt wd2 biosboot boot
----

The difference between the two sets of instructions are to ensure you use the fully populated /mnt/usr/mdec directory on the broken system -- the installation media does not have the bootloader files in its /usr/mdec directory.

Last edited by jggimi; 29th September 2016 at 09:27 PM. Reason: typos, clarity
Reply With Quote
  #3   (View Single Post)  
Old 30th September 2016
Valus Valus is offline
Port Guard
 
Join Date: Feb 2015
Location: EU
Posts: 19
Default

Hi jggimi,
thank for the answer. I have read installboot(8) man page, but before I do something I need to check it more time. The server where I overwrote the /boot file is still running, is located far away in another country and currently I do not have there iso image install media available.
This is status on running server:
Code:
bash-4.3$ df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/sd0a      201M   76.7M    114M    40%    /
/dev/sd0g      9.8G    816M    8.5G     9%    /home
/dev/sd0d      238M   14.0K    226M     0%    /tmp
/dev/sd0e      4.9G    908M    3.8G    19%    /usr
/dev/sd0f      9.8G    1.0G    8.3G    11%    /var
/dev/sd1c      3.0G    2.5G    419M    86%    /mnt/sd1
bash-4.3$ mount
/dev/sd0a on / type ffs (local)
/dev/sd0g on /home type ffs (local, nodev, nosuid)
/dev/sd0d on /tmp type ffs (local, nodev, nosuid)
/dev/sd0e on /usr type ffs (local, nodev)
/dev/sd0f on /var type ffs (local, nodev, nosuid)
/dev/sd1c on /mnt/sd1 type ffs (local)
I assume to do this:
Code:
# cd /usr/mdec
# installboot -v -r / sd0 biosboot boot
Do you think it is OK?
Thanks.
Reply With Quote
  #4   (View Single Post)  
Old 30th September 2016
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,520
Default

Yes, that appears OK to me. After running the command, check the date stamp on the /boot file in the root directory.

But ... You should put contingency plans in place, now, before you attempt a reboot. At this moment, that computer will not reboot. This is not an emergency at this moment, because the computer is running. But ....

What would you do if something happened the would cause a reboot, such a power loss? Or, if my guidance is incorrect?

Plan for it now, before you touch this platform remotely. Make arrangements to have someone available at that remote facility, who is capable of downloading and preparing install media from the Internet, and to be standing by in the event your reboot fails.

Last edited by jggimi; 30th September 2016 at 08:11 PM. Reason: typo
Reply With Quote
  #5   (View Single Post)  
Old 30th September 2016
Valus Valus is offline
Port Guard
 
Join Date: Feb 2015
Location: EU
Posts: 19
Default

Now I checked VPS control for server and found that openbsd 5.7 cdrom is available, but this version is too old.
I will ask provider to download install60.iso amd64 which I could mount remotely. After image is available I will try to restore /boot.
Thanks.
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
.serverauth was deleted Peter_APIIT OpenBSD General 7 28th August 2015 06:24 AM
OpenBSD groff deleted from tree J65nko News 2 17th March 2011 12:26 AM
Deleted my /boot/loader enpey FreeBSD General 16 10th June 2008 10:02 PM


All times are GMT. The time now is 06:36 PM.


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