2017年4月18日火曜日

openbsd 6.1 特に xenodm


fake history made by politicians

Politicians cannot do olympic level figure skating .Politicians do not have the technology to explore history .
Therefore history should be left to historians.
Conversely, historians should not do politics at present .

Regarding the historical problems 
lying between the two countries, 
I think that it should be decided openly 
by discussions with two national academics .



某国に行ってそこの屋台を食べた
確かに美味しい
しかし衛生と言う概念がまるでない
生野菜はそこのあたりの水で洗っているので食べたら細菌性の下痢の心配がある・

油はドブに捨てた油から作られてるかもしれない。

windows にはこの衛生概念違ったセキュリティへの配慮がかけている。
あなたは美味しいけど危険な windows を食べ続けますか
あるいは
コードの正確さから生まれるセキュリティなopenbsdにのりかえますか
旅客機にとって一番大事なことは安全に飛ぶことです

といいながら
白河の 清きに魚も 住みかねて もとの濁りの 田沼恋しき
ということで中庸なLINUXを常用してる日和見な自分がいる


これが現実だね(ちょっと言われてその気になって、女房にしたのがおおまちがい。
USB wifi ,bluetooth まるでダメ。 RUM0はOKだったけどねー


と いうふうに日本語入力 OKです。
今回の壁は xenodm でした。


ビデオは ここ

     寄り道への誘惑 openbsdとUEFIは ここ


1) .profile
export PKG_PATH=ftp://ftp.jaist.ac.jp/pub/OpenBSD/6.1/packages/i386



2)pkg_add nano lftp xfce




3)cat .xsession                                                                                     
startxfce4



4)cat /etc/rc.conf.local   
xenodm_flags=
にて xfce4が始まる


for autologin
by https://marc.info/?l=openbsd-misc&m=149261350115837&w=2
Just add to /etc/X11/xenodm/xenodm-config
                  DisplayManager.*.autoLogin: your_user_name



5)pkg_add chromium   seamonkey seamonkey-i18n-ja
chromeは パッケージからでも ポートからやっても立ち上がらないね


6)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 PKG_PATH=ftp://ftp.jaist.ac.jp/pub/OpenBSD/6.1/packages/i386

                 

export XMODIFIERS=@im=ibus

export GTK_IM_MODULE="ibus"

export QT_IM_MODULE="ibus"





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

8)boot openbsd by grub
fdisk -l /dev/sda
Device     Boot    Start       End  Sectors  Size Id Type
/dev/sda1        4196352  61499391 57303040 27.3G 83 Linux
/dev/sda2           2048   4196351  4194304    2G 82 Linux swap / Solaris

/dev/sda4       61499392 156301487 94802096 45.2G a6 OpenBSD




/boot/grub/grub.cfg
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi
function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}
if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod btrfs
set root='hd1,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos1' --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  9d7e1366-bafa-4822-86da-4f36ff6893cc
else
  search --no-floppy --fs-uuid --set=root 9d7e1366-bafa-4822-86da-4f36ff6893cc
fi
    font="/ROOT/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=15
else
  set timeout=15
fi
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-9d7e1366-bafa-4822-86da-4f36ff6893cc' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod btrfs
set root='hd1,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos1' --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  9d7e1366-bafa-4822-86da-4f36ff6893cc
else
  search --no-floppy --fs-uuid --set=root 9d7e1366-bafa-4822-86da-4f36ff6893cc
fi
echo 'Loading Linux linux ...'
linux /ROOT/boot/vmlinuz-linux root=UUID=9d7e1366-bafa-4822-86da-4f36ff6893cc rw rootflags=subvol=ROOT  quiet
echo 'Loading initial ramdisk ...'
initrd  /ROOT/boot/initramfs-linux.img
}

menuentry 'openbsd' {
set root='hd0,msdos4'
chainloader +1
}

if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;

fi






my now state

.profile
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=ftp://ftp.jaist.ac.jp/pub/OpenBSD/6.1/packages/i386
export XMODIFIERS=@im=scim
export GTK_IM_MODULE=scim
export QT_IM_MODULE=scim
 
zzz.bat          より軽いscimをこれで開始                                         
scim -d &
sleep 1
echo '-------'
kill `  ps ax | grep xfce4-terminal                                  |  cut -d ' ' -f 1 `
kill `  ps ax | grep xfce4-terminal  | sed "s/^ //g"                 |  cut -d ' ' -f 1 `
kill `  ps ax | grep xfce4-terminal  | sed "s/^ //g" | sed "s/^ //g" |  cut -d ' ' -f 1 `





