make qemu on xv6-riscv gets stucked at qemu-system-riscv64 ... command - xv6

On Ubuntu 20.04, I installed the xv6 project using the page Tools Used in 6.828
$ sudo apt-get install git build-essential gdb-multiarch qemu-system-misc gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu
The file version that they checked on the web page are
$ riscv64-unknown-elf-gcc --version
riscv64-unknown-elf-gcc () 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ qemu-system-riscv64 --version
QEMU emulator version 5.2.50 (v5.2.0-2349-g51db2d7cf2)
Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers
On xv6-riscv
$ make qemu
# ... lots of output ...
qemu-system-riscv64 -machine virt -bios none -kernel kernel/kernel -m 128M -smp 3 -nographic -drive file=fs.img,if=none,format=raw,id=x0 -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
The program get stuck there. The vm is not booted and no prompt is shown.
Any ideas on how to fix this are welcomed.

This has been mentioned in Tools Used in 6.S081
At this moment in time, it seems that the package qemu-system-misc has received an
update that breaks its compatibility with our kernel. If you run make qemu and the
script appears to hang after
qemu-system-riscv64 -machine virt -bios none -kernel kernel/kernel -m 128M -smp 3
nographic -drive file=fs.img,if=none,format=raw,id=x0 -device virtio-blk
device,drive=x0,bus=virtio-mmio-bus.0
you'll need to uninstall that package and install an older version:
$ sudo apt-get remove qemu-system-misc
$ sudo apt-get install qemu-system-misc=1:4.2-3ubuntu6

Related

RSK node on an Apple M1 chip architecture?

Following these instructions
to install the RSK node on an 2021 MBP with Apple M1 Pro chip.
I would like to run an RSK node locally in regtest mode.
After installation, running the command to start RSKj:
java \
-classpath ~/.rsk/rskj-core-3.1.0-IRIS-all.jar \
-Drpc.providers.web.cors=\* \
-Drpc.providers.web.ws.enabled=true \
co.rsk.Start \
--regtest
... results in the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no leveldbjni in java.library.path, /private/var/folders/40/k7t383452q75nkmr_5kl12_80000gn/T/libleveldbjni-64-8276576211622720497.jnilib: dlopen(/private/var/folders/40/k7t383452q75nkmr_5kl12_80000gn/T/libleveldbjni-64-8276576211622720497.jnilib, 0x0001): tried: '/private/var/folders/40/k7t383452q75nkmr_5kl12_80000gn/T/libleveldbjni-64-8276576211622720497.jnilib' (fat file, but missing compatible architecture (have 'x86_64,i386', need 'arm64e')), '/usr/lib/libleveldbjni-64-8276576211622720497.jnilib' (no such file)]
at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:182)
at org.fusesource.hawtjni.runtime.Library.load(Library.java:140)
at org.fusesource.leveldbjni.JniDBFactory.<clinit>(JniDBFactory.java:48)
at org.ethereum.datasource.LevelDbDataSource.init(LevelDbDataSource.java:104)
at org.ethereum.datasource.LevelDbDataSource.makeDataSource(LevelDbDataSource.java:70)
at co.rsk.RskContext.buildTrieStore(RskContext.java:1031)
at co.rsk.RskContext.buildAbstractTrieStore(RskContext.java:951)
at co.rsk.RskContext.getTrieStore(RskContext.java:408)
at co.rsk.RskContext.buildRepositoryLocator(RskContext.java:1073)
at co.rsk.RskContext.getRepositoryLocator(RskContext.java:384)
at co.rsk.RskContext.getTransactionPool(RskContext.java:353)
at co.rsk.RskContext.buildInternalServices(RskContext.java:844)
at co.rsk.RskContext.buildNodeRunner(RskContext.java:836)
at co.rsk.RskContext.getNodeRunner(RskContext.java:302)
at co.rsk.Start.main(Start.java:34)
Looks like the most likely problem is an incompatibility of something within RSKj with my chip architecture.
Is there a workaround that will allow RSKj to run with an M1 chip?
You can try to use Rosetta to run x86 code on M1. Just add arch -x86_64 at the begin of your command.
arch -x86_64 java \
-classpath ~/.rsk/rskj-core-3.1.0-IRIS-all.jar \
-Drpc.providers.web.cors=\* \
-Drpc.providers.web.ws.enabled=true \
co.rsk.Start \
--regtest
You are right, the problem is with the leveldbjni dependency, which is not running on aarch64 architecture. However, one can get around this limitation by running RSK node in a Docker container.
This process is described in detail in the Docker installation instructions on the RSK devportal.
Summary:
You can install Docker running
brew install --cask docker
Register a free Docker account, login to your installed desktop app and then in the terminal run
docker run rsksmart/rskj-standalone
Then you should download Dockerfile.RegTest and supervisord.conf from artifacts repo and in the same folder execute:
docker buildx build --platform linux/amd64 -t regtest -f Dockerfile.RegTest .
When the build finishes, you have a container ready to run RSK. To run the container, you should execute
docker run -d --name regtest-node-01 -p 4444:4444 -p 30305:30305 regtest
Now your local test RSK node will be running ready for testing your smart contracts.

