Re: Booting from a USB disk

2020-04-28 Thread Mike Pumford




On 28/04/2020 11:23, Ilia Zykov wrote:

I had such a case. The efi of my old server(it was Intel MB) only
supported a 16 bit vfat boot partition. And if during installation I
selected it over 128MiB, then the installer formatted it at 32 bit vfat
and I could not boot in EFI mode. See the default parameters
“mkfs.vfat –F”.

That could be a difference. I was migrating an existing install onto a 
new disk so all my EFI partitions were created manually so I might well 
have overridden default arguments if thats what the instructions I was 
following said to do. It could also be dependent on the age of the EFI 
BIOS. With newer ones being more flexible about VFAT format.


Mike


Re: Booting from a USB disk

2020-04-28 Thread Ilia Zykov
On 27.04.2020 23:02, Vincent DEFERT wrote:
> 
> I have also installed NetBSD on a server (Dell R610) previously running
> FreeBSD.
> The problem I had there is that NetBSD does not support EFI partition
> sizes greater than 128 MB.
> In this case also, I had to wipe the partition table, but I could do it
> with NetBSD's gpt(8).
> 

I had such a case. The efi of my old server(it was Intel MB) only
supported a 16 bit vfat boot partition. And if during installation I
selected it over 128MiB, then the installer formatted it at 32 bit vfat
and I could not boot in EFI mode. See the default parameters
“mkfs.vfat –F”.




smime.p7s
Description: S/MIME Cryptographic Signature


Re: Booting from a USB disk

2020-04-28 Thread Mike Pumford




On 28/04/2020 09:26, Martin Husemann wrote:


Now you deleted the FreeBSD boot stuff, and everything worked fine.

Should be totally unrelated to the partition size.
There is no limitation in NetBSD. My 9 STABLE machine EFI booting off an 

nvme device has a 256MB EFI partition and boots with no issue.

Mike


Re: Booting from a USB disk

2020-04-28 Thread Martin Husemann
On Tue, Apr 28, 2020 at 09:31:31AM +0200, Vincent DEFERT wrote:
> My first installation attempt consisted in deleting the FreeBSD
> partition but keeping the EFI one. I went through the whole
> installation without any trouble, but the system refused to
> reboot (can't remember the message).

This probably means you had a boot environment setup for FreeBSD
(as their boot partition + contents was still there and registered with the
firmware).

What the installer does *not* do is zap any environment settings that other
OSes could have done - it is possibel to use the same EFI partition for
different boots (and internally we don't have the API to access EFI boot
services/enviroment from userland).

> However, after using the gpt command to destroy the GPT
> table and create a new layout with a 128 MB EFI partition, the
> installation works as well as before, but the system now boots
> normally.

Now you deleted the FreeBSD boot stuff, and everything worked fine.

Should be totally unrelated to the partition size.

Martin


Re: Booting from a USB disk

2020-04-28 Thread Vincent DEFERT

Here are the 3 use cases I tested:

1. The first disk, the one on which I have tried installboot,
had FreeBSD on it using ZFS and I had trouble reusing it. The
partition table was MBR.

2. The second disk had OpenBSD and installing NetBSD worked
perfectly. The partition table was also MBR.

3. The server was previously running FreeBSD using ZFS. The
R610 is  a UEFI-only system, so the partition table was GPT.
The size of the existing EFI partition was 200 MB.

My first installation attempt consisted in deleting the FreeBSD
partition but keeping the EFI one. I went through the whole
installation without any trouble, but the system refused to
reboot (can't remember the message).

However, after using the gpt command to destroy the GPT
table and create a new layout with a 128 MB EFI partition, the
installation works as well as before, but the system now boots
normally.

On 28/04/2020 06:35, Martin Husemann wrote:

On Mon, Apr 27, 2020 at 10:02:41PM +0200, Vincent DEFERT wrote:

The problem I had there is that NetBSD does not support EFI partition sizes
greater than 128 MB.

Can you explain this? What exactly goes wrong?

Martin




Re: Booting from a USB disk

2020-04-27 Thread Thomas Mueller
from Vincent DEFERT <20@defert.com>:

> I've tried to install NetBSD onto another disk and it worked, so I made 
> further investigations on the disk having the issue.
> I turned out it had a remaining zfs_member signature somewhere, which I 
> only saw after trying to recreate its partition table with fdisk under 
> Linux.
> Once cleaned, the installation worked fine and the only manual operation 
> needed is to check /etc/fstab, and fix it if needed.

> I have also installed NetBSD on a server (Dell R610) previously running 
> FreeBSD.
> The problem I had there is that NetBSD does not support EFI partition 
> sizes greater than 128 MB.
> In this case also, I had to wipe the partition table, but I could do it 
> with NetBSD's gpt(8).

> A conclusion of this episode is that NetBSD works well, but is bad at 
> wiping disks. ;)
> Fortunately, this is only needed at installation. :)

