2016年9月12日月曜日

openbsd 6.0 scim-anthy 復活 , qemuなopenbsd

タイトルどおり 5.9ではダメだったのが 蘇生しました。
あるPCでは xfce はパッケージでは動かず portsから いれざるをえませんでした。



cat .profile
---------------------------------------------                                                            
# $OpenBSD: dot.profile,v 1.4 2005/02/16 06:56:57 matthieu Exp $
#
# sh/ksh initialization

PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:.
export PATH HOME TERM

export PKG_PATH=http://ftp.jaist.ac.jp/pub/OpenBSD/6.0/packages/amd64

export XMODIFIERS=@im=scim
export GTK_IM_MODULE=scim
export QT_IM_MODULE=scim

です。




youtube も chromiumで OKです。
https://youtu.be/SE87bnk2xos


grubは
menuentry "openbsd" {
        set root='hd1,msdos4'
        chainloader +1
}



印刷 :openbsdでの一応の解決です

openbsd  ................................................
archlinux ...............................................wifi router
DCp-J925N(openbsdでは cups ドライバーなし) .............
とすべてwifi です。

openbsd の chromium で印刷は ドライバーがないので
DCp-J925N で印刷できません。
が pdf はつくれます。

openbsdから  archlinux に pdfを scp で送ります
次に openbsdから  archlinux に ssh で入って lp  X.pdf
で印刷できます (archlinuxには篤志家のつくったドライバーがある)。
http://atrium.math.wisc.edu/computing/node/385 で勉強しました。

具体的には
cat scp+ssh.bat                                                              
scp -r $1 toto@192.168.8.12:/home/toto/From_openbsd-----
ssh          toto@192.168.8.12




slim
# ./comment-out.bat /etc/rc.local                                            
if [ -x /usr/local/bin/slim ]; then
        echo -n ' slim'; ( sleep 5; /usr/local/bin/slim -nodaemon ) &
fi





archlinuxのqemu で openbsd

残念ながら openbsd は 理念的にはすばらしいが
Xなアプリが少なく セキュリティ重視のため
遅く 実用性に 欠ける。
従って linux妻で 現実に対処し、そのqemu裏で
 openbsd恋人との 逢瀬を楽しむ

え、MSの windows ,
こいつはだめ、だめ、 お絵かき遊びばかりして馬鹿になる。
丁度 TVばかりみて 本(コード)なしでは 阿呆になるように。

従って openbsdは Xなしで サーバーとして使うのが最適です。
例えば 録画サーバー minidlna  を走らせてTVでmp4をみます。
TVがみてるのは 実は 仮想空間にあるopenbsd の/share なんだけどねー
というふうに サーバーとして使えば 最高

/etc/minidlna.conf  
port=8200
media_dir=/share
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
enable_tivo=no
strict_dlna=no
notify_interval=900
serial=12345678
model_number=1


archlinux のqemu でopenbsdを動かすには

1) pacman -S qemu bridge-utils libvirt




2)  ifconfig をして下の黄色を変えます

cat /etc/netctl/bridge
Description="Example Bridge connection"
Interface=br0
Connection=bridge
BindsToInterfaces=(enp9s0 tap0)
IP=dhcp


3)
cat /etc/qemu-ifup
#!/bin/sh
echo "Executing /etc/qemu-ifup"
echo "Bringing up $1 for bridged mode..."
sudo /usr/bin/ip link set $1 up promisc on
echo "Adding $1 to br0..."
sudo /usr/bin/brctl addif br0 $1
sleep 2

chmod 750 /etc/qemu-ifup


4)
cat /etc/qemu-ifdown
#!/bin/sh
echo "Executing /etc/qemu-ifdown"
sudo /usr/bin/ip link set $1 down
sudo /usr/bin/brctl delif br0 $1
sudo /usr/bin/ip link delete dev $1

chmod 750 /etc/qemu-ifdown

5)
5-1) qemu-img create -f qcow2 Q30.img 30G


5-2) qemu-system-x86_64 -hda Q30.img -enable-kvm  -m 2048 -cdrom ./install60.iso  -boot d -monitor stdio
と下準備をしてから

6)
qemu-openbsd.bat 
modprobe tun
sysctl net.ipv4.ip_forward=1
systemctl start libvirtd
netctl start bridge
modprobe -r kvm_intel 
modprobe kvm_intel nested = 1
netctl restart bridge

