Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

An authority is a person who can tell you more about something than you really care to know.


devel / comp.unix.bsd.freebsd.misc / Re: Bhyve with physical partitions?

SubjectAuthor
* Bhyve with physical partitions?David Chmelik
+* Re: Bhyve with physical partitions?Andreas Kempe
|`* Re: Bhyve with physical partitions?Grant Taylor
| `* Re: Bhyve with physical partitions?Andreas Kempe
|  `* Re: Bhyve with physical partitions?Grant Taylor
|   `* Re: Bhyve with physical partitions?Andreas Kempe
|    `- Re: Bhyve with physical partitions?Grant Taylor
`* Re: Bhyve with physical partitions?Andreas Kempe
 +- Re: Bhyve with physical partitions?Andreas Kempe
 +* Re: Bhyve with physical partitions?Grant Taylor
 |`- Re: Bhyve with physical partitions?Andreas Kempe
 `* Re: Bhyve with physical partitions?David Chmelik
  `- Re: Bhyve with physical partitions?Andreas Kempe

1
Bhyve with physical partitions?

<um0ffc$3uk6v$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=492&group=comp.unix.bsd.freebsd.misc#492

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dchme...@gmail.com (David Chmelik)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Bhyve with physical partitions?
Date: Thu, 21 Dec 2023 04:38:04 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <um0ffc$3uk6v$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 21 Dec 2023 04:38:04 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="458746ac8d706d58bdee789a52cbef2e";
logging-data="4149471"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX187+JumNTGhONxChDTpd70KO/ZO1Z/Z+nc="
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:OPfBRdUm2bU+iE9M/19gUBMXH7c=
 by: David Chmelik - Thu, 21 Dec 2023 04:38 UTC

Can one use physical partitions one multi-boots from in Bhyve in FreeBSD
UNIX and keep multi-booting? I'd like to use Slackware GNU/Linux (and
other OS) in Bhyve but still keep it on its partition.
How come newbies--even new computer programmers--in places like Libera
IRC (which most freenode moved to) and maybe the webforum deny FreeBSD is
a Unix and don't know it's a 'genetic Unix'?
Which of the following can you cross-post to without having to wait
for moderation (which I tried some months/years ago and my post never
appeared and I got no email why)?

comp.unix.freebsd.misc
list.freebsd.questions
mailing.freebsd.questions
(others that would be good?)

Re: Bhyve with physical partitions?

<um1212$mjs$2@nyheter.lysator.liu.se>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=493&group=comp.unix.bsd.freebsd.misc#493

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!nyheter.lysator.liu.se!.POSTED!not-for-mail
From: kem...@lysator.liu.se (Andreas Kempe)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Bhyve with physical partitions?
Date: Thu, 21 Dec 2023 09:54:42 -0000 (UTC)
Organization: Lysator ACS
Message-ID: <um1212$mjs$2@nyheter.lysator.liu.se>
References: <um0ffc$3uk6v$1@dont-email.me>
Injection-Date: Thu, 21 Dec 2023 09:54:42 -0000 (UTC)
Injection-Info: nyheter.lysator.liu.se; posting-account="kempe";
logging-data="23164"; mail-complaints-to="newsmaster@lysator.liu.se"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Andreas Kempe - Thu, 21 Dec 2023 09:54 UTC

Den 2023-12-21 skrev David Chmelik <dchmelik@gmail.com>:
> Can one use physical partitions one multi-boots from in Bhyve in FreeBSD
> UNIX and keep multi-booting? I'd like to use Slackware GNU/Linux (and
> other OS) in Bhyve but still keep it on its partition.

You can pass drives/partitions to bhyve just as you would image files.
Passing -s 2,ahci-hd,/dev/nvd0p1 to bhyve makes the first partition on
my NVME show up as a block device in the VM. I have never tried it
myself with an existing installation, but I think it should be
possible.

If only passing partitions through I suspect you could have some
issues with the bootloader since each partition becomes its own block
device. You might have to either adjust the bootloader's settings or
create a separate bootloader for that VM only.

Re: Bhyve with physical partitions?

<um1l7q$hqf$1@tncsrv09.home.tnetconsulting.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=494&group=comp.unix.bsd.freebsd.misc#494

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!news.hispagatos.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!tncsrv06.tnetconsulting.net!tncsrv09.home.tnetconsulting.net!.POSTED.198.18.1.140!not-for-mail
From: gtay...@tnetconsulting.net (Grant Taylor)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Bhyve with physical partitions?
Date: Thu, 21 Dec 2023 09:22:34 -0600
Organization: TNet Consulting
Message-ID: <um1l7q$hqf$1@tncsrv09.home.tnetconsulting.net>
References: <um0ffc$3uk6v$1@dont-email.me>
<um1212$mjs$2@nyheter.lysator.liu.se>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 21 Dec 2023 15:22:34 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="198.18.1.140";
logging-data="18255"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <um1212$mjs$2@nyheter.lysator.liu.se>
 by: Grant Taylor - Thu, 21 Dec 2023 15:22 UTC

On 12/21/23 03:54, Andreas Kempe wrote:
> You can pass drives/partitions to bhyve just as you would image files.
> Passing -s 2,ahci-hd,/dev/nvd0p1 to bhyve makes the first partition
> on my NVME show up as a block device in the VM. I have never tried
> it myself with an existing installation, but I think it should be
> possible.

The problem that I've had doing things like this -- admittedly with
other hypervisors and other OSs -- is that it a partition is not an
entire disk.

Thus when the VM thinks it's working with an entire disk and slices and
partitions therein, it's actually doing it inside of another partition
as seen from the outside of the VM.

To pull this off I've had to pass the entire drive to the VM so that
it's inside view of the drive / block device matches the outside view of
the drive / block device.

> If only passing partitions through I suspect you could have some
> issues with the bootloader since each partition becomes its own block
> device. You might have to either adjust the bootloader's settings or
> create a separate bootloader for that VM only.

IMHO the boot loader issue is a second order problem based on the first
order problem of nesting (slice & partitions inside a slice & partition).

--
Grant. . . .

Re: Bhyve with physical partitions?

<um1o9m$sob$1@nyheter.lysator.liu.se>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=495&group=comp.unix.bsd.freebsd.misc#495

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!nyheter.lysator.liu.se!.POSTED!not-for-mail
From: kem...@lysator.liu.se (Andreas Kempe)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Bhyve with physical partitions?
Date: Thu, 21 Dec 2023 16:14:46 -0000 (UTC)
Organization: Lysator ACS
Message-ID: <um1o9m$sob$1@nyheter.lysator.liu.se>
References: <um0ffc$3uk6v$1@dont-email.me>
<um1212$mjs$2@nyheter.lysator.liu.se>
<um1l7q$hqf$1@tncsrv09.home.tnetconsulting.net>
Injection-Date: Thu, 21 Dec 2023 16:14:46 -0000 (UTC)
Injection-Info: nyheter.lysator.liu.se; posting-account="kempe";
logging-data="29451"; mail-complaints-to="newsmaster@lysator.liu.se"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Andreas Kempe - Thu, 21 Dec 2023 16:14 UTC

Den 2023-12-21 skrev Grant Taylor <gtaylor@tnetconsulting.net>:
> On 12/21/23 03:54, Andreas Kempe wrote:
>> You can pass drives/partitions to bhyve just as you would image files.
>> Passing -s 2,ahci-hd,/dev/nvd0p1 to bhyve makes the first partition
>> on my NVME show up as a block device in the VM. I have never tried
>> it myself with an existing installation, but I think it should be
>> possible.
>
> The problem that I've had doing things like this -- admittedly with
> other hypervisors and other OSs -- is that it a partition is not an
> entire disk.
>
> Thus when the VM thinks it's working with an entire disk and slices and
> partitions therein, it's actually doing it inside of another partition
> as seen from the outside of the VM.
>
> To pull this off I've had to pass the entire drive to the VM so that
> it's inside view of the drive / block device matches the outside view of
> the drive / block device.
>

What kind of issues have you been having? When I pass a partition
through, it appears as a block device without a partition table with a
file system directly on the block device. Once Linux/FreeBSD is
booted, I have never had an issue mounting and using the storage, ex.
mount /dev/sda /mnt inside a Linux VM.

That said, in the scenario where you multi-boot, passing the entire
drive and selecting the right OS in the boot loader is probably the
easiest solution, but I imagine things can go horribly wrong if you
accidentally boot from the host's drive.

Only tangentially related to the matter at hand, but I usually forego
the partition table on things like USB sticks when I only want a
single file system and have never had an issue with it.

>> If only passing partitions through I suspect you could have some
>> issues with the bootloader since each partition becomes its own block
>> device. You might have to either adjust the bootloader's settings or
>> create a separate bootloader for that VM only.
>
> IMHO the boot loader issue is a second order problem based on the first
> order problem of nesting (slice & partitions inside a slice & partition).
>

Considering I've never tried doing this, the bootloader issue was
mostly me speculating because it was really the only thing I could
imagine having issues with considering both FreeBSD/Linux, in my
experience, handle file systems directly on block devices just fine,
but I don't know what Grub or other common bootloaders think of
booting a drive without a partition table.

Re: Bhyve with physical partitions?

<um36q1$m4u$1@tncsrv09.home.tnetconsulting.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=496&group=comp.unix.bsd.freebsd.misc#496

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!tncsrv09.home.tnetconsulting.net!.POSTED.198.18.1.140!not-for-mail
From: gtay...@tnetconsulting.net (Grant Taylor)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Bhyve with physical partitions?
Date: Thu, 21 Dec 2023 23:28:33 -0600
Organization: TNet Consulting
Message-ID: <um36q1$m4u$1@tncsrv09.home.tnetconsulting.net>
References: <um0ffc$3uk6v$1@dont-email.me>
<um1212$mjs$2@nyheter.lysator.liu.se>
<um1l7q$hqf$1@tncsrv09.home.tnetconsulting.net>
<um1o9m$sob$1@nyheter.lysator.liu.se>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 22 Dec 2023 05:28:33 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="198.18.1.140";
logging-data="22686"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <um1o9m$sob$1@nyheter.lysator.liu.se>
 by: Grant Taylor - Fri, 22 Dec 2023 05:28 UTC

On 12/21/23 10:14, Andreas Kempe wrote:
> What kind of issues have you been having? When I pass a partition
> through, it appears as a block device without a partition table with
> a file system directly on the block device.

You answered your own question. "When you pass a partition through, it
appears as a block device without a partition table with a file system
directly on the block device."

> Once Linux/FreeBSD is booted, I have never had an issue mounting and
> using the storage, ex. mount /dev/sda /mnt inside a Linux VM.

Even if it works, which Linux and FreeBSD probably can / will, it is an
atypical arrangement to use a file system on a raw partitioned block device.

What's more is that is different behavior inside vs outside of the
virtualization. Ergo inconsistent behavior. Now you are dependent on
an OS that can tolerate the inconsistency.

There's also a decent chance that the actual device names will be
different inside vs outside. How big of a problem that is will be
dependent on the OS.

I'll say it this way, the difference in accessing the block device
inside vs outside will be different and non-transparent.

> That said, in the scenario where you multi-boot, passing the entire
> drive and selecting the right OS in the boot loader is probably the
> easiest solution, but I imagine things can go horribly wrong if you
> accidentally boot from the host's drive.

I would suggest a different drive to avoid the issue that you mention.

> Only tangentially related to the matter at hand, but I usually forego
> the partition table on things like USB sticks when I only want a
> single file system and have never had an issue with it.

Most *nix will work with that fairly well. Any time I've tried to have
Windows access that flash drive (different computer I'm working on for a
family member) things don't go well, if at all. Far more times than I
care to count I've had to partition the drive and format the partition
vs formatting the raw drive.

> Considering I've never tried doing this, the bootloader issue was
> mostly me speculating because it was really the only thing I could
> imagine having issues with considering both FreeBSD/Linux, in my
> experience, handle file systems directly on block devices just fine,
> but I don't know what Grub or other common bootloaders think of
> booting a drive without a partition table.

Valid concerns.

I've tried to do something similar with Solaris and the one time I did,
the device names were significantly different and it was a non-starter.

Grant. . . .

Re: Bhyve with physical partitions?

<um3ml4$1g1v$1@nyheter.lysator.liu.se>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=497&group=comp.unix.bsd.freebsd.misc#497

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!nyheter.lysator.liu.se!.POSTED!not-for-mail
From: kem...@lysator.liu.se (Andreas Kempe)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Bhyve with physical partitions?
Date: Fri, 22 Dec 2023 09:59:00 -0000 (UTC)
Organization: Lysator ACS
Message-ID: <um3ml4$1g1v$1@nyheter.lysator.liu.se>
References: <um0ffc$3uk6v$1@dont-email.me>
<um1212$mjs$2@nyheter.lysator.liu.se>
<um1l7q$hqf$1@tncsrv09.home.tnetconsulting.net>
<um1o9m$sob$1@nyheter.lysator.liu.se>
<um36q1$m4u$1@tncsrv09.home.tnetconsulting.net>
Injection-Date: Fri, 22 Dec 2023 09:59:00 -0000 (UTC)
Injection-Info: nyheter.lysator.liu.se; posting-account="kempe";
logging-data="49215"; mail-complaints-to="newsmaster@lysator.liu.se"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Andreas Kempe - Fri, 22 Dec 2023 09:59 UTC

Den 2023-12-22 skrev Grant Taylor <gtaylor@tnetconsulting.net>:
> On 12/21/23 10:14, Andreas Kempe wrote:
>> Once Linux/FreeBSD is booted, I have never had an issue mounting and
>> using the storage, ex. mount /dev/sda /mnt inside a Linux VM.
>
> Even if it works, which Linux and FreeBSD probably can / will, it is an
> atypical arrangement to use a file system on a raw partitioned block device.
>
> What's more is that is different behavior inside vs outside of the
> virtualization. Ergo inconsistent behavior. Now you are dependent on
> an OS that can tolerate the inconsistency.
>
> There's also a decent chance that the actual device names will be
> different inside vs outside. How big of a problem that is will be
> dependent on the OS.
>
> I'll say it this way, the difference in accessing the block device
> inside vs outside will be different and non-transparent.
>

A very good point. I only thought about the root device, which for
Linux is passed by the bootloader so in my mind that probably wouldn't
be an issue if one got the bootloader working. If you have any
additional storage set up in the fstab, you will need to modify it
for use as a VM.

>> That said, in the scenario where you multi-boot, passing the entire
>> drive and selecting the right OS in the boot loader is probably the
>> easiest solution, but I imagine things can go horribly wrong if you
>> accidentally boot from the host's drive.
>
> I would suggest a different drive to avoid the issue that you mention.
>

Naturally. I was writing with David Chmelik's scenario in mind with a
multi-boot and partitions.

Re: Bhyve with physical partitions?

<um3sll$1hp7$1@nyheter.lysator.liu.se>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=498&group=comp.unix.bsd.freebsd.misc#498

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!paganini.bofh.team!pasdenom.info!nyheter.lysator.liu.se!.POSTED!not-for-mail
From: kem...@lysator.liu.se (Andreas Kempe)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Bhyve with physical partitions?
Date: Fri, 22 Dec 2023 11:41:41 -0000 (UTC)
Organization: Lysator ACS
Message-ID: <um3sll$1hp7$1@nyheter.lysator.liu.se>
References: <um0ffc$3uk6v$1@dont-email.me>
Injection-Date: Fri, 22 Dec 2023 11:41:41 -0000 (UTC)
Injection-Info: nyheter.lysator.liu.se; posting-account="kempe";
logging-data="50983"; mail-complaints-to="newsmaster@lysator.liu.se"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Andreas Kempe - Fri, 22 Dec 2023 11:41 UTC

Den 2023-12-21 skrev David Chmelik <dchmelik@gmail.com>:
> Can one use physical partitions one multi-boots from in Bhyve in FreeBSD
> UNIX and keep multi-booting? I'd like to use Slackware GNU/Linux (and
> other OS) in Bhyve but still keep it on its partition.

To not just talk out of my ass, I tried this with my Gentoo
installation and got it to work.

Create an image to use for a custom EFI:
dd if=/dev/zero of=/path/to/efi.img
mdconfig /path/to/efi.img
gpart create -s GPT md0
gpart add -t efi md0
newfs_msdos /dev/md0p1

Boot the VM using a live CD medium:
bhyve -A -H -P -c 2 -m 2G -s 0,hostbridge \
-s 1,lpc -s 2:0,ahci,hd:/path/to/efi.img,hd:/dev/gentoodevicep2 \
-s 3,ahci-cd,/path/to/install-amd64-minimal-20231210T170356Z.iso \
-s 4,virtio-net,tap4 -s 29,fbuf,tcp=0.0.0.0:5901,w=800,h=600,wait \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd testvm

The iso is the Gentoo minimal install ISO. /path/to/efi.img is the
custom EFI file system created earlier and /dev/gentoop2 is the
partition where the Gentoo install resides.

When the VM boots, /dev/sdb is the gentoo file system and /dev/sda1 is
the EFI partition. Mount the file systems and chroot.

mount /dev/sdb /mnt/gentoo
mount /dev/sda1 /mnt/gentoo/efi
arch-chroot /mnt/gentoo

In the chroot, backup the old grub config and generate a new one:
cp -r /boot/grub /root
grub-install --target=x86_64-efi --efi-directory=/efi --removable
grub-mkconfig -o /boot/grub/grub.cfg

I did not need to adjust the fstab since my fstab was empty. Make sure
to check it if you have mounts in there.

Exit the chroot and shut down the VM:
exit
shutdown -hP now

The VM can now be booted without the installation medium and boots
just fine:
bhyve -A -H -P -c 2 -m 2G -s 0,hostbridge \
-s 1,lpc -s 2:0,ahci,hd:/path/to/efi.img,hd:/dev/gentoodevicep2 \
-s 4,virtio-net,tap4 -s 29,fbuf,tcp=0.0.0.0:5901,w=800,h=600,wait \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd testvm

It is doable (since I did it), but how easy it is will depend on your
distribution. I have not used Slackware so I am afraid I don't really
know how easily the equivalent of what I did for my Gentoo
installation would be.

Re: Bhyve with physical partitions?

<um3ssf$1hp7$2@nyheter.lysator.liu.se>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=499&group=comp.unix.bsd.freebsd.misc#499

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!nyheter.lysator.liu.se!.POSTED!not-for-mail
From: kem...@lysator.liu.se (Andreas Kempe)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Bhyve with physical partitions?
Date: Fri, 22 Dec 2023 11:45:19 -0000 (UTC)
Organization: Lysator ACS
Message-ID: <um3ssf$1hp7$2@nyheter.lysator.liu.se>
References: <um0ffc$3uk6v$1@dont-email.me>
<um3sll$1hp7$1@nyheter.lysator.liu.se>
Injection-Date: Fri, 22 Dec 2023 11:45:19 -0000 (UTC)
Injection-Info: nyheter.lysator.liu.se; posting-account="kempe";
logging-data="50983"; mail-complaints-to="newsmaster@lysator.liu.se"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Andreas Kempe - Fri, 22 Dec 2023 11:45 UTC

Den 2023-12-22 skrev Andreas Kempe <kempe@lysator.liu.se>:
> Den 2023-12-21 skrev David Chmelik <dchmelik@gmail.com>:
>> Can one use physical partitions one multi-boots from in Bhyve in FreeBSD
>> UNIX and keep multi-booting? I'd like to use Slackware GNU/Linux (and
>> other OS) in Bhyve but still keep it on its partition.
>
> To not just talk out of my ass, I tried this with my Gentoo
> installation and got it to work.
>
> Create an image to use for a custom EFI:
> dd if=/dev/zero of=/path/to/efi.img
> mdconfig /path/to/efi.img
> gpart create -s GPT md0
> gpart add -t efi md0
> newfs_msdos /dev/md0p1
mdconfig -u 0 -d

The md0 device should be removed before using the image.

> Boot the VM using a live CD medium:
> bhyve -A -H -P -c 2 -m 2G -s 0,hostbridge \
> -s 1,lpc -s 2:0,ahci,hd:/path/to/efi.img,hd:/dev/gentoodevicep2 \
> -s 3,ahci-cd,/path/to/install-amd64-minimal-20231210T170356Z.iso \
> -s 4,virtio-net,tap4 -s 29,fbuf,tcp=0.0.0.0:5901,w=800,h=600,wait \
> -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd testvm
>
> The iso is the Gentoo minimal install ISO. /path/to/efi.img is the
> custom EFI file system created earlier and /dev/gentoop2 is the
> partition where the Gentoo install resides.
>
> When the VM boots, /dev/sdb is the gentoo file system and /dev/sda1 is
> the EFI partition. Mount the file systems and chroot.
>
> mount /dev/sdb /mnt/gentoo
> mount /dev/sda1 /mnt/gentoo/efi
> arch-chroot /mnt/gentoo
>
> In the chroot, backup the old grub config and generate a new one:
> cp -r /boot/grub /root
> grub-install --target=x86_64-efi --efi-directory=/efi --removable
> grub-mkconfig -o /boot/grub/grub.cfg
>
> I did not need to adjust the fstab since my fstab was empty. Make sure
> to check it if you have mounts in there.
>
> Exit the chroot and shut down the VM:
> exit
> shutdown -hP now
>
> The VM can now be booted without the installation medium and boots
> just fine:
> bhyve -A -H -P -c 2 -m 2G -s 0,hostbridge \
> -s 1,lpc -s 2:0,ahci,hd:/path/to/efi.img,hd:/dev/gentoodevicep2 \
> -s 4,virtio-net,tap4 -s 29,fbuf,tcp=0.0.0.0:5901,w=800,h=600,wait \
> -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd testvm
>
> It is doable (since I did it), but how easy it is will depend on your
> distribution. I have not used Slackware so I am afraid I don't really
> know how easily the equivalent of what I did for my Gentoo
> installation would be.

Re: Bhyve with physical partitions?

<um48n0$4rp$1@tncsrv09.home.tnetconsulting.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=500&group=comp.unix.bsd.freebsd.misc#500

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!tncsrv06.tnetconsulting.net!tncsrv09.home.tnetconsulting.net!.POSTED.198.18.1.140!not-for-mail
From: gtay...@tnetconsulting.net (Grant Taylor)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Bhyve with physical partitions?
Date: Fri, 22 Dec 2023 09:07:12 -0600
Organization: TNet Consulting
Message-ID: <um48n0$4rp$1@tncsrv09.home.tnetconsulting.net>
References: <um0ffc$3uk6v$1@dont-email.me>
<um1212$mjs$2@nyheter.lysator.liu.se>
<um1l7q$hqf$1@tncsrv09.home.tnetconsulting.net>
<um1o9m$sob$1@nyheter.lysator.liu.se>
<um36q1$m4u$1@tncsrv09.home.tnetconsulting.net>
<um3ml4$1g1v$1@nyheter.lysator.liu.se>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 22 Dec 2023 15:07:12 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="198.18.1.140";
logging-data="4985"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <um3ml4$1g1v$1@nyheter.lysator.liu.se>
 by: Grant Taylor - Fri, 22 Dec 2023 15:07 UTC

On 12/22/23 03:59, Andreas Kempe wrote:
> A very good point. I only thought about the root device, which
> for Linux is passed by the bootloader so in my mind that probably
> wouldn't be an issue if one got the bootloader working.

I think Linux has some flexibility that makes this a little bit easier
in that you can use UUID and / or a label that's part of the file system
meta-data to identify the file system for root and / or other mount
points. The kernel will then check all available block devices to
locate the file system based on that. It's nice and can be quite handy
in a dynamic hardware environment.

I don't know if any other OSs have any capability like that.

> If you have any additional storage set up in the fstab, you will need
> to modify it for use as a VM.

Most likely.

My stance is that this may be technically possible to do, but that it
will likely be ... problematic and not conducive for the average system
remotely supported.

> Naturally. I was writing with David Chmelik's scenario in mind with
> a multi-boot and partitions.

Fair enough.

--
Grant. . . .

Re: Bhyve with physical partitions?

<um49qr$4rp$2@tncsrv09.home.tnetconsulting.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=501&group=comp.unix.bsd.freebsd.misc#501

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!tncsrv09.home.tnetconsulting.net!.POSTED.198.18.1.140!not-for-mail
From: gtay...@tnetconsulting.net (Grant Taylor)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Bhyve with physical partitions?
Date: Fri, 22 Dec 2023 09:26:19 -0600
Organization: TNet Consulting
Message-ID: <um49qr$4rp$2@tncsrv09.home.tnetconsulting.net>
References: <um0ffc$3uk6v$1@dont-email.me>
<um3sll$1hp7$1@nyheter.lysator.liu.se>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 22 Dec 2023 15:26:19 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="198.18.1.140";
logging-data="4985"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <um3sll$1hp7$1@nyheter.lysator.liu.se>
 by: Grant Taylor - Fri, 22 Dec 2023 15:26 UTC

Pre-script: I'm sick and tired of the UI->UX changes made in
contemporary Thunderbird. Different buttons must now be used between
email and news to direct replies where I want them to go. >:-|

On 12/22/23 05:41, Andreas Kempe wrote:
> To not just talk out of my ass, I tried this with my Gentoo
> installation and got it to work.

Testing is good.

Aside: Are you running Gentoo (user space) on top of a FreeBSD kernel?
-- I believe it's an officially supported configuration, but I think
that most will assume Linux in association with Gentoo. The "bhyve" and
"mdconfig" seem very *BSD to me.

> Create an image to use for a custom EFI:
> dd if=/dev/zero of=/path/to/efi.img
> mdconfig /path/to/efi.img
> gpart create -s GPT md0
> gpart add -t efi md0
> newfs_msdos /dev/md0p1
>
> Boot the VM using a live CD medium:
> bhyve -A -H -P -c 2 -m 2G -s 0,hostbridge \
> -s 1,lpc -s 2:0,ahci,hd:/path/to/efi.img,hd:/dev/gentoodevicep2 \
> -s 3,ahci-cd,/path/to/install-amd64-minimal-20231210T170356Z.iso \
> -s 4,virtio-net,tap4 -s 29,fbuf,tcp=0.0.0.0:5901,w=800,h=600,wait \
> -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd testvm

Would you please break down what that command is doing, what virtual
hardware it's creating, how the disks are being backed, etc.

I'm not familiar with bhyve. I know of it, but not much more.

> The iso is the Gentoo minimal install ISO. /path/to/efi.img is the
> custom EFI file system created earlier and /dev/gentoop2 is the
> partition where the Gentoo install resides.
>
> When the VM boots, /dev/sdb is the gentoo file system and /dev/sda1 is
> the EFI partition. Mount the file systems and chroot.
>
> mount /dev/sdb /mnt/gentoo
> mount /dev/sda1 /mnt/gentoo/efi
> arch-chroot /mnt/gentoo

The arch-chroot is a new one on me. A quick search makes me think it's
just a wrapper around chroot with some creature features. Cool.

> In the chroot, backup the old grub config and generate a new one:
> cp -r /boot/grub /root

What is your goal of copying /boot/grub to root's home directory; /root?

> grub-install --target=x86_64-efi --efi-directory=/efi --removable
> grub-mkconfig -o /boot/grub/grub.cfg
>
> I did not need to adjust the fstab since my fstab was empty. Make sure
> to check it if you have mounts in there.

fstab is one of those things that's going to be very pointy if you use
device paths. Less so if you use UUID and / or labels.

> Exit the chroot and shut down the VM:
> exit
> shutdown -hP now
>
> The VM can now be booted without the installation medium and boots
> just fine:
> bhyve -A -H -P -c 2 -m 2G -s 0,hostbridge \
> -s 1,lpc -s 2:0,ahci,hd:/path/to/efi.img,hd:/dev/gentoodevicep2 \
> -s 4,virtio-net,tap4 -s 29,fbuf,tcp=0.0.0.0:5901,w=800,h=600,wait \
> -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd testvm
>
> It is doable (since I did it), but how easy it is will depend on your
> distribution.

Sure. Lots of things are possible with Linux.

Dr. Ian Malcolm from Jurassic Park comes to mind: ... your scients were
so preoccupied with whether or not they could that they didn't stop to
think if they should.

I'm all for a proof of concept for academic reasons. But I don't think
I'd want to do many of the academic things that I've done in production.
At least not as I did them.

> I have not used Slackware so I am afraid I don't really know how easily
> the equivalent of what I did for my Gentoo installation would be.

:-)

--
Grant. . . .

Re: Bhyve with physical partitions?

<um50dm$1sto$1@nyheter.lysator.liu.se>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=502&group=comp.unix.bsd.freebsd.misc#502

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!nyheter.lysator.liu.se!.POSTED!not-for-mail
From: kem...@lysator.liu.se (Andreas Kempe)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Bhyve with physical partitions?
Date: Fri, 22 Dec 2023 21:51:50 -0000 (UTC)
Organization: Lysator ACS
Message-ID: <um50dm$1sto$1@nyheter.lysator.liu.se>
References: <um0ffc$3uk6v$1@dont-email.me>
<um3sll$1hp7$1@nyheter.lysator.liu.se>
<um49qr$4rp$2@tncsrv09.home.tnetconsulting.net>
Injection-Date: Fri, 22 Dec 2023 21:51:50 -0000 (UTC)
Injection-Info: nyheter.lysator.liu.se; posting-account="kempe";
logging-data="62392"; mail-complaints-to="newsmaster@lysator.liu.se"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Andreas Kempe - Fri, 22 Dec 2023 21:51 UTC

Den 2023-12-22 skrev Grant Taylor <gtaylor@tnetconsulting.net>:
> Pre-script: I'm sick and tired of the UI->UX changes made in
> contemporary Thunderbird. Different buttons must now be used between
> email and news to direct replies where I want them to go. >:-|
>
> On 12/22/23 05:41, Andreas Kempe wrote:
>> To not just talk out of my ass, I tried this with my Gentoo
>> installation and got it to work.
>
> Testing is good.
>
> Aside: Are you running Gentoo (user space) on top of a FreeBSD kernel?
> -- I believe it's an officially supported configuration, but I think
> that most will assume Linux in association with Gentoo. The "bhyve" and
> "mdconfig" seem very *BSD to me.
>

I have Gentoo with the Linux kernel on a block device. Gentoo with the
FreeBSD kernel was abandoned a few years ago, if I'm not mistaken.

mdconfig is a FreeBSD utility. I should have specified, but I made the
experiment on my FreeBSD daily driver with a "normal" Gentoo
installation on a block device with a proper partition table.

Creating the partition table and file system in the EFI image was done
from FreeBSD using mdconfig, gpart and newfs_msdos, but could just as
well have been done using Linux tools from the installtion medium
instead.

>> Create an image to use for a custom EFI:
>> dd if=/dev/zero of=/path/to/efi.img
>> mdconfig /path/to/efi.img
>> gpart create -s GPT md0
>> gpart add -t efi md0
>> newfs_msdos /dev/md0p1
>>
>> Boot the VM using a live CD medium:
>> bhyve -A -H -P -c 2 -m 2G -s 0,hostbridge \
>> -s 1,lpc -s 2:0,ahci,hd:/path/to/efi.img,hd:/dev/gentoodevicep2 \
>> -s 3,ahci-cd,/path/to/install-amd64-minimal-20231210T170356Z.iso \
>> -s 4,virtio-net,tap4 -s 29,fbuf,tcp=0.0.0.0:5901,w=800,h=600,wait \
>> -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd testvm
>
> Would you please break down what that command is doing, what virtual
> hardware it's creating, how the disks are being backed, etc.
>
> I'm not familiar with bhyve. I know of it, but not much more.
>

-A - provide ACPI tables, not strictly needed, but I added it on by
reflex

-H - make the virtual CPU yield when idle to avoid constantly spinning

-P - force the guest virtual CPU to exit when a PAUSE instruction is
detected

-c 2 - two virtual cores

-m 2G - 2GB of memory

-s 1,lpc - add an LPC PCI-ISA bridge for serial ports

-s 2:0,ahci,hd:/path/to/efi.img,hd:/dev/gentoodevicep2 - provide an
AHCI controller with two block devices backed by efi.img, a
file, and gentoodevicep2, partition 2 of a GPT partitioned
block device. They show up as /dev/{sda,sdb}.

-s 3,ahci-cd,/path/to/install-amd64-minimal-20231210T170356Z.iso -
provide an AHCI CD controller backed by an iso file.

-s 4,virtio-net,tap4 - provide a network interface, I manually bridge
it on the host

-s 29,fbuf,tcp=0.0.0.0:5901,w=800,h=600,wait - graphics controller
listening for a VNC connection, wait means that the VM waits for an
incoming VNC connection before booting

-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd - bhyve UEFI
firmware needed to boot an UEFI VM

testvm - name of the virtual machine

>> The iso is the Gentoo minimal install ISO. /path/to/efi.img is the
>> custom EFI file system created earlier and /dev/gentoop2 is the
>> partition where the Gentoo install resides.
>>
>> When the VM boots, /dev/sdb is the gentoo file system and /dev/sda1 is
>> the EFI partition. Mount the file systems and chroot.
>>
>> mount /dev/sdb /mnt/gentoo
>> mount /dev/sda1 /mnt/gentoo/efi
>> arch-chroot /mnt/gentoo
>
> The arch-chroot is a new one on me. A quick search makes me think it's
> just a wrapper around chroot with some creature features. Cool.
>

The Gentoo install process uses a chroot and previously you had to
manually mount devfs, proc, sysfs etc in the chroot. arch-chroot does
the mounting for you so there is less to type.

>> In the chroot, backup the old grub config and generate a new one:
>> cp -r /boot/grub /root
>
> What is your goal of copying /boot/grub to root's home directory; /root?
>

It's just a backup. I don't want to use my Gentoo installation this
way so I wanted a simple way of restoring the bootloader config
without having to boot the installation medium to generate a new one.

>> grub-install --target=x86_64-efi --efi-directory=/efi --removable
>> grub-mkconfig -o /boot/grub/grub.cfg
>>
>> I did not need to adjust the fstab since my fstab was empty. Make sure
>> to check it if you have mounts in there.
>
> fstab is one of those things that's going to be very pointy if you use
> device paths. Less so if you use UUID and / or labels.
>
>> Exit the chroot and shut down the VM:
>> exit
>> shutdown -hP now
>>
>> The VM can now be booted without the installation medium and boots
>> just fine:
>> bhyve -A -H -P -c 2 -m 2G -s 0,hostbridge \
>> -s 1,lpc -s 2:0,ahci,hd:/path/to/efi.img,hd:/dev/gentoodevicep2 \
>> -s 4,virtio-net,tap4 -s 29,fbuf,tcp=0.0.0.0:5901,w=800,h=600,wait \
>> -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd testvm
>>
>> It is doable (since I did it), but how easy it is will depend on your
>> distribution.
>
> Sure. Lots of things are possible with Linux.
>
> Dr. Ian Malcolm from Jurassic Park comes to mind: ... your scients were
> so preoccupied with whether or not they could that they didn't stop to
> think if they should.
>
> I'm all for a proof of concept for academic reasons. But I don't think
> I'd want to do many of the academic things that I've done in production.
> At least not as I did them.
>
>> I have not used Slackware so I am afraid I don't really know how easily
>> the equivalent of what I did for my Gentoo installation would be.
>
>:-)
>
>
>

Re: Bhyve with physical partitions?

<um84cc$29k4q$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=509&group=comp.unix.bsd.freebsd.misc#509

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dchme...@gmail.com (David Chmelik)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Bhyve with physical partitions?
Date: Sun, 24 Dec 2023 02:17:48 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <um84cc$29k4q$1@dont-email.me>
References: <um0ffc$3uk6v$1@dont-email.me>
<um3sll$1hp7$1@nyheter.lysator.liu.se>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 24 Dec 2023 02:17:48 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="50a17661f1a27082e982ce394e3f9a87";
logging-data="2412698"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18m1nb+3XQCMUSglriwM46+1VaMfUO7L/c="
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:KygbcGqf36Zqh9r963m5t9C4AmM=
 by: David Chmelik - Sun, 24 Dec 2023 02:17 UTC

On Fri, 22 Dec 2023 11:41:41 -0000 (UTC), Andreas Kempe wrote:

> Den 2023-12-21 skrev David Chmelik <dchmelik@gmail.com>:
>> Can one use physical partitions one multi-boots from in Bhyve in
>> FreeBSD UNIX and keep multi-booting? I'd like to use Slackware
>> GNU/Linux (and other OS) in Bhyve but still keep it on its partition.
>
> To not just talk out of my ass, I tried this with my Gentoo installation
> and got it to work.

Good to see some discussion ending up with people testing this and getting
it working and explaining that for Gentoo GNU/Linux (which I'd also try
this with, without UEFI).

I looked for documentation on FreeBSD.org and BHyVe.org but didn't find
much. Is there a manual somewhere in (e)textbook format other than just
the manual page, or does one have to learn everything from that? I've
found textbooks to be a bit more descriptive than many of the manual pages
(some cryptic, some historically removed with the AT&T/whatever fiasco).

Re: Bhyve with physical partitions?

<umaeiu$gan$1@nyheter.lysator.liu.se>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=514&group=comp.unix.bsd.freebsd.misc#514

  copy link   Newsgroups: comp.unix.bsd.freebsd.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!nyheter.lysator.liu.se!.POSTED!not-for-mail
From: kem...@lysator.liu.se (Andreas Kempe)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Bhyve with physical partitions?
Date: Sun, 24 Dec 2023 23:24:14 -0000 (UTC)
Organization: Lysator ACS
Message-ID: <umaeiu$gan$1@nyheter.lysator.liu.se>
References: <um0ffc$3uk6v$1@dont-email.me>
<um3sll$1hp7$1@nyheter.lysator.liu.se> <um84cc$29k4q$1@dont-email.me>
Injection-Date: Sun, 24 Dec 2023 23:24:14 -0000 (UTC)
Injection-Info: nyheter.lysator.liu.se; posting-account="kempe";
logging-data="16727"; mail-complaints-to="newsmaster@lysator.liu.se"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Andreas Kempe - Sun, 24 Dec 2023 23:24 UTC

Den 2023-12-24 skrev David Chmelik <dchmelik@gmail.com>:
> On Fri, 22 Dec 2023 11:41:41 -0000 (UTC), Andreas Kempe wrote:
>
>> Den 2023-12-21 skrev David Chmelik <dchmelik@gmail.com>:
>>> Can one use physical partitions one multi-boots from in Bhyve in
>>> FreeBSD UNIX and keep multi-booting? I'd like to use Slackware
>>> GNU/Linux (and other OS) in Bhyve but still keep it on its partition.
>>
>> To not just talk out of my ass, I tried this with my Gentoo installation
>> and got it to work.
>
> Good to see some discussion ending up with people testing this and getting
> it working and explaining that for Gentoo GNU/Linux (which I'd also try
> this with, without UEFI).
>
> I looked for documentation on FreeBSD.org and BHyVe.org but didn't find
> much. Is there a manual somewhere in (e)textbook format other than just
> the manual page, or does one have to learn everything from that? I've
> found textbooks to be a bit more descriptive than many of the manual pages
> (some cryptic, some historically removed with the AT&T/whatever fiasco).

I'm afraid I don't know of any really good bhyve resource. What I
know, I've mostly learnt from reading man bhyve which at least has
some good examples.

For my daily behyve use, I use virt-manager and libvirtd since it now
has a bhyve back-end. Unfortunately, the interactive configuration in
virt-manager doesn't really support all the bhyve stuff so I have had
to resort to XML editing and reading libvirt's wiki page[0] on the
bhyve driver.

[0]: https://libvirt.org/drvbhyve.html


devel / comp.unix.bsd.freebsd.misc / Re: Bhyve with physical partitions?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor