FreeRADIUS Google Dual Factor Authenticator, Pam - pam

Hi I've been following this article to setup FreeRADIUS Google Dual Factor Authenticator
http://www.supertechguy.com/help/security/freeradius-google-auth
Hours of testing I still can't get it to work. If my /etc/pam.d/radiusd looks like the following it works well with
the following command
radtest test test localhost 18120 testing123
#
# /etc/pam.d/radiusd - PAM configuration for FreeRADIUS
#
# We fall back to the system default in /etc/pam.d/common-*
#
#include common-auth
#include common-account
#include common-password
#include common-session
However if it looks like the following
#
# /etc/pam.d/radiusd - PAM configuration for FreeRADIUS
#
# We fall back to the system default in /etc/pam.d/common-*
#
##include common-auth
##include common-account
##include common-password
##include common-session
auth requisite pam_google_authenticator.so forward_pass
auth required pam_unix.so use_first_pass
my log file says the following and auth fails.
rad_recv: Access-Request packet from host 127.0.0.1 port 43185, id=111, length=56
User-Name = "test"
User-Password = "test"
NAS-IP-Address = 127.0.1.1
NAS-Port = 18120
Thu Sep 26 16:38:19 2013 : Info: # Executing section authorize from file /etc/freeradius/sites-enabled/default
Thu Sep 26 16:38:19 2013 : Info: +- entering group authorize {...}
Thu Sep 26 16:38:19 2013 : Info: ++[preprocess] returns ok
Thu Sep 26 16:38:19 2013 : Info: ++[chap] returns noop
Thu Sep 26 16:38:19 2013 : Info: ++[mschap] returns noop
Thu Sep 26 16:38:19 2013 : Info: ++[digest] returns noop
Thu Sep 26 16:38:19 2013 : Info: [suffix] No '#' in User-Name = "test", looking up realm NULL
Thu Sep 26 16:38:19 2013 : Info: [suffix] No such realm "NULL"
Thu Sep 26 16:38:19 2013 : Info: ++[suffix] returns noop
Thu Sep 26 16:38:19 2013 : Info: [eap] No EAP-Message, not doing EAP
Thu Sep 26 16:38:19 2013 : Info: ++[eap] returns noop
Thu Sep 26 16:38:19 2013 : Info: [files] users: Matched entry DEFAULT at line 74
Thu Sep 26 16:38:19 2013 : Info: ++[files] returns ok
Thu Sep 26 16:38:19 2013 : Info: ++[expiration] returns noop
Thu Sep 26 16:38:19 2013 : Info: ++[logintime] returns noop
Thu Sep 26 16:38:19 2013 : Info: [pap] WARNING! No "known good" password found for the user. Authentication may fail because of this.
Thu Sep 26 16:38:19 2013 : Info: ++[pap] returns noop
Thu Sep 26 16:38:19 2013 : Info: Found Auth-Type = PAM
Thu Sep 26 16:38:19 2013 : Info: # Executing group from file /etc/freeradius/sites-enabled/default
Thu Sep 26 16:38:19 2013 : Info: +- entering group authenticate {...}
Thu Sep 26 16:38:19 2013 : Debug: pam_pass: using pamauth string <radiusd> for pam.conf lookup
Thu Sep 26 16:38:19 2013 : Debug: pam_pass: function pam_authenticate FAILED for <test>. Reason: Cannot make/remove an entry for the specified session
Thu Sep 26 16:38:19 2013 : Info: ++[pam] returns reject
Thu Sep 26 16:38:19 2013 : Info: Failed to authenticate the user.
Thu Sep 26 16:38:19 2013 : Info: Using Post-Auth-Type Reject
Thu Sep 26 16:38:19 2013 : Info: # Executing group from file /etc/freeradius/sites-enabled/default
Thu Sep 26 16:38:19 2013 : Info: +- entering group REJECT {...}
Thu Sep 26 16:38:19 2013 : Info: [attr_filter.access_reject] expand: %{User-Name} -> test
Thu Sep 26 16:38:19 2013 : Debug: attr_filter: Matched entry DEFAULT at line 11
Thu Sep 26 16:38:19 2013 : Info: ++[attr_filter.access_reject] returns updated
Thu Sep 26 16:38:19 2013 : Info: Delaying reject of request 0 for 1 seconds
Thu Sep 26 16:38:19 2013 : Debug: Going to the next request
Thu Sep 26 16:38:19 2013 : Debug: Waking up in 0.9 seconds.
Thu Sep 26 16:38:20 2013 : Info: Sending delayed reject for request 0
Sending Access-Reject of id 111 to 127.0.0.1 port 43185
Thu Sep 26 16:38:20 2013 : Debug: Waking up in 4.9 seconds.
Thu Sep 26 16:38:25 2013 : Info: Cleaning up request 0 ID 111 with timestamp +3
Thu Sep 26 16:38:25 2013 : Info: Ready to process requests.
I'm using Ubuntu latest
Does anyone know what the issue here?
Many Thanks

