How to run uniCenta POS (Version 3.91.3) in Ubuntu 16.04? - ubuntu-16.04

I successfully installed uniCenta POS in 2 PCs: one with Ubuntu 15.10, and the other with Ubuntu 16.04, both with Spanish (Español) installations
(I downloaded and executed the installation with: unicentaopos-3.91.3-linux-x64-installer.run).
The program runs normally through the terminal with: sudo ./start.sh
Now I try to make a Desktop entry for the application:
I created a file called: Unicenta.desktop, located in: /usr/share/applications, with the content:
[Desktop Entry]
Name=Unicenta
Comment=Fires up Unicenta oPOS
Type=Application
Exec=/home/barmistias/unicentaopos-3.91.3/start.sh
Icon=/home/barmistias/unicentaopos-3.91.3/unicentaopos.ico
Terminal=false
At this stage, it doesn't create any icon & launcher (but it already should, right?)
The locations for the executable start.sh and the icon file are correct. Now, through the terminal, I try to turn the files into executables:
when I'm located in the folder: /usr/share/applications:
sudo chmod 775 ./Unicenta.desktop with ls -l I get: -rwxrwxr-x
and when I'm located in the folder: /home/barmistias/unicentaopos-3.91.3:
sudo chmod 775 ./start.sh with ls -l I get: -rwxrwxr-x
sudo chmod 777 ./unicentaopos.jar with ls -l I get: -rwxrwxrwx
Additionally, I put the right path in the start.sh file:
start uniCenta oPOS
java -cp $CP -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel -jar /home/barmistias/unicentaopos-3.91.3/unicentaopos.jar "$#"
So, it should work, but it doesn't. Additionally, if I turn the start.sh into executable by activating in properties: “Allow executing file as program”, the application launches differently (with the derby database deactivated, and unable to save a change to this setting. It only loops with the settings window, so it doesn't allow to get to the main window of the program).
So, in conclusion, how do I create a desktop icon that successfully and normally launches uniCenta POS (Version 3.91.3)?
Thanks for any help!

How do I create a desktop icon that successfully and normally launches uniCenta POS (Version 3.91.3)
Try this:
Create Unicenta.desktop in your Desktop directory (/home/barmistias/Desktop), just like you did above.
Change start.sh to launcher.sh from the Exec= line.
Create the file launcher.sh like so;
#!/bin/bash
cd /home/barmistias/unicentaopos-3.91.3/
./start.sh
Set execute permission for launcher.sh and Unicenta.desktop
Now test.
The guide was taken from this blog post
Also, searching for unicenta desktop shortcut not working solution yields helpful articles from Unicenta discussion pages and other blog posts.

Related

Bun Not Found After Running Installation Script

I have ran the installation script by pasting this code:
$ curl https://bun.sh/install | bash
However, when I try to get the version of bun, it says it could not find it:
$ bun --version
Command 'bun' not found, did you mean:
command 'ben' from deb ben (0.9.0ubuntu2)
command 'bus' from deb atm-tools (1:2.5.1-4)
command 'zun' from deb python3-zunclient (4.0.0-0ubuntu1)
Try: sudo apt install <deb name>
I had the same issue running on Windows 10 WSL2 Ubuntu-22.04 with Bun v0.1.5.
The solution (and more detail just in case anyone needs it) below:
The executable for bun is in the directory "/home/username/.bun". You need to add this to your $PATH so that this can be found when typing bun commands such as "bun --help".
The bun setup process does not add this path so you need to do it yourself.
Two ways to do this :
(1) Manual method
Type in the terminal:
export BUN_INSTALL="/home/YOUR_USERNAME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
Replacing YOUR_USERNAME with your real username (the current username can be found by typing 'whoami' in the terminal).
Note: This process will have to be REPEATED for every new shell you open.
(2) Automatic method
Edit the .bashrc file :
nano ~/.bashrc
at the end of this file add
BUN_INSTALL="/home/YOUR_USERNAME/.bun"
PATH="$BUN_INSTALL/bin:$PATH"
Replacing YOUR_USERNAME with your real username (the current username can be found by typing 'whoami' in the terminal).
(Remember to save your changes with Ctrl-O)
Note: You will NEED TO OPEN A NEW SHELL for this to work OR type 'source ~/.bashrc' to use in the current terminal.
You should now be able to run bun commands in any new shell.
The installation script says a message at the end telling you how to add bun to your PATH manually. Here is that output:
Manually add the directory to your $HOME/.bashrc (or similar)
BUN_INSTALL="/home/sno2/.bun"
PATH="$BUN_INSTALL/bin:$PATH"
I advise you re-run the installation command and copy the environment variables and add them to your PATH.
export BUN_INSTALL="/Users/manendra/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
add these to your .bashrc, .zshrc or you can use export command to use for current session.
Note: Change your username place of (manendra) "/Users/manendra/.bun"
Manually add the directory to ~/.bashrc (or similar):
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
From the installer, last message is:
To get started, run
exec /bin/zsh
bun --help