qemu-system-x86_64 -enable-kvm -m 2048 -hda Q30.img -net nic,macaddr=52:54:00:12:11:11 -net tap,ifname=tap0,script=/etc/qemu-ifup

そして このqemuなopenbsdで make world じゃ


https://youtu.be/cI9M2li8tOw
なかんじで コンパイル中

なお make world は
http://openbsd-akita.blogspot.jp/2015/10/make-world-openbsd-follow-current.html

不便さ
openbsdは xfce4で日本語キーボードにしたら | をおしても | がでません。
で やむを得ず 英語キーボードにしてつかってます。
つまり xfce4のソースの 日本語キーボード 設定部分が変です。
これは 当然 日本人がやるべき仕事ですが 自分はソースをいじれませんのでできない

でも 不便かというと 普通は
archの上に起動したopenbsdは
このarchから sshでopenbsdにはいってしますので
キーボード問題は感じないです。

かーねる -> ユーザーランド -> midori -> ibus-anthy -> minidlna
と 全部ソースからコンパイルしていれたが
midori がおそすぎるので firefoxはコンパイルにすっごく時間がかかるだろうので 
firefoxをパッケージからいれてお茶をにごした。


https://takaki-web.media-as.org/blog/1vf6rs/ より # qemu-image resize target.img +4G


実は 意外にopenbsdのファイルシステム newfs は 電源の突然遮断に弱い。
qemu ですると 簡単に コピーでバックアップがとれるので楽だ。


上の図だけど ちょっと解説する。
/dev/sdb2は 実は WIN10が入ってる。
ここに openbsd のQEMUイメージ Q30.imgを移動する。
そして サイズを qemu-image resize で 100Gまで増やす。
mp4 は 元来 /dev/sda1 にあるが、 これを openbsd の/shareのところに
scp あるいは sftp で移す。
すると 外部のTVは この/shareの mp4を 見れる
             



と いいながら XEONなマシンに 実なopenbsd  をいれてしまった自分がいる
なおブラウザはwordがわりにつかえる seamonkey  seamonkey-i18n-ja がいい。
入力は ibus-anthy の方が動作が確実だ。


2016年4月21日木曜日

5.8 -> openbsd 5.9 日本語入力 nginx

https://osdn.jp/magazine/05/06/20/0123202 より

Theo de Raadt:セキュリテイの セキュリテイによる セキュリテイのためのOS
Linuxが単なるカーネルであるのに対し て、OpenBSDは複雑なUnixシステムであり、カーネル、デバイス・ドライバ、ライブラリ、userland、開発環境、マニュアル、そして開発の 継続に必要なすべてのツールが含まれています。

TheoLinuxを使ったことは一度もない

宗教さえ感じるすごい発言です。 自分などbsd,linuxの間で右往左往してます。 

なお一般的日本人もキリスト教会で式を上げ 葬式は仏教でと 右往左往だよね。 


menu.lst
# menu.lst produced by grub4dosconfig-v1.9.1
color white/blue black/cyan white/black cyan/black
#splashimage=/splash.xpm
timeout 10
default 0

# Frugal installed Puppy

title DebianDog Jessie in sda1=NTFS
 root=(hd0,1)
 kernel /live/vmlinuz1 noauto from=/ changes=/live/
 initrd /live/initrd1.xz



title openbsd
 root=(hd0,3)
 chainloader +1


title arch linux
 root=(hd0,6)
 kernel    /boot/vmlinuz-linux root=/dev/sda6 rw  quiet
 initrd     /boot/initramfs-linux.img




title Puppy precise 5.7.1JP (sda2/p571)
  uuid 7386abd0-b5a9-4555-84ea-4bcf6f3ff73e
  kernel /p571/vmlinuz  pmedia=atahd psubdir=p571 pfix=fsck
  initrd /p571/initrd.gz

title Zdrv tahr64 6.0.5 (sda2/tahr)
  uuid 7386abd0-b5a9-4555-84ea-4bcf6f3ff73e
  kernel /tahr/vmlinuz  pmedia=atahd psubdir=tahr pfix=fsck
  initrd /tahr/initrd.gz

# Full installed Linux