This is the first time I see anything about NetBSD not booting by UEFI if the 
EFI system partition > 128 MB.

EFI system partition is activated before any OS is booted.

I read through the NetBSD wiki about UEFI booting, but where do I find 
something more comprehensive?

Tom



Re: Booting from a USB disk

2020-04-27 Thread Martin Husemann
On Mon, Apr 27, 2020 at 10:02:41PM +0200, Vincent DEFERT wrote:
> The problem I had there is that NetBSD does not support EFI partition sizes
> greater than 128 MB.

Can you explain this? What exactly goes wrong?

Martin


Re: Booting from a USB disk

2020-04-27 Thread Vincent DEFERT
I've tried to install NetBSD onto another disk and it worked, so I made 
further investigations on the disk having the issue.
I turned out it had a remaining zfs_member signature somewhere, which I 
only saw after trying to recreate its partition table with fdisk under 
Linux.
Once cleaned, the installation worked fine and the only manual operation 
needed is to check /etc/fstab, and fix it if needed.


I have also installed NetBSD on a server (Dell R610) previously running 
FreeBSD.
The problem I had there is that NetBSD does not support EFI partition 
sizes greater than 128 MB.
In this case also, I had to wipe the partition table, but I could do it 
with NetBSD's gpt(8).


A conclusion of this episode is that NetBSD works well, but is bad at 
wiping disks. ;)

Fortunately, this is only needed at installation. :)

On 27/04/2020 09:14, Martin Husemann wrote:

On Mon, Apr 27, 2020 at 08:53:16AM +0200, Vincent DEFERT wrote:

No, I haven't changed anything else and no modules are listed in /boot.cfg.

Is there any chance it worked due to a side-effect of not loading modules?

Yes, and I am currently out of ideas what went wrong.

I wonder if we should make the libsa version of "panic" wait for a key
press on the console, so you have a chance to fully read the message.

Martin




Re: Booting from a USB disk

2020-04-27 Thread Martin Husemann
On Mon, Apr 27, 2020 at 08:53:16AM +0200, Vincent DEFERT wrote:
> No, I haven't changed anything else and no modules are listed in /boot.cfg.
> 
> Is there any chance it worked due to a side-effect of not loading modules?

Yes, and I am currently out of ideas what went wrong.

I wonder if we should make the libsa version of "panic" wait for a key
press on the console, so you have a chance to fully read the message.

Martin


Re: Booting from a USB disk

2020-04-27 Thread Vincent DEFERT

No, I haven't changed anything else and no modules are listed in /boot.cfg.

Is there any chance it worked due to a side-effect of not loading modules?

I have previously tried: installboot /dev/rsd0a /usr/mdec/bootxx_ffsv2
(i.e. without the '-o modules') but it still had the 'Heap full' error.

On 27/04/2020 06:53, Martin Husemann wrote:

On Sun, Apr 26, 2020 at 10:23:03PM +0200, Vincent DEFERT wrote:

Here is the output of modstat in single user mode:

NAME   CLASS    SOURCE   FLAG  REFS    SIZE REQUIRES
aac    driver   builtin  -    1   - pci

So no modules loaded - and the installboot change was the only thing that
you changed?

Are there any modules listed in your /boot.cfg?

Something (and I have no clue what that could be) must have tried to load
modules, which then failed with the out of memory message. Now you have
inhibited module loading and it works.

However, nothing in a default install should cause modules to be loaded
this early (AFICT).

Martin




Re: Booting from a USB disk

2020-04-26 Thread Martin Husemann
On Sun, Apr 26, 2020 at 10:23:03PM +0200, Vincent DEFERT wrote:
> Here is the output of modstat in single user mode:
> 
> NAME   CLASS    SOURCE   FLAG  REFS    SIZE REQUIRES
> aac    driver   builtin  -    1   - pci

So no modules loaded - and the installboot change was the only thing that
you changed?

Are there any modules listed in your /boot.cfg?

Something (and I have no clue what that could be) must have tried to load
modules, which then failed with the out of memory message. Now you have
inhibited module loading and it works.

However, nothing in a default install should cause modules to be loaded
this early (AFICT).

Martin


Re: Booting from a USB disk

