Using ks.cfg with virt-install? - linux

I've been trying to get a virtual machine working with a cfg file on centos but unfortunately, I'm getting the error that ks.cfg file does not exist.
Below is the command I ran to enable the VM.
virt-install --name FedoraTest --ram 1024 --disk pool=default,size=10 --location ~/Desktop/CentosOS --initrd-inject ks.cfg --extra-args "ks=file:~/Desktop/ks.cfg"
I am new to the VM setup and am unsure if I'm doing it right.
Any advice on how to fix this will be greatly appreciated.
Also, what does initrd-inject do? And is it possible to save the above command into a file and run the file instead?

I suppose you have switched the meaning of 'initrd-inject' and 'extra-args' parameters. The initrd-inject should contain path to the ks file in your file system, while in 'extra-args' you should specify kernel to use the injected ks file. See the snippet:
virt-install --connect=qemu:///system \
--network=bridge:br0 \
--initrd-inject=/export/rhel.ks \
--extra-args="ks=file:/rhel.ks console=tty0 console=ttyS0,115200" \
--name=$domname \
--disk /export/vmimgs/$domname.img,size=20 \
--ram 2048 \
--vcpus=2 \
--check-cpu \
--accelerate \
--hvm \
--location=$location1 \
--nographics
The snippet comes from here

Related

is it possible for fusioninspector to find new Fusions which are not included STAR fusion?

i am beginner bioinformatician!
i run CTAT for fusion analysis
here is my code
docker run -v `pwd`:/data --rm trinityctat/starfusion \
STAR-Fusion \
--left_fq /data/reads_1.fq.gz \
--right_fq /data/reads_2.fq.gz \
--genome_lib_dir /data/ctat_genome_lib_build_dir \
-O /data/StarFusionOut \
--FusionInspector validate \
--examine_coding_effect \
--denovo_reconstruct
i thought fusioninspector's role is just validation for fusions which STAR-Fuision predicted
. But final results are different from my expactation
i wonder why fusioninspector's results have more fusions and how fusioninspector's results have fusions which are not included in STAR-Fusion result!!
please help me..!

Error running gatk HaplotypeCaller with allele specific annotations

I've got HaplotypeCaller working nicely in standard mode, like so:
# Run haplotypcaller
gatk --java-options "-Xmx4g" HaplotypeCaller \
--intervals "$INTERVALS" \
-R "$REF" \
-I "$OUT"/results/alignment/${SN}_sorted_marked_recalibrated.bam \
-O "$OUT"/results/variants/${SN}_g.vcf.gz \
-ERC GVCF
But when I try in allele-specific mode, I get the following error. All I've done is add the -G annotations at the end, as suggested here.
# Haplytype caller with allele-specific annotations
gatk --java-options "-Xmx4g" HaplotypeCaller \
--intervals "$INTERVALS" \
-R "$REF" \
-I "$OUT"/results/alignment/${SN}_sorted_marked_recalibrated.bam \
-O "$OUT"/results/variants/${SN}_g.vcf.gz \
-ERC GVCF \
-G Standard \
-G AS_Standard
Here's the error:
***********************************************************************
A USER ERROR has occurred: Unrecognized annotation group name: Standard
***********************************************************************
I think that those options should be:
-G StandardAnnotation
-G AS_StandardAnnotation
At least, when I changed them to that, it didn't throw an error message.
However, I haven't used GATK much, so I'm not sure that's correct. I posted on the relevant Broad page, so more info may show up there.

how to create VM from Azure CLi with exising key pair?

I tried to create VM from another VM via Azure CLI with this command :
az vm create \
--resource-group my_resource \
--name newVMfromImage \
--image firstMachine-image \
--admin-username user_name \
--data-disk-sizes-gb 150 20 --size Standard_B1ms \
--verbose \
----ssh-key-value /path/to/publick/key/azure.pub
But I get this error :
az: error: unrecognized arguments: ----ssh-key-value
/path/to/publick/key/azure.pub
----ssh-key-value /path/to/publick/key/azure.pub
should only be:
--ssh-key-value /path/to/publick/key/azure.pub
Remove the 2 additional dashes.
Correct, the 4 dashes (----) indicates a wrong transmission while uploading the .PUB file.
Remove the 2 additional dashes.

KVM guest os boot error