After so much internet surfing and forum hunting I manage to fix this problem. If anyone else having this issue this might help them :)
Thu Sep 26 16:38:19 2013 : Debug: pam_pass: using pamauth string <radiusd> for pam.conf lookup
Thu Sep 26 16:38:19 2013 : Debug: pam_pass: function pam_authenticate FAILED for <test>. Reason: Cannot make/remove an entry for the specified session
The above line actually means a auth fail, even though it doesn't sound like it, also it could mean that .google_authenticator file in the user's home directory isn't accessible.
FreeRadius log file not help you much with this issue, but have a look through /var/log/secure on CentOS and /var/log/auth.log in Ubuntu. This will explain which is the issue.
Issue with my system was my time was out and my random generated number by Google Dual Factor Authenticator application on my iPhone wasn't valid. I had to install NTP and change my servers time to the correct time which fixed the issue!!!!
hope this help someone else :)

The how-to on Super Tech Guy's page (http://www.supertechguy.com/help/security/freeradius-google-auth) has a typo.
DEFAULT Auth-Type := PAM
should be
DEFAULT Auth-Type = PAM
I don't know why he put a colon in there, but removing it fixed my issue.
This was after I made sure the server had the correct time (and timezone), which it didn't. So thanks for that suggestion too!

Related

The ClassNotFoundException when running a jar from command line

