20080420

Disable Solaris GUI

It could be done by using one of the two methods.
The first one does its job immediate.

# svcadm disable cde-login

(You could also use the full FMRI, svc:/application/graphical-login/cde-login:default)

The second one takes place during the next startup.

# /usr/dt/bin/dtconfig -d

(Use -e switch to enable auto-start)

20080413

OpenSolaris on MacBook Pro

The purpose of this post is not to give the recipe for an overall installation.
I've written down a few notes about the network configuration.

I've used the Parallels virtualization and OpenSolaris b79b. Parallels emulates the Realtek 8029(AS) network card but there's no support inside the OS.
To complete this task perform the following steps:

1. Mount vmtools.iso as CD/DVD-ROM (/Library/Parallels/Tools/vmtools.iso)
2. Turn off the eeprom DMA property (atapi-cd-dma-enabled) - before the boot process edit the grub menu list (press 'e') and add the following to the kernel line:

grub edit> kernel$ /platform/i86pc/kernel/$ISADIR/unix -B atapi-cd-dma-enabled=0

Boot with a 'b' key.
3. Install the requested driver:

# cd /cdrom/prltools/Drivers/Network/RTL8029/SOLARIS
# ./network.sh
[...]
Will you receive IP address from DHCP server (Y/N)


If you've chosen the answer 'N', enter the requested values:

Enter IP address of the virtual machine:
Enter network address:
Enter network mask:
Enter default gateway IP address:


The script will modify the following files:
/etc/inet/hosts
/etc/hostname.ni0
/etc/netmasks
/etc/defaultrouter
or
/etc/dhcp.ni0
/etc/hostname.ni0
(if the 'Y' have been chosen)

Now, reboot the system.

During the boot process you could see the information:

WARNING: ni0: niattach: SA_eeprom is funny, assuming byte-mode

but everything should be just fine.

20070917

oneliner

Task: Remove user1, user2 and user3 ssh keys from multiple machines for both home users and root account,
for ssh protocol 1 as well as protocol 2 files.

To accomplish this task I've used sed and DSH (Dancer's Shell / Distributed Shell) on Debian GNU/Linux.

I've defined the redpool host group:

# cat /etc/dsh/group/redpool
root@red1
root@red2
[...]
root@red99
root@red100


and I've done:

dsh -g redpool "sed -i '/^.*user1\|user2\|user3.*$/d' /{root,home/*}/.ssh/authorized_keys*"


But... you could sue me: "You're guilty of using multiple commands to perform your job."
So, let's ride:

for i in {1..100}; do ssh root@red$i "sed -i '/^.*user1\|user2\|user3.*$/d' /{root,home/*}/.ssh/authorized_keys*"; done


Above option is only usable with hostnames / addresses counted sequentially.
In case of various name schemes it's easier to use the dsh command.

20070813

Solaris hostname

Setting the hostname - one of the most basic installation procedure. Unlike other operating systems a few places to visit. A few places to forget at least one of them.

Ex. setting the sunshine hostname on the machine with a bge0 interface and IP address 10.0.0.1

# echo -e "10.0.0.1\tsunshine" >> /etc/inet/hosts
# echo "sunshine" > /etc/hostname.bge0
# echo "sunshine" > /etc/nodename


There's one more file with the hostname and IP address information - /etc/inet/ipnodes. In Solaris 11 it's a symlink to /etc/inet/hosts file. So, you could leave it alone.

The change of the running system's name is as simple as:

# hostname sunshine

20070803

oneliner

Remove asterisks only from the lines beginning with a specified TAG:

sed '/^TAG.*/!p; s/\*//g; n'

turn into mirror

In below example i've used single volume zfs pool to convert it into mirror zpool.
To show the possibilities of zfs in more extensive way it's based on file volumes instead of drives.

# mkfile -nv 1g mud
mud 1073741824 bytes
# zpool create pond /export/mud

I've created the pond pool based on a mud file.
Now, using the attach method of zpool command, I'll turn it into mirror with water (second file volume).

# mkfile -nv 1g water
water 1073741824 bytes
# zpool attach pond /export/mud /export/water
# zpool status pond
pool: pond
state: ONLINE
scrub: resilver completed with 0 errors on Wed Apr 11 09:43:22 2007
config:

NAME STATE READ WRITE CKSUM
pond ONLINE 0 0 0
mirror ONLINE 0 0 0
/export/mud ONLINE 0 0 0
/export/water ONLINE 0 0 0

errors: No known data errors

20070802

quick snapshot tour

To take a snapshot of zfs pool pool/aqua you have to run an example command:
# zfs snapshot pool/aqua@cold
where the cold is the name of a newly created shot.

You could find it in (pool/aqua/) .zfs/snapshot directory. By default it's hidden.
You can change this behaviour by setting snapdir variable on pool/aqua to visible:
# zfs set snapdir=visible pool/aqua

To take advantage of snapshots in another way, use it to quickly reproduce the filesystems with clone method.
The clone is functional fs instead of snapshot which cannot be modified (ro mode).
# zfs clone pool/aqua@cold pool/ice

It's a good habit to name the snapshop in a way enabling you to remember the creation time.
In a case of memory leak do the following:
# zfs get creation pool/aqua@cold

To destroy snapshot simply run:
# zfs destroy pool/aqua@cold