Is the VxWorks file system corrupted and is it possible to fix it? - vxworks

I have a device with VxWorks 5 connected via a serial port. The device doesn't boot properly, but I can get access to its CLI via PuTTY. OS looks working, for example I can get a list of tasks by the "i" command. But I can't get any information about file system.
The "ls" command returns an error:
-> ls
Can't open ".".
value = -1 = 0xffffffff
The "pwd" command returns nothing:
-> pwd
value = 1 = 0x1
The "chkdsk" command just doesn't work:
-> chkdsk
errno = 0xc0007
value = -1 = 0xffffffff
Does it mean that the file system is corrupted? Is there any chance to re-flash such device?

Related

Gem5,computer architecture

I am trying to run gem5 in FS mode by using command as : "build/ARM/gem5.opt configs/example/fs.py --disk-image=/home/coep/gem5%202/full_system_images/aarch32-ubuntu-natty-headless.img --arm=/home/coep/gem5 2/full_system_images/vmlinux.arm.smp.fb.3.2/vmlinux.arm.smp.fb.3.2"
and getting error as : "Usage: fs.py [options] fs.py: error: option --arm-iset: invalid choice: '/home/coep/gem5' (choose from 'arm', 'thumb', 'aarch64')"
please help me to solve this error.
Thank you.
I assume the --arm=/home/coep/gem5...vmlinux.arm.smp.fb.3.2 argument specifies the path to the guest kernel, in which case it should be --kernel=...:
build/ARM/gem5.opt \
configs/example/fs.py \
--disk-image=/home/coep/gem5\ 2/full_system_images/aarch32-ubuntu-natty-headless.img \
--kernel=/home/coep/gem5\ 2/full_system_images/vmlinux.arm.smp.fb.3.2/vmlinux.arm.smp.fb.3.2
Arguments and their explanations are found in configs/common/Options.py
There can be multiple reasons why are getting this error, One of them can be an incorrect path to the disk image files.
I have run the gem5 in the FS mode and have booted Linux on top of it on Ubuntu 18.04 LTS
You can follow the below steps, the first step is to download and install the full-system binary and disk image files.
1. $ mkdir full_system_image
2. $ cd full_system_image/
3. $ wget http://www.m5sim.org/dist/current/arm/aarch-system-2014-10.tar.bz2
4. $ tar jxf aarch-system-2014-10.tar.bz2
5. $ echo "export M5_PATH=/Path to the full_system_image directory/full_system_images/" >> ~/.bashrc
6. $ source ~/.bashrc
7. $ echo $M5_PATH (- check if the path is set correct)
Now the path has been set, the next step is to run the gem5 in FS mode.
1. connect to gem5 base directory
2. $ ./build/ARM/gem5.opt configs/example/fs.py --disk-image=/home/full_system_image/disks/aarch32-ubuntu-natty-headless.img
3. Note: --disk-image=path to the full_system_image/disks/aarch32-ubuntu-natty-headless.img
4. open a new terminal and listen to port 3456
5. $ telnet localhost 3456
6. Here 3456 is a port number on the gem5 terminal
7. this will take around 30 mins depending on the machine performance.
8. After this, at the end you will get something like this
input: AT Raw Set 2 keyboard as /devices/smb.14/motherboard.15/iofpga.17/1c060000.kmi/serio0/input/input0
input: touchkitPS/2 eGalax Touchscreen as
/devices/smb.14/motherboard.15/iofpga.17/1c070000.kmi/serio1/input/input2
kjournald starting. Commit interval 5 seconds
EXT3-fs (sda1): using internal journal
EXT3-fs (sda1): mounted filesystem with writeback data mode
VFS: Mounted root (ext3 filesystem) on device 8:1.
Freeing unused kernel memory: 292K (806aa000 - 806f3000)
random: init urandom read with 14 bits of entropy available
Ubuntu 11.04 gem5sim ttySA0
9. login as root
Voila, you have run the gem5 in FS mode.

vscode cant ssh connect "The process tried to write to a nonexistent pipe"

I am able to ssh on my windows 10 computer using ubuntu subsystem when I run the command:
/mnt/c/Users/marti/Downloads$ sudo ssh -i credfile.pem ec2-user#3.333.33.333
Where I have a file located at /mnt/c/Users/marti/Downloads/credfile.pem
I am trying to get VSCode's ssh extension to work but it keeps failing with an error "The process tried to write to a nonexistent pipe"
In my vscode settings it points to my ssh config file:
In order to connect I click the green bottom left corner of my vscode window and select the first option 'remote-ssh connect current window to host'
I paste in my command, hit enter, it prompts me to choose either mac/win/linux and I pick linux.
But it then just leads to an error saying it tried to write to a nonexistent pipe?
[20:50:27.876] "install" terminal command done
[20:50:27.877] Install terminal quit with output: The process tried to write to a nonexistent pipe.
[20:50:27.877] Received install output: The process tried to write to a nonexistent pipe.
[20:50:27.883] Resolver error: Error: The process tried to write to a nonexistent pipe
Is there something else I need to setup or change for my vscode ssh connection to work?
Instead of pasting your command, you should code the same command in your .ssh/config file.
Add in it:
Host ec2
Hostname 3.333.33.333
User ec2-user
IdentityFile C:\path\to\credfile.pem
Then you will be able to select the entry 'ec2' after selecting 'remote-ssh connect current window to host'