i use SSD of 32 GB .

# df
Filesystem  512-blocks      Used     Avail Capacity  Mounted on
/dev/sd0a     58447576   4436968  51088232     8%    /

only 8%


# top ( 1GB memory)
and in using seamonkey
 load averages:  1.34,  1.04,  0.50                                       i3.lan 05:44:57
61 processes: 3 running, 57 idle, 1 on processor                                up  0:04
CPU states: 33.3% user,  0.0% nice, 66.7% system,  0.0% interrupt,  0.0% idle
Memory: Real: 297M/634M act/tot Free: 349M Cache: 196M Swap: 0K/1028M
  PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND
99439 fuji      32    0  187M  200M run       -         0:49  2.83% seamonkey
64681 _x11      29    0   14M   28M run       -         0:07  0.68% Xorg
89616 fuji       2    0 3416K   14M sleep     poll      0:01  0.34% xfwm4
63670 fuji      29    0 6188K   21M run       -         0:01  0.05% xfce4-terminal
81230 fuji       2    0 3620K   16M sleep     poll      0:01  0.05% xfce4-panel
 5154 fuji       2    0 6864K   18M sleep     poll      0:01  0.00% xfdesktop
    1 root      10    0  384K  368K idle      wait      0:01  0.00% init
57588 root      10    0 1712K 6488K idle      wait      0:00  0.00% slim
70594 fuji       2    0 1376K 8920K sleep     poll      0:00  0.00% xfce4-session





温度 CPU temperature
 ./comment-out.bat /etc/rc.conf.local  | grep sensor
sensorsd_flags=



./comment-out.bat temp.bat                                                   
n=0
while true
do
n=`expr $n + 1`
echo $n '---------------'
sysctl -a | grep "hw.sensors" | grep cpu
echo
echo
sleep 5
done


9)HDD 80GB -> SSD 32GB
a) install minimum openbsd to SSD 32 GB
b) boot openbsd by [usb openbsd ] or perhaps [cd openbsd]
c) attach HDD to usb-sata converter
d) attach SSD to usb-sata converter
e)mount /dev/sd1a /s1   <------HDD
f) mount /dev/sd2a /s2   <------SSD
g) (cd /s1 ; tar cvpf - .)|(cd /s2 ; tar xpf -)
h) umount /s1 ; umount /s2
i) atach SSD to PC
j) boot by cd and upgrade




i386 , celeron, 1G memory , 80GB harddisk-> https://youtu.be/e4s6-iMEzY4
the end of real openbsd
----------------------------------------------<





the following is virtual openbsd on archlinux.

#1) qemu-img create -f qcow2 OpenBSD30-61.img 30G

#2) qemu-system-x86_64 -hda OpenBSD30-61.img -enable-kvm  -m 4096 -cdrom ./install61.iso  -boot d -monitor stdio

#3)

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 4096 -hda OpenBSD30-61.img -net nic,macaddr=52:54:00:12:11:11 -net tap,ifname=tap0,script=/etc/qemu-ifup


#qemu-system-x86_64 -enable-kvm  -soundhw sb16,adlib   -m 4096 -hda OpenBSD30-61.img -net nic,macaddr=52:54:00:12:11:11 -net tap,ifname=tap0,script=/etc/qemu-ifup





if you can not conect internet on arch , plese do  netctl restart bridge







my cheap printer(DCP-J325N) is not supported by cups .
cat print.bat                                                                
scp mozilla.pdf ya@192.168.80.116:/home/ya
ssh ya@192.168.80.116

and
lp mozilla.pdf 

then i get print ! 
cups is not needed .

ps is also OK .









3) www server 


/etc/rc.conf.local                                         
httpd_flags=""


/var/www/htdocs/index.html
123


/etc/httpd.conf                                            
ext_addr="*"
server "default" {
        listen on $ext_addr port 804)boot openbsd by grub
}






again real openbsd , but now amd64
  first i install USB stick then dd to HDD .

1) in i386       chromium can not boot , but 
    in arm64   chromium can        boot