How to mount vmware shared folders in WSL2

I have a Mac, and install a Win10 VM by vmware fusion, the shared folders between Mac and Win10 VM use drive letter Z: or \vmware-host
And I mapped a network address \192.168.111.49\Builds to drive letter Y:
Then I install WSL2 in the Win10 VM, and linux subsystem Ubuntu 20.04 LTS
I want to mount all drive letter in Ubuntu, C: is automatically mount /mnt/c
And i use these cmd to mount Y:
sudo mkdir /mnt/y
sudo mount -t cifs -o username=xxx,password=xxxx,domain=xxx //192.168.111.49/Builds /mnt/y
It's OK
However, when I try mount Z:, it's not work
# from vmware official site
$ sudo vmhgfs-fuse -d .host:/ /mnt/z -o subtype=vmhgfs-fuse,allow_other
Segmentation fault (core dumped)
# try to use drvfs
$ sudo mount -t drvfs Z: /mnt/z
mount: /mnt/z: special device Z: does not exist.
<3>init: (457) ERROR: UtilCreateProcessAndWait:489: /bin/mount failed with status 0x2000
<3>init: (457) ERROR: MountPlan9:478: mount cache=mmap,rw,trans=fd,rfdno=3,wfdno=3,msize=65536,aname=drvfs;path=Z:;symlinkroot=/mnt/ failed 2
No such file or directory
# like network address
$ sudo mount -t cifs -o username=xxx,password=xxx //vmware-host/ /mnt/z
mount: /mnt/z: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
And I check my open-vm-tools version
$ sudo apt-get upgrade open-vm-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
open-vm-tools is already the newest version (2:11.1.5-1~ubuntu20.04.2).
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
It's already newest.
Any help? Thanks.
I found the reason is I run cmd or powershell as administrator
If I don't use administator, the following mount is OK
sudo mount -t drvfs Z: /mnt/z

Why does ir-keytable quit?

To set IR on my clean Raspberry Pi 4, I am following the instructions at https://learn.pi-supply.com/make/ir-remote-control-support-on-raspbian-buster-justboom/.
One step at the beginning, even before installing lirc package, is to install and run ir-keytable:
$ sudo apt install ir-keytable
$ sudo ir-keytable
This command shows that my driver is gpio_ir_recv and the device is /dev/lirc1. Perfect.
Next, I run the command to test receiving IR signals:
$ sudo ir-keytable -c -p all -t
However, this command quits as soon as it is run. There are no new messages in /var/log/ folder either.
Wondering why this command would simply quit.
Note that lirc package as not yet been installed. As per the article, this step comes later.

Error OpenOCD debugging on ATSAMA5D36 Xplained board:

