Re: Installing NetBSD 9.1 on USB stick, not booting

2021-04-06 Thread Martin Husemann
On Tue, Apr 06, 2021 at 12:09:29PM +0530, Mayuresh wrote:
> I think NetBSD, to a larger extent than others, used to be agnostic to a
> specific hardware it is installed on, which IMHO was a great feature.

It still is - on the same architecture and using the same boot method.

For amd64 you can even create boot method agnostic setups (like the USB
images are), but it is extra effort, may waste some space, and is not what
the installer aims at.

Martin


Re: Installing NetBSD 9.1 on USB stick, not booting

2021-04-06 Thread Mayuresh
On Tue, Apr 06, 2021 at 07:48:31AM +0200, Martin Husemann wrote:
> The installer is supposed to run on the target machine and it tries to
> avoid many questions by checking the machine instead of asking
> the user.
> 
> Also the results may differ significantly and the "generic" solution
> could be wastefull, so optimizing for the real machine makes sense
> to me.

It's not an uncommon view. For example Linux has initramfs etc which
'ties' it to the machine. Windows is just too much tied to the specific
hardware that it doesn't tolerate even a slight change.

I think NetBSD, to a larger extent than others, used to be agnostic to a
specific hardware it is installed on, which IMHO was a great feature.

(It's not a this vs that argument, it's more about the extent. Lesser you
infer from the target machine the better, I think.)

Opinions on this may vary.

-- 
Mayuresh


Re: Installing NetBSD 9.1 on USB stick, not booting

2021-04-05 Thread Martin Husemann
On Tue, Apr 06, 2021 at 11:13:06AM +0530, Mayuresh wrote:
> BTW isn't it good for the installer to not assume anything about the
> target machine? It makes the installation more resilient to hardware
> changes.

The installer is supposed to run on the target machine and it tries to
avoid many questions by checking the machine instead of asking
the user.

Also the results may differ significantly and the "generic" solution
could be wastefull, so optimizing for the real machine makes sense
to me.

Martin


Re: Installing NetBSD 9.1 on USB stick, not booting

2021-04-05 Thread Mayuresh
On Tue, Apr 06, 2021 at 07:22:22AM +0200, Martin Husemann wrote:
> A device booted via UEFI (as you are apparently setting up) will not
> need any bootsector installed, so the installer does not ask for anything
> but just puts the proper file(s) into the EFI partition.
> 
> If you are preparing the stick for another machine (that does not boot
> via UEFI but uses BIOS) the installer (assuming it runs on the target
> machine and can use all characteristics of the current machine to set up
> the installation) will not work.

Thanks a lot. I found that the device I am booting had BIOS option of
'Legacy' and 'UEFI'. Choosing the latter helped boot.

BTW isn't it good for the installer to not assume anything about the
target machine? It makes the installation more resilient to hardware
changes.

-- 
Mayuresh


Re: Installing NetBSD 9.1 on USB stick, not booting

2021-04-05 Thread Martin Husemann
On Tue, Apr 06, 2021 at 07:41:39AM +0530, Mayuresh wrote:
> Device Boot  Start  End  Sectors  Size Id Type
> /dev/sdb1   64   262207   262144  128M ef EFI (FAT-12/16/32)
> /dev/sdb2  *262272 30031871 29769600 14.2G a9 NetBSD

A device booted via UEFI (as you are apparently setting up) will not
need any bootsector installed, so the installer does not ask for anything
but just puts the proper file(s) into the EFI partition.

If you are preparing the stick for another machine (that does not boot
via UEFI but uses BIOS) the installer (assuming it runs on the target
machine and can use all characteristics of the current machine to set up
the installation) will not work.

There might be subtle differences in the setup (e.g. default partition
sizes vary depending on available memory and disk size), but on typical
amd64 machines they should be negliable.

If this happens in this direction (perparation on UEFI machine, target machine
might use BIOS) all that should be needed is an additional installboot call.
In the other direction you are basically lost due to the missing EFI partition.

However, I totaly fail to see *why* you are trying to do this instead of
starting with the USB image and modifying that after boot to your liking
(after it once resized the root partition).

Martin


Re: Installing NetBSD 9.1 on USB stick, not booting

2021-04-05 Thread Mayuresh
On Mon, Apr 05, 2021 at 04:14:50PM -0400, Bob Bernstein wrote:
> https://wiki.netbsd.org/tutorials/how_to_install_netbsd_from_an_usb_memory_stick/