# Windows
# this entry searches Windows on the HDD and boot it up
title Windows\nBoot up Windows if installed
  errorcheck off
  find --set-root --ignore-floppies --ignore-cd  /bootmgr
  chainloader /bootmgr
  find --set-root --ignore-floppies --ignore-cd  /ntldr
  chainloader /ntldr
  find --set-root --ignore-floppies --ignore-cd   /io.sys
  chainloader /io.sys
  errorcheck on

# Advanced Menu
title Advanced menu
  configfile /menu-advanced.lst
  commandline



 http://www.excite.co.jp/News/column_g/20160315/Cobs_412667.html より
「OpenBSD 5.9」の新機能を発表。

i386カーネルにおけるW^Xのサポート
pledge(2)システムコール機能の導入
\802.11nサポートの強化
Xen domUサポートの向上
UTF-8サポートの改善
amd64におけるEFIサポート(32ビット、64ビット)
ネットワークスタックにおけるMP機能の改善
新しいハードウェアサポートの追加と既存のドライバのアップデート


pledge(2)はFreeBSDで導入されたCapsicumと呼ばれるセキュリティ機能(ケーパビリティ)の実装に類似したもので、OpenBSDのベースシステム
次の368個のコマンドにpledge(2)システムコールを適用した
2015年11月16日までにpledge(2)が適用されたコマンド

ac acpidump addr2line apm apply apropos ar arp as at atq atrm awk
b64decode b64encode banner basename batch bc bgpctl bgpd biff c++
c++filt cal cap_mkdb captoinfo cat cc chgrp chmod chown ci cksum clear
clri cmp co col colrm column comm compress comsat config cp cpio cpp
cron crontab crunchgen csh csplit ctags cu cut date dc dd deroff
dev_mkdb df diff diff3prog dig dirname disklabel dmesg doas du
dvmrpctl echo ed egrep eigrpctl eigrpd encrypt env ex expand expr
fdisk fgen fgrep file find finger fingerd flex flex++ fmt fold from
fsck_ext2fs fsck_ffs fsck_msdos fsdb fsirand fstat ftp ftpd fuser g++
gcc gencat getcap getent getopt getty grep group groupadd groupdel
groupinfo groupmod groups gunzip gzcat gzip head help hexdump host
htpasswd httpd id ident identd ikectl iked indent inetd info infocmp
infokey infotocap install-info iscsictl join jot kdump kill ksh
kvm_mkdb lam last lastcomm ld ldapctl ldapd ldconfig ldpctl ldpd leave
less lesskey lex ln lndir locate locate.bigram locate.code lock
lockspool logger login_activ login_crypto login_passwd login_reject
login_skey login_snk login_tis login_token login_yubikey logname look
ls m4 mailwrapper make makeinfo makewhatis makewhatis man mandoc md5
merge mesg mg mkdir mklocale mktemp more nc ncheck ncheck_ffs
netgroup_mkdb nice nl nm nohup nologin nslookup ntpctl ntpd objcopy
objdump od opencvs openssl ospf6ctl ospfctl ospfd otp-md5 otp-rmd160
otp-sha1 paste patch pax pflogd pgrep ping ping6 pkill portmap pr
printenv printf ps pwd pwd_mkdb radiusctl radiusd radiusd_bsdauth
radiusd_radius ranlib rarpd rcs rcsclean rcsdiff rcsmerge rdate
readelf readlink rebound relayctl relayd renice reset rev ripctl rksh
rlog rm rmdir rmt route route6d rpcgen rs rtadvd savecore scan_ffs scp
script sdiff sed sendbug sftp sh sha1 sha256 sha512 signify size skey
skeyaudit skeyinfo sleep slowcgi smtpctl smtpd snmpctl sort spamdb
spellprog split sshd stat strings strip stty su syslogc syslogd
systrace tail tar tcpbench tcpdump tee telnet test texindex tftp
tftp-proxy tftpd tic time tmux top touch tput tr traceroute
traceroute6 tradcpp tset tsort tty tunefs ul uname uncompress unexpand
unifdef uniq units unvis uptime user useradd userdel userinfo usermod
users uudecode uuencode vi view vipw vis w wall wc what whatis whereis
which who whoami whois write x99token xargs yacc yes ypcat ypldap zcat
zdump zegrep zfgrep zgrep zic zzz ZZZ

1) upgrade
rewite .profile
# export PKG_PATH=http://ftp.jaist.ac.jp/pub/OpenBSD/6.1/packages/amd64
pkg_add -iu