WSL2 terminal does not recognize Visual Studio Code

When I try to execute code from WSL, like this:
cmd.exe
wsl code .
I get the following error:
/bin/bash: code: command not found
However, if I execute the same command but first run cmd.exe as an Administrator, vscode opens as expected.
The question is why "code" is not recognizable when I run as non-admin, and how can I solve it?
Additional info:
WSL2 version 41959
vscode version 1.38
vscode Remote WSL extension version 0.39.5
As #Biswapriyo mentioned, this is an open bug where WSL cannot access Windows C drive.
Workaround that helped me is to restart WSL like this:
wsl --shutdown
wsl
Open the PowerShell administrator window
wsl --list --version
Show as wsl 2
Enter the Linux console
wsl
Change related files' rights
chmod u+x vscode_dir/code.exe
chmod u+x vscode_dir/bin/code
Create symbolic link
ln -s vscode_dir/bin/code code
mv code ~/.local/bin
Modify .bashrc, add a line as follows:
export PATH="$HOME/.local/bin:$PATH"
source .bashrc or restart terminal.
Then you can happily play code in wsl2-ubuntu environment or terminal of VSCode.
My problem was that I was using the root user after running sudo -i. Exiting and using my normal user on WSL solved the error.
In my case I am using Debian and echo %PATH% did not output anything.
I used the second part of suggested solution from resolved github issue
For Debian, /etc/profile contributed to this problem.
Here is the path definition in /etc/profile
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
Option 1:
You can delete above lines, then wsl --shutdown to restart Debian.
Option 2:
If you would like to keep these lines, you can also append ":$PATH" to each path like below, then wsl --shutdown
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:$PATH"
fi
Thank you to licanchua
I'd recommend checking /etc/wsl.conf to see if appendWindowsPath setting shares the Windows PATH with WSL, and also if it is specifically setting a particular user.
For the config settings, see https://learn.microsoft.com/en-us/windows/wsl/wsl-config

Setting up mongoDB raspberry pi

i just installed mongopi from https://github.com/RickP/mongopi and it working correctly after doing a few adjustments mainly $ sudo chown $USER /data/db. However my mongo and mongod calls arent persistent i do PATH=$PATH:/opt/mongo/bin/ &
export PATH however this does not last on next ssh session. Also how can I make mongo initialize at startup? I did all the steps from the github repo.
For the path part of the question:
To get the path working you should put it in a script that runs every time you log in. Generally there is a rc-file for you shell in your home directory. Type
echo $SHELL
to see what shell you are running. Go to your home directory:
cd
and then open the file that is called .(your shell)rc - that is, if you are running bash, open .bashrc
nano .bashrc
add the path at the end of this file:
PATH=$PATH:/opt/mongo/bin
export PATH
For the initialization part of the question:
Download and edit this script: Mongo init.d at github
You'll need to change the value of the DEAMON at line 50. I had some other troubles, but you should probably be ok if you create a configuration file (that probably could be empty) and refer to it from line 57. Also, you need to add a mongodb user that the server should run as. You can edit this on line 95, but the default is probably a good idea.
When all this editing is done, you move the file to /etc/init.d/mongodb, like so:
sudo mv init.d /etc/init.d/mongodb
and then add it to the systems start-up routine
sudo update-rc.d mongodb defaults
(This is presuming you run debian. Other distros may have other commands to do this.)
Now, see to that you are not running mongod some other place, and control the service by
sudo service mongodb start
service mongodb status
sudo service mongodb stop
... and so on. This will also run automatically on start-up and shutdown.

Installing Meteor - Couldn't write the launcher script