I am not sure what is missing from this jar file but when I try to run the jar from the command line, it cannot load the main entry point:
This is the directory that contains the classes and the resources for my application.
C:\Users\hrh74\Documents\ABack up\NetBeansProjects\mavenfxedittableview\target\classes\org\openjfx\mavenfxedittableview
09/04/2020 08:48 PM <DIR> .
09/04/2020 08:48 PM <DIR> ..
09/03/2020 04:24 PM 2,502 addressBookData.xml
09/02/2020 05:52 PM 9,562 Address_Book.png
09/02/2020 05:52 PM 859 birthdaystatistic.fxml
09/02/2020 05:52 PM 3,274 BirthdaystatisticController.class
09/02/2020 05:52 PM 3,224 DarkTheme.css
09/02/2020 05:52 PM 2,072 DateUtil.class
09/02/2020 05:52 PM 1,214 LocalDateAdapter.class
09/02/2020 05:52 PM 3,523 Person.class
09/02/2020 05:52 PM 4,535 personeditdialog.fxml
09/02/2020 05:52 PM 5,128 PersoneditdialogController.class
09/02/2020 05:52 PM 1,029 PersonListWrapper.class
09/02/2020 05:52 PM 6,412 personoverview.fxml
09/02/2020 05:52 PM 1,904 rootlayout.fxml
09/02/2020 05:52 PM 4,490 RootlayoutController.class
09/02/2020 05:52 PM 9,060 TableEditApp.class
09/02/2020 05:52 PM 6,812 TableVieweditController.class
16 File(s) 65,600 bytes
2 Dir(s) 57,686,331,392 bytes free
I created an app.jar for my application and specified the application's main entry class.
C:\Users\hrh74\Documents\ABack up\NetBeansProjects\mavenfxedittableview\target
\classes\org\openjfx>jar cvfe app.jar TableEditApp.class -C mavenfxedittableview .
added manifest
adding: addressBookData.xml(in = 2502) (out= 376)(deflated 84%)
adding: Address_Book.png(in = 9562) (out= 9567)(deflated 0%)
adding: birthdaystatistic.fxml(in = 859) (out= 372)(deflated 56%)
adding: BirthdaystatisticController.class(in = 3274) (out= 1544)(deflated 52%)
adding: DarkTheme.css(in = 3224) (out= 826)(deflated 74%)
adding: DateUtil.class(in = 2072) (out= 941)(deflated 54%)
adding: LocalDateAdapter.class(in = 1214) (out= 537)(deflated 55%)
adding: Person.class(in = 3523) (out= 1277)(deflated 63%)
adding: personeditdialog.fxml(in = 4535) (out= 872)(deflated 80%)
adding: PersoneditdialogController.class(in = 5128) (out= 2418)(deflated 52%)
adding: PersonListWrapper.class(in = 1029) (out= 485)(deflated 52%)
adding: personoverview.fxml(in = 6412) (out= 1149)(deflated 82%)
adding: rootlayout.fxml(in = 1904) (out= 542)(deflated 71%)
adding: RootlayoutController.class(in = 4490) (out= 2097)(deflated 53%)
adding: TableVieweditController.class(in = 6812) (out= 2835)(deflated 58%)
The app.jar created successfully. Here is the content of META-INF/MANIFEST.MF file.
Manifest-Version: 1.0
Created-By: 14.0.2 (Oracle Corporation)
Main-Class: TableEditApp.class
Here is my classpath having the current directory '.' in the beginning.
.;C:\Users\hrh74\Documents\ABack up\NetBeansProjects\javalearning\build\classes;C:\Program Files\Java\jdk-14.0.2;C:\Program Files\Java\jdk-14.0.2\bin;C:\Program Files (x86)\Java\jre1.8.0_251\bin;C:\Program Files\Java\jdk-14.0.2\lib;
When I list the content of the jar file, all the classes are properly packaged in the jar.
C:\Users\hrh74\Documents\ABack up\NetBeansProjects\mavenfxedittableview\target\classes\org\openjfx>jar tvf app.jar
0 Fri Sep 04 23:22:18 IRDT 2020 META-INF/
98 Fri Sep 04 23:22:18 IRDT 2020 META-INF/MANIFEST.MF
2502 Thu Sep 03 16:24:22 IRDT 2020 addressBookData.xml
9562 Wed Sep 02 17:52:36 IRDT 2020 Address_Book.png
859 Wed Sep 02 17:52:36 IRDT 2020 birthdaystatistic.fxml
3274 Wed Sep 02 17:52:40 IRDT 2020 BirthdaystatisticController.class
3224 Wed Sep 02 17:52:36 IRDT 2020 DarkTheme.css
2072 Wed Sep 02 17:52:40 IRDT 2020 DateUtil.class
1214 Wed Sep 02 17:52:38 IRDT 2020 LocalDateAdapter.class
3523 Wed Sep 02 17:52:38 IRDT 2020 Person.class
4535 Wed Sep 02 17:52:36 IRDT 2020 personeditdialog.fxml
5128 Wed Sep 02 17:52:40 IRDT 2020 PersoneditdialogController.class
1029 Wed Sep 02 17:52:40 IRDT 2020 PersonListWrapper.class
6412 Wed Sep 02 17:52:36 IRDT 2020 personoverview.fxml
1904 Wed Sep 02 17:52:36 IRDT 2020 rootlayout.fxml
4490 Wed Sep 02 17:52:38 IRDT 2020 RootlayoutController.class
9060 Wed Sep 02 17:52:38 IRDT 2020 TableEditApp.class
6812 Wed Sep 02 17:52:38 IRDT 2020 TableVieweditController.class
Finally, when I run the application from the command line using java –jar app.jar, I get the ClassNotFoundException.
C:\Users\hrh74\Documents\ABack up\NetBeansProjects\mavenfxedittableview\target\classes\org\openjfx>java -jar app.jar
Error: Could not find or load main class TableEditApp.class
Caused by: java.lang.ClassNotFoundException: TableEditApp.class
I tried to adhere to the spec to the best of my knowledge, so I am not sure why this is not working. Any idea, what might be causing this exception?
Thanks in advance.
I discovered something interesting in respect to the HelloWorld.java that I mentioned in my last comment. I abandoned using the "jar cvfe" and instead created a file name mymanifest.txt and placed the name of the class with the main entry as "Main-Class: org.me.HelloWorld" followed by two blank lines (per specification). I packaged the jar using the "jar cvmf" instead of "jar cvfe" and it WORKED FINE. I then applied the same method to my application jar creation, and now I am getting a Linkage Error instead of ClassNotFoundException. Perhaps, it has something to do with the JavaFX library that I have to investigate deeper. In summary, I suspect that the "jar cvfe" switch might not be working as described in the Java tutorial. I have had found errors in the tutorial in the past and this MIGHT be another one.
Anyway, thank you all for your comments.

