From nobody Fri Jan 27 00:54:49 2023 X-Original-To: freebsd-virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P2zdY0yqxz3bL2F for ; Fri, 27 Jan 2023 00:55:29 +0000 (UTC) (envelope-from marietto2008@gmail.com) Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P2zdX1mGqz4Y15 for ; Fri, 27 Jan 2023 00:55:28 +0000 (UTC) (envelope-from marietto2008@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=RVAD43KB; spf=pass (mx1.freebsd.org: domain of marietto2008@gmail.com designates 2a00:1450:4864:20::62c as permitted sender) smtp.mailfrom=marietto2008@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-x62c.google.com with SMTP id me3so9742775ejb.7 for ; Thu, 26 Jan 2023 16:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=K0pigyce3yq68PmZ2v0aAnF71xw26eo68jkrZ0luDIU=; b=RVAD43KB2qYgOZW/aalIMDQ+AOtsO+SJ25PM48UVtJjEr2g4lmdppJ6+f9IK9wUs94 I3Ho2Hdw/Mbm6BKyZj1DF3lhLYJzRzbUb3oqX8HLKG6UZBdnoFol1Tm8Xhomv78VJaJZ 7A0HL80ENaDpvrJIYfbUQYmyHkg6Zl7nTm1sUR5FuNLshAQdw9V8Of2eotLtHYJ/60ds vcncbJCzxCvMNDPe5ZKGEGJteBOi62FsnkHhLJOgtpLz4XDK47AkytN/OCh3VpEmG1bf +3KsEESh3D7arl1Nl768GKGKBQ6O/koa3KV9JdSSRD6wJqzc+Fq0FQgBePVtKbuxbaI/ 3XSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=K0pigyce3yq68PmZ2v0aAnF71xw26eo68jkrZ0luDIU=; b=EcjKEQu0I1OWzw6HSHc5ev3uFLGsaMP/chGquyJeRSSr4zlT7vKX7Ae4MyOOidtPRL Hm5Psned/XRmBayOPwo82u8EgEC+n33HJVoeSS8+PJwpih6HjkA9UunLAAzcnbCRCOdK QsT3VWtPlBZz5bURFuxCFsiaN1eUGXObcNZXOmAhd2jCwdqyZ6NrBmxQIehmvWwPuncs jXcnXrpYP9fIR+Z7YXgJ9pG9XhH1ngyqOj26ijjQO63jdp+yAy8n2RJjpNw0ELW3YZAf wa9OkoiEuzRo4sy+R1/JABnN5cKwJy3gjVhyRGnIkeko7917BG/DoiNhxWWfoT3i9xWb 5Yxg== X-Gm-Message-State: AFqh2koiDTUZPSb9y3RYJjz+3z/XZZERXJ06R2u4X3CbG/vx7Xr1SJe8 73ySqD7fZ819R5VhzsU/lDWLv7ZVhIugTlC8D1ui3aNbwQn/hg== X-Google-Smtp-Source: AMrXdXtb+w33Vy94D3YdlzMvAY+DsSqFTFdf600Ijdcr6fytMY7ca58FoqYlR/JIdn5w2AadZ0T86Hhn4Id7P7od+eA= X-Received: by 2002:a17:906:6049:b0:84d:457b:b987 with SMTP id p9-20020a170906604900b0084d457bb987mr4540954ejj.161.1674780926291; Thu, 26 Jan 2023 16:55:26 -0800 (PST) List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org MIME-Version: 1.0 From: Mario Marietto Date: Fri, 27 Jan 2023 01:54:49 +0100 Message-ID: Subject: devctl: Failed to detach pci0:1:0:0: Device not configured To: FreeBSD virtualization Content-Type: multipart/alternative; boundary="00000000000030355205f334524e" X-Spamd-Result: default: False [-1.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; HTTP_TO_IP(1.00)[]; URI_COUNT_ODD(1.00)[5]; NEURAL_HAM_SHORT(-1.00)[-0.996]; NEURAL_HAM_LONG(-0.99)[-0.991]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::62c:from]; RCPT_COUNT_ONE(0.00)[1]; PREVIOUSLY_DELIVERED(0.00)[freebsd-virtualization@freebsd.org]; FREEMAIL_FROM(0.00)[gmail.com]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; MLMMJ_DEST(0.00)[freebsd-virtualization@freebsd.org]; DKIM_TRACE(0.00)[gmail.com:+]; TO_DN_ALL(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; ARC_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4P2zdX1mGqz4Y15 X-Spamd-Bar: - X-ThisMailContainsUnwantedMimeParts: N --00000000000030355205f334524e Content-Type: text/plain; charset="UTF-8" Hello FreeBSD Virtualization Team. I've created this bhyve script that suits my needs,but unfortunately it does not work properly. Can someone help me to understand where the error is ? *./20-Ubuntu-2004-Focal-Stable-Diffusion-vm20.sh* #!/bin/sh vms="$(ls /dev/vmm/*)" vncs="vm$(ps ax | awk '/vncviewer [0]/{print $6}')" echo "*** checkpoint 1" echo "*** checkpoint 1" echo "*** checkpoint 1" ls /dev/vmm pciconf -l | grep 0:1:0: for vm in $vms; do session="${vm##*/}" echo "bhyve session = $session" echo "vnc session = $vncs" if ! printf '%s\n' "${vncs}" | grep "${session}"; then printf 'VNC session not found,destroying ghost vms\n' bhyvectl --vm=$session --destroy #devctl detach pci0:1:0:0 #devctl detach pci0:1:0:1 #devctl set driver pci0:1:0:0 ppt #devctl set driver pci0:1:0:1 ppt echo "*** checkpoint 2" echo "*** checkpoint 2" echo "*** checkpoint 2" ls /dev/vmm pciconf -l | grep 0:1:0: #sleep 999 else printf 'Found VNC session %s\n' "${session},no ghost vms found,not destroying them" #devctl detach pci0:1:0:0 #devctl detach pci0:1:0:1 #devctl set driver pci0:1:0:0 ppt #devctl set driver pci0:1:0:1 ppt echo "*** checkpoint 3" echo "*** checkpoint 3" echo "*** checkpoint 3" ls /dev/vmm pciconf -l | grep 0:1:0: #sleep 999 fi done echo "*** checkpoint 4" echo "*** checkpoint 4" echo "*** checkpoint 4" ls /dev/vmm pciconf -l | grep 0:1:0: vmdisk0=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident: (NM13N4CZ)/ && d{print d}'` echo "Seagate M3 Portable 1.8 TB ; $vmdisk0" vmdisk1=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident: (2015020204055E)/ && d{print d}'` echo "TOSHIBA External USB 1.8 TB ; $vmdisk1" vmdisk2=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident: (2022285F1175)/ && d{print d}'` echo "CT1000P1SSD8 ; $vmdisk2" vmdisk3=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident: (20130506005976F)/ && d{print d}'` echo "TOSHIBA External USB 932GB ; echo $vmdisk3" vmdisk4=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident: (BE0191500218)/ && d{print d}'` echo "G-DISK ; $vmdisk4" vmdisk5=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident: (38434B4237354B45)/ && d{print d}'` echo "Elements ; $vmdisk5" vmdisk6=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident: (WD-WCAV2X597309)/ && d{print d}'` echo "WDC WD3200AAJS-00L7A0-298GB ; $vmdisk6" vmdisk7=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident: (0774911DDC4200A6)/ && d{print d}'` echo "SanDisk Cruzer-15GB ; $vmdisk7" vmdisk8=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident: (60A44C4138D8F311190A0149)/ && d{print d}'` echo "Kingston DataTraveler 2.0 ; $vmdisk8" vmdisk9=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident: (20140100006C)/ && d{print d}'` echo "SAMSUNG HM320JI ; $vmdisk9" vmdisk10=`geom disk list | awk '/^Geom name: /{d=$NF} /^ *ident: (1924E20B2AE5)/ && d{print d}'` echo "CT500MX500SSD4 ; $vmdisk10" mount -t ufs /dev/$vmdisk1'p2' /mnt/$vmdisk1'p2' echo "*** checkpoint 5" echo "*** checkpoint 5" echo "*** checkpoint 5" ls /dev/vmm pciconf -l | grep 0:1:0: devctl detach pci0:1:0:0 devctl detach pci0:1:0:1 devctl set driver pci0:1:0:0 ppt devctl set driver pci0:1:0:1 ppt bhyve -S -c sockets=2,cores=2,threads=2 -m 4G -w -H -A \ -s 0,hostbridge \ -s 1,virtio-blk,/mnt/$vmdisk0'p2'/bhyve/img/Linux/focal-stable-diffusion.img,bootindex=1 \ -s 2,virtio-blk,/dev/$vmdisk3 \ -s 8:0,passthru,1/0/0 \ -s 8:1,passthru,1/0/1 \ -s 11,virtio-net,tap20 \ -s 12,virtio-9p,sharename=/ \ -s 13,hda,play=/dev/dsp,rec=/dev/dsp \ -s 29,fbuf,tcp=0.0.0.0:5920,w=1600,h=950 \ -s 30,xhci,tablet \ -s 31,lpc \ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_CODE.fd \ vm0:20 < /dev/null & sleep 2 && vncviewer 0:20 echo "*** checkpoint 6" echo "*** checkpoint 6" echo "*** checkpoint 6" ls /dev/vmm pciconf -l | grep 0:1:0: sleep 999 This is what happens when I launch it,regularly,but not always : root@marietto:/usr/home/marietto/bhyve # ./20-Ubuntu-2004-Focal-Stable-Diffusion-vm20.sh *** checkpoint 1 *** checkpoint 1 *** checkpoint 1 vm0:20 pcib1@pci0:0:1:0: class=0x060400 rev=0x0d hdr=0x01 vendor=0x8086 device=0x1901 subvendor=0x1458 subdevice=0x5000 ppt0@pci0:1:0:0: class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1c02 subvendor=0x19da subdevice=0x2438 ppt1@pci0:1:0:1: class=0x040300 rev=0xa1 hdr=0x00 vendor=0x10de device=0x10f1 subvendor=0x19da subdevice=0x2438 bhyve session = vm0:20 vnc session = vm VNC session not found,destroying ghost vms *** checkpoint 2 *** checkpoint 2 *** checkpoint 2 ls: /dev/vmm: No such file or directory pcib1@pci0:0:1:0: class=0x060400 rev=0x0d hdr=0x01 vendor=0x8086 device=0x1901 subvendor=0x1458 subdevice=0x5000 ppt0@pci0:1:0:0: class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1c02 subvendor=0x19da subdevice=0x2438 ppt1@pci0:1:0:1: class=0x040300 rev=0xa1 hdr=0x00 vendor=0x10de device=0x10f1 subvendor=0x19da subdevice=0x2438 *** checkpoint 4 *** checkpoint 4 *** checkpoint 4 ls: /dev/vmm: No such file or directory pcib1@pci0:0:1:0: class=0x060400 rev=0x0d hdr=0x01 vendor=0x8086 device=0x1901 subvendor=0x1458 subdevice=0x5000 ppt0@pci0:1:0:0: class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1c02 subvendor=0x19da subdevice=0x2438 ppt1@pci0:1:0:1: class=0x040300 rev=0xa1 hdr=0x00 vendor=0x10de device=0x10f1 subvendor=0x19da subdevice=0x2438 Seagate M3 Portable 1.8 TB ; da5 TOSHIBA External USB 1.8 TB ; da4 CT1000P1SSD8 ; nvd0 TOSHIBA External USB 932GB ; echo da2 G-DISK ; Elements ; da3 WDC WD3200AAJS-00L7A0-298GB ; ada2 SanDisk Cruzer-15GB ; Kingston DataTraveler 2.0 ; SAMSUNG HM320JI ; CT500MX500SSD4 ; ada0 mount: /dev/da4p2: Device busy *** checkpoint 5 *** checkpoint 5 *** checkpoint 5 ls: /dev/vmm: No such file or directory pcib1@pci0:0:1:0: class=0x060400 rev=0x0d hdr=0x01 vendor=0x8086 device=0x1901 subvendor=0x1458 subdevice=0x5000 ppt0@pci0:1:0:0: class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1c02 subvendor=0x19da subdevice=0x2438 ppt1@pci0:1:0:1: class=0x040300 rev=0xa1 hdr=0x00 vendor=0x10de device=0x10f1 subvendor=0x19da subdevice=0x2438 -----> devctl: Failed to detach pci0:1:0:0: Device not configured -----> devctl: Failed to detach pci0:1:0:1: Device not configured -----> bhyve: PCI device at 1/0/0 is not using the ppt(4) driver device emulation initialization error: No such file or directory TigerVNC Viewer 64-bit v1.12.0 Built on: 2021-11-23 05:59 Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst) See https://www.tigervnc.org for information on TigerVNC. Fri Jan 27 01:38:17 2023 DecodeManager: Detected 16 CPU core(s) DecodeManager: Creating 4 decoder thread(s) CConn: unable to connect to socket: Connection refused (61) *** checkpoint 6 *** checkpoint 6 *** checkpoint 6 vm0:20 pcib1@pci0:0:1:0: class=0x060400 rev=0x0d hdr=0x01 vendor=0x8086 device=0x1901 subvendor=0x1458 subdevice=0x5000 ppt0@pci0:1:0:0: class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1c02 subvendor=0x19da subdevice=0x2438 ppt1@pci0:1:0:1: class=0x040300 rev=0xa1 hdr=0x00 vendor=0x10de device=0x10f1 subvendor=0x19da subdevice=0x2438 ^C = sleep 999 As you can see this error : "devctl: Failed to detach pci0:1:0:0: Device not configured" is preventing me from running the VM. I've also tried to don't detach pci0:1:0:0 and detach pci0:1:0:1,but in this case,the error is : "bhyve: PCI device at 1/0/0 is not using the ppt(4) driver". I'm sure that you will understand fast and that you can know how to replicate the experiment using the values according to your system. Thanks. -- Mario. --00000000000030355205f334524e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello FreeBSD Virtualization Team.

I've created this bhyve script that suits my needs,but unfortuna= tely it does not work properly. Can someone help me to understand where the= error is ?

=
./20-Ubuntu-20= 04-Focal-Stable-Diffusion-vm20.sh
#!/bin/sh

vms=3D"$(ls /dev/vmm/*)"
vncs=3D= "vm$(ps ax | awk '/vncviewer [0]/{print $6}')"
echo &q= uot;*** checkpoint 1"
echo "*** checkpoint 1"
echo &qu= ot;*** checkpoint 1"
ls /dev/vmm
pciconf -l | grep 0:1:0:
for= vm in $vms; do
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = session=3D"${vm##*/}" =C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 echo "bhyve session =3D $session"
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 echo "vnc session= =3D $vncs"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= if ! printf '%s\n' "${vncs}" | grep "${session}&quo= t;; then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printf 'VNC session no= t found,destroying ghost vms\n'
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 bhyvectl --vm=3D$session --destroy
#devctl detach pci0:1:0:0
= #devctl detach pci0:1:0:1
#devctl set driver pci0:1:0:0 ppt
= #devctl set driver pci0:1:0:1 ppt
echo "*** checkpoint 2&quo= t;
echo "*** checkpoint 2"
echo "*** checkpoin= t 2"
ls /dev/vmm
pciconf -l | grep 0:1:0: #sleep 999 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printf 'Found VNC session %s\n' = "${session},no ghost vms found,not destroying them"
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 #devctl detach pci0:1:0:0
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 #devctl detach pci0:1:0:1
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 #devctl set driver pci0:1:0:0 ppt
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 #devctl set driver pci0:1:0:1 ppt
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 echo "*** checkpoint 3"
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 echo "*** checkpoint 3"
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 echo "*** checkpoint 3"
ls /dev/vmm
p= ciconf -l | grep 0:1:0:
#sleep 999
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 fi
done

echo "*** checkpoint 4&q= uot;
echo "*** checkpoint 4"
echo "*** checkpoint 4&qu= ot;
ls /dev/vmm
pciconf -l | grep 0:1:0:

vmdisk0=3D`geom disk = list | awk '/^Geom name: /{d=3D$NF} /^ *ident: (NM13N4CZ)/ && d= {print d}'`
echo "Seagate M3 Portable 1.8 TB ; $vmdisk0"
vmdisk1=3D`geom disk list | awk '/^Geom name: /{d=3D$NF} /^ *iden= t: (2015020204055E)/ && d{print d}'`
echo "TOSHIBA Exte= rnal USB 1.8 TB ; $vmdisk1"

vmdisk2=3D`geom disk list | awk = 9;/^Geom name: /{d=3D$NF} /^ *ident: (2022285F1175)/ && d{print d}&= #39;`
echo "CT1000P1SSD8 ; $vmdisk2"

vmdisk3=3D`geom di= sk list | awk '/^Geom name: /{d=3D$NF} /^ *ident: (20130506005976F)/ &a= mp;& d{print d}'`
echo "TOSHIBA External USB 932GB ; echo $= vmdisk3"

vmdisk4=3D`geom disk list | awk '/^Geom name: /{d= =3D$NF} /^ *ident: (BE0191500218)/ && d{print d}'`
echo &quo= t;G-DISK ; $vmdisk4"

vmdisk5=3D`geom disk list | awk '/^Geo= m name: /{d=3D$NF} /^ *ident: (38434B4237354B45)/ && d{print d}'= ;`
echo "Elements ; $vmdisk5"

vmdisk6=3D`geom disk list= | awk '/^Geom name: /{d=3D$NF} /^ *ident: (WD-WCAV2X597309)/ &&= ; d{print d}'`
echo "WDC WD3200AAJS-00L7A0-298GB ; $vmdisk6&quo= t;

vmdisk7=3D`geom disk list | awk '/^Geom name: /{d=3D$NF} /^ *= ident: (0774911DDC4200A6)/ && d{print d}'`
echo "SanDis= k Cruzer-15GB ; $vmdisk7"

vmdisk8=3D`geom disk list | awk '= /^Geom name: /{d=3D$NF} /^ *ident: (60A44C4138D8F311190A0149)/ && d= {print d}'`
echo "Kingston DataTraveler 2.0 ; $vmdisk8"
vmdisk9=3D`geom disk list | awk '/^Geom name: /{d=3D$NF} /^ *ident= : (20140100006C)/ && d{print d}'`
echo "SAMSUNG HM320JI= ; $vmdisk9"

vmdisk10=3D`geom disk list | awk '/^Geom name:= /{d=3D$NF} /^ *ident: (1924E20B2AE5)/ && d{print d}'`
echo = "CT500MX500SSD4 ; $vmdisk10"

mount -t ufs /dev/$vmdisk1= 9;p2' /mnt/$vmdisk1'p2'

echo "*** checkpoint 5"= ;
echo "*** checkpoint 5"
echo "*** checkpoint 5"=
ls /dev/vmm
pciconf -l | grep 0:1:0:
devctl detach pci0:1:0:0
= devctl detach pci0:1:0:1
devctl set driver pci0:1:0:0 ppt
devctl set = driver pci0:1:0:1 ppt

bhyve -S -c sockets=3D2,cores=3D2,threads=3D2 = -m 4G -w -H -A \
-s 0,hostbridge \
-s 1,virtio-blk,/mnt/$vmdisk0'= p2'/bhyve/img/Linux/focal-stable-diffusion.img,bootindex=3D1 \
-s 2,= virtio-blk,/dev/$vmdisk3 \
-s 8:0,passthru,1/0/0 \
-s 8:1,passthru,1/= 0/1 \
-s 11,virtio-net,tap20 \
-s 12,virtio-9p,sharename=3D/ \
-s = 13,hda,play=3D/dev/dsp,rec=3D/dev/dsp \
-s 29,fbuf,tcp=3D0.0.0.0:5920,w=3D1600,h=3D950 \
-s 30,xhci,tablet \=
-s 31,lpc \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_CODE= .fd \
vm0:20 < /dev/null & sleep 2 && vncviewer 0:20
<= br>echo "*** checkpoint 6"
echo "*** checkpoint 6"echo "*** checkpoint 6"
ls /dev/vmm
pciconf -l | grep 0:1= :0:
sleep 999

This is what happens when I launch it,re= gularly,but not always :

root@marietto:/usr/ho= me/marietto/bhyve # ./20-Ubuntu-2004-Focal-Stable-Diffusion-vm20.sh
*** checkpoint 1
*** checkpoint 1
*** checkpoint 1

vm0:20pcib1@pci0:0:1:0: =C2=A0 =C2=A0 =C2=A0 class=3D0x060400 rev=3D0x0d hdr=3D0= x01 vendor=3D0x8086 device=3D0x1901 subvendor=3D0x1458 subdevice=3D0x5000ppt0@pci0:1:0:0: =C2=A0 =C2=A0 =C2=A0 =C2=A0class=3D0x030000 rev=3D0xa1 h= dr=3D0x00 vendor=3D0x10de device=3D0x1c02 subvendor=3D0x19da subdevice=3D0x= 2438
ppt1@pci0:1:0:1: =C2=A0 =C2=A0 =C2=A0 =C2=A0class=3D0x040300 rev=3D= 0xa1 hdr=3D0x00 vendor=3D0x10de device=3D0x10f1 subvendor=3D0x19da subdevic= e=3D0x2438
bhyve session =3D vm0:20
vnc session =3D vm
VNC session= not found,destroying ghost vms

*** checkpoint 2
*** checkpoint 2=
*** checkpoint 2

ls: /dev/vmm: No such file or directory
pcib= 1@pci0:0:1:0: =C2=A0 =C2=A0 =C2=A0 class=3D0x060400 rev=3D0x0d hdr=3D0x01 v= endor=3D0x8086 device=3D0x1901 subvendor=3D0x1458 subdevice=3D0x5000
ppt= 0@pci0:1:0:0: =C2=A0 =C2=A0 =C2=A0 =C2=A0class=3D0x030000 rev=3D0xa1 hdr=3D= 0x00 vendor=3D0x10de device=3D0x1c02 subvendor=3D0x19da subdevice=3D0x2438<= br>ppt1@pci0:1:0:1: =C2=A0 =C2=A0 =C2=A0 =C2=A0class=3D0x040300 rev=3D0xa1 = hdr=3D0x00 vendor=3D0x10de device=3D0x10f1 subvendor=3D0x19da subdevice=3D0= x2438

*** checkpoint 4
*** checkpoint 4
*** checkpoint 4
ls: /dev/vmm: No such file or directory
pcib1@pci0:0:1:0: =C2=A0 =C2= =A0 =C2=A0 class=3D0x060400 rev=3D0x0d hdr=3D0x01 vendor=3D0x8086 device=3D= 0x1901 subvendor=3D0x1458 subdevice=3D0x5000
ppt0@pci0:1:0:0: =C2=A0 =C2= =A0 =C2=A0 =C2=A0class=3D0x030000 rev=3D0xa1 hdr=3D0x00 vendor=3D0x10de dev= ice=3D0x1c02 subvendor=3D0x19da subdevice=3D0x2438
ppt1@pci0:1:0:1: =C2= =A0 =C2=A0 =C2=A0 =C2=A0class=3D0x040300 rev=3D0xa1 hdr=3D0x00 vendor=3D0x1= 0de device=3D0x10f1 subvendor=3D0x19da subdevice=3D0x2438

Seagate M3 Portable 1.8 TB ; da5
TOSHIBA External USB 1.8 TB ; d= a4
CT1000P1SSD8 ; nvd0
TOSHIBA External USB 932GB ; echo da2
G-DIS= K ;
Elements ; da3
WDC WD3200AAJS-00L7A0-298GB ; ada2
SanDisk Cru= zer-15GB ;
Kingston DataTraveler 2.0 ;
SAMSUNG HM320JI ;
CT500M= X500SSD4 ; ada0
mount: /dev/da4p2: Device busy

*** checkpoint 5*** checkpoint 5
*** checkpoint 5

ls: /dev/vmm: No such file or= directory
pcib1@pci0:0:1:0: =C2=A0 =C2=A0 =C2=A0 class=3D0x060400 rev= =3D0x0d hdr=3D0x01 vendor=3D0x8086 device=3D0x1901 subvendor=3D0x1458 subde= vice=3D0x5000
ppt0@pci0:1:0:0: =C2=A0 =C2=A0 =C2=A0 =C2=A0class=3D0x0300= 00 rev=3D0xa1 hdr=3D0x00 vendor=3D0x10de device=3D0x1c02 subvendor=3D0x19da= subdevice=3D0x2438
ppt1@pci0:1:0:1: =C2=A0 =C2=A0 =C2=A0 =C2=A0class=3D= 0x040300 rev=3D0xa1 hdr=3D0x00 vendor=3D0x10de device=3D0x10f1 subvendor=3D= 0x19da subdevice=3D0x2438

-----> devctl: Failed to detach pci0:1:= 0:0: Device not configured
-----> devctl: Failed to detach pci0:1:0:1= : Device not configured
-----> bhyve: PCI device at 1/0/0 is not usin= g the ppt(4) driver

device emulation initialization error: No such f= ile or directory

TigerVNC Viewer 64-bit v1.12.0
Built on: 2021-11= -23 05:59
Copyright (C) 1999-2021 TigerVNC Team and many others (see REA= DME.rst)
See https://www.tigervnc.o= rg for information on TigerVNC.

Fri Jan 27 01:38:17 2023
=C2= =A0DecodeManager: Detected 16 CPU core(s)
=C2=A0DecodeManager: Creating = 4 decoder thread(s)
=C2=A0CConn: =C2=A0 =C2=A0 =C2=A0 unable to connect = to socket: Connection refused (61)

*** checkpoint 6
*** checkpoin= t 6
*** checkpoint 6

vm0:20
pcib1@pci0:0:1:0: =C2=A0 =C2=A0 = =C2=A0 class=3D0x060400 rev=3D0x0d hdr=3D0x01 vendor=3D0x8086 device=3D0x19= 01 subvendor=3D0x1458 subdevice=3D0x5000
ppt0@pci0:1:0:0: =C2=A0 =C2=A0 = =C2=A0 =C2=A0class=3D0x030000 rev=3D0xa1 hdr=3D0x00 vendor=3D0x10de device= =3D0x1c02 subvendor=3D0x19da subdevice=3D0x2438
ppt1@pci0:1:0:1: =C2=A0 = =C2=A0 =C2=A0 =C2=A0class=3D0x040300 rev=3D0xa1 hdr=3D0x00 vendor=3D0x10de = device=3D0x10f1 subvendor=3D0x19da subdevice=3D0x2438

^C =3D sl= eep 999

As you can see this error : "devctl: Failed = to detach pci0:1:0:0: Device not configured" is preventing me from run= ning the VM. I've also tried to don't detach pci0:1:0:0 and detach = pci0:1:0:1,but in this case,the error is : "bhyve: PCI device at 1/0/0= is not using the ppt(4) driver". I'm sure that you will understan= d fast and that you can know how to replicate the experiment using the valu= es according to your system.

Thanks.

--
Mario.
--00000000000030355205f334524e--