2020-04-26 Thread Vincent DEFERT

Yes, I now have a working system. :)

Unfortunately, when I had the "Head full" error, I didn't have the time 
to read more than these words.
I could reproduce it and try to press 'Scroll lock', or at worse film 
the display if it is helpful to you.


Here is the output of modstat in single user mode:

NAME   CLASS    SOURCE   FLAG  REFS    SIZE REQUIRES
aac    driver   builtin  -    1   - pci
accf_dataready misc builtin  -    0   - -
accf_httpready misc builtin  -    0   - -
acpiacad   driver   builtin  -    0   - 
sysmon_envsys,sysmon_power
acpibat    driver   builtin  -    0   - 
sysmon_envsys

acpibut    driver   builtin  -    0   - sysmon_power
acpicpu    driver   builtin  -    0   - -
acpidalb   driver   builtin  -    0   - sysmon_power
acpifan    driver   builtin  -    0   - 
sysmon_envsys

acpilid    driver   builtin  -    0   - sysmon_power
acpitz driver   builtin  -    0   - 
sysmon_envsys

acpivga    driver   builtin  -    0   - -
acpiwdrt   driver   builtin  -    0   - sysmon_wdog
acpiwmi    driver   builtin  -    4   - -
aibs   driver   builtin  -    0   - 
sysmon_envsys

aio    misc builtin  -    0   - -
amdsmn driver   builtin  -    1   - pci
amdtemp    driver   builtin  -    0   - 
sysmon_envsys
amdzentemp driver   builtin  -    0   - 
sysmon_envsys,amdsmn

amr    driver   builtin  -    1   - pci
asus   driver   builtin  -    0   - 
sysmon_envsys,sysmon_power

ataraid    driver   builtin  -    1   - -
ath    misc builtin  -    1   - ath_hal
ath_hal    misc builtin  -    1   - -
au8522 driver   builtin  -    1   - i2cexec
audio  driver   builtin  -    5   - -
auvitek    driver   builtin  -    0   - au8522,xc5k
blowfish   misc builtin  -    2   - -
bpf    driver   builtin  -    1   - bpf_filter
bpf_filter misc builtin  -    2   - -
bufq_disksort  bufq builtin  -    0   - -
bufq_fcfs  bufq builtin  -    4   - -
bufq_priocscan bufq builtin  -    0   - -
cac    driver   builtin  -    2   - -
cac_pci    driver   builtin  -    0   - cac,pci
camellia   misc builtin  -    1   - -
cast128    misc builtin  -    1   - -
ccd    driver   builtin  -    0   - 
dk_subr,bufq_fcfs

cd9660 vfs  builtin  -    0   - -
cgd    driver   builtin  -    0   - 
blowfish,des,dk_subr,bufq_fcfs

cir    driver   builtin  -    1   - ir
clockctl   driver   builtin  -    0   - -
coda   vfs  builtin  -    0   - vcoda
compat_16  exec builtin  -    1   - compat_20
compat_20  exec builtin  -    2   - compat_30
compat_30  exec builtin  -    2   - 
compat_util,compat_40

compat_40  exec builtin  -    2   - compat_50
compat_43  exec builtin  -    2   - 
compat_sysctl_09_43,compat_util,compat_60

compat_50  exec builtin  -    5   - compat_60
compat_60  exec builtin  -    3   - compat_70
compat_70  exec builtin  -    1   - compat_80
compat_80  exec builtin  -    3   - -
compat_crypto_50   exec builtin  -    0   - 
crypto,compat_50
compat_linux   exec builtin  -    1   - 
compat_ossaudio,sysv_ipc,compat_util,compat_50,compat_43,exec_elf64
compat_linux32 exec builtin  -    0   - 
compat_linux,sysv_ipc,compat_sysv_50,compat_netbsd32_50,compat_netbsd32_43,exec_elf32,compat_netbsd32,compat_netbsd32_sysvipc
compat_netbsd32    exec builtin  -    9   - 
ksem,coredump,compat_util,exec_elf32
compat_netbsd32_16 exec builtin  -    0   - 
compat_netbsd32_20,compat_16
compat_netbsd32_20 exec builtin  -    1   - 
compat_netbsd32_30,compat_20
compat_netbsd32_30 exec builtin  -    1   - 
compat_netbsd32_40,compat_30

Re: Booting from a USB disk

2020-04-26 Thread Martin Husemann
On Sun, Apr 26, 2020 at 08:04:44PM +0200, Vincent DEFERT wrote:
> In case anyone else would want to do the same, I've finally
> found out that in order to boot from an USB disk, the
> loading of modules must be enabled, i.e.:
> 
> installboot -o modules /dev/rsd0a /usr/mdec/bootxx_ffsv2

