Sunday, November 24, 2013
How Bitcoin Works
A fairly low level description as to how Bitcoins actually work.
How Bitcoin Works Under the Hood - YouTube - https://www.youtube.com/watch?v=Lx9zgZCMqXE
Force a Kernel Panic
Have you ever wanted to generate a kernel panic, for kernel testing purposes?
A few ways to generate a kernel panic, a kernel oops and reboots:
# echo 1 > /proc/sys/kernel/panic
# dd if=/dev/random of=/dev/port
# cat /dev/port
# cat /dev/zero > /dev/memForcing an Alt-SysReq-c command from the console:
# echo c > /proc/sysrq-trigger
To generate a kernel panic from source code, we will need to compile a kernel module from the kernel source: (source)
// source: force_panic.c
#ifdef __KERNEL__
/* Makefile :
obj-m := force_panic.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
*/
#include <linux/module.h>
#include <linux/kernel.h>
static int __init panic_init(void) {
panic("force-panic");
return 0;
}
static void __exit panic_exit(void) {
}
module_init(panic_init);
module_exit(panic_exit);
#endif
Generate a kernel oops: (source)
static int crash_module_init(void) {
printf("crash module starting\n");
int *p = 0;
printk("%d\n", *p);
return 0;
}
static void crash_module_exit(void) {
printf("crash module exiting\n");
}
module_init(crash_module_init);
module_exit(crash_module_exit);
Monday, November 11, 2013
PSOD (Purple Screen of Death)
![]() |
| Example of a PSOD kernel stack trace screen |
- Hardware failure
- Out of memory
- Hung CPU conditions
- Misbehaving drivers (null pointers, invalid memory access, etc)
- NMI (Non Maskable Interrupts)
- Screenshot of PSOD kernel stack trace screen (if possible)
- Support logs from the vm-support command
- Kernel log(should be included in vm-support, but better safe then sorry)
- Kernel core dump (only needed if a developer asks for it)
## Kernel log - will output: vmkernel-log.1
# esxcfg-dumppart -L /vmfs/devices/disks/$( \
esxcfg-dumppart --get-active | awk '{print $1}' )
To manually collect the kernel core dump: (if developer asks for it)
## Kernel core dump - will output: vmkernel-zdump.1
## Note: ESXi 5.x will put kernel dump here:
## /scratch/core/vmkernel-zdump.*
# esxcfg-dumppart -C -D /vmfs/devices/disks/$( \
esxcfg-dumppart --get-active | awk '{print $1}' )
For testing purposes, one can manually trigger a PSOD:
# vsish -e set /reliability/crashMe/Panic
How To Disable ESXi Password Restrictions
The following instructions will allow you to change the "root" user's password to something simple like "password".
2. Change password:
Note: You will need to force the write with an exclamation ":wq!".
2. Change password:
Note: The enforce setting will be lost on the next reboot, so change your password now.
2. Change password:
2. Change password:
2. Change password:
ESXi 5.0, ESXi 5.1 and ESXi 5.5
1. Edit /etc/pam.d/passwd and add "enforce=none" to the end of the "password requisite" line:esx# vi /etc/pam.d/passwd
password requisite /lib/security/$ISA/pam_passwdqc.so \
retry=3 min=8,8,8,7,6 enforce=none
2. Change password:
esx# passwd
ESXi 4.1
1. Edit /etc/pam.d/system-auth and add "enforce=none" to the end of the "password requisite" line:esx# vi /etc/pam.d/system-auth
password requisite /lib/security/$ISA/pam_passwdqc.so \
retry=3 min=8,8,8,7,6 enforce=none
Note: You will need to force the write with an exclamation ":wq!".
2. Change password:
esx# passwd
Note: The enforce setting will be lost on the next reboot, so change your password now.
ESXi 4.0
1. Edit /etc/pam.d/common-password and add "enforce=none" to the end of the "password requisite" line:esx# vi /etc/pam.d/common-password
password requisite /lib/security/$ISA/pam_passwdqc.so \
retry=3 min=8,8,8,7,6 enforce=none
2. Change password:
esx# passwd
ESX 4.1
1. Edit /etc/pam.d/system-auth and add "enforce=none" to the end of the "password required" line:esx# vi /etc/pam.d/system-auth
password required /lib/security/$ISA/pam_passwdqc.so \
min=8,8,8,7,6 similar=deny match=0 enforce=none
2. Change password:
esx# passwd
ESX 4.0
1. Edit /etc/pam.d/system-auth-generic and add "enforce=none" to the end of the "password required" line:esx# vi /etc/pam.d/system-auth-generic
password required /lib/security/$ISA/pam_passwdqc.so \
min=8,8,8,7,6 similar=deny match=0 enforce=none
2. Change password:
esx# passwd
How To Enable ESXi SSH Access
The following instructions will allow you to enable root ssh access to an ESXi server:
2. Navigate down to "Troubleshooting Options", and press enter.
3. Navigate down to "Enable SSH" and press enter.
4. To disable the configuration warning "Configuration Issues: SSH for the host has been enabled" in the vSphere Client, change the following:
2. Navigate down to "Troubleshooting Options", and press enter.
3. Navigate down to "Enable Remote Tech Support (SSH)" and press enter.
2. Type in "unsupported" (the characters will not be echoed back) and press enter. Now enter in the root user's password and press enter.
3. Edit /etc/inetd.conf and uncomment the "ssh stream tcp" line:
4. Reboot the server:
2. Edit /etc/ssh/sshd_config and change the 'PermitRootLogin' line to allow root login:
3. Restart the SSH service:
ESXi 5.0 and ESXi 5.1
1. From the DCUI (Direct Console User Interface), press "[F2]" and login.2. Navigate down to "Troubleshooting Options", and press enter.
3. Navigate down to "Enable SSH" and press enter.
4. To disable the configuration warning "Configuration Issues: SSH for the host has been enabled" in the vSphere Client, change the following:
- Configuration -> Software (section) -> Advanced Settings -> UserVars -> SuppressShellWarning = 0
ESXi 4.1
1. From the DCUI (Direct Console User Interface), press "[F2]" and login.2. Navigate down to "Troubleshooting Options", and press enter.
3. Navigate down to "Enable Remote Tech Support (SSH)" and press enter.
ESXi 4.0
1. From the DCUI (Direct Console User Interface), switch to the hidden shell login screen with "[Alt]+[F1]".2. Type in "unsupported" (the characters will not be echoed back) and press enter. Now enter in the root user's password and press enter.
3. Edit /etc/inetd.conf and uncomment the "ssh stream tcp" line:
esx# vi /etc/inetd.conf ssh stream tcp nowait root /sbin/dropbearmulti dropbear ...
4. Reboot the server:
esx# reboot
ESX 4.1 and ESX 4.0
1. From the terminal screen, switch to the shell login screen with "[Alt]+[F1]" and login as root.2. Edit /etc/ssh/sshd_config and change the 'PermitRootLogin' line to allow root login:
esx# vi /etc/ssh/sshd_config PermitRootLogin yes
3. Restart the SSH service:
esx# service sshd restart
How To Manage Kernel Module Load Settings on ESXi
The following are instructions for managing kernel modules (drivers) on ESX(i).
List all loaded kernel modules
# vmkload_mod -l # --list
Show kernel module information
# vmkload_mod -s some_module # --showinfoNote: This works in the same manner as modinfo on Linux
List module load parameters for on boot
# esxcfg-module -g some_module # --get-options
Set module load parameters for on boot
# esxcfg-module -s 'parameter_a=1 parameter_b=test' some_moduleNote: This does not affect parameters on manual module load
Clear module load parameters for on boot
# esxcfg-module -s '' some_module # --set-options
Disable module on boot
# esxcfg-module -d some_module # --disable
## write boot config, extra step for ESX 4.x only # esxcfg-boot -b
Enable module on boot
# esxcfg-module -e some_module # --enableNOTE: On ESXi 5.1 you will need to re-enable the module to even manually load the driver.
Manually load module
# vmkload_mod some_module # vmkload_mod some_module parameter_a=1 parameter_b=testNote: This works in the same manner as modprobe/insmod on Linux
Manually unload module
# vmkload_mod -u some_module # --unloadNote: This works in the same manner as modprobe/rmmod on Linux
How To Reset ESXi Trial License
WARNING: This is for education/informational testing/development purposes only, and should not be used on a production server.
WARNING: This trick will only work with an ESX(i) stand alone server. It will not work if the ESX(i) server is connected to a vCenter Server, as the vCenter Server knows better than to let you do this. (you can always remove and readd the ESX(i) server to vCenter.)
To reset your ESX 4.x, ESXi 4.x and ESXi 5.x 60 day evaluation license:
Sample commands:
For ESXi 5.1 and ESXi 5.5, you may need to continually remove the license files as the server reboots for this to work. The following should do this quite nicely:
An alternative shows that restarting the services should works just as well as rebooting the server:
The alternative also shows a method for resetting the trial license while connected to vCenter server. I still think removing and re-adding the ESXi server is cleaner.
WARNING: This trick will only work with an ESX(i) stand alone server. It will not work if the ESX(i) server is connected to a vCenter Server, as the vCenter Server knows better than to let you do this. (you can always remove and readd the ESX(i) server to vCenter.)
To reset your ESX 4.x, ESXi 4.x and ESXi 5.x 60 day evaluation license:
- Login to the TSM through SSH or Shell
- Remove the following two files:
- /etc/vmware/vmware.lic
- /etc/vmware/license.cfg
- Reboot server
Sample commands:
rm -f /etc/vmware/vmware.lic /etc/vmware/license.cfg reboot
For ESXi 5.1 and ESXi 5.5, you may need to continually remove the license files as the server reboots for this to work. The following should do this quite nicely:
rm -f /etc/vmware/vmware.lic /etc/vmware/license.cfg
reboot ; while true ; do
rm -f /etc/vmware/vmware.lic /etc/vmware/license.cfg
done
An alternative shows that restarting the services should works just as well as rebooting the server:
# For ESXi 5.0 rm -f /etc/vmware/vmware.lic /etc/vmware/license.cfg services.sh restart
# For ESXi 5.1 rm -r /etc/vmware/license.cfg cp /etc/vmware/.#license.cfg /etc/vmware/license.cfg /etc/init.d/vpxa restart
The alternative also shows a method for resetting the trial license while connected to vCenter server. I still think removing and re-adding the ESXi server is cleaner.
Subscribe to:
Posts (Atom)