I am front-end developer attempting to crossover into the world of web app development. I've come a long way in learning Javascript, and now I'm looking to toy around with frameworks.
I still have a bit to learn about using the OSX terminal, but I was hoping somebody could help me with this first stumble I'm having....
I try to install meteor using:
$ curl https://install.meteor.com | /bin/sh
Then I get the following:
Meteor 0.6.4 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.
This may prompt for your password.
cp: /usr/local/bin/meteor: No such file or directory
Couldn't write the launcher script. Please either:
(1) Run the following as root:
cp ~/.meteor/tools/latest/launch-meteor /usr/bin/meteor
(2) Add ~/.meteor to your path, or
(3) Rerun this command to try again.
Then to get started, take a look at 'meteor --help' or see the docs at
docs.meteor.com.
If it's still helpful to anyone, going into /usr/local/bin, running "sudo rm meteor" then running the install gets it to work for me
Yeah try one of the three suggestions or:
sudo curl https://install.meteor.com | /bin/sh
I had the same problem heres how I fixed it!
Delete all meteor folders
In finder (cmd +shft+g)
type in "~/.meteor"
on the top of the finder window where is has the folder.meteor click and drag folder to trash
In finder (cmd +shft+g) type in "/usr/bin/meteor" then drag the meteor folder to trash
3.In /usr/ create a new folder "local" (password required) and inside "local" create a folder "bin"
Go back to terminal a run curl https://install.meteor.com | /bin/sh

How to get root access on Android emulator?