I don't understand why that would be needed or help (but I also don't
understand what that option does, the documentation is... lacking).

You now have a working setup? Can you boot single user and show
output from modstat(8)?

Martin


Re: Booting from a USB disk

2020-04-26 Thread Martin Husemann
On Sun, Apr 26, 2020 at 05:18:35PM +0200, Vincent DEFERT wrote:
> I have the time to read is "Heap full".

This is probably a message from the bootloader, it comes from
here:

https://nxr.netbsd.org/xref/src/sys/lib/libsa/alloc.c#202

It would be interesting to know what numbers it prints.

Also this is pretty strange behaviour without special configurations,
do you have a boot.cfg that maybe got corrupted?

Martin


Re: Booting from a USB disk

2020-04-26 Thread Vincent DEFERT

In case anyone else would want to do the same, I've finally
found out that in order to boot from an USB disk, the
loading of modules must be enabled, i.e.:

installboot -o modules /dev/rsd0a /usr/mdec/bootxx_ffsv2

Vincent


Re: Booting from a USB disk

2020-04-26 Thread Vincent DEFERT

Thank you for answering, Greg.

I've booted the installer from a USB key and installed NetBSD 9 on an 
USB disk known as /dev/sd0 (the key being /dev/sd1).

The machine is an Intel NUC6CAYH with 8 GB RAM and an up-to-date BIOS.

After successfully going the whole installation process (NetBSD 
installed on a single 235 GB partition + 8 GB swap), I reboot on my USB 
disk.
I select choice 1 (boot multi-user) from the boot menu and the only 
message I have the time to read is "Heap full".
The machine immediately continues with the only other available option, 
its internal disk with Void Linux.


If I reboot again and select choice 3 (drop to boot prompt) and type: 
'boot hd0':, NetBSD boots correctly.


I have tried the UEFI installer, the other installer image, the standard 
kernel and the KASLR kernel, all give the same result.


I don't know what other details could help you to help me, feel free to 
ask more precise questions.


On 26/04/2020 14:46, Greg Troxel wrote:

Vincent DEFERT <20@defert.com> writes:


I've installed NetBSD on an external USB disk and made sure its
/etc/fstab was correct.
However, when I reboot on this disk, I have a "Heap full" error and
the machine boots on its internal disk.

It would help if you were much more precise about what you are doing to
boot and exactly what happens.  I can't tell if you are using the BIOS
to boot the disk, or some EFI thing, and how far it gets.


If I drop to the boot prompt and type "boot hd0:", NetBSD boots normally.

This is also unclear - a key point is if that boot loader was loaded
from the USB disk, or not.


My guess is that I need to set some additional option in some
configuration file.
With FreeBSD, I need to set vfs.mountroot.timeout="10" in
/boot/loader.conf, for instance.

Many things are possible, but far more information is needed to help
you.

(Reply on list, not to me personally, as always.)




Re: Booting from a USB disk

2020-04-26 Thread Greg Troxel
Vincent DEFERT <20@defert.com> writes:

> I've installed NetBSD on an external USB disk and made sure its
> /etc/fstab was correct.
> However, when I reboot on this disk, I have a "Heap full" error and
> the machine boots on its internal disk.

It would help if you were much more precise about what you are doing to
boot and exactly what happens.  I can't tell if you are using the BIOS
to boot the disk, or some EFI thing, and how far it gets.

> If I drop to the boot prompt and type "boot hd0:", NetBSD boots normally.

This is also unclear - a key point is if that boot loader was loaded
from the USB disk, or not.

> My guess is that I need to set some additional option in some
> configuration file.
> With FreeBSD, I need to set vfs.mountroot.timeout="10" in
> /boot/loader.conf, for instance.

Many things are possible, but far more information is needed to help
you.

(Reply on list, not to me personally, as always.)


Booting from a USB disk

2020-04-26 Thread Vincent DEFERT

Hi,

I've installed NetBSD on an external USB disk and made sure its 
/etc/fstab was correct.
However, when I reboot on this disk, I have a "Heap full" error and the 
machine boots on its internal disk.

If I drop to the boot prompt and type "boot hd0:", NetBSD boots normally.
My guess is that I need to set some additional option in some 
configuration file.
With FreeBSD, I need to set vfs.mountroot.timeout="10" in 
/boot/loader.conf, for instance.


Can someone tell me what I should do for NetBSD in this case?

Thanks in advance,

Vincent