How do you run code on a specific page without missing the init hook?

The earliest that functions such as get_permalink or is_page are available is parse_query (afaik). Then I thought, ok, clearly, I can’t say if( is_page('myPage') ) { add_action( 'init'... // because is_page will always resolve to false.

So then I thought, well, how about wrapping parse_query inside init like so:

add_action( 'init', function() {     add_action( 'parse_query', function() use() {         if( is_page( 'myPage' ) ) { //     }, 10 ); }, 10 ); 

Well, that still does nothing. The code works, but hooking into init there doesn’t really work. My goal here is to make use of items that need to launch/are available on init:10. So, I said, ok, just pass them, right?

add_action( 'init', function() {   $  something_i_need_from_init_10 = //do something.   add_action( 'parse_query', function() use( $  something_i_need_from_init_10 )   // } 

Which works, now, there are two cases that you’ll use this for:

  1. Getting something. If it’s available on init:10, isn’t it available on parse_query since parse_query come after? Sure, for most things, but remember that WP core itself gets rid of certain get_post_* functionality once it hits certain actions. Perhaps you have a service container that works well with WP and a service is only available on init:10.
  2. Doing something. Perhaps something needs to fire here. If so, this still works.

But all of this is clunky to write.

Is there no way to tell WP to run code on init, on a certain page only? Just looking at the link won’t do. There are rewrite rules, link formats and so on that one has to take care of and that probably don’t load until later on.

Ultimately, it’d be nice if all I had to write was:

add_action( 'init', function() {   if( is_page( 'myPage' ) ) {     //do stuff   } } 

What can one do when trying to design this way?


I don’t know how to figure it myself, but perhaps pipelining this process through the page.php / single.php pages will work. I assume WP has to figure out very early on what page, with what template it has to serve for any given link, for which it calls these 2 (usually).

DOM XSS via JQuery function init()

Burp reported potential DOM XSS. Data is read from location and passed to the ‘init()’ function of JQuery via:

var table = location['table'] || location['sysparm_table']; snPresence.init(table, sys_id, query); 

URL looks as such,

https://publicsite.com/scripts/Scoreboard/js_includes_cmdb_scoreboard.jsx

Is this vulnerable? How can I check if vulnerable with Chrome DevTools?

Portswigger also mentions the init() sink of JQuery as leading to DOM XSS
https://portswigger.net/web-security/cross-site-scripting/dom-based

DBCA and can’t init database

SQL> startup; ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file '/u01/app/oracle/product/12.2.0.1/db_1/dbs/initAWSDB.ora' 

I created a new Oracle 12c database using dbca

the only files in the dbs directory

$   ls -ltrh total 24K -rw-r--r--. 1 oracle oinstall 3.1K May 15  2015 init.ora -rw-r-----. 1 oracle oinstall   24 Mar 22 23:10 lkCFRDB -rw-r-----. 1 oracle oinstall 3.5K Mar 22 23:13 orapwCFRDB -rw-rw----. 1 oracle oinstall 1.6K Mar 22 23:27 hc_CFRDB.dat -rw-r-----. 1 oracle oinstall 3.5K Mar 22 23:27 spfileCFRDB.ora -rw-rw----. 1 oracle oinstall 1.6K Mar 22 23:42 hc_AWSDB.dat 

When I tried to start up with init.ora

SQL> startup pfile=/u01/app/oracle/product/12.2.0.1/db_1/dbs/init.ora ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated ORA-01262: Stat failed on a file destination directory Linux-x86_64 Error: 2: No such file or directory 

Kernel panic – not syncing! Attemped to kill init?

error message

kernel slelction

I compiled a 2.6 version kernel on latest Ubuntu for learning LDD(3rd editon), the make_install succeeded and those initrc…,vmlinuz,module packages were generated automatically. But the kernel 2.6 won’t start anyway.

I have tried some methods from similar questions:

  1. edit boot commands and add “selinx = 0”
  2. edit “grub.conf” and add “selinux = 0” to the boot-related line of 2.6 kernel
  3. create new file “/etc/selinux/config” and add “selinux=permissive”

None of the above works…I’m badly confusing.. But when choose kernel-5.0xxx,it can boot up normally.

Please help me figure out where the problem lies,I would appreciate that a lot.

MariaDB docker “Can’t init tc log” on start up when using mounted storage

I am initializing a new MariaDB database. Running docker with a volume to my home directory allows MariaDB to start up just fine:

docker run -it --rm --name mymaria \   -e MYSQL_RANDOM_ROOT_PASSWORD=yes \   -e MYSQL_PASSWORD=p@$  $  w0rd \   -e MYSQL_DATABASE=myapp \   -e MYSQL_USER=myapp \   -v /home/myuser/mysql:/var/lib/mysql \   mariadb:10.2 

However, running the mariadb container with a volume via a mounted directory like so:

docker run -it --rm --name mymaria \   -e MYSQL_RANDOM_ROOT_PASSWORD=yes \   -e MYSQL_PASSWORD=p@$  $  w0rd \   -e MYSQL_DATABASE=myapp \   -e MYSQL_USER=myapp \   -v /mnt/storage/mysql:/var/lib/mysql \   mariadb:10.2 

This configuration returns this from the docker logs output:

Initializing database 2019-09-23  5:12:13 139724696503616 [ERROR] Can't init tc log 2019-09-23  5:12:13 139724696503616 [ERROR] Aborting   Installation of system tables failed! ... 

Simply removing tc.log as some folks have suggested does not work. Restarting mariadb will rewrite tc.log back into the volume /var/lib/mysql.

Perhaps this is a permissions issue? I feel like I’ve tried every combination of chown with each directory. I do notice that docker appears to change the mounted volume /mnt/storage/mysql to drwxr-xr-x 2 systemd-coredump root 176 Sep 22 23:11 mysql which I find odd.

I encounter this issue only with the 10.2 tag and not the latest. However, for an orchestration I’m working on, it suggests mariadb:10.2.

Kernel tainted and attempted to kill init ubuntu 16.04.06

This is the image of what loads on my screen when I try I try to boot up ubuntu. I don’t know how to fix this error. The Kernel is tainted, and I’m not able to fix anything at the moment because accessing any mode at all leads to this same problem. I have a live disk, but I don’t know ow to fix this problem with it. I know reinstalling would be a solution but is there any way to fix this without doing that? Please help. Thanks!

How to init other systems in the enterprise

We currently have a REST API on top of a MongoDB cluster which works pretty well given the right indexes, as we are mostly benchmarking the MongoDB driver.

A few data points:

  • several thousands of requests per second
  • 100 GB of data
  • 1 billion of items in the main collection

There are other entities in the enterprise that need some part of this data, in order to aggregate / rework / merge with other systems.

The question is: how do you handle an init of their systems in that case?

We have thought about a few solutions:

  • stream the data from the API
  • provide them with a dump of the data, in the same format as the API
  • provide them with a MongoDB read-only replica
  • … ?

How do bigger entities handle that kind of data transfer?

NVIDIA: GPU exception occured durint X server init

My GPU is the GTX870M. I did a fresh install of Ubuntu 18.04. All I did was:

sudo apt-get update sudo apt-get upgrade sudo ubuntu-drivers autoinstall nvidia-xconfig reboot 

It installed the nvidia-390 driver. Now whenever I try to start the X server with startx it fails. I can still use Wayland. Here is what I tried (in recovery mode):

startx

Output:

X.Org X Server 1.20.1 X Protocol Version 11, Revision 0 Build Operating System: Linux 4.4.0-140-generic x86_64 Ubuntu Current Operating System: Linux <censored>-PC 4.18.0-22-generic #23~18.04.1-Ubuntu SMP Thu Jun 6 08:37:25 UTC 2019 x86_64 Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.18.0-22-generic root=UUID=0d1d9304-4cd6-41f6-80b2-3562578a252e ro recovery nomodeset Build Date: 27 November 2018  05:27:12PM xorg-server-hwe-18.04 2:1.20.1-3ubuntu2.1~18.04.1 (For technical support please see http://www.ubuntu.com/support)  Current version of pixman: 0.34.0     Before reporting problems, check http://wiki.x.org     to make sure that you have the latest version. Markers: (--) probed, (**) from config file, (==) default setting,     (++) from command line, (!!) notice, (II) informational,     (WW) warning, (EE) error, (NI) not implemented, (??) unknown. (==) Log file: "/var/log/Xorg.0.log", Time: Sat Jun 22 13:47:29 2019 (==) Using config file: "/etc/X11/xorg.conf" (==) Using system config directory "/usr/share/X11/xorg.conf.d" (EE)  Fatal server error: (EE) NVIDIA: A GPU exception occurred during X server initialization(EE)  (EE)  Please consult the The X.Org Foundation support       at http://wiki.x.org  for help.  (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information. (EE)  (EE) Server terminated with error (1). Closing log file. xinit: giving up xinit: unable to connect to X server: Connection refused xinit: server error 

/var/log/Xorg.0.log: https://pastebin.com/ygxRKPpg

In these logs, 2 things caught my eyes:

[   119.994] (II) NVIDIA(0): Virtual screen size determined to be 640 x 480 [   119.994] (WW) NVIDIA(0): Unable to get display device for DPI computation. 

and

[   119.994] (--) NVIDIA(0): Memory: 3145728 kBytes [   119.994] (II) NVIDIA: Using 6144.00 MB of virtual memory for indirect memory 

It seems like my display device is not correctly detected and/or that X server is trying to use too much memory?

dmesg output: https://pastebin.com/fcYMPrUB

Relevant parts:

[  120.275346] NVRM: GPU at PCI:0000:01:00: GPU-c588f20e-6b26-3352-5b81-666db3c970a2 [  120.275348] NVRM: Xid (PCI:0000:01:00): 44, Ch 00000000, engmask 00000101, intr 10000000 [  120.793329] NVRM: Xid (PCI:0000:01:00): 31, Ch 00000008, engmask 00000111, intr 10000000 

I checked what the Xid meant: https://docs.nvidia.com/deploy/xid-errors/index.html

31 GPU memory page fault

44 Graphics Engine fault during context switch

nvidia-smi output:

Sat Jun 22 14:23:52 2019        +-----------------------------------------------------------------------------+ | NVIDIA-SMI 390.116                Driver Version: 390.116                   | |-------------------------------+----------------------+----------------------+ | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC | | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. | |===============================+======================+======================| |   0  GeForce GTX 870M    Off  | 00000000:01:00.0 N/A |                  N/A | | N/A   83C    P0    N/A /  N/A |      0MiB /  3018MiB |     N/A      Default | +-------------------------------+----------------------+----------------------+  +-----------------------------------------------------------------------------+ | Processes:                                                       GPU Memory | |  GPU       PID   Type   Process name                             Usage      | |=============================================================================| |    0                    Not Supported                                       | +-----------------------------------------------------------------------------+ 

Any help is appreciated, thanks.

Ubuntu 18.04 won’t start on a dual-boot system: “No init found. Try passing init=bootarg.”

Ubuntu has been having issues lately on my computer. When I start it, I get an error message ending inNo init found. Try passing init=bootarg. This has become slightly common since I installed Windows 10 on my computer. I would like to know the culprit to this error, why this is happening, and how to fix it.

Best regards,

Michael

Any way to view contents of init files

I am using Ubuntu 18.04.2 LTS. I have a file called init and it is an executable (appplication/x-executable). I would like to read the content of the executable. When I use the cat command, I see gibberish. When I used the file command, it returned

init: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, …

Is there any way for me to view the contents?