I have All Android SDK versions(from 1.5 to 2.3.3), and I tried many methods for getting root in Android emulator. I don't use any Android device and test everything on emulator(AVD).
I need to get root access in any one of the Android emulator to use the 'iptables' and 'busybox' functionality. And to use iptables I must have root access. Atleast 'su' command should execute in the terminal emulator.
I also installed z4root application,
But it takes very long time and doesn't finish rooting, and gets stuck. some say that if we downgrade the system to below RC30, this way we can get root access. if this is true, then how to do this? I use both Linux and Windows OS.
Please someone tell me any method to root my emulator.
If you have a virtual device with root access, this should do the job:
$ > adb shell
generic_x86:/ $
generic_x86:/ $ exit
$ > adb root
restarting adbd as root
$ > adb shell
generic_x86:/ #
If you don't, you might be interested in this answer to a different question, which explains how to create an virtual device with root access, with Google APIs (aka Google Play services), but without the Google Play app.
If you really need the Google Play app, you might be interested in other answers which instruct how to root an Android virtual device.
How to root android emulator (tested on Android 7.1.1/ Nougat)
Requirements:
SuperSU app (chainfire) latest version 2.82
Recovery flashable.zip (contains su binary) (Here is alternative backup link provided by XDA user Ibuprophen for flashable zips if the main link is not working: Flashable zip releases)
Instructions
Install the SuperSu.apk
Install the SuperSu app firstly, just do drag and drop (if running latest emulator version or sideload through adb i.e adb -e install supersu.apk)
After installing it, when you run it shows a screen as shown below indicating “There is no SU binary installed..”. This error just confirms the device is not yet rooted.
Make emulator’ system partition writable
As it suggests, we need to give the emulator permission to write system files.
Type the following code to accomplish this: emulator -avd {emulator_name} -writable-system
If you have more than one AVD, you can get a list of avds by using the command: emulator -list-avds
Note: Navigate to the tools folder where Android SDK is installed and open command prompt there by pressing shift and right clicking.
Pushing su binary in system directory
Extract the Recovery flashable.zip (containing the su binaries of different architectures)
Important! Only use the su binary that matches your avd architecture e.g x86, arm etc.., and note the path where you extracted these binaries.
Make sure you are running adb as root and also you need to remount.
Just enter these codes
adb root
adb remount
Now its time to push the su binary:
This is the code I successfully used: adb -e push C:\Users\User1\Desktop\rootemu\x86\su.pie /system/bin/su
(nevermind about my specific location of su binary, any location is okay as long there is no white space)
note: To figure out bin or xbin do in console before: > adb shell, > ls /system/xbin/su
If this fails try this pushing to this directory instead /system/xbin/su. Also for emulators running android 5.1 and below use the su and not su.pie
Change permissions of the su binary
Next let’s do a bit of modification of the permissions of su binary. We have to do this in emulator device through adb:
adb -e shell
su root
cd /system/bin
chmod 06755 su
Important!! Take note of su binary path (mine is /system/bin)
Setting the install directive on su binary and set a daemon
Type the codes:
su --install
and for setting up daemon:
su --daemon&
Important!! Take note of spacing
Setting SELinux to Permissive(i.e turning off SE Linux)
Finally turn off selinux through this code:
setenforce 0
Open SuperSU app and it may ask to update binaries, you can use Normal method.
Note: If you're experiencing bootloops, rather don't update the binaries, just use it as it is.
That’s pretty much it!!
Open any application requiring SU permissions just to double check and indeed SuperSU ask if you wish to grant it su permissions.
To have the root persist update su binary (using Normal method), then copy system.img from temp directory (Users\AppData\Local\Temp\Android Emulator the file is usually randomly named e.g 1359g.tmp with a large size) and replace default system.img.
Update:
I have noted is is easier to obtain a temporary system image in Linux, than Windows. You can try using snapshot image.
##Update 4 August 2018
With the emergence of emulator 27.3.x it now makes preserving root much easier through snapshot feature (if copying the system.img method isn't working):
Ideally it is more like hibernarig the virtual device with config intact, hence everything is preserved.
Snapshots
You can now save multiple AVD snapshots for a given device
configuration and choose which of the saved snapshots to load when you
start the emulator. Starting a virtual device by loading a snapshot is
much like waking a physical from a sleep state, as opposed to booting
it from a powered-off state.
This implies the only requirement to start the emulator is adding the -writable-system parameter to the normal emulator -avd [avdname] command to start the emulator. (Running the emulator just with emulator -avd [avdname] doesn't launch the rooted version/copy or may lead to some error)
Tested on API level 22
Also for bootloop issues see the other post: Android Emulator: How to avoid boot loop after rooting? and updates thereof.
Remarks
Most content in reference was for older android versions and hence the reason for different commands and paths which I modified.
Acknowledgements;
Irvin H: Rooting the android emulator -on Android Studio 2.3((Android 4.4)
Android AVD root access fail.
Here is the list of commands you have to run while the emulator is running, I test this solution for an avd on Android 2.2 :
adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock03 /system
adb push su /system/xbin/su
adb shell chmod 06755 /system
adb shell chmod 06755 /system/xbin/su
It assumes that the su binary is located in the working directory. You can find su and superuser here : http://forum.xda-developers.com/showthread.php?t=682828.
You need to run these commands each time you launch the emulator. You can write a script that launch the emulator and root it.
For AVD with 5.1.1 and 6.0 I used next script in windows:
set adb=adb -s emulator-5558
set arch=x64
set pie=
adb start-server
%adb% root
%adb% remount
rem %adb% shell mount -o remount,rw /system
%adb% shell setenforce 0
%adb% install common/Superuser.apk
%adb% push %arch%/su%pie% /system/bin/su
%adb% shell chmod 0755 /system/bin/su
%adb% push %arch%/su%pie% /system/xbin/su
%adb% shell chmod 0755 /system/xbin/su
%adb% shell su --install
%adb% shell "su --daemon&"
rem %adb% shell mount -o remount,ro /system
exit /b
Need UPDATE.zip from SuperSU. Unpacked them to any folder. Create bat file with content above. Do not forget specify necessary architecture and device: set adb=adb -s emulator-5558 and set arch=x64. If you run Android above or equal 5.0, change set pie= to set pie=.pie. Run it. You get temporary root for current run.
If you got error on remount system partition then you need start AVD from command line. See below first step for Android 7.
If you want make it persistent - update binary in SuperSU and store system.img from temp folder as replace of default system.img.
How to convert the resulting temporary root on a permanent
First - it goes to SuperSu. It offers a binary upgrade. Update in the normal way. Reboot reject.
Second - only relevant for emulators. The same AVD. The bottom line is that changes in the system image will not be saved. You need to keep them for themselves.
There are already instructions vary for different emulators.
For AVD you can try to find a temporary file system.img, save it somewhere and use when you start the emulator.
In Windows it is located in the %LOCALAPPDATA%\Temp\AndroidEmulator and has a name something like TMP4980.tmp.
You copy it to a folder avd device (%HOMEPATH%\.android\avd\%AVD_NAME%.avd\), and renamed to the system.img.
Now it will be used at the start, instead of the usual. True if the image in the SDK is updated, it will have the old one.
In this case, you will need to remove this system.img, and repeat the operation on its creation.
More detailed manual in Russian: http://4pda.ru/forum/index.php?showtopic=318487&view=findpost&p=45421931
For android 7 you need run additional steps:
1. Need run emulator manually.
Go to sdk folder sdk\tools\lib64\qt\lib.
Run from this folder emulator with options -writable-system -selinux disabled
Like this:
F:\android\sdk\tools\lib64\qt\lib>F:\android\sdk\tools\emulator.exe -avd 7.0_x86 -verbose -writable-system -selinux disabled
You need restart adbd from root:
adb -s emulator-5554 root
And remount system:
adb -s emulator-5554 remount
It can be doned only once per run emulator. And any another remount can break write mode. Because of this you not need run of any other commands with remount, like mount -o remount,rw /system.
Another steps stay same - upload binary, run binary as daemon and so on.
Picture from AVD Android 7 x86 with root:
If you see error about PIE on execute su binary - then you upload to emulator wrong binary. You must upload binary named su.pie inside archive, but on emulator it must be named as su, not su.pie.
I believe that the easiest way is to create an alias for the command sh, e.g.
adb shell
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cd /system/bin
cat sh > su && chmod 4775 su
Tested on Android Emulator 3.0 and higher.
A virtual device without "Play Store" should be used.
Note: You can either create one new or edit the settings of the existing one if you have some databases already inside the emulated device.
Once avd is created and is running Open terminal anywhere > in android studio or from start menu
Run adb root
Now you can use adb shell to open device shell window.
If your physical device with developer options is connected you will get message like "adb.exe: more than one device/emulator"
in this case you can use command 'adb -e shell'
Other useful note for beginners in adb shell:
Run 'ls' to see all the files.
cd to change directory.
some letters of the directory name+ TAB to auto complete the name.
'..' to go back.
I know this question is pretty old. But we can able to get root in Emulator with the help of Magisk by following https://github.com/shakalaca/MagiskOnEmulator
Basically, it patch initrd.img(if present) and ramdisk.img for working with Magisk.
Here my pack with all you need.
Or you can use this script:
echo on
set device=emulator-5554
set avd_name=
set adb=d:\Poprygun\DevTools\Android\Android-sdk\platform-tools\adb -s %device%
set emulator=d:\Poprygun\DevTools\Android\Android-sdk\emulator\emulator
set arch=x86
set pie=
echo Close all ANDROID emulators and press any key
pause
start %emulator% -avd Nexus_One_API_25 -verbose -writable-system
echo Wait until ANDROID emulator loading and press any key
pause
%adb% start-server
%adb% root
%adb% remount
%adb% shell setenforce 0
%adb% install D:\SuperSU\SuperSU.apk
%adb% push D:\SuperSU\su\%arch%\su.pie /system/bin/su
%adb% shell chmod 0755 /system/bin/su
%adb% push D:\SuperSU\su\%arch%\su.pie /system/xbin/su
%adb% shell chmod 0755 /system/xbin/su
%adb% shell su --install
%adb% shell "su --daemon&"
pause
exit /b
I just replaced and assigned attributes for su to ~/Android/Sdk/system-images/android-22/google_apis/x86/system.img
and now on android 5 I always have root even for new systems, it’s enough to install SuperSu.apk
Android 6 is necessary only
adb root
adb shell
>/system/xbin/su --daemon &
>setenfoce 0
after that, SuperSu.apk sees root. But I do not update the binary file
I used part of the method from the solutions above; however, they did not work completely. On the latest version of Andy, this worked for me:
On Andy (Root Shell) [To get, right click the HandyAndy icon and select Term Shell]
Inside the shell, run these commands:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cd /system/bin
cat sh > su && chmod 4775 su
Then, install SuperSU and install SU binary. This will replace the SU binary we just created.
(Optional)
Remove SuperSU and install Superuser by CWM. Install the su binary again.
Now, root works!
I tried many of the above suggestions, including SuperSU and couldn't get any to work but found something much simpler that worked for my purposes. In my case, I only wanted to be able to run sqlite at the command prompt. I simply spun up an emulator with an older version of Android (Lollipop) and got root access immediately.
Use android image without PlayServices then you'll be able to run add root and access whatever you want.
https://github.com/newbit1/rootAVD save my life .
It root by Magisk
The script simple enough for user
I found that default API 23 x86_64 emulator is rooted by default.
Now i will let know the simplest way to root your emulator in few steps using 1 command.
Create or configure emulator.
Check by running your application that your emulator is working or not.
Open cmd and give the path of your sdk platform-tools like as below
C:\Users\XYZ>cd C:\Users\XYZ\AppData\Local\Android\Sdk\platform-tools
if you are not sure that where is your platform tools then goto android studio and open SDK Manager(Click the icon of sdk manager) there you will get the path of your sdk like this ==>C:\Users\XYZ\AppData\Local\Android\Sdk and add platform tools at the end like as below
C:\Users\XYZ\AppData\Local\Android\Sdk\platform-tools
Now follow step 3 i.e Open cmd and give the path of your sdk platform-tools like as below
C:\Users\XYZ>cd C:\Users\XYZ\AppData\Local\Android\Sdk\platform-tools
Step 4: C:\Users\XYZ\AppData\Local\Android\Sdk\platform-tools>adb root
Step 5: C:\Users\XYZ\AppData\Local\Android\Sdk\platform-tools>adb shell
Now you will get the success message as below:
C:\Users\XYZ\AppData\Local\Android\Sdk\platform-tools>adb root
adbd is already running as root
Step 6 : XYZ generic # cd data/data//databases/
sqlite3
.tables
.schema
Hope it will help. Its worked for me.