2) when boot
i do the next script
zzzzz.bat                                                  
sleep 1
export PKG_PATH=ftp://ftp.jaist.ac.jp/pub/OpenBSD/6.1/packages/amd64
sleep 1
export XMODIFIERS=@im=ibus
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
echo $PKG_PATH
echo
echo $XMODIFIERS
echo $GTK_IM_MODULE
echo $QT_IM_MODULE
ibus-daemon &
sleep 1
echo '-------'
kill `  ps ax | grep xfce4-terminal                                  |  cut -d ' ' -f 1 `
kill `  ps ax | grep xfce4-terminal  | sed "s/^ //g"                 |  cut -d ' ' -f 1 `

kill `  ps ax | grep xfce4-terminal  | sed "s/^ //g" | sed "s/^ //g" |  cut -d ' ' -f 1 `


3) print.bat      need not install cups                                            
scp -r $1  taro@192.168.80.105:/home/taro
ssh taro@192.168.80.105

4) i use ibus-anthy

5)sound
xfce4-mixer

6)/etc/rc.conf.local                                         
xenodm_flags=


# ./comment-out.bat .xsession                                                  
startxfce4


 /etc/X11/xenodm/xenodm-config                                        <
! $OpenBSD: xenodm-config.cpp,v 1.1 2016/10/23 08:30:37 matthieu Exp $
!
!
!
!
!
DisplayManager.*.autoLogin:      User_A
DisplayManager.authDir: /etc/X11/xenodm
DisplayManager.errorLogFile:    /var/log/xenodm.log
DisplayManager.keyFile:         /etc/X11/xenodm/xenodm-keys
DisplayManager.servers:         /etc/X11/xenodm/Xservers
DisplayManager*resources:       /etc/X11/xenodm/Xresources
! All displays should use authorization, but we cannot be sure
! X terminals may not be configured that way, so they will require
! individual resource settings.
DisplayManager*authorize:       true
!
DisplayManager*startup:         /etc/X11/xenodm/Xstartup
DisplayManager*session:         /etc/X11/xenodm/Xsession
DisplayManager*reset:           /etc/X11/xenodm/Xreset
DisplayManager*authComplain:    true
! The following three resources set up display :0 as the console.
DisplayManager._0.setup:        /etc/X11/xenodm/Xsetup_0
DisplayManager._0.startup:      /etc/X11/xenodm/GiveConsole
DisplayManager._0.reset:        /etc/X11/xenodm/TakeConsole
DisplayManager.*.authName:      MIT-MAGIC-COOKIE-1



7) dd over scp

dd if=/dev/rsd1c  | gzip -1 - | ssh f@s.mydns.jp  dd of=p.gz




8) wifi router

many PC ---(wifi)--->rumo:OpenBSD:bge0---(wired LAN)--->internet


./comment-out.bat /etc/hostname.bge0                                         

dhcp

./comment-out.bat /etc/hostname.rum0                                         
awk: can't open file /etc/hostname.rum0

 source line number 1
つまりない

./comment-out.bat /etc/sysctl.conf                                           

net.inet.ip.forwarding=1 


./comment-out.bat /etc/pf.conf                                               
ext=bge0
icmp_types = "{echoreq, unreach}"
set block-policy return
set loginterface $ext
set skip on lo0
match in all scrub (no-df max-mss 1440)
match out on $ext inet from !($ext:network) to any nat-to ($ext:0)
block log all
pass out quick
pass in quick inet proto { tcp udp gre } from any to any

pass in quick inet proto icmp all icmp-type $icmp_types keep state


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



 ./comment-out.bat /etc/dhcpd.conf                                            
option  domain-name-servers 8.8.8.8;
subnet 192.168.120.0 netmask 255.255.255.0 {
        option routers 192.168.120.1;
        range 192.168.120.11 192.168.120.15;

}




./comment-out.bat wifi-AP.bat                                                
sh /etc/netstart
ifconfig rum0 inet 192.168.120.1 netmask 255.255.255.0 \
media autoselect mediaopt hostap nwid openbsdAP  wpakey 123  \
chan 1 up
/etc/rc.d/dhcpd restart




9) print

openbsd--wired LAN-->192.168.1.64:archlinux--USB cable-->epson PX-404A

という印刷です。
なぜなら openbdは USBプリンターが苦手だから

9-A) archlinux



/etc/cups/cupsd.conf
MaxLogSize 0
LogLevel warn
port 631
Browsing On
BrowseLocalProtocols dnssd
DefaultAuthType Basic
WebInterface Yes
<Location />
  Order allow,deny
  Allow localhost
  Allow 192.168.1.0/24