2)日本語
どうも scim-setup がうまくいかなく scim-anthy がだめ

よって簡単には 
pkg_add ibus-anthy   ja-mplus-ttf

 cat .profile                                                          
# $OpenBSD: dot.profile,v 1.4 2005/02/16 06:56:57 matthieu Exp $
#
# sh/ksh initialization
PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:.
export PATH HOME TERM
export XMODIFIERS=@im=ibus
export GTK_IM_MODULE="ibus"
export QT_IM_MODULE="ibus"
export LC_CTYPE=ja_JP.UTF-8

export PKG_PATH=http://ftp.jaist.ac.jp/pub/OpenBSD/5.9/packages/i386
あとは ibus-daemon &


他には uim-anthyも使える
こっちは 
pkg_add uim anthy uim-gtk

cat .xinitrc                                                                
export  LANG=ja_JP.UTF-8

export  LC_ALL=$LANG

export  XMODIFIERS='@im=uim'

export  GTK_IM_MODULE='uim'

export  QT_IM_MODULE='uim'


uim-xim &

uim-pref-gtk で設定(下2つの図をみてください。 ちょっとだけ面倒)





 uim-toolbar-gtk & でいいけど




3)bridge

internet
|
router
192.168.1.1
|
|有線

bge0
openbsd
axe0


|有線
|
HUB---TV
|
linux


 # cat /etc/hostname.bge0                                                      
dhcp
#
# cat /etc/hostname.axe0                                                      
up
#
# cat /etc/hostname.bridge0                                                   
add bge0
add axe0
up



openbsd
ifconfig 
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 32768
        priority: 0
        groups: lo
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet 127.0.0.1 netmask 0xff000000

 

bge0: flags=18b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST,MPSAFE> mtu 1500
        lladdr 00:1e:c9:05:78:fc
        priority: 0
        groups: egress
        media: Ethernet autoselect (100baseTX full-duplex,rxpause,txpause)
        status: active
        inet 192.168.1.244 netmask 0xffffff00 broadcast 192.168.1.255
enc0: flags=0<>
        priority: 0
        groups: enc
        status: active

 

axe0: flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:0d:0b:6a:34:16
        priority: 0
        media: Ethernet autoselect (100baseTX full-duplex)
        status: active
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33192
        priority: 0
        groups: pflog

 

bridge0: flags=41<UP,RUNNING>
        groups: bridge
        priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp
        bge0 flags=3<LEARNING,DISCOVER>
                port 1 ifpriority 0 ifcost 0
        axe0 flags=3<LEARNING,DISCOVER>
                port 4 ifpriority 0 ifcost 0



linux 192.168.1.47

TV    192.168.1.144


4)nginx

/etc/nginx/nginx.conf

 worker_processes  1;
worker_rlimit_nofile 1024;
events {
    worker_connections  800;
       }
http {
    include       mime.types;
    default_type  application/octet-stream;
    index         index.html index.htm;
    keepalive_timeout  65;
    server_tokens off;
server {
        listen       80;
        server_name  localhost;    #<-for test
        root         /var/www/d1;
          }
server {
        listen       80;
        server_name  s-himitu.com;
        root         /var/www/d1;
    auth_basic           "closed site";
    auth_basic_user_file /var/www/1/.htpasswd;
          }
    }


 htpasswd   /var/www/1/.htpasswd     ID
でいいけど


 # ls -l /var/www/1/
-rw-r-----  1 root   www     65 Apr 29 11:19 .htpasswd


5)x11vnc

ちょっと便利。

openbsd で あるユーザーでlogin して Xをたちあげてから
linux で ssh でopenbsdにはいって x11vnc
それから linux で xtightvncviewer 192.168.100.200すると openbsdのXが linuxにくる








http://www.openbsd.org/faq/pf/example1.html#pf より


#int_if="{ vether0 em1 em2 em3 }" 
int_if="fxp0"
table <martians> { 0.0.0.0/8 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16     \
      172.16.0.0/12 192.0.0.0/24 192.0.2.0/24 224.0.0.0/3 \
      192.168.0.0/16 198.18.0.0/15 198.51.100.0/24        \
      203.0.113.0/24 }