I'm trying to boot up a guest os to continue with my work but I have a problem with my virsh installation.
Here is the part of installation script:
qemu-img create -f qcow2 -o preallocation=metadata ~/images/${vm_name}.qcow2 ${pool_size}G
# create dir for images
mkdir ~/images/
virt-install \
--connect qemu:///system \
--name $vm_name \
--ram 10240 \
--vcpus 4 \
--disk ~/images/${vm_name}.qcow2,size=$pool_size,bus=virtio,sparse=false,format=qcow2 \
--network network=default,model=virtio \
--location http://ua.archive.ubuntu.com/dists/trusty-updates/main/installer-amd64/ \
--initrd-inject=$current_dir/preseed.cfg \
--extra-args="file=file:/preseed.cfg vga=788 quiet console=tty0 utf8 console=ttyS0,115200" \
--os-type=linux \
--virt-type kvm \
--video=vga \
--noreboot \
--cpu host \
--hvm
virsh start $vm_name
echo "----------Login to console----------"
virsh console $vm_name
WHen Im trying to run this script as a file like ./script.sh it produces an error:
Formatting '/home/{username}/images/test.qcow2', fmt=qcow2 size=53687091200 encryption=off cluster_size=65536 preallocation='metadata' lazy_refcounts=off refcount_bits=16
mkdir: cannot create directory '/home/flash/images/': File exists
ERROR 'DebianDistro' object has no attribute '_prefix'
error: failed to get domain 'test'
error: Domain not found: no domain with matching name 'test'
----------Login to console----------
error: failed to get domain 'test'
error: Domain not found: no domain with matching name 'test'
I have tried already reinstalling kvm qemu packages using this guide - https://help.ubuntu.com/community/KVM/Installation
and everything completed successfully.
I am sure that script will work file as I was using it before on the other machine without any problems.
Another try:
Using that script below
virt-install --connect qemu:///system -n test -r 10240 \
--vcpus=4 \
--disk path=/data0/images/test.img,size=50,format=qcow2,bus=virtio,cache=none \
--cdrom /home/{username}/Downloads/kvm/ubuntu-14.iso \
--vnc \
--os-type=linux \
--accelerate \
--network network=default \
--hvm
Produces an error:
ERROR internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied
failed to initialize KVM: Permission denied
Also when I'm trying to list all os variants by virt-install --os-variant list it cannot recognize this command and trying to boot up a guest os instead of listing variants.
Can you please help me to find out what is the problem here?
To fix this error:
ERROR 'DebianDistro' object has no attribute '_prefix'
Edit the file /usr/share/virt-manager/virtinst/urlfetcher.py and change this in line 1034:
if self._prefix:
to this:
if self._url_prefix:
Ubuntu 14.04.

virtualbox + perl + shared folder == fail

This is a convoluted one so bear with me. I have a Perl script that is located on a Windows VirtualBox guest. I want to call this script from the Linux host and have it read a shared folder from the host. The reading of the folder fails.
On the host I call this script and it gives me the following output:
host:~/$ ./script.pl /nfs/nasi/temp
[2014-04-02 10:50:55] Uploading file records to localhost
[2014-04-02 10:50:55] Running VirtualBox for Kaspersky
fatal: opendir(E:\nasi\temp) failed: No such file or directory
[2014-04-02 10:50:56] Uploading malware samples data to localhost
host:$
The script converts the argument /nfs/nasi/temp to E:\nasi\temp and calls the script using the following command:
/usr/bin/VBoxManage guestcontrol <guest> execute \
--image "C:\strawberry\perl\bin \perl.exe" \
--username <user> --password <pass> \
--wait-stdout --wait-stderr --wait-exit -- \
"C:\antivirus\kaspersky.pl" "E:\nasi\temp"
When I run this same script using the same option from the guest directly however I get the following:
C:\antivirus>C:\strawberry\perl\bin\perl.exe C:\antivirus\kaspersky.pl E:\nasi\temp
[2014-04-02 10:54:19] Running Kaspersky Antivirus
[2014-04-02 10:54:20] Parsing Kaspersky report
[2014-04-02 10:54:20] Uploading Kaspersky results to 10.0.0.1
C:\antivirus>
But wait, it gets weirder. When instead of providing the shared directory E:\ I instead point it to C:\ it has no problem reading the directory and just happily keeps going. So the error only shows up when I run the command from the host through VirtualBox and point it to the share.
Here is the relevant code:
sub createSamplesMap {
opendir( my $dh, $ARGV[0] ) or
die "fatal: opendir($ARGV[0]) failed: $!\n";
my #files = readdir( $dh );
foreach my $file ( #files ) {
if (! -d $file ) {
...
}
}
closedir($dh);
}
I tried different ways of reading the filenames from the directory but they didn't work. Here's what I tried.
my #files = <$ARGV[0]\\*>;
my #files = glob( $ARGV[0] . '\\*' );
I don't know whether to blame perl or virtualbox. Anyone have any ideas on what the problem might be?
Windows 7, Strawberry Perl v5.18.2
Ubuntu 12.04.04, Perl v5.14.2
VirtualBox 4.2.16r86992
crosspost: https://forums.virtualbox.org/viewtopic.php?f=2&t=61011
I've found the problem. As mentioned on the virtualbox forum there was a problem with the environment variables set when running the perl script. After much googling I also found a blog post from kissmyarch where he describes how he solved the problem.
You can set environment variables using the --environment option in VBoxManage guestcontrol and according to kissmyarch you need to set USERPROFILE to get it to work. This did not work for me.
So instead I used the following code from the script to figure out what environment variables were set:
foreach $key (sort keys(%ENV)) {
print "$key = $ENV{$key}\n";
}
and ran that both on the guest and from guestcontrol to compare the environments. My command now looks like this:
/usr/bin/VBoxManage guestcontrol <vm> execute \
--image "C:\strawberry\perl\bin\perl.exe" \
--username <user> --password <pass> \
--environment "USERPROFILE=C:\Users\<user>" \
--environment "APPDATA=C:\Users\<user>\AppData\Roaming" \
--environment "LOCALAPPDATA=C:\Users\<user>\AppData\Local" \
--environment "HOMEDRIVE=C:" \
--environment "HOMEPATH=\Users\<user>" \
--environment "LOGONSERVER=\\\<server>" \
--environment "SESSIONNAME=Console" \
--environment "TEMP=C:\Users\<user>\AppData\Local\Temp" \
--environment "TMP=C:\Users\<user>\AppData\Local\Temp" \
--environment "USERDOMAIN=<domain>" \
--environment "USERNAME=<user>" \
--wait-stdout --wait-stderr --wait-exit \
-- "C:\antivirus\kaspersky.pl" "E:\nasi\temp"
Somewhere in that big pile of environment variables is one that is important.
Thanks to all that helped.

Resources