</Location>
<Location /admin>
  Order allow,deny
  Allow localhost
  Allow 192.168.1.0/24
</Location>
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
</Location>
<Location /admin/log>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
</Location>
<Policy default>
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default
  <Limit Create-Job Print-Job Print-URI Validate-Job>
    Order deny,allow
  </Limit>
  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Cancel-Job CUPS-Authenticate-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit All>
    Order deny,allow
  </Limit>
</Policy>
<Policy authenticated>
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default
  <Limit Create-Job Print-Job Print-URI Validate-Job>
    AuthType Default
    Order deny,allow
  </Limit>
  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
    AuthType Default
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Cancel-Job CUPS-Authenticate-Job>
    AuthType Default
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit All>
    Order deny,allow
  </Limit>
</Policy>
<Policy kerberos>
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default
  <Limit Create-Job Print-Job Print-URI Validate-Job>
    AuthType Negotiate
    Order deny,allow
  </Limit>
  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
    AuthType Negotiate
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Cancel-Job CUPS-Authenticate-Job>
    AuthType Negotiate
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit All>
    Order deny,allow
  </Limit>
</Policy>


cat /etc/cups/mime.types
application/octet-stream


cat /etc/cups/mime.convs
application/octet-stream       application/vnd.cups-raw        0






9-B)openbsd



at httpa://192.178.1.64:631
i can print out testpage


use seamonkey , and print page to file (mozilla.pdf)
lp -h192.168.1.64:631/printers/EPSON_PX-404A/version=1.1  mozilla.pdf
then print it to USB printer which is attached to archlinux 


mv /usr/bin/lpr   /usr/bin/lpr-ori/home/fuji/LPR                                                         
cat  /home/f-user/LPR                     
lp -h192.168.1.64:631/printers/EPSON_PX-404A/version=1.1
ln -s  /home/f-user/LPR  /usr/bin/lpr
then i can print www page on seamonkey





2017年3月10日金曜日

★ openbsd snapshots ( after 6.3 ) on raspberry pi 3

ラズパイ 3 に openbsd をインストールします。
ただ インストール後 水面に上がったとき 
Xは HDMIケーブルでつないだTV画面にでない。            (Xアプリはセキュリテイ上動かさないのが安全)

でも 換気扇をコントロールするarmなopenbsdにとって HDMIポートそのものが邪魔くさい。 
他のPCから ssh で入れさえすればいい。 

そうすれば

家にいながら牛舎の換気を適切に行える、ただしボードに温度、2酸化炭素センサーなどがついてれば。


換気扇のarm

USBポート: いらねえ
HDMIポート:いらねえ
GPIO:     いる ---> ここに rs232 ポートをつなぐ必要あり、インストール時必要
LANポート:  いる
電源:        いる



fake history
歴史が 本当はどうであったかの判断は 歴史学者に任せるべきで政治に任せてはいけない。
従って A国 B国で 認識の差があるのなら A国 B国の歴史学者でまず見当すべきものである。
過去の遺物、文献、録音、写真、ビデオなどを 解析する能力は そういう訓練を受けたことのない政治家にはない (昔の文字が読めるか、真偽の度合いはどうか等)。 
一流のフランス料理は 政治家の能力を遥かに超え、プロのコックにまかすべきものだ。
そうしないと fake history ができあがる(alike fake news)。

以下の 正史=fake history も参照のこと
https://ja.wikipedia.org/wiki/%E6%AD%A3%E5%8F%B2

----------------------------------------------------------
i use miniroot.fs of snaphots ,
we do not need 
U-Boot> setenv boot_targets usb0 mmc0 pxe dhcp  .







this "USB Serial Adapter"
connect  pin 8(ground),   pin10(tx) ,  pin12(rx)



1) connect      microSD card
                  &  wired LAN
                  &  USB serial adapter
                  &  
USB memory.




2) at openbsd 



3)power on raspberry pi 3

4) start install






sd0 is USB memory







then power off raspberry pi .


remove micro SD card .


at openbsd


power on raspberry pi .


arm's openbsd comes .





in this state ,


df

Filesystem  512-blocks      Used     Avail Capacity  Mounted on

/dev/sd0a     11057980   1255668   9249416    12%    /
                     about 5GB

top