set block-policy drop
set loginterface egress
set skip on lo0
match in all scrub (no-df random-id max-mss 1440)
match out on egress inet from !(egress:network) to any nat-to (egress:0)
block in quick on egress from <martians> to any
block return out quick on egress from any to <martians>
block all
pass out quick inet
pass in on $int_if inet
#pass in on egress inet proto tcp from any to (egress) port 22 
# pass in on egress inet proto tcp from any to (egress) port { 80 443 } rdr-to 192.168.1.2
pass in on egress inet proto tcp from any to (egress) port { 22 80 1194 }




なお バックアップは sd1にopenbsdをいれたので
インストール時に

sd1a   は /
sd1b は swap
sd1d は /backup
としておきます。

snapshotのCDでブートして upgradeをえらび
アップグレードの対象を sd1 としたあと
ctrl+c で抜けて

mkdir /ma
mkdir -p /md/0303

mount /dev/sd1a /ma
mount /dev/sd1d /md

(cd /ma ; tar cvpf - .)|(cd /md/0303 ; tar xpf -)



nat



新しいopenbsd---wired---> sisi0:古いopenbsd5.9:bwi0----wifi----> wifi router

新しいopenbsd にもwifiがついてるのですが 新しすぎてopenbsdのドライバーがありません。
古いopenbsd5.9を介在させました
これにて 新しいopenbsd がインターネットにでれます。

./comment-out.bat /etc/sysctl.conf                                         
net.inet.ip.forwarding=1        # 1=Permit forwarding (routing) of IPv4 packets


 ./comment-out.bat /etc/hostname.sis0                                       
inet 192.168.1.1 255.255.255.0



comment-out.bat /etc/dhcpd.interfaces                                        <
sis0





$ ./comment-out.bat /etc/dhcpd.conf                                          
option  domain-name "my.domain";
option  domain-name-servers 8.8.8.8, 192.168.100.254;
subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers 192.168.1.1;
        range 192.168.1.32 192.168.1.127;
        host static-client {
                hardware ethernet 22:33:44:55:66:77;
                fixed-address 192.168.1.200;
        }
        host pxe-client {
                hardware ethernet 02:03:04:05:06:07;
                filename "pxeboot";
                next-server 192.168.1.1;
        }



cat /etc/pf.conf                                                           
int_if="{ sis0 }"
#table <martians> { 0.0.0.0/8 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16     \
                   172.16.0.0/12 192.0.0.0/24 192.0.2.0/24 224.0.0.0/3 \
                   192.168.0.0/16 198.18.0.0/15 198.51.100.0/24        \
                   203.0.113.0/24 }

set block-policy drop
set loginterface egress
set skip on lo0
match in all scrub (no-df random-id max-mss 1440)
match out on egress inet from !(egress:network) to any nat-to (egress:0)

#block in quick on egress from <martians> to any

block return out quick on egress from any to <martians>
block all
pass out quick inet
pass in on $int_if inet

pass in on egress inet proto tcp from any to (egress) port 22




以前の記載から

でどんな風かというと
左上に 時計が
右下に scim-anthy
がありますね。




大きな字の xterm  にするために
cd /usr/X11R6/bin/
mv xterm  xterm-old


xterm.bat を                                                           xterm-old -fn 10x20 &
にして

ln -s xterm.bat xterm
でOKです。

時計は
wmclock &


OpenBSD 5.9.
amd64 can now boot from 32 bit and 64 bit EFI.


cat .xinitrc               
fvwm
すると


startxでXが立ち上がります
なお
 cat .xinitrc                
twm
とすると この上もなく質素なXがきます。



2015年11月5日木曜日

make a real machine from qemu image (仮想環境で作ったopenbsdを実環境で動かす)


i am greatly helped by openbsd fellows , especially 
tar over ssh   (thanks to Benny Lofgren)ん下
and 
install boot      (thanks to Jan Vlach).


(referrence 1) about qemu
    http://qemuandopenbsd.blogspot.jp/2015/09/qemu.html


in Japanese
夢(kvm)の中ではうまくいった。 じゃあこれを現実のハードデスクで 具現化したいとおもわないだろうか。
でも 霊界と現世との間では cpは通じない。
ただ sshという霊界トンネルをとおれば いけるのだ。
そのため tar over ssh を使う。
ただし 夢を見ながら 夢をコピーするので変質がおこる恐れもなきにしもあらずだ。

linuxの場合は うまい具合に qemu-nbdがあり、 これを使えば 夢からさめた後で コピーするので変質はおこらない。 同じのが openbsdにもあればなあと嘆く。 devつくてね


