Solved Bhyve can boot only an OS that can be loaded into the RAM memory if a device like the graphic card is passed through.

Ok,I'm working on this crazy idea. Everyone here already understood that I love to play with all these almost not useful ideas,but for me every idea that excites me is worth pursuing.

I'm looking for the better tool /method / technique that can help me to keep synchronized in real time two Ubuntu installations. I want that every change I make to one of them will be immediately applied to the other one. Maybe the easiest solution is to use rsync,but I don't like it. I want to understand if can use chroot or one LXC container (just to use some new tool) to work directly inside the physical installation of Ubuntu. I don't know if LXC is the appropriate tool in this context.

Now I'm going to explain how is configured my setup. Let's start saying that my primary OS is FreeBSD and that I'm using bhyve to virtualize Ubuntu,using the following script :

linwin.sh

Code:
lklfuse -o type=ext4 /dev/nvd0p7 /mnt/nvd0p7

bhyve -S -c sockets=1,cores=2,threads=2 -m 4G -w -H -A \
-s 0,hostbridge \
-s 1,ahci-hd,/mnt/da3p2/bhyve/nvme.img \
-s 2,passthru,1/0/0 \
-s 3:0,passthru,2/0/0 \
-s 3:1,passthru,2/0/1 \
-s 3:2,passthru,2/0/2 \
-s 3:3,passthru,2/0/3 \
-s 8,virtio-net,tap1 \
-s 9,virtio-9p,sharename=/mnt/nvd0p7 \
-s 30,xhci,tablet \
-s 31,lpc \
-s 29,fbuf,tcp=0.0.0.0:5901,w=1440,h=900 \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_CODE.fd \
-l com1,stdio \
vm1

Actually I have installed Ubuntu 21.10 physically on my nvme disk and it is partitioned like this :

Code:
marietto@marietto:/usr/home/marietto # gpart show

=>        34  1953525101  nvd0  GPT  (932G)
          34        2014        - free -  (1.0M)
        2048     1748992     1  efi  (854M)
     1751040  1113507840     2  ms-basic-data  (531G)
  1115258880   833185547     7  ms-basic-data  (397G)
  1948444427         245        - free -  (123K)
  1948444672     1318912     3  ms-recovery  (644M)
  1949763584        2048        - free -  (1.0M)
  1949765632     1310720     4  ms-recovery  (640M)
  1951076352        2048        - free -  (1.0M)
  1951078400     1265657     5  ms-basic-data  (618M)
  1952344057           7        - free -  (3.5K)
  1952344064     1179641     6  ms-basic-data  (576M)
  1953523705        1430        - free -  (715K)


The Ubuntu 21.10 root partition is installed on the slot /dev/nvd0p7. What I wanted to do at the beginning was to boot that Ubuntu physical installation directly on bhyve,pointing it to /dev/nvd0,but there is a bug and it does not work for the easiest way. So,I found a "workaround" ; I have cloned my nvme disk with dd and I've created an img / raw file called "nvme.img" and I've copied it to my 2 TB size disk. Now,when I want to boot and use Ubuntu 21.10, I can do it directly when I'm running FreeBSD and bhyve. The real Ubuntu installation and its img file are almost identical. Actually when I boot the nvme.img file with bhyve,I have also share the partition where I have mounted the physical installation of Ubuntu in FreeBSD,using this parameter : -s 9,virtio-9p,sharename=/mnt/nvd0p7 \

So,the real partition where are stored all the physical Ubuntu installation's files is available when I boot the Ubuntu image created with dd while I'm using FreeBSD and bhyve. Good. at this point you have all the elements to understand what I want to do. While I'm using the image of Ubuntu created with dd,some files of this installation will change. What I want to do is to keep them synchronized with the files stored on the physical installation of Ubuntu, mapped at /mnt/nvd0p7 ; doing this, when, in the future I will boot the physical installation of Ubuntu I will have all the files updated correctly. If everything will work correctly there will be no need to boot Ubuntu physically but it could happen. Now I'm going to explain the problem that I'm not able to fix at the moment. The linwin.sh script is able to mount correctly the physical partition where Ubuntu 21.10 is installed,as u can see below :

Code:
marietto@marietto:/usr/home/marietto/bhyve # ls /mnt/nvd0p7

bin             etc             libx32          proc            swapfile        var
boot            home            lost+found      root            sys
boot-new        lib             media           run             timeshift
cdrom           lib32           mnt             sbin            tmp
dev             lib64           opt             srv             usr

BUT, when inside the Ubuntu 21.10 guest os I try to mount the shared folder with this command :

Code:
mount -t 9p -o trans=virtio,version=9p2000.L,rw sharename /home/ziomario/Scrivania/nvme-disk

the folder "/home/ziomario/Scrivania/nvme-disk/mnt/nvd0p7/nvme-disk" looks empty. So, if I'm not able to fix this problem my whole project will die.
 
Last edited by a moderator:
I love the fact that OP's topics are not formulated as either question or statement. It's a statement but it doesn't seem to be 100% valid and it's indeed a question but without a question mark. When you get in the topic, the first post rarely has anything to do with the topic name and it explores some borderline scenario that's mostly unique to OP's use case, which always seems to be on the cutting edge, but with mandatory programming/debugging approach replaced with some sort of patch-integration + reconfiguration trial and error.

I'm not discouraging him in his affairs, I for one want to see what bhyve can do with existing codebase etc. but as an advice, this approach is badly constructed, the writings do not belong either in the user discussion or the developer discussion, they're somewhere in the middle without a clear audience or goal.

The way I see it, users will not be able to help you and programmers will not be able to help you because the questions are not meant for either.
 
Back
Top