load averages:  0.00,  0.06,  0.07                       foo.my.domain 16:28:38
30 processes: 29 idle, 1 on processor                                  up  0:34
CPU0 states:  0.2% user,  0.0% nice,  0.2% system,  0.0% interrupt, 99.6% idle
CPU1 states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU2 states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU3 states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
Memory: Real: 22M/302M act/tot Free: 561M Cache: 172M Swap: 0K/2051M



for pkg_add
do 
export PKG_PATH=http://ftp.OpenBSD.org/pub/OpenBSD/snapshots/packages/aarch64


i use USB 3.0 8GB memory stick for fast speed and 
use another USB 2.0 64GB memory for big volume .





in my case 
Welcome to the OpenBSD/arm64 6.3 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? i
At any prompt except password prompts you can escape to a shell by
typing '!'. Default answers are shown in []'s and are selected by
pressing RETURN.  You can exit this program at any time by pressing
Control-C, but this can leave your system in an inconsistent state.

Terminal type? [vt220] 
System hostname? (short form, e.g. 'foo') ssd

Available network interfaces are: smsc0 vlan0.
Which network interface do you wish to configure? (or 'done') [smsc0] 
IPv4 address for smsc0? (or 'dhcp' or 'none') [dhcp] 
smsc0: bound to 192.168.188.6 from 192.168.188.253 (44:d1:fa:0d:4f:28)
IPv6 address for smsc0? (or 'autoconf' or 'none') [none] 
Available network interfaces are: smsc0 vlan0.
Which network interface do you wish to configure? (or 'done') [done] 
DNS domain name? (e.g. 'example.com') [my.domain] 
Using DNS nameservers at 192.168.188.253

Password for root account? (will not echo) 
Password for root account? (again) 
Start sshd(8) by default? [yes] 
Setup a user? (enter a lower-case loginname, or 'no') [no] snap
Full name for user snap? [snap] 
Password for user snap? (will not echo) 
Password for user snap? (again) 
WARNING: root is targeted by password guessing attacks, pubkeys are 
safer.
Allow root ssh login? (yes, no, prohibit-password) [no] 

Available disks are: sd0.
Which disk is the root disk? ('?' for details) [sd0] 
Disk: sd0       geometry: 3892/255/63 [62533294 Sectors]
Offset: 0       Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
*0: 0C      0 130   3 -      2 140  10 [        8192:       32768 ] 
FAT32L      
 1: 00      0   0   0 -      0   0   0 [           0:           0 ] 
unused      
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] 
unused      
 3: A6      2 140  11 -   3892 131  61 [       40960:    62492334 ] 
OpenBSD     
Use (W)hole disk or (E)dit the MBR? [whole] 
Creating a msdos partition and an OpenBSD partition for rest of 
sd0...done.
/dev/rsd0i: 32668 sectors in 8167 FAT16 clusters (2048 bytes/cluster)
bps=512 spc=4 res=1 nft=2 rde=512 sec=32768 mid=0xf8 spf=32 spt=63 
hds=255 hid=8192
The auto-allocated layout for sd0 is:
#                size           offset  fstype [fsize bsize   cpg]
  a:          1024.0M            40960  4.2BSD   2048 16384     1 # /
  b:          1170.6M          2138112    swap                    
  c:         30533.8M                0  unused                    
  d:          1910.4M          4535616  4.2BSD   2048 16384     1 # /tmp
  e:          2989.4M          8448064  4.2BSD   2048 16384     1 # /var
  f:          2019.0M         14570304  4.2BSD   2048 16384     1 # /usr
  g:          1024.0M         18705184  4.2BSD   2048 16384     1 # 
/usr/X11R6
  h:          4381.0M         20802336  4.2BSD   2048 16384     1 # 
/usr/local
  i:            16.0M             8192   MSDOS                    
  j:          1747.6M         29774560  4.2BSD   2048 16384     1 # 
/usr/src
  k:          3967.2M         33353632  4.2BSD   2048 16384     1 # 
/usr/obj
  l:         10280.7M         41478432  4.2BSD   2048 16384     1 # 
/home
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] c
Label editor (enter '?' for help at any prompt)
> p
OpenBSD area: 40960-15482880; size: 15441920; free: 24
#                size           offset  fstype [fsize bsize   cpg]
  a:         11241696          4241184  4.2BSD   2048 16384 12958 
  b:          4200200            40960    swap                    
  c:         62533294                0  unused                    
  i:            32768             8192   MSDOS                    
