How can exe run in qemu system mode - qemu

I am trying to run exe file on qemu in system mode. For that, I created a compiled a kernel, buildroot and qemu based on the Prepare the environment for developing Linux kernel with qemu (also created a shared folder between the host and the guest qemu from How to share a directory with the host without networking in QEMU). Now, I want to compile and run exe on the qemu system... After compiling the pcimem project on the host, I opened qemu, moved to the shared folder and tried to run it, but I got -sh: ./pcimem: not found. When I run ls in qemu, I can see the files and that they have the right permissions:
# ls -la
total 80
drwxrwxr-x 3 1006 1001 4096 Oct 2 17:32 .
drwxrwxr-x 3 1006 1001 4096 Oct 2 17:31 ..
drwxrwxr-x 8 1006 1001 4096 Oct 2 17:31 .git
-rw-rw-r-- 1 1006 1001 59 Oct 2 17:31 .gitignore
-rw-rw-r-- 1 1006 1001 18092 Oct 2 17:31 LICENSE.txt
-rw-rw-r-- 1 1006 1001 80 Oct 2 17:31 Makefile
-rw-rw-r-- 1 1006 1001 5691 Oct 2 17:31 README
-rwxrwxr-x 1 1006 1001 21672 Oct 2 17:32 pcimem
-rw-rw-r-- 1 1006 1001 5283 Oct 2 17:31 pcimem.c
What am I doing wrong ? How can I run exe on the qemu in system mode ?
Update:
I found out here that I am trying to invoke the exe file from busybox terminal, and apparently it can't be done... so I tried to invoke the next command line:
ash ./pcimem
but than I get the next error:
./pcimem: line 1: can't create #: Operation not permitted
./pcimem: line 1:ELF: not found
./pcimem: line 2: syntax error: unexpected "("

Related

How to uninstall mySQL when "rm /usr/local/mysql" returns permissions error?

I have been having problems logging into MySQL through phpMyAdmin so I decided to uninstall both on my computer. To my surprise, I do not even have the permissions to uninstall MySQL.
I tried to uninstall MySQL using the command "sudo rm /usr/local/mysql" and the terminal returned that I did not have permission.
I looked up a StackOverflow question about not having access to /usr/local and a reply asked the user to do sudo $chown, which my terminal said I did not have permission to do.
I did have permission to do ls -la /usr/local, and this is what the terminal returned:
total 0
drwxr-xr-x 16 root wheel 512 Jun 6 22:32 .
drwxr-xr-x# 9 root wheel 288 Mar 27 2018 ..
-rw-r--r-- 1 x wheel 0 Feb 19 23:21
.com.apple.installer.keep
drwxrwxr-x 4 x admin 128 Jun 7 2018 Cellar
drwxrwxr-x 17 x admin 544 May 22 2018 Homebrew
drwxrwxr-x 61 x admin 1952 Jun 7 2018 bin
drwxrwxr-x 3 x admin 96 May 22 2018 etc
drwxr-xr-x 10 x wheel 320 May 22 2018 git
drwxrwxr-x 3 x admin 96 May 22 2018 lib
drwxrwxr-x 5 x wheel 160 May 22 2018 libexec
lrwxr-xr-x 1 x wheel 30 Jun 6 22:32 mysql -> mysql-5.7.26-
macos10.14-x86_64
drwxr-xr-x 13 x wheel 416 Jun 6 22:32 mysql-5.7.26-macos10.14-
x86_64
drwxrwxr-x 4 x admin 128 Jun 7 2018 opt
drwxr-xr-x 3 x wheel 96 May 22 2018 remotedesktop
drwxrwxr-x 5 x admin 160 May 22 2018 share
drwxrwxr-x 3 x admin 96 May 22 2018 var
I am shocked about the "remotedesktop" line, but I hope it is innocent considering it shows up the same day as Homebrew. Please help me understand these results and what to do next.
You can't remove a directory with rm unless you use the recursive flag (-r). You should get an "is a directory" error, not a permissions error. You'll probably want to include the "force" flag (-f) to avoid having to confirm each deletion.
That's also a symlink so you need to remove the specific instance of it, or adapt your command to remove anything MySQL-ish using a wildcard:
rm -rf /usr/local/mysql*
As always, pay extremely close attention to what you're doing when using recursive deletes and sudo. A single space in the wrong place can utterly ruin your day. Triple check before executing these commands.

google-chrome --headless --screenshot is crashing with message "Could not get download directory" on Centos 7

