How can I boot OpenSolaris x86 into single-user mode? - solaris

Modern OpenSolaris is configured to disallow root logins during normal boots. It is only possible in single-user mode. However, many instructions online simply say to add "-s" to the end of the default grub boot arguments, which leaves a graphical boot progress display in an endless loop and never enters the single-user mode console.

The key point left out of many OpenSolaris single-user boot instructions is that you must modify a text boot grub entry, and not the default graphical entry. Booting in graphical mode with the single-user switch leaves the boot progress graphic overlayed atop the console forever, never allowing the maintenance console to be visible.
Reboot.
At the grub prompt, highlight the most recent text boot entry and press 'e'.
Highlight the line beginning with kernel$ and press 'e'.
Add '-s' to the end of the line.
e.g. change:
kernel$ /platform/i86pc/kernel/$ISADIR/unix -Bv$ZFS-BOOTFS
to
kernel$ /platform/i86pc/kernel/$ISADIR/unix -Bv$ZFS-BOOTFS -s
Press 'enter'.
Press 'b' to boot.
The system should boot without a graphical overlay, and should promptly arrive at the system maintenance console.

Full solution of OpenIndiana 157:
Reboot
At the grub prompt, highlight the most recent text boot entry and press 'e'.
Remove three lines (pressing d with cursor on the line to be deleted):
splashimage /boot/solaris.xpm
foreground d25f00
background 115d93
Press e with cursor on the line beginning with kernel$
Remove portion " ,console=graphics" from this line
Add ' -s' to the end of this line
Press 'enter'.
Press 'b' to boot.

Related

How are keyboard inputs transmitted through Windows terminal and WSL2

I'm using WSL (WSL2 in fact) for a few days and I'm a bit confuse about keyboard combination redirection and/or interception.
I have to say that my favorite tool to edit text is emacs, that use a lot of keyword combinations.
My stack is this one :
Under windows, I run Windows terminal (WT.exe)
In this terminal I open a tab which (afaik magically) is a shell on a linux subsystem. This subsystem is a Debian
In this shell I run emacs.
The whole thing looks like that :
At this point, when I enter a key combination, it may be passed to emacs, or it may be intercepted/interpreted by any other layer of the stack.
For instance :
ctrl-e is interpreted by emacs : it move the caret to the end of file
ctrl-z is interpreted by wsl2 (afaik) : it pauses emacs as a background job
ctrl-tab is interpreted by windows terminal : it changes tab
alt-f4 is interpreted by windows : it closes windows terminal
And some of them are a mystery for me. For instance ctrl-_ (ctrl underscore), which is very useful on default emacs configuration, is not interpreted by emacs. It is translated at some point as "delete". In this configuration typing "delete" or "ctrl-_" is the very same thing : it removes the first character before the caret.
Very specifically and synthetically stated, my question would be : "How do I configure this stack to make emacs receive ctrl-_ ?"
Of course more generally, I really would like to know, how each layer works and is parameterized. For instance, is there a configuration file for WT and/or WSL2, that says which combination are forwarded, which one are interpreted and which one are ignored.
Additional Data :
If I run WSL2 through WT, but don't start emacs, ctrl-_ is also interpreted as "delete"
If I run another type of "tab" in WT, like cmd.exe or powershell, ctrl-_ is not interpreted as "delete". I don't know if it is interpreted at all
If I run WSL2 without WT, Ctrl-_ is not interpreted at all.
I didn't found any mention of ctrl-_ in WT config shortcuts.
Additional Data :
I tried to run following python program in both stacks : WT/WSL and WT/CMD.EXE
import keyboard
while(True):
c = keyboard.read_key()
print(c)
On WT/CMD.EXE, the output is :
ctrl
_
_
ctrl
Which means it receive the keyboard info.
On WT/WSL2, it fails to run. Apparently "keyboard" is not compatible with WSL2. But this is not the question here.
A useful tool for debugging input on linux is showkey -a. You can use that to help debug what keys the client application is receiving. If you press a key and it doesn't display anything in the output, then there's a good chance it's being intercepted by the Terminal.
There's probably an open issue for this on the Terminal repo. #8458 looks similar.
is there a configuration file for WT and/or WSL2, that says which combination are forwarded, which one are interpreted and which one are ignored.
defaults.json is the file that contains all the keybindings that the Windows Terminal binds by default.
What WSL does is more complicated. IIRC, the inputrc file on linux is used readline (for bash, etc) to specify how certain keys are handled by the shell. But then there are also keys configured in stty that control other parts of the TTY interface. That part I understand less.
alt-f4 is interpreted by windows : it closes windows terminal
FWIW That's actually a application-level keybinding. The Terminal handles that key manually, so that people can optionally disable it. See defaults.json

