Qemu giving an drive with bus=0, unit=0 (index=0) exists error - emulation

This is the entire command, but i can't seem to work over it for some reason.. HELP
qemu-system-x86_64 \
-m 1G \
-cpu host \
-enable-kvm \
-boot order=d \
-drive file=Win10_1803_English_x64.iso,media=cdrom \
-drive file=windows10.img,format=raw,if=virtio \
-drive file=virtio-win.iso,media=cdrom \
-vnc :0 \

Related

Use iso image for virt-builder

the virt command works fine with the distributions from the list(debian-11 for example), but can I somehow use my own iso-file as a source? At the output, I need to have a qcow2 file with an OS and preinstalled commands like this:
virt-builder debian-11 \
--size 8G \
--output /var/lib/libvirt/images/gitlab-runner-base.qcow2 \
--format qcow2 \
--hostname gitlab-runner-bullseye \
--network \
--install curl \
--run-command 'curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | bash' \
--run-command 'curl -s "https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh" | bash' \
--run-command 'useradd -m -p "" gitlab-runner -s /bin/bash' \
--install gitlab-runner,git,git-lfs,openssh-server \
--run-command "git lfs install --skip-repo" \
--ssh-inject gitlab-runner:file:/root/.ssh/id_rsa.pub \
--run-command "echo 'gitlab-runner ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" \
--run-command "sed -E 's/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/' -i /etc/default/grub" \
--run-command "grub-mkconfig -o /boot/grub/grub.cfg" \
--run-command "echo 'auto eth0' >> /etc/network/interfaces" \
--run-command "echo 'allow-hotplug eth0' >> /etc/network/interfaces" \
--run-command "echo 'iface eth0 inet dhcp' >> /etc/network/interfaces"

VirtManager libvirt.libvirtError: internal error: process exited while connecting to monitor