Snakemake: R script fails (almost) immediately

Once more I'm encountering an error in my snakemake workflow that doesn't make any sense to me.
This is the error I get:
[Thu Jan 25 10:47:00 2018] Building DAG of jobs...
[Thu Jan 25 10:47:01 2018] Provided cores: 24
[Thu Jan 25 10:47:01 2018] Rules claiming more threads will be scaled down.
[Thu Jan 25 10:47:01 2018] Job counts:
[Thu Jan 25 10:47:01 2018] count jobs
[Thu Jan 25 10:47:01 2018] 1 merging_seurat
[Thu Jan 25 10:47:01 2018] 1
[Thu Jan 25 10:47:01 2018] Job 0: --- Merging samples using seurat.
Error in setClass("Snakemake", slots = c(input = "list", output = "list", :
unused argument(s) (slots = c(input = "list", output = "list", params = "list", wildcards = "list", threads = "numeric", log = "list", resources = "list", config = "list", rule = "character"))
Execution halted
[Thu Jan 25 10:47:02 2018] Error in rule merging_seurat:
[Thu Jan 25 10:47:02 2018] jobid: 0
[Thu Jan 25 10:47:02 2018] output: merging_seurat/12_top10_heatmap_all_wilcox.pdf, merging_seurat/13_top10_heatmap_all_roc.pdf, merging_seurat/merging_seurat.RData
[Thu Jan 25 10:47:02 2018] RuleException:
[Thu Jan 25 10:47:02 2018] CalledProcessError in line 372 of .../snakemake_pipeline/Snakefile:
[Thu Jan 25 10:47:02 2018] Command ' set -euo pipefail; Rscript .../snakemake_pipeline/scripts/.snakemake.jv8ijpiw.merging_seurat.R ' returned non-zero exit status 1
[Thu Jan 25 10:47:02 2018] File ".../snakemake_pipeline/Snakefile", line 372, in __rule_merging_seurat
[Thu Jan 25 10:47:02 2018] File ".../tools/anaconda3/envs/Seurat/lib/python3.5/concurrent/futures/thread.py", line 55, in run
[Thu Jan 25 10:47:02 2018] Will exit after finishing currently running jobs.
[Thu Jan 25 10:47:02 2018] Exiting because a job execution failed. Look above for error message
[Thu Jan 25 10:47:02 2018] Complete log: .../snakemake_6/.snakemake/log/2018-01-25T104700.498155.snakemake.log
This is the rule in question:
rule merging_seurat:
input: expand("{sample}/molecule_count/counts_wide.tsv", sample=config["samples"]),
output: "merging_seurat/12_top10_heatmap_all_wilcox.pdf",
"merging_seurat/13_top10_heatmap_all_roc.pdf",
"merging_seurat/merging_seurat.RData"
message: "--- Merging samples using seurat."
script: "scripts/merging_seurat.R"
Here we have the top of the R script that is still executed:
sink('merging_seurat/output.txt')
print(installed.packages())
print(sessionInfo())
sink()
And these are the following lines in the R script that are not executed anymore:
library('Seurat')
library('dplyr')
library('org.Hs.eg.db')
Because I logged the packages that are available, I know that the three packages that should be loaded are also installed so it shouldn't fail because of that. In fact, commenting these lines out doesn't change anything, the script still breaks and the log message that should come right after loading the packages is not written to the log file.
Finally, this is the command that I use to run snakemake:
snakemake --use-conda \
--latency-wait 90 \
--rerun-incomplete \
--keep-going \
--timestamp \
--cluster-config SGE.json \
--cluster "qsub -cwd -N {cluster.name} -l h_vmem={cluster.h_vmem},h_stack=256M -o {cluster.stdout}{cluster.name}.o -e {cluster.stderr}{cluster.name}.e -m {cluster.mailtype} -M {cluster.mailuser}" \
-j 8 \
--directory .../snakemake_6
Does anybody have a clue what the error message could mean? unused argument of the snakemake R object is strange because I'm calling multiple parameters later on in the script.
What is even more strange is that I have another R script that works with different packages but has very similar first lines runs fine. I remember that in the beginning I had the same problem with that script (same error message) but don't remember how I solved it.
Any help is well appreciated.

ORA-12505 + "network adapter could not establish the connection" on Oracle11g/VirtualBox

I have Oracle 11g installed locally on each of my virtualbox machines (working under Windows 7 64bit). Suddenty, after a simple reboot, the database on one of the 5 virtual machines doesn't want to connect anymore.
With SID connection I obtain ORA-12505 error, and with service name : "Network adapter could not establish the connection", in SqlDeveloper with both cases. If I try a connection with SqlPlus as sysdba, I obtain the connection but with "connected to an idle instance". Hence if I try to see, for example, the list of sessions and processes working, I have the error 01034 ("ORACLE not available"). I tried a lot of tricks but nothing works. Could it be a specific problem with virtual machines ?
Here what I tried :
the services (of my base and of the listener) are working (and I wait enough between relaunch and connection retry) ;
the files tnsnames.ora, listener.ora and sqlnet.ora seem correct (see below) ;
If I force localhost to be 127.0.0.1 in hosts file, I have the 12514 error ;
ORACLE_HOME and ORACLE_SID are correctly set ;
It can't a priori be a memory problem (I even try to allow more memory to the specific VM which doesn't work) ;
If I force "startup" on sysdba session, the next requests obtain : ORA-03114 : not connected to ORACLE ;
It's not a priori a problem of system files size. In all cases, the not working database is not my biggest database among all my databases (and any file in oradata are bigger than in others VMs which have exactly the same configurations).
# tnsnames.ora Network Configuration File: C:\oracle_32\product\11.2.0\dbhome_2\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
# listener.ora Network Configuration File: C:\oracle_32\product\11.2.0\dbhome_2\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oracle_32\product\11.2.0\dbhome_2)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\oracle_32\product\11.2.0\dbhome_2\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:\oracle_32
Thank you to read !
Here the alert log for the first connection of this morning :
Fri Jun 23 11:08:13 2017
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Picked latch-free SCN scheme 2
Using LOG_ARCHIVE_DEST_1 parameter default value as USE_DB_RECOVERY_FILE_DEST
Autotune of undo retention is turned on.
IMODE=BR
ILAT =167
LICENSE_MAX_USERS = 0
SYS auditing is disabled
Starting up:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options.
Using parameter settings in server-side spfile C:\ORACLE_32\PRODUCT\11.2.0\DBHOME_2\DATABASE\SPFILEORCL.ORA
System parameters with non-default values:
processes = 1000
sessions = 1524
memory_target = 1232M
control_files = "C:\ORACLE_32\ORADATA\ORCL\CONTROL01.CTL"
control_files = "C:\ORACLE_32\FLASH_RECOVERY_AREA\ORCL\CONTROL02.CTL"
db_block_size = 8192
compatible = "11.2.0.0.0"
db_recovery_file_dest = "C:\oracle_32\flash_recovery_area"
db_recovery_file_dest_size= 3852M
undo_tablespace = "UNDOTBS1"
remote_login_passwordfile= "EXCLUSIVE"
db_domain = ""
dispatchers = "(PROTOCOL=TCP) (SERVICE=orclXDB)"
local_listener = "LISTENER_ORCL"
audit_file_dest = "C:\ORACLE_32\ADMIN\ORCL\ADUMP"
audit_trail = "DB"
db_name = "orcl"
open_cursors = 300
diagnostic_dest = "C:\ORACLE_32"
Fri Jun 23 11:08:20 2017
PMON started with pid=2, OS id=2160
Fri Jun 23 11:08:20 2017
VKTM started with pid=3, OS id=2164 at elevated priority
VKTM running at (10)millisec precision with DBRM quantum (100)ms
Fri Jun 23 11:08:21 2017
GEN0 started with pid=4, OS id=2168
Fri Jun 23 11:08:21 2017
DIAG started with pid=5, OS id=2172
Fri Jun 23 11:08:21 2017
DBRM started with pid=6, OS id=2176
OER 7451 in Load Indicator : Error Code = OSD-04500: option indiquée interdite !
Fri Jun 23 11:08:21 2017
PSP0 started with pid=7, OS id=2180
Fri Jun 23 11:08:21 2017
DIA0 started with pid=8, OS id=2184
Fri Jun 23 11:08:21 2017
MMAN started with pid=9, OS id=2188
Fri Jun 23 11:08:21 2017
DBW0 started with pid=10, OS id=2192
Fri Jun 23 11:08:21 2017
LGWR started with pid=11, OS id=2196
Fri Jun 23 11:08:21 2017
CKPT started with pid=12, OS id=2200
Fri Jun 23 11:08:21 2017
SMON started with pid=13, OS id=2204
Fri Jun 23 11:08:21 2017
RECO started with pid=14, OS id=2208
Fri Jun 23 11:08:21 2017
MMON started with pid=15, OS id=2212
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
Fri Jun 23 11:08:21 2017
MMNL started with pid=16, OS id=2216
starting up 1 shared server(s) ...
ORACLE_BASE from environment = C:\oracle_32
Fri Jun 23 11:08:22 2017
alter database mount exclusive
Successful mount of redo thread 1, with mount id 1475182246
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: alter database mount exclusive
alter database open
Fri Jun 23 11:08:31 2017
Errors in file c:\oracle_32\diag\rdbms\orcl\orcl\trace\orcl_lgwr_2196.trc:
ORA-00338: log 3 of thread 1 is more recent than control file
ORA-00312: online log 3 thread 1: 'C:\ORACLE_32\ORADATA\ORCL\REDO03.LOG'
Errors in file c:\oracle_32\diag\rdbms\orcl\orcl\trace\orcl_lgwr_2196.trc:
ORA-00338: log 3 of thread 1 is more recent than control file
ORA-00312: online log 3 thread 1: 'C:\ORACLE_32\ORADATA\ORCL\REDO03.LOG'
Errors in file c:\oracle_32\diag\rdbms\orcl\orcl\trace\orcl_ora_2232.trc:
ORA-00338: fichier journal 1 du thread plus recent que le fichier de controle
ORA-00312: journal en ligne 3 thread 1 : 'C:\ORACLE_32\ORADATA\ORCL\REDO03.LOG'
USER (ospid: 2232): terminating the instance due to error 338
Fri Jun 23 11:08:34 2017
Instance terminated by USER, pid = 2232`
Did you check the alert log of the database? that could be a good place to start looking.
Also when logged as sysdba, did you try to start the database: startup ?
If yes, what is the error message if any?

Unix command for extracting lines befor and after a particular searched string pattern

How can I search for lines in a file and extract the lines above and below lines of the searched line .
My input is like
Tue Jun 26 14:59:46 2012
Warning ffffffff act_msg_ctms_remove_from_pending_queue: deleting message 44817201 from the queue.
Tue Jun 26 14:59:46 2012
Warning ffffffff Finishing processing record number 44817201
Tue Jun 26 14:59:46 2012
Warning 5000000 activity_queue_manager_finish_cb: unknown activity 120.
Tue Jun 26 14:59:46 2012
Warning ffffffff Activity State Machine priority (2) finished
Tue Jun 26 14:59:46 2012
Warning ffffffff
====================================================
Processing database file "INCOMING_MESSAGES" record number 47810234 from user "(unknown)"
Tue Jun 26 14:59:46 2012
Warning ffffffff ACTIVITY data: rec_num (47810234) size (116)
Tue Jun 26 14:59:46 2012
Warning ffffffff activity status: ACT_SENT
Tue Jun 26 14:59:46 2012
Warning ffffffff MESSAGE body "MVT
QFA6673/26.VHQOS.BNE
EA0541
"
Tue Jun 26 14:59:46 2012
Warning ffffffff Finishing processing record number 47810234
Tue Jun 26 14:59:46 2012
Warning ffffffff Activity State Machine priority (1) finished
Tue Jun 26 14:59:46 2012
Warning ffffffff
End processing record number 47810234
====================================================
And I require my output to be like
/
Tue Jun 26 14:59:46 2012
Warning ffffffff MESSAGE body "MVT
QFA6673/26.VHQOS.BNE
EA0541"
/
My search string would be MVT.
Pls help
For three lines before and after the match
grep -C 3 pattern filename
For more control on number of after and before lines to be displayed for a match, use
grep -A (num of after) -B (num of lines before) pattern filename
From man grep:
-A NUM, --after-context=NUM
Print NUM lines of trailing context after matching lines.
Places a line containing -- between contiguous groups of matches.
-a, --text
Process a binary file as if it were text;
this is equivalent to the --binary-files=text option.
-B NUM, --before-context=NUM
Print NUM lines of leading context before matching lines.
Places a line containing -- between contiguous groups of matches.
-C NUM, --context=NUM
Print NUM lines of output context.
Places a line containing -- between contiguous groups of matches.
Grep has options to display rows immediately before and after the match. The numbers in the command line below are the appropriate number of rows to display, after and before the match. E.g.
grep -A3 -B5 yoursearchpattern inputfilepattern
man grep is useful for details about the options.
Assuming you have GNU grep, to check you can use --version option:
> grep --version
GNU grep 2.6.3

Time zone and BST woes in Europe/London

I am really struggling with my hwclock since the UK changed to British Summer Time (BST) last weekend on my Centos 5.8 KVM guest.
Here's some command outputs..
[root#host ~]# TZ=Europe/London date
Mon Apr 2 08:12:03 EDT 2012
[root#host ~]# TZ=Europe/Jersey date
Mon Apr 2 08:12:11 EDT 2012
[root#host ~]# TZ=Europe/Paris date
Mon Apr 2 14:12:16 CEST 2012
[root#host ~]# TZ=Europe/Rome date
Mon Apr 2 14:12:22 CEST 2012
[root#host ~]# TZ=Europe/Athens date
Mon Apr 2 15:12:27 EEST 2012
[root#host ~]# hwclock -rD
hwclock from util-linux-2.13-pre7
Using /dev/rtc interface to clock.
Last drift adjustment done at 1333367010 seconds after 1969
Last calibration done at 1333367010 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
/dev/rtc does not have interrupt functions. Waiting in loop for time from /dev/rtc to change
...got clock tick
Time read from Hardware Clock: 2012/04/02 12:22:27
Hw clock time : 2012/04/02 12:22:27 = 1333369347 seconds since 1969
Mon 02 Apr 2012 12:22:27 PM UTC -0.422061 seconds
And finally when I ln -sf to Europe/London it just goes back to EDT :(
[root#host ~]# ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
[root#host ~]# date
Mon Apr 2 08:23:02 EDT 2012
:(
Here's also some contents of files:
[root#host ~]# cat /etc/sysconfig/clock
ZONE="Europe/London"
UTC=true
ARC=false
Really struggling here guy and have googled til my eyes popped out but to no avail.
smybolically linking the files doesn't work - they need to be physically copied
[root#xxx]# mv /etc/localtime /etc/localtime.default
[root#xxx]# cp /usr/share/zoneinfo/Europe/London /etc/localtime
[root#xxx]# date
Fri Apr 13 11:35:57 BST 2012
Hope that helps :-)
I had a similar problem on my mailserver runninng CentOS 6.4 64-bit. Mail coming in marked 6 hours forward in time! I set Oslo-time for the server. The clock was correct but it showed the wrong time zone. It should be CEST:
/etc/localtime -> /usr/share/zoneinfo/Europe/Oslo
$date
Thu Sep 19 17:08:42 EDT 2013
Cities in the same time zone showed CEST. Strange. The only way to fix it was to use Copenhagen instead.
localtime -> /usr/share/zoneinfo/Europe/Copenhagen
$ date
Thu Sep 19 17:16:55 CEST 2013
So if nothing works try to use a city in the same time zone.

Resources