Rendez-vous sur Arrakis, Le site perso d'un hacker libriste curieux crêpophile étourdi
Le 11/09/2019 à 14:53 dans /Logiciel-libre/OpenBSD/

Dualboot OpenBSD et Debian

On commence par installer OpenBSD.
À l'étape de configuration du disque, on choisit d'éditer le disque

Which disk is the root disk? ('?' for details) [sd0]
   Use (W)hole disk MBR, whole disk (G)PT, (O)penBSD area or (E)dit? [E]

Ça lance fdisk.
Puis on crée une parittion de type A6 moins grande que la taille maximale du disque. Il faut un peu compter mais on s'en sort.
Si vous avez trop peur de faire une boulette, laissez le partitionnement automatique avec “whole disk”. Juste après, vous annulez l'installation avec ctrl-c, puis la relancez avec install.
Une fois arrivé à la même question qu'avant, choisissez “E” pour réduire la partition OpenBSD déjà existante.

On édite la partition OpenBSD, puis dans les questions posées on change juste la taille. On quitte avec “quit" :

edit 3
Partition id ('0' to disable) [01 - FF]: [A6] (? for help)
Do you wish to edit in CHS mode? [n]
Partition offset [0 - 9437184]: [64]
Partition size [1 - 9437120]: [9430091] 500000
quit

La suite, c'est comme d'hab.
Je vous colle le texte d'installation ci-dessous :

Welcome to the OpenBSD/amd64 6.2 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? I
At any prompt except password prompts you can escape to a shell by
typing '!'. Default answers are shown in []'s and are selected by
pressing RETURN.  You can exit this program at any time by pressing
Control-C, but this can leave your system in an inconsistent state.

Terminal type? [vt220]
System hostname? (short form, e.g. 'foo') test

Available network interfaces are: vio0 vlan0.
Which network interface do you wish to configure? (or 'done') [vio0]
IPv4 address for vio0? (or 'dhcp' or 'none') [dhcp]
vio0: DHCPDISCOVER - interval 1
vio0: BOOTREPLY from 100.64.5.2 (fe:e1:bb:d1:be:2f)
vio0: bound to 100.64.5.3 -- renewal in 8000 seconds
IPv6 address for vio0? (or 'autoconf' or 'none') [none] autoconf
Available network interfaces are: vio0 vlan0.
Which network interface do you wish to configure? (or 'done') [done]
DNS domain name? (e.g. 'example.com') [my.domain]
Using DNS nameservers at 100.64.5.2

Password for root account? (will not echo)
Password for root account? (again)
Start sshd(8) by default? [yes]
Change the default console to com0? [yes]
Available speeds are: 9600 19200 38400 57600 115200.
Which speed should com0 use? (or 'done') [9600]
Setup a user? (enter a lower-case loginname, or 'no') [no]
Since no user was setup, root logins via sshd(8) might be useful.
WARNING: root is targeted by password guessing attacks, pubkeys are safer.
Allow root ssh login? (yes, no, prohibit-password) [no]

Available disks are: sd0.
Which disk is the root disk? ('?' for details) [sd0]
Disk: sd0       geometry: 587/255/63 [9437184 Sectors]
Offset: 0       Signature: 0xAA55
           Starting         Ending         LBA Info:
#: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
0: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
*3: A6      0   1   2 -    586 254  63 [          64:     9430091 ] OpenBSD
Use (W)hole disk MBR, whole disk (G)PT, (O)penBSD area or (E)dit? [OpenBSD] e
You will now create a single MBR partition to contain your OpenBSD data. This
partition must have an id of 'A6'; must *NOT* overlap other partitions; and
must be marked as the only active partition.  Inside the fdisk command, the
'manual' command describes all the fdisk commands in detail.

Disk: sd0       geometry: 587/255/63 [9437184 Sectors]
Offset: 0       Signature: 0xAA55
           Starting         Ending         LBA Info:
#: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
0: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
*3: A6      0   1   2 -    586 254  63 [          64:     9430091 ] OpenBSD
Enter 'help' for information
fdisk: 1> edit 3
           Starting         Ending         LBA Info:
#: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
*3: A6      0   1   2 -    586 254  63 [          64:     9430091 ] OpenBSD
Partition id ('0' to disable) [01 - FF]: [A6] (? for help)
Do you wish to edit in CHS mode? [n]
Partition offset [0 - 9437184]: [64]
Partition size [1 - 9437120]: [9430091] 500000
fdisk:*1> p
Disk: sd0       geometry: 587/255/63 [9437184 Sectors]
Offset: 0       Signature: 0xAA55
           Starting         Ending         LBA Info:
#: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
0: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
*3: A6      0   1   2 -     31  32  33 [          64:      500000 ] OpenBSD
fdisk:*1> quit
Writing MBR at offset 0.
The auto-allocated layout for sd0 is:
#                size           offset  fstype [fsize bsize   cpg]
 a:           244.1M               64  4.2BSD   2048 16384     1 # /
 c:          4608.0M                0  unused
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a]
...
...

Une fois qu'OpenBSD est installé, on boot sur une session live avec gparted pour créer une partition ext4 et swap sur l'espace restant du disque. Ce n'est pas obligé, l'installateur peut le faire, mais j'aime bien être sûr avant de me lancer dans l'installation de debian.

On installe enfin debian sur cette partition.

GRUB s'installe sur le MBR.
On ajoute une entrée dans 40_custom.conf :

menuentry "OpenBSD" {
set root=(hd0,4)
chainloader +1
}

C'est expliqué sur la FAQ.

Enfin, sur debian, on édite /etc/default/grub

GRUB_DEFAULT=2

Enfin :

sudo update-grub