I'm trying to flash on ATSAMA5D36 Xplained board using OpenOCD.
I builded and compiled application and want to debug using OpenOCD. When I am doing that I get the following error.
Openocd verson:
openocd-0.9.0.tar.gz
root#Harsha:/home/harsha/openocd_bin# openocd -f
interface/ftdi/ngxtech.cfg -f target/sama5d36.cfg Open On-Chip Debugger 0.10.0+dev-00556-gd0be163-dirty (2018-10-25-18:04) Licensed under GNU GPL v2
For bug reports, read http://openocd.org/doc/doxygen/bugs.html WARNING!
This file was not tested with real interface, but is assumed to work as this
interface uses the same layout as configs that were verified. Please report your
experience with this file to openocd-devel mailing list, so it could be marked
as working or fixed.
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain
connect_deassert_srst
adapter speed: 1500 kHz
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
embedded:startup.tcl:21: Error: target requires -dap parameter instead of -chain-position!
in procedure 'script'
at file "embedded:startup.tcl", line 60
in procedure 'target' called at file "target/sama5d36.cfg", line 46
in procedure 'ocd_bouncer'
at file "embedded:startup.tcl", line 21
Steps Followed:
$ sudo apt-get install build-essential
$ sudo apt-get install automake
$ sudo apt-get install autoconf
$ sudo apt-get install texinfo
Build:
$ cd openocd-r520/
$ ./bootstrap
$ ./configure --enable-ft2232_ftd2xx
$ make
$ sudo make install
I'm using a JTAG adapter based on the FT2232 chip, FTDI support library.
$ wget http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx0.20.0 .tar.gz
$ tar -zxf libftd2xx0.20.0tar.gz
$ sudo cp *.h /usr/local/include/
$ sudo cp libftd2xx.so.0.20.0 /usr/local/lib/
$ cd /usr/local/lib/
$ sudo ln -s libftd2xx.so.0.20.0 libftd2xx.so
$ sudo ln -s libftd2xx.so.0.20.0 libftd2xx.so.0
$ cd /usr/lib/
$ sudo ln -s /usr/local/lib/libftd2xx.so.0.20.0libftd2xx.so.0
$ sudo mount -a
-I am not able to figure out the issue, I only know this details. Any help will be appreciated.
Thanks in Advance

clGetPlatformIDs(): CL_PLATFORM_NOT_FOUND_KHR Hashcat

i am trying to run hashcat on my Zen Archlinux i am on the 4.15.4-1-zen kernel version. I have an NVIDIA geforce 920MX and an intel i6189DU.
i installed the latest nvidia-dkms drivers and as well as the opencl-nvidia package.
I also installed the latest Hashcat version.
When i run the hashcat command i get this error :clGetPlatformIDs(): CL_PLATFORM_NOT_FOUND_KHR.
I used a tool to determin the openCL platforms available clinfo and the output only shows my CPU platform not my GPU yet the hashcat command still outputs the same erro.
Any help ?
Fellow Archer here, I found a way to fix the broken hashcat as you can see:
$ hashcat -b
hashcat (...) starting in benchmark mode...
clGetPlatformIDs(): CL_PLATFORM_NOT_FOUND_KHR
ATTENTION! No OpenCL-compatible or CUDA-compatible platform found.
You are probably missing the OpenCL or CUDA runtime installation.
$ pacman -S clinfo
$ clinfo
Number of platforms 0
One way to fix it is to install pocl (Portable OpenCL is an open-source implementation of OpenCL):
$ pacman -S pocl
$ clinfo
Number of platforms 1
Platform Name Portable Computing Language
Platform Vendor The pocl project
...
$ hashcat -b
hashcat (...) starting in benchmark mode...
OpenCL API (...) - Platform #1 [The pocl project]
=========================================================================================================================
* Device #1: pthread-Intel(R) ...
Benchmark relevant options:
===========================
* --optimized-kernel-enable
Hashmode: 0 - MD5
Speed.#1.........: ...
...
Happy cracking! ( ͡° ͜ʖ ͡°)
Linuxmint 22.1:
sudo apt-get install pocl-opencl-icd

Resources