I think in earlier versions of installers, the installation process used
to do the needful. But may be I do not recollect well enough.

The installation is already done on the stick, and right now from Linux
host I can see that the partition's Boot flag is set.

# This is fdisk -l on Linux. Will have to boot using installable to use
# NetBSD disklabel.

Disk /dev/sdb: 14.33 GiB, 15376318464 bytes, 30031872 sectors
Disk model: Cruzer Blade
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x

Device Boot  Start  End  Sectors  Size Id Type
/dev/sdb1   64   262207   262144  128M ef EFI (FAT-12/16/32)
/dev/sdb2  *262272 30031871 29769600 14.2G a9 NetBSD

So is it only the following command that I require now? (It will be sd1 in
my case.)

# installboot -v -o timeout=1 /dev/rsd0a /usr/mdec/bootxx_ffsv1

-- 
Mayuresh


Re: Installing NetBSD 9.1 on USB stick, not booting

2021-04-05 Thread Mayuresh
On Mon, Apr 05, 2021 at 08:55:28PM +0200, Matthias Petermann wrote:
> I recently set up a NetBSD 9.1 for my NAS with BIOS boot in the same way. My
> problem was that both the installer USB stick and the target USB stick for
> the installation were connected at the same time during the installation
> (logical ;-)). During the installation, the target USB stick was detected as
> unit sd1, and the installer as sd0. When booting without the installer after
> the installation, the target USB stick then takes the place of the installer
> USB stick and becomes sd0 itself. As a result, the root filesystem could not
> be mounted because the entry in fstab was still set to sd1. Since then I
> mount the target partition again r/w before the first reboot and correct the
> fstab if necessary. I don't know if this helps you. As partitioning scheme I
> used disklabel. In this case at least the bootloader was installed. I did
> not try with GPT.

Thanks. I might face this issue as well. But I think that comes into
picture after boot. The installer did not offer bootcode transfer (forgot
what wording it exactly used to use). So the stick is not booting. Once I
go past this I'll change sd1 to sd0 in fstab.

-- 
Mayuresh


Re: Installing NetBSD 9.1 on USB stick, not booting

2021-04-05 Thread Bob Bernstein

On Mon, 5 Apr 2021, Mayuresh wrote:

What exactly do I need to do to make it bootable. I don't need 
it to work with the hdd of the host or grub etc. Just need 
plain simple bootable usb stick that would boot into NetBSD.


It's a small world. I just got through reading this about an 
hour ago:


https://wiki.netbsd.org/tutorials/how_to_install_netbsd_from_an_usb_memory_stick/

The making-bootable is, if an amateur may say so, non-trivial, 
but from days long gone by it all looks very familiar.


9-)

Best,

--
RSB


Re: Installing NetBSD 9.1 on USB stick, not booting

2021-04-05 Thread Matthias Petermann

Hi Mayuresh,

I recently set up a NetBSD 9.1 for my NAS with BIOS boot in the same 
way. My problem was that both the installer USB stick and the target USB 
stick for the installation were connected at the same time during the 
installation (logical ;-)). During the installation, the target USB 
stick was detected as unit sd1, and the installer as sd0. When booting 
without the installer after the installation, the target USB stick then 
takes the place of the installer USB stick and becomes sd0 itself. As a 
result, the root filesystem could not be mounted because the entry in 
fstab was still set to sd1. Since then I mount the target partition 
again r/w before the first reboot and correct the fstab if necessary. I 
don't know if this helps you. As partitioning scheme I used disklabel. 
In this case at least the bootloader was installed. I did not try with GPT.


Many greetings
Matthias

On 05.04.21 19:36, Mayuresh wrote:

I have installed NetBSD 9.1 on a USB stick. I think earlier installers
used to ask about bootcode. 9.1 installer didn't ask me about it. The
installation seems fine but the stick is not booting.

I tried manually setting the boot manager (fdisk -B) though it didn't
work. I do not have a trace of all my attempts but finally it rendered the
USB stick read-only. Wasn't able to make it writable again, also tried on
Linux.

I got a new replacement stick now and I am back into the same situation -
installation is complete, but it won't boot. What exactly do I need to do
to make it bootable. I don't need it to work with the hdd of the host or
grub etc. Just need plain simple bootable usb stick that would boot into
NetBSD.





smime.p7s
Description: S/MIME Cryptographic Signature