> d b
> d a
> a b
offset: [40960] 
size: [15441920] 2g
Rounding size to cylinder (16065 sectors): 4200200
FS type: [swap] 
> a a
offset: [4241160] 
size: [11241720] 
FS type: [4.2BSD] 
mount point: [none] /
Rounding offset to bsize (32 sectors): 4241184
Rounding size to bsize (32 sectors): 11241696
> w
> q
No label changes.
/dev/rsd0a: 5489.1MB in 11241696 sectors of 512 bytes
28 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
/dev/sd0a (78090009746d5f0c.a) on /mnt type ffs (rw, asynchronous, 
local)

Let's install the sets!
Location of sets? (disk http nfs or 'done') [http] 
HTTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none] 
(Unable to get list from ftp.openbsd.org, but that is OK)
HTTP Server? (hostname or 'done') ftp.openbsd.org
Server directory? [pub/OpenBSD/snapshots/arm64] 
Unable to connect using https. Use http instead? [no] yes

Select sets by entering a set name, a file name pattern or 'all'. 
De-select
sets by prepending a '-', e.g.: '-game*'. Selected sets are labelled 
'[X]'.
    [X] bsd           [X] base63.tgz    [X] game63.tgz    [X] 
xfont63.tgz
    [X] bsd.mp        [X] comp63.tgz    [X] xbase63.tgz   [X] 
xserv63.tgz
    [X] bsd.rd        [X] man63.tgz     [X] xshare63.tgz
Set name(s)? (or 'abort' or 'done') [done] -g*
    [X] bsd           [X] base63.tgz    [ ] game63.tgz    [X] 
xfont63.tgz
    [X] bsd.mp        [X] comp63.tgz    [X] xbase63.tgz   [X] 
xserv63.tgz
    [X] bsd.rd        [X] man63.tgz     [X] xshare63.tgz
Set name(s)? (or 'abort' or 'done') [done] -x*
    [X] bsd           [X] base63.tgz    [ ] game63.tgz    [ ] 
xfont63.tgz
    [X] bsd.mp        [X] comp63.tgz    [ ] xbase63.tgz   [ ] 
xserv63.tgz
    [X] bsd.rd        [X] man63.tgz     [ ] xshare63.tgz
Set name(s)? (or 'abort' or 'done') [done] -c*
    [X] bsd           [X] base63.tgz    [ ] game63.tgz    [ ] 
xfont63.tgz
    [X] bsd.mp        [ ] comp63.tgz    [ ] xbase63.tgz   [ ] 
xserv63.tgz
    [X] bsd.rd        [X] man63.tgz     [ ] xshare63.tgz
Set name(s)? (or 'abort' or 'done') [done] 
Get/Verify SHA256.sig   100% |**************************|  1464       
00:00    
Signature Verified
Get/Verify bsd          100% |**************************|  6251 KB    
00:20    
Get/Verify bsd.mp       100% |**************************|  6255 KB    
00:19    
Get/Verify bsd.rd       100% |**************************| 11712 KB    
00:36    
Get/Verify base63.tgz   100% |**************************|   107 MB    
05:37    
Get/Verify man63.tgz    100% |**************************|  7034 KB    
00:22    
Installing bsd          100% |**************************|  6251 KB    
00:00    
Installing bsd.mp       100% |**************************|  6255 KB    
00:00    
Installing bsd.rd       100% |**************************| 11712 KB    
00:00    
Installing base63.tgz   100% |**************************|   107 MB    
00:59    
Extracting etc.tgz      100% |**************************|   260 KB    
00:00    
Installing man63.tgz    100% |**************************|  7034 KB    
00:05    
Location of sets? (disk http nfs or 'done') [done] 

What timezone are you in? ('?' for list) [Canada/Mountain] Japan
Saving configuration files...done.
Making all device nodes...done.
Multiprocessor machine; using bsd.mp instead of bsd.
Relinking to create unique kernel...done.

CONGRATULATIONS! Your OpenBSD install has been successfully completed!

When you login to your new system the first time, please read your mail
using the 'mail' command.

Exit to (S)hell, (H)alt or (R)eboot? [reboot] 








the followings is written under 6.2 , and so they may be outdate .



3) www server at openbsd's arm


/etc/rc.conf.local                                         

httpd_flags=""


/var/www/htdocs/index.html
123


/etc/httpd.conf                                            
ext_addr="*"
server "default" {
        listen on $ext_addr port 80

}








4)
PC1--wired lan-->openbsd--wifi-->wifi router-->intenet
i use snapshot .