I am using Archlinux with virt-manager and kvm. When I conifgured like this and I got these errors below. Can somebody help me solve it? Thank you a lot!
Configration of Display Spice
Configration of Video Virtio
Error starting domain: internal error: process exited while connecting to monitor
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 72, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 108, in tmpcb
callback(*args, **kwargs)
File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
ret = fn(self, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/object/domain.py", line 1384, in startup
self._backend.create()
File "/usr/lib/python3.10/site-packages/libvirt.py", line 1352, in create
raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: internal error: process exited while connecting to monitor
And I found these in /var/log/libvirt/qemu/$MYGUESTNAME.log, but I cannot figure out what's wrong with it.
2022-06-24 03:05:53.851+0000: starting up libvirt version: 8.4.0, qemu version: 7.0.0, kernel: 5.18.6-arch1-1, hostname: ArchPorn.localdomain
LC_ALL=C \
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin \
HOME=/var/lib/libvirt/qemu/domain-1-archlinux \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain-1-archlinux/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain-1-archlinux/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain-1-archlinux/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=archlinux,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-1-archlinux/master-key.aes"}' \
-machine pc-q35-7.0,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram \
-accel kvm \
-cpu host,migratable=on \
-m 6144 \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":6442450944}' \
-overcommit mem-lock=off \
-smp 4,sockets=4,cores=1,threads=1 \
-uuid 668eec0e-75a5-46cd-8379-4d493e59ae8a \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=33,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc,driftfix=slew \
-global kvm-pit.lost_tick_policy=delay \
-no-hpet \
-no-shutdown \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
-boot strict=on \
-device '{"driver":"pcie-root-port","port":16,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x2"}' \
-device '{"driver":"pcie-root-port","port":17,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x2.0x1"}' \
-device '{"driver":"pcie-root-port","port":18,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x2.0x2"}' \
-device '{"driver":"pcie-root-port","port":19,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x2.0x3"}' \
-device '{"driver":"pcie-root-port","port":20,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x2.0x4"}' \
-device '{"driver":"pcie-root-port","port":21,"chassis":6,"id":"pci.6","bus":"pcie.0","addr":"0x2.0x5"}' \
-device '{"driver":"pcie-root-port","port":22,"chassis":7,"id":"pci.7","bus":"pcie.0","addr":"0x2.0x6"}' \
-device '{"driver":"pcie-root-port","port":23,"chassis":8,"id":"pci.8","bus":"pcie.0","addr":"0x2.0x7"}' \
-device '{"driver":"pcie-root-port","port":24,"chassis":9,"id":"pci.9","bus":"pcie.0","multifunction":true,"addr":"0x3"}' \
-device '{"driver":"pcie-root-port","port":25,"chassis":10,"id":"pci.10","bus":"pcie.0","addr":"0x3.0x1"}' \
-device '{"driver":"pcie-root-port","port":26,"chassis":11,"id":"pci.11","bus":"pcie.0","addr":"0x3.0x2"}' \
-device '{"driver":"pcie-root-port","port":27,"chassis":12,"id":"pci.12","bus":"pcie.0","addr":"0x3.0x3"}' \
-device '{"driver":"pcie-root-port","port":28,"chassis":13,"id":"pci.13","bus":"pcie.0","addr":"0x3.0x4"}' \
-device '{"driver":"pcie-root-port","port":29,"chassis":14,"id":"pci.14","bus":"pcie.0","addr":"0x3.0x5"}' \
-device '{"driver":"qemu-xhci","p2":15,"p3":15,"id":"usb","bus":"pci.2","addr":"0x0"}' \
-device '{"driver":"virtio-serial-pci","id":"virtio-serial0","bus":"pci.3","addr":"0x0"}' \
-blockdev '{"driver":"file","filename":"/home/fansuregrin/VMs/archlinux.qcow2","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"qcow2","file":"libvirt-2-storage","backing":null}' \
-device '{"driver":"virtio-blk-pci","bus":"pci.4","addr":"0x0","drive":"libvirt-2-format","id":"virtio-disk0","bootindex":1}' \
-device '{"driver":"ide-cd","bus":"ide.0","id":"sata0-0-0"}' \
-netdev tap,fd=34,vhost=on,vhostfd=36,id=hostnet0 \
-device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:cf:92:94","bus":"pci.1","addr":"0x0"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
-chardev socket,id=charchannel0,fd=32,server=on,wait=off \
-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"org.qemu.guest_agent.0"}' \
-chardev spicevmc,id=charchannel1,name=vdagent \
-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":2,"chardev":"charchannel1","id":"channel1","name":"com.redhat.spice.0"}' \
-device '{"driver":"usb-tablet","id":"input0","bus":"usb.0","port":"1"}' \
-audiodev '{"id":"audio1","driver":"spice"}' \
-spice port=0,disable-ticketing=on,image-compression=off,gl=on,rendernode=/dev/dri/by-path/pci-0000:00:02.0-render,seamless-migration=on \
-device '{"driver":"virtio-vga-gl","id":"video0","max_outputs":1,"bus":"pcie.0","addr":"0x1"}' \
-device '{"driver":"ich9-intel-hda","id":"sound0","bus":"pcie.0","addr":"0x1b"}' \
-device '{"driver":"hda-duplex","id":"sound0-codec0","bus":"sound0.0","cad":0,"audiodev":"audio1"}' \
-chardev spicevmc,id=charredir0,name=usbredir \
-device '{"driver":"usb-redir","chardev":"charredir0","id":"redir0","bus":"usb.0","port":"2"}' \
-chardev spicevmc,id=charredir1,name=usbredir \
-device '{"driver":"usb-redir","chardev":"charredir1","id":"redir1","bus":"usb.0","port":"3"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.5","addr":"0x0"}' \
-object '{"qom-type":"rng-random","id":"objrng0","filename":"/dev/urandom"}' \
-device '{"driver":"virtio-rng-pci","rng":"objrng0","id":"rng0","bus":"pci.6","addr":"0x0"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
2022-06-24 03:05:54.292+0000: shutting down, reason=failed
That is a sign that QEMU has unexpectedly crashed. if you are lucky there will be more useful error information in /var/log/libvirt/qemu/$GUESTNAME.log that will help you diagnose the problem

Compiled opencv3.2.0 on ubuntu16.04 failed