概略はこうだ 。
まず arch linuxをたちあげ 、
それから kvm guestとしてopenbsd.qcow2をたちあげる。
そして make world (正確には follow current)をする。
そしたら、openbsd.qcow2ができる。
linuxは openbsdのファイルシステムを認識できないので 、
一旦 linuxからもopenbsdからも読み書き可能なext2へコピーする。
次はopenbsdを立ち上げ ext2 から例えば /home/user-fogeへ openbsd.qcow2を コピーし、
これをopenbsd の qemu guestとして立ち上げる。
openbsdなので 他のドライブのopenbsdファイルシステムは認識するので
この他のドライブへ tar over sshで 写す。
これで終了だ!





i prepare 4 story .
i pactice and scceed  
            1st and 2nd and 3rd  story .


i have not practice   4th story yet .
but i guess it is perhaps OK .
 


1st story -----------------------
first overall view

 



i intend to install  [i386 openbsd] on the sd0a area.
i write this story .



1) on rental server

                       rental server (openbsd) is running at sd1a

mount /dev/sd0a /MNT



2)boot bohdi

A) install kvm 0penbsd

 qemu-system-i386 -hda Q30.img -enable-kvm  -cdrom install58.iso -boot d -m 1024
( install58.iso is i386 snapshots   ) 


B) run kvm 0penbsd
qemu-system-i386 -enable-kvm -m 1024 -hda Q30.img   -net nic,macaddr=52:54:00:12:11:11 -net tap,ifname=tap0,script=/etc/qemu-ifup 


C) cd /; tar cvpf -   .  | ssh root@1.2.3.4     "cd /MNT ;  tar xpf -"



3) again on rental server

rewite /MNT/etc/fstab          <- disklabel sd0
 
installboot -r /MNT sd0


4)boot rental server by grub2


i can boot i386 openbsd of sd0a !







2nd story: ----------- for openbsd
1) run linux
     make kvm.img in sdb1 (ext2)   




 2)run openbsd
# mount_ext2fs /dev/sd1i /EXT2/

because of the weak ext2fs
# cp      /EXT2/OpenBSD-current.img   ./
# umount  /EXT2

# mount /dev/sd1a /MNT/

#qemu-system-x86_64 -m $1 -hda $2 -net nic,vlan=1,model=e1000,macaddr=fe:e1:ba:d3:e7:11 -net tap,vlan=1

# ssh -l tuyosi 192.168.100.115 (192.168.100.115 is kvm guest address)



