Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
This question arose in my mind while I was installing JDK on Ubuntu. While I was installing JDK the steps are -
Extracting the .bin file of java.
Make a directory named java6 in /usr/lib and move all the content of extracted .bin file to the /usr/lib/java6.
Now soft a soft link is created in the current directory like this-
ln -s java6 java
I am surprised that the newly created link 'java' is used to set "JAVA_HOME" environment variable. As far as I know a similar thing is not possible in Windows.
More over while I am installing nexus I noticed the following -
$ ln -s nexus-2.7-06-bundle nexus
$ cd nexus
$ ./bin/nexus console
What I am trying to say here is - first we access the link directory (nexus), then we are running script (in /bin/nexus). I noticed these two approaches in several tutorials. I think these approaches should have some benefits.
Now my questions are that -
Why a link (/usr/lib/java) is set as JAVA_HOME; what is the advantage of doing so?
Why we are running the script (... /bin/nexus) from going to the soft link directory and what is the advantage of doing so?
When I am using the base directory instead of the link for the mentioned two cases, it also works fine. So, why these approaches?
If you install java7 instead of java6 (or java7 parallel to java6
or something else like that), if the JAVA_HOME variable and 100 other things are set
explicitly to java6, you would have to change them all to java7.
(and it is not trivial to find all config stuff which need changes).
With the link, you set all config stuff to the link and change only the link if necessary.And yes, this is possible on Windows too.
1) Why a link (/usr/lib/java) is set as JAVA_HOME; what is the advantage of doing so?
JAVA_HOME points to java you want to use (say java6)
JAVA_HOME is just a convention, usually software like eclipse, maven etc... use it to find where Java is located.
And yea it can be done in Windows too.
2) Why we are running the script (... /bin/nexus) from going to the soft link directory and what is the advantage of doing so?
Advantage none (It depends on you how you see it)
This Q is somewhat similar to Q1..
Say in future you want to use new version nexus-2.8-*. So instead of changing all configuration from nexus-2.7-* to nexus-2.8-*; you can just change the soft link nexus(to point the new version)
3) When I am using the base directory instead of the link for the mentioned two cases, it also works fine. So, why these approaches?
You answered you own Q!
Yep its a link; so nexus --> nexus-2.7-06-bundle; one and the same...
why the approach? see 3rd point of previous Q
Think of soft link as shortcut in Windows
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
So I've been looking around on the web for some while now but this seems to be a tricky task.
I intended to change my default terminal on a Mint system from gnome to alacrity.
I had alacrity installed before on the same system and it seemed to be work fine.
I have not set up my root user or know the password for it so this makes this extra hard!
To change the default global behavior (e.g. pressing Crtl+Alt+T) modifying the /etc/passwd seemed reasonably to me.
This is what the last line looks now: user:x:1000:1000:User,,,:/home/user:/usr/bin/alacritty
But: If I want to open a shell now almost a thousand instances do appear once the command is triggered and after a short while the whole system crashes.
I don't know how to reset to the default setting since I need a shell and that tool is broken...
Here is what I tried so far
Try to use the shell env available at user log in: Login ends in an infinite loop
Try to open the /etc/passwd in graphical environment: Cannot modify the file (read only)
So here what I wish: Make this undone without reinstalling the operational system.
Thanks for your help and advice!
The field you are trying to change in /etc/passwd is used to set the per user shell (usually /bin/bash on Linux). The terminal emulator you want to use is can either be done with update-alternatives (system wise if you have root) on Debian based systems, or Window Manager specific configuration in general (GNOME, KDE, Xmonad etc).
Login in as root, and change the /etc/passwd file back to using a valid shell for the user in question. Not sure how you don't have a root user. If you don't have the root password then follow the normal password recovery process. Boot from a live or rescue cd. If it doesn't mount the file system for you, mount it manually then edit /mnt/etc/password (where /mnt is where the original file system was mounted). Unmount and reboot your system normally.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I wanted to install JDK on my linux machine, so I followed these steps: https://www.javahelps.com/2015/03/install-oracle-jdk-in-ubuntu.html
When I opened my /etc/environment file, it was empty, so I added PATH variable and the rest three variables from tutorial.
Since then it seems that all env variables are deleted so I cannot do almost any command including sudo, su, vim etc.
I am new with linux so I didn't know that would happen. I guess there were some default variables in case none of them are set?
Is there a way to restore that file?
And where were those PATH variables before? How is it possible that I overwrote them since I didn't delete anything?
My OS is Redhat Linux Server.
/etc/environment is used by PAM to override environment variable settings, so by putting a PATH in there which does not contain any default directories like /usr/bin, you effectively removed them.
It sounds like your OS does not use PAM to set the path if /etc/environment was empty, so you can probably restore things by deleting the PATH line you added. If that works, you can see what your 'normal' default PATH is, and add it back, along with the additions for oracle jdk
Failing that, just ensure that the PATH you define in /etc/environment contains at least /usr/bin and /bin (and perhaps /usr/sbin, /sbin, and /usr/local/bin.) A decent one is
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 7 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I need to use root for the installation and maintenance for the database and application server that I am playing around with. The database and application server create files and directories in the /usr directory that I need to manipulate.I have accidentally deleted important files in /usr in the past , making the system act funny.I was wondering how to prevent this from happening in the future. I have a habit of rm -rf developed from years of non root user use.
I thought of moving /usr to /usr_bkp and creating a soft_link /usr to point to /usr_bkp. I am afraid that moving or removing /usr even temporarily will have unpredictable consequences. What is the best known method to avoid such errors.
The purpose of root is to do everything he wants. However you could use the -i option to have to confirm to delete the files.
"I mostly work as root user these days and have accidentally deleted important files": those two don't work together. Removing files by mistake is one of the actions that have immediate and visible consequences (there are others that might appear later and require lots of time to debug).
Create a separate user (this is what I'd suggest until gaining more XP) and give it sudo rights (the good thing is that extreme care is only required in sudo mode, not by default).
As for the 2nd part:
I'm pretty sure that symlinking /usr is not something that the Linux admin manual recommends
rm -rf /usr/SOME_FILES_OR_FOLDERS when /usr is a symlink to usr_bkp (or whatever its name could be), will still delete the files/folders located in the /usr folder, so no protection there.
The only change I see is that every time something from /usr will be accessed, instead of the direct access, the symlink will have to be resolved (each time ?); (more operations, require more time -> performance decrease)
(if i'm not missing something obvious,) doing the symlink thing would introduce some "traps" since mv, ln,... are ELFs that (by default) reside in /usr/bin, and the 1st command (mv) will succeed, but then you'll no longer have ln (unless specifying its full new path), or in other words "ROUText: ti-ai taiat craca :d ". Regarding running apps, I think you'll be OK (at most a reboot required).
So, considering the 4 items I advise not to use root (at least for now).
What x4rkz said but also if you're concerned of 'rm'ing files as root, create an alias in your shell's rc file to always confirm the removal of files. In Bourne derivatives this can be accomplished with:
alias rm='/usr/bin/rm -i '
Test:
# alias rm='/usr/bin/rm -i'
# rm test
# /usr/bin/rm: remove regular empty file ‘test’? y
Of course, this won't help you if you write a script that doesn't first load that alias.
Another failure mode I've seen with new admins is misusing output redirection and overwriting a file. In Bourne derivatives, you can set the 'NOCLOBBER' option in shell scripts to prevent this:
# set NOCLOBBER
This is not 100% portable so ensure this is supported before relying on it.
OK so you are working with a database and an application.
Write a script. Then don't touch the files unless you use the script.
Just put into the script every operation that you need to do.
./my-script clean
./my-script install
./my-script run
etc...
This way the files will be deleted by clean, installed, and the application restarted the same way every time with no danger of deleting the wrong thing.
Also, consistency is something you want as a developer. No more wondering why the update failed because you forgot to copy the right files into place or forgot to remove the old binaries.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
My KDE is broken, the desktop Widgets cannot be displayed. And many KDE programs look like this:
All the software written in GTK is all right.
Can any one give me any suggestion about what's happening and which part is broken?
Where can I find error log?
You don't say what disto you're using (please add it to the tags in your question), nor how you got in this state - new installation? dist-upgrade? hard crash? That would be useful information.
But in general, here's what I would try:
Log out and go to a bare terminal with CTRL-ALT-F1, then login and rename your .kde / .kde4 directories: mv ~/.kde ~/.kde.old and reboot or otherwise restart your GUI system.
That will at least tell you whether the problem is messed up personal settings or messed-up system files.
If that doesn't fix the issue (that directory will be recreated when you start up KDE again; all your settings will be lost, but you can recover them - carefully, one by one - from the backup you just made), then I would first try sudo apt-get check (assuming you're on a Debian-based distro).
If that doesn't report any problems, then I would update my system - possibly even do a dist-upgrade without changes any sources.
If this issue still wasn't fixed, I would run sudo dpkg -l > ~/Desktop/dpkg_out.txt to get a list of installed or uninstalled packages and their state in a file, and then look through the file for problems as explained here.
Finally, if all of that failed, I would take a good hard look at my video drivers.
Good luck!
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I would like to backup a dir in Win XP on a Solaris server via rsync. I installed cygwin but when I type rsync I get 'command not found'. How can I install rsync? And how can I install ssh. I have installed Poderosa as ssh client (a sort of putty).
run your cygwin setup.exe again, and expand the categories to find 'rsync' and 'ssh'.
Much easier. Run setup, click through to the 'Cygwin Setup - Select Packages' window, and type 'rsync' in the 'Search' box at upper left. At this writing, this shows three lines, one of which is 'Net'. Expand Net and you'll find rsync. Click the circular arrow icon to mark it for install, then click Next at lower right.
You still need to install the rsync package. Run setup.exe again and go through the packages manually (it's probably in 'networking' or 'utilities').
When you run setup.exe, the package selection will be set to "default". You need to click on the top-level circular arrow picture until it says "Install" or "Full" (my memory fails me), it will do this for all sub-packages as well.
The first time you click on it, wait a few seconds - there's a long delay in getting from "default" to the next option.
That's the best way. All the times I've tried to select individual packages, I've had troubles so I've long since gotten into the habit of installing everything.
If all you want is rsync, the BackupPC project (OSS) has a slightly modified version of cygwin's rsync that runs without a full cygwin installation, and can even be installed remotely on PCs with IPC$. http://sourceforge.net/project/showfiles.php?group_id=34854&package_id=88133