Disabling folder cache on Raspbian Linux SMB share - linux

On my desktop I added a shorctut to my bat file, which I can run with CTRL+F10 key-presses.
del z:\WVW_LAUNCH\WVW_LAUNCH
E:\upx-4.0.1-win64\upx.exe E:\WVW_RPI3_EQ_CROSS\WVW_LAUNCH
copy E:\WVW_RPI3_EQ_CROSS\WVW_LAUNCH z:\WVW_LAUNCH\
pause
Z:\ is the SMB share on my Raspberry Pi.
This is using an exe packer, and it works fine, except, that when I switch my KVM switch to my RPi, to execute it, it says:
sudo: unable to execute ./WVW_LAUNCH: Text file is busy
Then I have to wait approximately 5 to 10 seconds before I can run the executable.
QUESTION: Does anybody know how to disable the cache in my /home/pi/WVW_LAUNCH directory? (so I do not have to wait).
How to disable cache on Linux, over Samba share.

Related

xcopy, net use not working from Linux machine

I am trying to copy files from windows server to network shared folder via VPN . Here is my code from batch file. This is working fine without any issues.
net use \\servername\test_folder password /user:user_name
xcopy C:\Apache\htdocs\arul\xias \\servername\\test_folder
But when I try to run this from Linux machine it is not working. This Linux machine is also connected to network shared folder via VPN. So I tried below on Linux machine in .sh file.
net use \\servername\test_folder password /user:user_name
cp C:\Apache\htdocs\arul\xias \\servername\\test_folder
I am getting errors like net command is not found and cp: -r not specified;
How to achieve this from Linux machine ?
The commands "net use" and "xcopy" are specific to Windows and will newer work on linux.
You should use some smb specific commands instead (of course, the kernel must support them).

Centos 7 Emergency Mode infinite error