Run a program in debug mode in eclipse in command line

For several reasons I must test my program with multiple computer restart.
So I need at the computer startup, eclipse open and the tested program runs in eclipse (in debug mode if possible).
Can you give me a command line or another way to do that. I just need when I open eclipse or when I use the given command line, the program automatically start
Thank you
For Linux OS (not sure on Win, Mac), Eclipse (or other apps) can be automated with xdotool utility. Assuming your app has run at least once in debug mode within Eclipse so it exists an entry on Debug history, a Bash script could do the following actions
-Edit the script below to set the correct position value for the app.
-Launch Eclipse.
-Wait some time until is fully up.
-Execute the following command sequence:
#!/bin/bash
position=6
#find Eclipse app window IDs, keep the last one
e_wid=$(xdotool search --class Eclipse | gawk 'END{print $0}')
# Create basic command string
cmd="xdotool windowactivate --sync $e_wid"
# Send key strokes with some delay in between
# Open Run menu
$cmd key Alt+r
sleep 1
# select Debug option
$cmd key h
sleep 0.5
# pick the sixth option in that menu
$cmd key $position
It's recommended to mark the app as a favorite so it gets a constant order in the menu.
To see another example, check this mluis7 gist at Github.

How do I kill a server in Powershell ISE?

Let's say I run a node server via node server.js
In PowerShell (sans ISE) I can hit CTRL + C or CTRL + BREAK twice to stop the server. However, running the same shortcut in ISE will make it hang. It says "stopping" in the bar across the bottom (I imagine this would be referred to as the status bar) but never actually stops.
Is there a shortcut that I'm unaware of?
One way to handle this is to create a new powershell tab, then kill the server from the new tab (using stop-process for instance). Then switch back to the old tab and (after a possible few second delay) the server will have been terminated. Once you have the command to terminate the server in the command line history of the second PS tab, it will be a little quicker to subsequently kill the server.
Another way I handle this if I have a PS script (vs an external program) that has hung is to create a new powershell tab (ctrl-T), then click the old tab, then click the X on the old tab. Unfortunately you'll have to reopen any files you were editing.

Command line installer issues

Am attempting to run installer using command line using -c option.
Command line execution appears like this:
E:\dev>MyApp_32.exe -c
E:\dev>This will install App on your computer.
OK [o, Enter], Cancel [c]
E:\dev> (showing the Windows command line is confusing to user)
Welcome .. (text of 2nd screen)
Typing "c" or "Cancel" doesn't work. It always takes enter key as input and proceeds to next screen.
Pressing enter transfers control back to windows's command shell, then back to installer. This looks confusing to user. It doesn't give a unified experience to user.
Is it possible to provide input via a silent file ? i.e. a text file with pre-selected inputs?
Am using 32 bit installer on Win 7 Professional x64 with Java 1.6 installed.
The problem is that the installer is a GUI application, it cannot take control of a WIndows terminal in this way. If you start it via
start /wait MyApp_32.exe -c
the command line prompts will not be displayed.
You can run set a response file with the -varfile argument, see the help for more information.

full screen mode (25*80) command line scripting

when you run a script (such as vbscript) from 25*80 (full screen mode of dos prompt) and that your script call a windows application (such as notepad), at the end of the operation, focus remains on the desktop (although "command prompt" at the taskbar minimized and wait for only one "{enter}" to go back in 25*80 full screen command prompt)
how can i do that? (go back to full screen command prompt at the end of the call windows app. from my script)
look at shell command START
Make your command prompt shortcut in fullscreen mode (25*80) by setting property & dbl click on it.
At the prompt enter start /b notepad, and then push enter and see what happen. How can you return to command prompt in full screen mode and how to automate it?