i reversely follow 
http://www.bsdguides.org/2012/a-wireless-access-point-hotspot-using-openbsd/ .
because this article is
PC1--wifi---------->openbsd--wired lan -->router--------> internet

my case is
PC1--wired lan-->openbsd--wifi----------->wifi router-->intenet


this may be useful , and arm of openbsd has happy future .

internet
|
wifi
|
run0
<openbsd Rpi3>
smsc0
|
wired lan
|1) about run0
PC1


i  succeed that PC1 access the internet via openbsd .

the details in next .

4-1) about run0

/etc/hostname.run0                                          
nwid Mypoint                                                                    
wpakey 1122334455                                                               
dhcp                


/etc/pf.conf                                                
ext=run0                                                                        
icmp_types = "{echoreq, unreach}"                                               
set block-policy return                                                         
set loginterface $ext                                                           
set skip on lo0                                                                 
match in all scrub (no-df max-mss 1440)                                         
match out on $ext inet from !($ext:network) to any nat-to ($ext:0)              
block log all                                                                   
pass out quick                                                                  
pass in quick inet proto { tcp udp gre } from any to any                        
pass in quick inet proto icmp all icmp-type $icmp_types keep state              
pass out quick                                                                  
pass in quick inet proto { tcp udp gre } from any to any                        
pass in quick inet proto icmp all icmp-type $icmp_types keep state


4-2) about smmc0
2) about smmc0
/etc/dhcpd.interfaces                                        < 
smsc0                                                                           

                                                                               
/etc/dhcpd.conf                                             
option domain-name "my.domain";                                                 
option domain-name-servers 8.8.8.8;                                             
subnet 10.0.3.0 netmask 255.255.255.0 {                                         
option routers 10.0.3.1;                                                        
range 10.0.3.100 10.0.3.150;                                                    
}                           


4-3) shell script4) the other
accesspoint.bat                                             
sysctl net.inet.ip.forwarding=1                                                 
ifconfig smsc0 inet 10.0.3.1  netmask 255.255.255.0 up                          
dhcpd smsc0          



4-4) the other
ls -l /etc/hostname.smsc0                                                     
ls: /etc/hostname.smsc0: No such file or directory

# route show                                                                    
Routing tables                                                                  
                                                                                
Internet:                                                                       
Destination        Gateway            Flags   Refs      Use   Mtu  Prio Iface   
default            192.168.12.1       UGS        3     3063     -    12 run0    
BASE-ADDRESS.MCAST localhost          URS        0        3 32768     8 lo0     
10.0.3/24          10.0.3.1           Cn         0        0     -     4 smsc0   
10.0.3.1           b8:27:eb:c3:cc:1a  UHLl       0        1     -     1 smsc0   
10.0.3.255         10.0.3.1           Hb         0        0     -     1 smsc0   
loopback           localhost          UGRS       0        0 32768     8 lo0     
localhost          localhost          UHhl       1        2 32768     1 lo0     
192.168.12/24      jp                 UCn        1        0     -     8 run0    
192.168.12.1       00:13:ef:c0:04:40  UHLch      1       30     -     7 run0    
jp                 00:13:ef:bb:00:78  UHLl       0       26     -     1 run0    
192.168.12.255     jp                 UHb        0        0     -     1 run0    
                                                                                
Internet6:                                                                      
Destination        Gateway            Flags   Refs      Use   Mtu  Prio Iface   
::/96              localhost          UGRS       0        0 32768     8 lo0     
::/104             localhost          UGRS       0        0 32768     8 lo0     
localhost          localhost          UHhl      14       28 32768     1 lo0     
::127.0.0.0/104    localhost          UGRS       0        0 32768     8 lo0     
::224.0.0.0/100    localhost          UGRS       0        0 32768     8 lo0     
::255.0.0.0/104    localhost          UGRS       0        0 32768     8 lo0     
::ffff:0.0.0.0/96  localhost          UGRS       0        0 32768     8 lo0     
2002::/24          localhost          UGRS       0        0 32768     8 lo0     
2002:7f00::/24     localhost          UGRS       0        0 32768     8 lo0     
2002:e000::/20     localhost          UGRS       0        0 32768     8 lo0     
2002:ff00::/24     localhost          UGRS       0        0 32768     8 lo0     
fe80::/10          localhost          UGRS       0        0 32768     8 lo0     
fec0::/10          localhost          UGRS       0        0 32768     8 lo0     
fe80::1%lo0        fe80::1%lo0        UHl        0        0 32768     1 lo0     
ff01::/16          localhost          UGRS       0        0 32768     8 lo0     
ff01::%lo0/32      localhost          Um         0        1 32768     4 lo0     
ff02::/16          localhost          UGRS       0        0 32768     8 lo0     
ff02::%lo0/32      localhost          Um         0        1 32768     4 lo0