# and on this qemu guest
rm -rf /usr/src/*
rm -rf /usr/obj/*
rm -rf /usr/xobj/*
rm -rf /usr/xenocara/*


cd /; tar cvpf -   .  | ssh root@192.168.100.101  "cd /MNT ;  tar xpf -"
                                (192.168.100.101 is kvm host address)
  and agein return to  qemu host
a)  rewite /MNT/etc/fstab   
       disklabel sd1
 
cat /MNT/etc/fstab   
9f39539222428a90.b none swap sw
#9f39539222428a90.a / ffs rw 1 1
#duid: 183119b913f9d677
183119b913f9d677.a / ffs rw 1 1
 
b)  installboot -r /MNT sd1


halt -p
boot by grun2

snapshots and sd1a appear , success!


 
3rd story  : for Linux




this gray part is written for japanese .     
the writing in english is later .
qemu-nbd をつかったものをかきます。
debiandog でしてます。

sda1はdebiandogで sda4に sda1にあるイメージTC.imgを実装します
したがってtinycoreのqemu イメージ /TC.imgはできた後の作業です。

    aptitude install  qemu-nbd

    # modprobe nbd max_part=8


    # qemu-nbd --connect=/dev/nbd0   /TC.img     

    # mount /dev/nbd0p1 /KVM

    mount  /dev/sda4  /MNT/
   (cd /KVM ; tar cvpf - .)|(cd /MNT ; tar xpf -)


     # umount /KVM
     # qemu-nbd --disconnect /dev/nbd0

     # umount /MNT

        edit /boot/grub/grub.cfg in /dev/sda1

 menuentry ' tc' {
 set root='hd0,msdos4'
 linux /tce/boot/vmlinuz
 initrd /tce/boot/core.gz

}

以上です。





on kvm host, lxle
mount  /dev/sdb1  /MNT

on  kvm guest , bean
cd /; tar cvpf -   .  | ssh root@192.168.100.101    "cd /MNT ;  tar xpf -"



again
on  kvm host, lxle
        edit /boot/grub/grub.cfg in /dev/sda1
menuentry 'bean' {
    set root='(hd1,msdos1)'
    linux    /boot/vmlinuz-3.2.0-89-generic root=UUID=d88f3df3-769d-4f79-b22a-8c2864cd555f ro  
    initrd    /boot/initrd.img-3.2.0-89-generic
}



another Linux specific method : 
this method is very secure because BEAN is not runnning .
[tar over ssh] method is copy running image to a partition , so there may be problems , so i think . 

on kvm host, lxle

    aptitude install  qemu-nbd

    # modprobe nbd max_part=8
    # qemu-nbd --connect=/dev/nbd0   /BEAN.img     # mount /dev/nbd0p1 /KVM



  mount  /dev/sda4  /MNT/
 (cd /mnt/kvm ; tar cvpf - .)|(cd /MNT/ ; tar xpf -)


edit    /MNT/etc/fstab

     # umount /KVM
     # qemu-nbd --disconnect /dev/nbd0

     # umount /MNT

        edit /boot/grub/grub.cfg in /dev/sda1
 menuentry ' tc' {
 set root='hd0,msdos4'
 linux /tce/boot/vmlinuz
 initrd /tce/boot/core.gz
}


apparently , changing sdb1 for sda3 is OK in Linux.
namely , 1 drive is OK ,
               but this setting does not fit to openbsd
               because  in openbsd 1 drive  should have only  1 openbsd file system .
                                 
perhaps other combination is possible .
 for example  kvm host is arch , and kvm guest is debian.
 but i did not try it yet .

about arch's qemu ,   see
   http://hatahata50.blogspot.jp/2015/10/arch-linux-qemu.html
                                                                                 (written in japanese)

real example is here !
http://qemuandopenbsd.blogspot.jp/2015/11/bohdi-arch20qcow2.html



the 4th story----------- only plan



archlinux machine is kvm supported intel machine
and
openbsd machine is i386 machine.

i386 machine cannot compile sources
                          becase of it's poor memory (256MB)


so
compaling current sources should be done on amd64 fast  PC
and
only binaly should be exported to old i386 machine .


why kvm ? -> if following current fails  , i only erase the kvm image file .
                and if succeed , back up is easy to copy  the kvm image file .
                openbsd lacks kvm module  , so openbsd's qemu is slow  .
            



overall view is next .

hub looks like internet .



i use 3 colours.

192.168.100.106

 

192.168.100.101 *about arch's kvm :
                               http://hatahata50.blogspot.jp/2015/10/arch-linux-qemu.html


192.168.100.116

1) on openbsd= 192.168.100.106
 mount /dev/sd1a  /MNT


2)on archlinux=192.168.100.101

a)boot archlinux

qemu-image create -f qcow2 OpenBSD-current.img 30G

B)install
qemu-system-i386 -m 1024 -hda OpenBSD-current.img -cdrom install58.iso(i386 current) -boot d   -net nic,vlan=1,model=e1000,macaddr=fe:e1:ba:d3:e7:11 -net tap,vlan=1


c)run
qemu-system-i386 -m 1024 -hda OpenBSD-current.img -net nic,vlan=1,model=e1000,macaddr=fe:e1:ba:d3:e7:11 -net tap,vlan=1

and
ssh -l tuyosi  192.168.100.106


3)on kvm's openbsd=192.168.100.116


when the follwing current is  finished (reboot and 2)'s run and ssh  )

ssh  root@192.168.100.106   "tar cvpf    -  /      | tar  xpf     - -C  /MNT

or
ssh  root@192.168.100.106   "tar czpf    -  /      | tar  xzpf     - -C  /MNT

or original is
ssh root@192.168.100.106   "tar czpf - / " | tar xzpf - -C /MNT

or

from ML
cd /; tar cfz -   | ssh root@real_machine        "cd /MNT;    tavfpz -"
correct miss typing 
cd /; tar cvpf -   .  | ssh root@192.168.100.106  "cd /MNT ;  tar xpf -"




4) on openbsd= 192.168.100.106

rewite /MNT/etc/fstab  <- disklabel wd1
 
 
installboot -r /MNT wd1
 
 

5) boot by grub2

 







Impossible Dream Don Quixote)

To dream the impossible dream
To fight  the unbeatable foe
To bear with unbearable sorrow
To run where the brave dare not go

To right the unrightable wrong
To love pure and chaste from a far
To try when your arms are too weary
To reach the unreachable star

This is my quest to follow that star
No matter how hopeless, no matter how far
To fight for the right
Without question or pause
To be willing to march
Into hell for a heavenly cause

And I know if I’ll only be true
To this glorious quest
That my heart will lie peaceful and calm
When I’m laid to my rest

And the world will be better for this
That one man, scorned and covered with scars
Still strove with his last ounce of courage
To reach the unreachable star
The fight the unbeatable foe
To dream the impossible dream


以下日本語で書きます。
 qemu~KVM にて 他のCPUをエミュレートしてコンパイルができます。
  失敗すれば KVMはファイルなので 消せばよい。
  成功すれば そのimage ファイルをコピーすれば バックアップできる。

また
cd /; tar cvpf -   .  | ssh root@1.2.3.4     "cd /MNT ;  tar xpf -"
にて実機に バイナリを送れます。
ということは x86_64 マシンさえあれば 純粋i386を作れます。

  32bit版では、2の32乗・・・つまり、約4GBのメモリが扱えるのに対して、
  64bit版では(理論上)2の64乗・・・つまり、16エクサバイトと言う
       とてつもなく大きなメモリが取り扱える事になりますが

CPU i386 、 メモリ  64MB ではコンパイル自体が無理です。



もちろん sparc64、powerPCもエミュレートできます。
その心は
http://gihyo.jp/dev/serial/01/vm_work/0001?page=2
仮想マシン上で動作するOSは
「そこに本物のハードウェアがある」と錯覚した状態で動作するため,使用するOS側に別途変更を加える必要がない点が魅力ですが,そのかわりに仮想マシンの実装は複雑になりがちです。
VMware,Hyper-V,KVMXenなどの主要な仮想マシンソフトウェアは,完全仮想化の方式をとっています。
 
 
よく考えると 
x86_64つまりamd64は i386を実行できるのだ。
だから 
なにもKVMの上でなくとも 純粋i386コーディングができるかは別として 実機でやればよい。
それで 
openbsdには amd64とi386の間にしか効かない
            kvm moduleがないのも頷ける。
 
したがって 
amd64の上で powepcを動かすとか(kvm効かないよ
危険なOSをkvm で動かすとか
linuxをしながら openbdのcurrentをKVMで追うとか
debug(自分の駄目ソースを実行したらOS自体まで壊した; 極例は rm -rf /
とかに使うべきだろう。 



ただ、もしも もしも
100Gメモリ core9な 64ビットPC で
純粋i386 OSを   純粋i386コンパイラーで
make world し 、 それを 
貧弱な i386 machine(CPUセレロン メモリ514M) に
実装できたら カ イ カ ン
その心は そのi386 machine には できないから。
なお 32bit PCでは メモリは 2の32乗で 4Gが限界
64bitでは さらに4Gx2x2x2.......x2(32回)なので まあ無限ですね。
 
 
linuxを起動し 、最初に openbsd current のイメージをコピーする。
それから openbsd current を kvm guestでたちあげて 
もっと新しいソースを追っかけている。
そして うまくいったらそれを 外付けHDDに実装してたしかめている。


fdisk -e sd1
edit 3

disklabel -E sd1
newfs sd1a
 
 
 https://www.youtube.com/watch?v=bqmWOSV--mE&spfreload=10


Korean soldier when the Vietnam War was added to the sexual assault 
against Vietnamese women .
But there is no apology from South Korea to Vietnam for this thing.
https://en.wikipedia.org/wiki/Phong_Nh%E1%BB%8B_and_Phong_Nh%E1%BA%A5t_massacre
 
 



https://www.youtube.com/watch?v=2oLmlYSJEy0
The term Lai Dai Han is a Vietnamese term for a mixed ancestry person 
born to a South Korean father 
and 
a Vietnamese mother (including the victims of Korean soldiers) 
during the Vietnam War
 
 Lai Dai Han often live at the margins of Vietnamese society. 
The South Korean government has not released an official statement 
regarding the sexual violence that took place during the Vietnam War.