I failed to compile opencv3.2.0 on ubuntu 16.04,that is the error:
Build output check failed:Regex: 'command line option .* is valid for .* but not for C++'
I tried to add -D CMAKE_C_COMPILER=/usr/bin/gcc-5 and -D ENABLE_CXX11=ON but it didn't work...So how can i solve this problem?
Ubuntu 16.04.6 - amd64 : Build opencv-3.2.0
sudo apt build-dep opencv
sudo apt install cmake python3-dev python3-numpy libgl1-mesa-dev libgoogle-glog-dev \
libgphoto2-dev liblapack-dev libleptonica-dev libprotobuf-dev libraw1394-dev libtbb-dev \
libtesseract-dev libv4l-dev maven-repo-helper ocl-icd-opencl-dev protobuf-compiler \
python-dev libtiff-dev libswscale-dev python-vtk *gstreamer*-dev linux-libc-dev \
libavresample-dev libatlas-cpp-0.6-dev libopenblas-dev doxygen \
libinsighttoolkit4-dev liblapacke-dev
tar xvf opencv_3.2.0+dfsg.orig.tar.gz
cd opencv-3.2.0+dfsg/
tar xvf ../opencv_3.2.0+dfsg-6.debian.tar.xz
mkdir build && cd build/
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DOPENCV_MATHJAX_RELPATH=/usr/share/javascript/mathjax/ \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_EXAMPLES=ON \
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DWITH_FFMPEG=ON \
-DWITH_GSTREAMER=OFF \
-DWITH_GTK=ON \
-DWITH_JASPER=OFF \
-DWITH_JPEG=ON \
-DWITH_PNG=ON \
-DWITH_TIFF=ON \
-DWITH_OPENEXR=ON \
-DWITH_PVAPI=ON \
-DWITH_UNICAP=OFF \
-DWITH_EIGEN=ON \
-DWITH_VTK=ON \
-DWITH_GDAL=ON \
-DWITH_GDCM=ON \
-DWITH_XINE=OFF \
-DWITH_IPP=OFF \
-DBUILD_TESTS=OFF \
-DCMAKE_SKIP_RPATH=ON \
-DWITH_CUDA=OFF \
-DENABLE_PRECOMPILED_HEADERS=OFF \
-DWITH_IPP=OFF \
-DWITH_CAROTENE=OFF \
-DOPENCL_INCLUDE_DIR:PATH="/usr/include/CL/" ../
make ## no errors
.
[100%] Linking CXX executable ../../bin/opencv_version
.
[100%] Built target opencv_version

How to know how many arguments can be used for compiling vim totally?

My vim was compiled with the following configure.
./configure --prefix=/usr/local/ \
--with-features=huge \
--enable-multibyte \
--enable-cscope=yes \
--enable-perlinterp=yes \
--enable-rubyinterp=yes \
--with-ruby-command=/usr/bin/ruby \
--enable-luainterp=yes \
--enable-pythoninterp=yes \
--enable-python3interp=yes \
--enable-tclinterp=yes \
--enable-gui=gtk3 \
--enable-cscope \
--enable-xim \
--enable-fontset \
--with-x --with-compiledby=$USER
How to know how many arguments can be used for compiling vim totally?
And almost same puzzle,how to know how many arguments can be used for compiling ffmpeg totally?
By what method?
Is there a sentence describing that there are xxxx arguements for compling vim such as ..... in some manul?
You can find the list of all arguments simply with the help command :
:help feature-list

Command Line Tool to Disable PDF Printing

Does anyone know of a "FREE" command line tool that can lock a pdf from a user being able to print it. I need to be able to put this in a batch to loop through a folder and disable printing from adobe standard and reader. Is this possible to do it from command line with any tool?
First, pdftk:
You can use pdftk for (available for Linux, Unix, Mac OS X and Windows) to set an "owner password":
pdftk \
input.pdf \
output semi-protected.pdf \
owner_pw "supersecret"
Result is this, for example:
pdfinfo semi-protected.pdf | grep Encrypted:
Encrypted: yes (print:no copy:no change:no addNotes:no)
You can modify the command to additionally require a user password to open the PDF:
pdftk \
input.pdf \
output semi-semi-protected.pdf \
owner_pw "supers3cr3t" \
user_pw "s3cr3t"
You can modify the command to (selectively) "allow" other user actions:
pdftk \
input.pdf \
output semi-semi-protected.pdf \
owner_pw "supers3cr3t" \
allow ModifyContents \
allow CopyContents \
allow ScreenReaders \
allow ModifyAnnotations
Result may be this, for example:
pdfinfo semi-semi-protected.pdf | grep Encrypted:
Encrypted: yes (print:no copy:yes change:yes addNotes:yes)
Second, podofoencrypt:
Commandline example:
podofoencrypt \
--rc4v2 \
-o "supers3cr3t" \
-u "s3cr3t" \
--edit \
--copy \
--editnotes \
--fillandsign \
--accessible \
--assemble \
input.pdf \
semi-protected.pdf
Big, fat caveat:
You should be aware, that this way of 'protecting' PDF files is by no means super-secure. There are quite a lot of PDF cracker software utilities out there which easily un-protect your PDF files. This method is only a very basic means to prevent most noobie computer users to mess with your files.
In addition, see also
Third, qpdf:
in Martin Schröder's answer!
qpdf can do this:
qpdf \
--encrypt \
"user-password" \
"owner-password" \
40 \
--print=n \
-- \
infilename \
outfilename
or even
qpdf \
--encrypt \
"user-password" \
"owner-password" \
128 \
--print=non \
--accessiblity=y \
--force-V4 \
--modify=form \
-- \
infilename \
outfilename

Resources