I cant boot my linux machine due to /etc/fstab having bad lines of code. Currently my machine will attempt to boot and will infinitely loop the message "Welcome to Emergency Mode!..." . I can't get to the console or login.
Hitting escape at the start up screen and entering the rescue mode does not work either. Using grub2 i can see my fstab file via : cat (lvm/centos-root)/etc/fstab.
How can i edit this file and remove the bad lines of code?
Boot from a live DVD, or boot in rescue mode from the installation disk. If necessary (it probably won't be), manually mount the main system's root partition somewhere (e.g. /mnt/rescue). Edit /mnt/rescue/etc/fstab appropriately. Perform a clean reboot.

Raspberry Pi stuck on script at startup

I wanted to have my Raspberry Pi update the system clock from a GPS on start up but now something has gone wrong and I can't login.
I created a bash script that calls 'sudo -i' and a few other gpsd related instructions. I pointed the /etc/profile towards the script. If I Ctrl+C to get to a prompt I get root access but the directories are listing nothing when I use the 'ls' command. If I exit from root I get stuck again. I figure that if I could delete the bash script the problem would go away but I don't know how to view that partition of the SD card on a PC. Any suggestions?
Ok, I solved the problem. There is a ext4 partition editor called ExtFS for Windows. You can view and edit an ext4 partition easily in this program. You can download it here.

Stop Raspberry Pi from running program at boot

I was trying to figure out how to run a program at boot, but after realizing this program is an infinite loop, I have no way of getting out, or back to the terminal. Right when I give the Pi power it just goes right to the program on a black background. I don't remember exactly what I did to make it run at boot, I believe I just added some code in a place right above something that said "exit 0" and below something that says "esac". I don't remember the command that even got me there. (I am new to the Pi and Python and have just been playing around..unsucessfully.)
If anyone could help me either delete this program or get me to be able to edit it so I can fix the infinite loop that would be great. I'd rather not have to completely over-write the sd card with a fresh raspbian. But like I said I can't do anything at boot, and Ctrl + C doesn't do anything nor Ctrl + Alt + Delete.
EDIT: When I put the SD card in my computer, I see a list of 11 files:
bootcode
cmdline
config
fixup
fixup_cd
issue
kernel
kernel_cutdown
kernel_emergency
start.elf
start_cd.elf
None of these mean anything to me...
Update: Looks like I failed to get that you want to interrupt the running bootprocess and stop the script.
The simplest idea would be to turn of the pi, unplug the sd card and plug it into your desktop, (re)move the script and boot again.
Processes spawned during boot are stored in scripts in /etc/init.d/.... These scripts are called by the init process, the first process on a Linux machine (PID:1)
But init starts not all scripts in /etc/init.d. This depends on the run level. On a debian system there are 7 run levels.
For every run level there is a folder called like:
/etc/rc0.d
...
/rc6.d
in which are softlinks to scripts from /etc/init.d are stored.
To remove a script from being executed on every boot you'll delete all links from that folders. Usually on debian systems this is done using the update-rc.d tool:
update-rc.d NAME_OF_INIT_SCRIPT remove
You should also have a look at the file /etc/rc.local
Alt + PrintScn + k to kill the process stuck running from rc.local
You can use the cmdline.txt.
First, add or modify the cmdline.txt file on your sd card. Add "init=/bin/sh", then restart your Pi, and you can see a command line prompt.
Type 'sudo nano /etc/rc.local' to edit the file, and comment or delete the line containing the error. After that restart.
I had exactly the same issue, couldn't quit the process using CTRL+C. I edited the cmdline.txt like stated above, but then the pi didn't load the necessary usb drivers for my keyboard.
So eventually I logged in over SSH to the pi, and modified my rc.local file that way.
In my case worked combination "Alt" + "F4", it stops the current session and opens the login screen
I had the same problem as explained at the beginning of this Post. My Python app was caught in an endless loop.
I tried the Ctrl+Alt+F2 Command as recommended in many posts found in Internet without any terminal window being open. Apparently, after many other trials and reboots I saw a glimpse of a Terminal window each time the loop of my application restarted. It was impossible to catch anything until I started recording the screen using the slow motion video of my mobile phone and, yes, a terminal window with the Linux prompt was active, and able to accept keyboard entries.
All I did was (almost blindly) editing the culprit file with the
sudo nano filename command
and entering some characters in order to actually corrupt such file, saving and closing it, a rebooting the Pi.
At the end of the boot, the file produced an error but the system kept ready to operate.
I was then able to fix the bug in a normal way.
It hope this may be useful to others. In my case it spared me of burning a new Raspbian and losing all my previous work.
I got myself stuck in exactly the same problem. Luckily I had the ssh enabled, apparently this is disabled by default on Raspbian Jessie, so this may not work for all.
The exit 0 is the line in /etc/rc.local where you would have added in the script that is now running in a continuous mode. If you can ssh into the Pi using Putty and the Pi's IP address then
sudo nano /etc/rc.local
Scroll down to the bottom of the file and remove the offending program, then sudo reboot
They way to prevent this issue from happening is to add an & (ampersand) to the end of the line to fork the process and run it as a separate process like so
python /home/pi/myscript.py &
as specified in https://www.raspberrypi.org/documentation/linux/usage/rc-local.md
The ampersand allows the command to run in a separate process and continue booting with the process running.

Eject CD-ROM Drive after application Installation

I have an application in Linux that installs from a CD-ROM Device.
When the CD-ROM is inserted into the Drive, the autorun feature runs the installation script in an xterm window. Now when the installation is over, I do an 'exit 1' , and the xterm window prompts the user to 'press any key to close the window'. My problem is that I would like the script to eject the CD-ROM Drive after the Installation is over.
However since the installation script is still running from the CD-ROM Drive, the script cannot unmount the CD-ROM Drive and eject the Drive.
Could any please give me some idea of how the script could possibly eject the CD-Drive after Installation?
You could use a local installation script that refers to the installation files on the CD. That does mean your user will have to copy the file locally in order to start running the installation program.
Another option could be that your installation program could create the supplementary install file when the user starts the install process from CD.
Before the installer starts, copy the installer and an "eject CD" shell script to the /tmp directory on the Linux machine. Then, execute the installer from /tmp and create a shell script that executes, or find a way to execute, the following commands:
sudo umount /dev/cdrom
eject /dev/cdrom
Also, on some machines it's sudo umount /dev/sr0, but /dev/cdrom should work.

Resources