5)  .profile                                                  
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.openbsd.org/pub/OpenBSD/snapshots/packages/aarch64



6)削除






7)vnc ; 

when i use port , it takes long time .
so i lie in a bed  watching compile .


5-1 ) ssh -l userX 192.168.1.83  

(from openBSD note PC on bed to archLINUX desktop PC on 1st floor )   

5-2 ) then x11vnc


5-3) at new terminal

ssh 192.168.1.83  -L 5900:localhost:5900




5-4)
at another new terminal
vncviewer localhost:5900





8)
pkg_add nginx                                                                        
nginx-1.10.2p2: ok                                                                     
The following new rcscripts were installed: /etc/rc.d/nginx                            
See rcctl(8) for details.                                                              
Look in /usr/local/share/doc/pkg-readmes for extra documentation. 



9) backup=cloning  sd1->sd2


dd if=/dev/rsd0c of=/dev/rsd2c

(after some time , perhaps 10 min or so)
ctrl + c

newfs sd2a

mount /dev/sd1a  /ma1

mount /dev/sd2a  /ma2
rsync -avHx /ma1/ /ma2/


mount /dev/sd1i  /mi1
mount /dev/sd2i  /mi2
rsync -avHx /mi1/ /mi2/


swapctl -a /dev/sd2b



10) wifi router
many PC ---(wifi)--->rum0:raspberry:smsc0---(wired LAN)--->internet

# ./comment-out.bat /etc/hostname.smsc0  
dhcp




# ./comment-out.bat /etc/hostname.rum0    
awk: can't open file /etc/hostname.rum0
 source line number 1



# ./comment-out.bat /etc/rc.conf.local                                         
dhcpd_flags=
pf=YES                  # Packet filter / NAT


# ./comment-out.bat /etc/sysctl.conf                                           
net.inet.ip.forwarding=1        




#/comment-out.bat /etc/dhcpd.interfaces                                        <
rum0


# ./comment-out.bat /etc/dhcpd.conf                                            
option  domain-name-servers 8.8.8.8;
subnet 192.168.120.0 netmask 255.255.255.0 {
        option routers 192.168.120.1;
        range 192.168.120.11 192.168.120.15;
}


# ./comment-out.bat /etc/pf.conf                                               
ext=smsc0
icmp_types = "{echoreq, unreach}"
set block-policy return
set loginterface $ext
set skip on lo0
match in all scrub (no-df max-mss 1440)
match out on $ext inet from !($ext:network) to any nat-to ($ext:0)
block log all
pass out quick
pass in quick inet proto { tcp udp gre } from any to any
pass in quick inet proto icmp all icmp-type $icmp_types keep state



# ./comment-out.bat wifi-AP.bat                                                
sh /etc/netstart
pfctl -f /etc/pf.conf                                                                             
pfctl -sr         
ifconfig rum0 inet 192.168.120.1 netmask 255.255.255.0 \
media autoselect mediaopt hostap nwid openbsdAP  wpakey 1234567890 \
chan 1 up
/etc/rc.d/dhcpd  restart





continued - see ->
         http://openbsd-akita.blogspot.jp/2017/05/arm-server.html
 


sshd server + www server + wifi router

 






















freeBSDをためす
http://www.raspbsd.org/raspberrypi.html
にて

root@rpi3:~ # df                                                                
Filesystem     1K-blocks    Used    Avail Capacity  Mounted on                  
/dev/mmcsd0s2a  15161308 1037444 12910960     7%    /                           
devfs                  1       1        0   100%    /dev                        
/dev/mmcsd0s1      51128    7620    43508    15%    /boot/efi                   
/dev/md0           29340      24    26972     0%    /tmp                        
/dev/md1           14492      64    13272     0%    /var/log                    
/dev/md2    11420       8    10500     0%    /var/tmp 

そして rebootすれば HDMIを通じて TV画面に 
login:
がでてきます。

しかし このあと FreeBSDしらないので何もできません








<ーーー end ーーー>