Expect: How to use "ls -d filename" for full path name in expect?

I am trying to automate loading of image on the hardware using expect. For that I need to get full path of the image.
I am using the following syntax -
spawn ls -d $env(PWD)/build/image/bmxs.*bin
expect -re {(\S+)(\r)}
set imgpath $expect_out(1,string)
The message I get is -
spawn: returns {51875}
expect: does "" (spawn_id exp4) match regular expression "(\S+)(\r)"? no
So, it appears that the spawn does not return anything.
I've tried various syntaxes, but no use -
send "ls -d $env(PWD)/build/images/final/nxos.*bin\r"
spawn "ls -d $env(PWD)/build/image/bmxs.*bin"
puts "$LS" ### where $LS is the command.
None of these work. Am I making a mistake?
Your code suggests that
the image file is local - on same machine where you run Expect
You want the first file which matches the pattern
If this is so, you can just do
set files [glob $env(PWD)/build/image/bmxs.*bin]
set imgpath [lindex [lsort $files] 0]
On the other hand, the phrase "on the hardware" suggests that this image file is on some remote system. If so, and you already have spawned a login session there, you need to send the ls command on the existing session and then expect the output from ls. However in that case it looks strange to get the directory from $env(PWD)" as this will read the environment variable PWD on your local machine.

Not able to mount azure file share into local RHEL7 VM

I want to mount(symlink) from Azure file share to a local RHEL7 VM . I am using the following command
mount -t cifs //<storage-account-name>.file.core.windows.net/<share-name> /mymountpoint -o vers=3.0,username=<storage-acc-name>,password=<pwd>,dir_mode=0777,file_mode=0777,sec=ntlmssp,mfsymlinks
but getting the following error
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
`The dmesg | tail gives the following log
[root#googleapps ~]# dmesg | tail
[98383.619149] fs/cifs/smb2misc.c: SMB2 data length 0 offset 0
[98383.619151] fs/cifs/smb2misc.c: SMB2 len 77
[98383.619163] fs/cifs/transport.c: cifs_sync_mid_result: cmd=1 mid=1 state=4
[98383.619168] Status code returned 0xc0000022 STATUS_ACCESS_DENIED
[98383.619175] fs/cifs/smb2maperror.c: Mapping SMB2 status code -1073741790 to POSIX err -13
[98383.619177] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[98383.619181] CIFS VFS: Send error in SessSetup = -13
[98383.619185] fs/cifs/connect.c: CIFS VFS: leaving cifs_get_smb_ses (xid = 59) rc = -13
[98383.619297] fs/cifs/connect.c: CIFS VFS: leaving cifs_mount (xid = 58) rc = -13
[98383.619300] CIFS VFS: cifs_mount failed w/return code = -13`
Try removing the Symlink option then manually linking it afterwards. I did a quick test on my machine, a RHEL V7 (Brand new for testing) on Azure, and linked a file share with it using the following steps:
1- Manually create the mount point dir, then run the following:
sudo yum install cifs-utils
sudo mount -t cifs //USERNAME.file.core.windows.net/FILESHARE ~/mountpoint/ -o vers=3.0,username=<>,password=<>,dir_mode=0777,file_mode=0777,sec=ntlmssp
Then try using the symlink afterwards.
I had the similar problem. Read most of the forums tried all in the end found that password used by me was wrong and it has to be SSH key which is generated with storage account. I got hint to this by using trouble shooting script by Azure support.
You can find this script here :
https://gallery.technet.microsoft.com/Troubleshooting-tool-for-02184089
Bash script found here can be used to go through series of probable issues and will give you a fair idea of the problem.
Sometimes you will get Status code returned 0xc0000022 STATUS_ACCESS_DENIED if you do not have the proper "Public network access" setting.
Set this setting to "All networks" or add your Server IP/CIDR to the firewall exclusion list.

Cygwin ssh not setting DISPLAY correctly (extra :0)

I am using Cygwin on Windows 7 to connect to a unix (RHEL 6) server via SSH. When I do so, X forwarding is not being set correctly:
(Starting from Cygwin xterm on the Windows machine)
> echo $DISPLAY
:0
> ssh -Y myname#rhel.server.com
[enter password]
> echo $DISPLAY
localhost:52.0:0
If I now try to start any windowed process, I get an error message:
> emacs
emacs: Cannot connect to X server localhost:52.0:0.
Check the DISPLAY environment variable or use '-d'.
Also use the 'xhost' program to verify that it is set to permit connections from your machine.
Additional Details
The number that follows 'localhost' (52 in the example above) is different each time I connect.
If I do the following,
> export DISPLAY=localhost:52.0
(that is, I remove the trailing ":0) then this DOES fix the issue, and the window forwarding works just fine.
So the question is: how to fix so that I do not need to manually change the DISPLAY variable with each connection?
A false alarm, much to my embarrassment. Turns out my .profile (that I had borrowed from someone else, as it contained a large quantity of useful customization for our development environment) contained these lines:
export DISPLAY
if [[ -z $DISPLAY ]]; then
DISPLAY=my.machine.addr:0
elif echo $DISPLAY | grep -z -v ':0'; then
DISPLAY=$DISPLAY:0
fi
Lo and behold, commenting out the elif branch solves the problem. May this be a lesson to us all on the dangers of copying someone else's config without knowing what it contains.