I'm attempting to get a screenshot via command line using the new features of Google Chrome 59 (Google Chrome 59.0.3071.86) in a Centos 7 box and I'm getting an error saying it could not get the download directory. I attempted to create the directory in my home folder but no success! Any suggestions?
[root#vm_1 ~]# google-chrome-stable --headless --disable-gpu --enable-logging -v=5 --screenshot=out.png http://www.google.com
[0613/154943.103775:VERBOSE1:zygote_main_linux.cc(626)] ZygoteMain: initializing 0 fork delegates
[0613/154943.104006:INFO:cpu_info.cc(50)] Available number of cores: 1
[0613/154943.108816:VERBOSE1:audio_manager_pulse.cc(273)] Failed to connect to the context. Error: Connection refused
[0613/154943.108868:WARNING:audio_manager.cc(293)] Multiple instances of AudioManager detected
[0613/154943.108875:WARNING:audio_manager.cc(254)] Multiple instances of AudioManager detected
[0613/154943.109345:VERBOSE1:webrtc_internals.cc(106)] Could not get the download directory.
Trace/breakpoint trap
[root#vm_1 ~]# google-chrome-stable --version
[root#vm_1 ~]# Google Chrome 59.0.3071.86
Here is my folder structure:
[root#vm_1 ~]# ls -la
total 56
dr-xr-x---. 12 root root 4096 Jun 13 15:23 .
dr-xr-xr-x. 17 root root 4096 Jun 13 13:42 ..
-rw-------. 1 root root 1116 Dec 24 2015 anaconda-ks.cfg
drwx------. 3 root root 16 Jan 22 10:10 .ansible
-rw-------. 1 root root 18800 Jun 13 14:59 .bash_history
-rw-r--r--. 1 root root 18 Dec 28 2013 .bash_logout
-rw-r--r--. 1 root root 176 Dec 28 2013 .bash_profile
-rw-r--r--. 1 root root 176 Dec 28 2013 .bashrc
drwx------. 3 root root 16 Oct 24 2016 .cache
drwx------. 3 root root 26 Jun 13 2017 .config
-rw-r--r--. 1 root root 100 Dec 28 2013 .cshrc
drwxr-xr-x. 2 root root 6 Jun 13 2017 download
drwxr-xr-x. 2 root root 6 Jun 13 2017 Download
drwxr-xr-x. 2 root root 6 Jun 13 2017 downloads
drwxr-xr-x. 2 root root 6 Jun 13 2017 Downloads
drwxr-xr-x. 3 root root 18 Jun 13 2017 .local
drwxr-----. 3 root root 18 Dec 24 2015 .pki
drwx------. 2 root root 28 Jan 22 10:09 .ssh
-rw-r--r--. 1 root root 129 Dec 28 2013 .tcshrc
-rw-r--r-- 1 root root 228 Jun 13 15:23 test.py
[root#vm_1 ~]#
I found an answer to this here:
https://bugs.chromium.org/p/chromium/issues/detail?id=695212
The fix is to install the google font package:
$ sudo yum install gnu-free-sans-fonts
Then this should work:
$ google-chrome --headless --disable-gpu --enable-logging -v=10 --screenshot=out.png http://www.chromestatus.com

Unable to deploy app due to wrong permissions in some files

Its been a while since i had to modify an application. Today doing another deploy I got
Counting objects: 16, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (16/16), 1.44 KiB | 0 bytes/s, done.
Total 16 (delta 11), reused 0 (delta 0)
remote: Stopping Cron cartridge
remote: CLIENT_RESULT: cron scheduling service is already disabled for gear <<OPENSHIFHASH>>
remote: Stopping PHP 5.4 cartridge (Apache+mod_php)
remote: Stopping PHPMyAdmin cartridge
remote: Operation not permitted - /var/lib/openshift/<<OPENSHIFHASH>>/app-deployments/2016-09-25_11-55-15.153/repo/utils/PkgInfo.pyc
To ssh://<<OPENSHIFHASH>>#<<APP>>.rhcloud.com/~/git/app.git/
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://<<OPENSHIFHASH>>#<<APP>>.rhcloud.com/~/git/app.git/'
Then I logged in using ssh and I found out that in fact that file PkgInfo.pyc is own by root when in fact should be owned by the app
like this
-rw-------. 1 <<OPENSHIFHASH>> <<OPENSHIFHASH>> 2929 Sep 25 11:55 HashCache.pyc
-rw-------. 1 <<OPENSHIFHASH>> <<OPENSHIFHASH>> 0 Sep 25 11:55 __init__.py
-rw-------. 1 root root 101 Oct 23 00:10 __init__.pyc
-rw-------. 1 <<OPENSHIFHASH>> <<OPENSHIFHASH>> 8991 Sep 25 11:55 MultiPart.py
-rw-------. 1 <<OPENSHIFHASH>> <<OPENSHIFHASH>> 8051 Sep 25 11:55 MultiPart.pyc
-rw-------. 1 <<OPENSHIFHASH>> <<OPENSHIFHASH>> 646 Sep 25 11:55 PkgInfo.py
-rw-------. 1 root root 613 Oct 23 00:10 PkgInfo.pyc
-rw-------. 1 <<OPENSHIFHASH>> <<OPENSHIFHASH>> 6607 Sep 25 11:55 Progress.py
Why would that file changed the owner? That file was updated on Oct, the 23 but me (as the app) I'm not able to change them to root
any idea?
I believe I have the same issue though with different cartridges/application architecture so the error log is different. OpenShift help suggested to file a bug about it.
My current workaround uses manual deployments:
Disable auto deployment with $ rhc app-configure <YOUR_APP> --no-auto-deploy
$ git push origin
$ ssh <YOUR_APP>#<YOUR_APP>.rhcloud.com
$ gear build
Run gear start for all your cartridges - make sure that they run successfully
This is not optimal but hope it helps.

Neo4j - Couldn't load the external resource at: file:

I am using ubuntu 14.04 and trying to import csv file but getting following error - Couldn't load the external resource at: file:/usr/share/neo4j/import/orders.csv
My query is -
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///orders.csv" AS row
MATCH (order:Order {orderId: row.SalesOrderID})
MATCH (product:Product {productId: row.ProductID})
MERGE (order)-[pu:PRODUCT]->(product)
ON CREATE SET pu.unitPrice = toFloat(row.UnitPrice), pu.quantity = toFloat(row.OrderQty);
I have placed csv files at /var/lib/neo4j/import and also changed permission sudo chmod 777 -R /var/lib/neo4j/import but still not working.
file permissions are as -
sachin#sachin:/var/lib/neo4j$ ls -la
total 28
drwxr-xr-x 7 neo4j adm 4096 Aug 31 10:10 .
drwxr-xr-x 76 root root 4096 Aug 30 19:33 ..
drwxr-xr-x 2 neo4j nogroup 4096 Aug 31 10:10 certificates
drwxr-xr-x 4 neo4j adm 4096 Aug 31 10:10 data
drwxrwxrwx 2 neo4j adm 4096 Aug 31 11:16 import
drwxr-xr-x 2 neo4j nogroup 4096 Aug 31 10:10 .oracle_jre_usage
drwxr-xr-x 2 neo4j adm 4096 Jul 28 09:19 plugins
Please help!!! Thanks.
okay , I've resolved it by creating new directory import under /usr/share/neo4j , place csv files in this directory and set its permission to 777.
Explanation Since my error was Couldn't load the external resource at: file:/usr/share/neo4j/import/orders.csv and I placed my csv files at /var/lib/neo4j/import. Hope it will help others,Thanks.

Cannot clone repository ("Operation not permitted: <workspace_folder>/<project_name>/.hg/requires")

Sorry in advance for my bad english...
I'm trying to clone an hg repository using Eclipse on Ubuntu.
I always have the following error message which is exactly the same when I perform a "hg clone" command :
"Operation not permitted: <workspace_folder>/<project_name>/.hg/requires"
Here is the /.hg content :
ls -al .hg/
total 40K
drwxrwxr-x 4 www-data web 4.0K Apr 18 09:33 .
drwxrwxr-x 3 www-data svn 4.0K Mar 5 17:52 ..
-rwxrwxr-x 1 www-data web 57 Mar 5 17:48 00changelog.i
drwxrwxr-x 2 www-data web 4.0K Apr 18 09:33 cache
-rwxrwxr-x 1 www-data web 40 Mar 5 17:51 dirstate
-rwxrwxrwx 1 www-data web 40 Apr 18 21:45 requires
drwxrwxr-x 3 www-data web 4.0K Apr 18 09:33 store
-rw-rw-r-- 1 nico web 0 Apr 18 09:33 undo.bookmarks
-rw-rw-r-- 1 nico web 7 Apr 18 09:33 undo.branch
-rw-rw-r-- 1 nico web 38 Apr 18 09:33 undo.desc
-rw-rw-r-- 1 nico web 40 Apr 18 09:33 undo.dirstate
And here is the /.hg/requires file content :
revlogv1
store
fncache
dotencode
Here is the output of the hg clone command :
running ssh nico#www.there.com "hg -R /var/dev/projects/my_hg_project serve --stdio"
sending hello command
sending between command
nico#www.there.com's password:
remote: 145
remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
remote: 1
destination directory: my_hg_project
abandon : Operation not permitted : /media/data/workspaces/my_workspace/my_hg_project/.hg/requires
I tried many things such as chmod and chown... I'm not a linux expert so I googled my error message but there is not many results.
Has anyone an idea about this?
Thank you very much in advance
You're right to be thinking file permissions because that's the root cause, but I'm a little confused. Are you showing up the file permissions on the server, but seeing that message on the your workstation? Where exactly are you trying to clone from and to? Are you cloning over http or ssh? What user are you running the clone command as?