tag:blogger.com,1999:blog-63586303107220187812024-03-21T17:48:38.812+01:00Karellen's Unix BlogJust my personal notepad...Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.comBlogger204125tag:blogger.com,1999:blog-6358630310722018781.post-91832256951162228632021-11-20T10:37:00.002+01:002021-11-20T10:37:21.625+01:00iSCSI<p>Just some experiments I made with iSCSI. If you want to use iSCSI in a productive environment, make sure to set up a dedicated network for your iSCSI traffic. And maybe don't use your wireless network for iSCSI. This article covers the following topics:</p><ul style="text-align: left;"><li>Basic Setup</li><li>Reduce access to a specific IP<br /></li><li>Incoming user from Initiator to Target<br /></li><li>Add initiator name for access control<br /></li><li>Automatic lun import on startup <br /></li></ul><p><span></span></p><a name='more'></a>Let's get started with my general setup:<p></p><ul style="text-align: left;"><li>Target (Server): ct01 192.168.4.1</li><li>Initiator (Client): ws02 192.168.4.2</li></ul><p><u><i><b>Basic Setup</b></i></u><br /><br />Start with a very basic configuration to provide one lun from the target to the network:<br /><br /><span style="color: #666666;"><span><span style="font-family: courier;"># vi /etc/tgt/conf.d/ws02.conf<br /><target iqn.ct01.karellen.local:lun0><br /> backing-store /dev/mapper/ct01--local-iscsi0<br /></target><br /><br /># systemctl restart tgt<br /># tgt-admin -s<br />Target 1: iqn.ct01.karellen.local:lun0<br /> System information:<br /> Driver: iscsi<br /> State: ready<br /> I_T nexus information:<br /> LUN information:<br /> LUN: 0<br /> Type: controller<br /> SCSI ID: IET 00010000<br /> SCSI SN: beaf10<br /> Size: 0 MB, Block size: 1<br /> Online: Yes<br /> Removable media: No<br /> Prevent removal: No<br /> Readonly: No<br /> SWP: No<br /> Thin-provisioning: No<br /> Backing store type: null<br /> Backing store path: None<br /> Backing store flags:<br /> LUN: 1<br /> Type: disk<br /> SCSI ID: IET 00010001<br /> SCSI SN: beaf11<br /> Size: 10737 MB, Block size: 512<br /> Online: Yes<br /> Removable media: No<br /> Prevent removal: No<br /> Readonly: No<br /> SWP: No<br /> Thin-provisioning: No<br /> Backing store type: rdwr<br /> Backing store path: /dev/mapper/ct01--local-iscsi0<br /> Backing store flags:<br /> Account information:<br /> ACL information:<br /> ALL</span></span></span><br /><br />On the initiator, import the lun:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># iscsiadm -m discovery -t st -p 192.168.4.1<br />192.168.4.1:3260,1 iqn.ct01.karellen.local:lun0<br /><br /># iscsiadm -m node --targetname "iqn.ct01.</span></span><span style="color: #666666;"><span style="font-family: courier;"><span style="color: #666666;"><span style="font-family: courier;">karellen</span></span>.local:lun0" --portal "192.168.4.1:3260" --login<br />Logging in to [iface: default, target: iqn.ct01.</span></span><span style="color: #666666;"><span style="font-family: courier;"><span style="color: #666666;"><span style="font-family: courier;">karellen</span></span>.local:lun0, portal: 192.168.4.1,3260] (multiple)<br />Login to [iface: default, target: iqn.ct01.</span></span><span style="color: #666666;"><span style="font-family: courier;"><span style="color: #666666;"><span style="font-family: courier;">karellen</span></span>.local:lun0, portal: 192.168.4.1,3260] successful.<br /><br /></span></span><span style="color: #999999;"><span style="font-family: courier;"><span style="color: #666666;"># lsblk<br />NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT<br />sda 8:0 0 10G 0 disk<br />+-sda1 8:1 0 10G 0 part</span><br />...</span></span><br /><br />Back on the target, show the current state of the lun and check the I_T nexus information section<br /><br /><span style="color: #666666;"><span><span style="font-family: courier;"># tgt-admin -s<br />Target 1: iqn.ct01.</span></span></span><span style="color: #666666;"><span><span style="font-family: courier;"><span style="color: #666666;"><span style="font-family: courier;">karellen</span></span>.local:lun0<br />...<br /> I_T nexus information:<br /> I_T nexus: 2<br /> Initiator: iqn.1993-08.org.debian:01:b8ae24706873 alias: ws02<br /> Connection: 0<br /> IP Address: 192.168.4.2<br />...</span></span></span><br /><br />On the iniator again, do your operations (mount, copy, umount) then remove the lun again:<br /><br /><span style="color: #666666;"><span><span style="font-family: courier;"># iscsiadm -m node --targetname "iqn.ct01.</span></span></span><span style="color: #666666;"><span><span style="font-family: courier;"><span style="color: #666666;"><span style="font-family: courier;">karellen</span></span>.local:lun0" --portal "192.168.4.1:3260" --logout<br />Logging out of session [sid: 1, target: iqn.ct01.</span></span></span><span style="color: #666666;"><span><span style="font-family: courier;"><span style="color: #666666;"><span style="font-family: courier;">karellen</span></span>.local:lun0, portal: 192.168.4.1,3260]<br />Logout of [sid: 1, target: iqn.ct01.</span></span></span><span style="color: #666666;"><span><span style="font-family: courier;"><span style="color: #666666;"><span style="font-family: courier;">karellen</span></span>.local:lun0, portal: 192.168.4.1,3260] successful.</span></span></span><br /></p><p><u><i><b>Reduce access to a specific IP</b></i></u><br /><br />On the target, add a wrong IP for the initiator (wrong IP for testing):<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi /etc/tgt/conf.d/ws02.conf<br /><target iqn.ct01.karellen.local:lun0><br /> backing-store /dev/mapper/ct01--local-iscsi0<br /> initiator-address 192.168.4.10<br /></target><br /><br /># systemctl restart tgt</span></span><br /><br />On the initiator, import the lun and note the error massage:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># iscsiadm -m discovery -t st -p 192.168.4.1<br />iscsiadm: No portals found<br /># iscsiadm -m node --targetname "iqn.ct01.karellen.local:lun0" --portal "192.168.4.1:3260" --login<br />iscsiadm: default: 1 session requested, but 1 already present.<br />iscsiadm: Could not log into all portals</span></span><br /><br />On the target, correct the IP for the initiator:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi /etc/tgt/conf.d/ws02.conf<br /><target iqn.ct01.karellen.local:lun0><br /> backing-store /dev/mapper/ct01--local-iscsi0<br /> initiator-address 192.168.4.2<br /></target><br /><br /># systemctl restart tgt</span></span><br /><br />Run a discovery on the initiator again:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># iscsiadm -m discovery -t st -p 192.168.4.1<br />192.168.4.1:3260,1 iqn.ct01.karellen.local:lun0</span></span><br /></p><p><u><i><b>Incoming user from Initiator to Target</b></i></u><br /><br />Add a user to your configuration:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi ct01-iscsi0.conf<br /><target iqn.ct01.karellen.local:lun0><br /> backing-store /dev/mapper/ct01--local-iscsi0<br /> initiator-address 192.168.4.2<br /> incominguser iscsi-user password<br /></target><br /><br /># iscsiadm -m discovery -t st -p 192.168.4.1<br />192.168.4.1:3260,1 iqn.ct01.karellen.local:lun0<br /># iscsiadm -m node --targetname "iqn.ct01.karellen.local:lun0" --portal "192.168.4.1:3260" --login<br />Logging in to [iface: default, target: iqn.ct01.karellen.local:lun0, portal: 192.168.4.1,3260] (multiple)<br />iscsiadm: Could not login to [iface: default, target: iqn.ct01.karellen.local:lun0, portal: 192.168.4.1,3260].<br />iscsiadm: initiator reported error (24 - iSCSI login failed due to authorization failure)<br />iscsiadm: Could not log into all portals</span></span><br /><br />Enter the following commands to add username and password:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># iscsiadm --mode node -T iqn.ct01.karellen.local:lun0 -p 192.168.4.1:3260 -o update -n node.session.auth.authmethod -v CHAP<br /># iscsiadm --mode node -T iqn.ct01.karellen.local:lun0 -p 192.168.4.1:3260 -o update -n node.session.auth.username -v iscsi-user<br /># iscsiadm --mode node -T iqn.ct01.karellen.local:lun0 -p 192.168.4.1:3260 -o update -n node.session.auth.password -v password</span></span><br /><br />Or edit the config file directly:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi /etc/iscsi/nodes/iqn.ct01.karellen.local\:lun0/192.168.4.1\,3260\,1/default<br />...<br />node.session.auth.authmethod = CHAP<br />node.session.auth.username = iscsi-user<br />node.session.auth.password = password<br />...<br /><br /># iscsiadm -m node --targetname "iqn.ct01.karellen.local:lun0" --portal "192.168.4.1:3260" --login<br />Logging in to [iface: default, target: iqn.ct01.karellen.local:lun0, portal: 192.168.4.1,3260] (multiple)<br />Login to [iface: default, target: iqn.ct01.karellen.local:lun0, portal: 192.168.4.1,3260] successful.</span></span><br /><br />After a new discovery, authmethod, username and password are reset to default:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># iscsiadm -m discovery -t st -p 192.168.4.1<br />192.168.4.1:3260,1 iqn.ct01.karellen.local:lun0</span></span><br /><br /><i><u><b>Add initiator name for access control</b></u></i><br /><br />First the initiator name on the initiator has to be set:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># echo "InitiatorName=`/sbin/iscsi-iname`" > /etc/iscsi/initiatorname.iscsi<br /># cat /etc/iscsi/initiatorname.iscsi<br />InitiatorName=iqn.2005-03.org.open-iscsi:28ec27b9454c</span></span><br /><br />Add initiator name on target:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># cat ct01-iscsi0.conf<br /><target iqn.ct01.karellen.local:lun0><br /> backing-store /dev/mapper/ct01--local-iscsi0<br /> initiator-address 192.168.4.2<br /> initiator-name iqn.2005-03.org.open-iscsi:28ec27b9454c<br /> incominguser iscsi-user password<br /></target></span></span><u><i><b> </b></i></u></p><p><u><i><b>Automatic lun import on startup</b></i></u><br /><br />From what I have figured out, one of the following command is enough to import your lun automatically during startup. But since I saw both all the time I also added both:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># iscsiadm --mode node -T iqn.ct01.karellen.local:lun0 -p 192.168.4.1:3260 -o update -n node.startup -v automatic<br /># iscsiadm --mode node -T iqn.ct01.karellen.local:lun0 -p 192.168.4.1:3260 -o update -n node.conn[0].startup -v automatic</span></span><br /><br />Then restart the iscsi service:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># systemctl restart iscsi.service</span></span><br /><br />To disable:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># iscsiadm --mode node -T iqn.ct01.karellen.local:lun0 -p 192.168.4.1:3260 -o update -n node.startup -v manual<br /># iscsiadm --mode node -T iqn.ct01.karellen.local:lun0 -p 192.168.4.1:3260 -o update -n node.conn[0].startup -v manual</span></span><br /></p><p>That's it for iSCSI what I have tested out. I am not using iSCSI at all (I just have no use for it) but I wanted to know, what is required to get a small configuration up and running.<br /></p>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-16106242120198490982021-06-14T11:39:00.000+02:002021-06-14T11:39:04.351+02:00NanoPi Duo2 with IoT-Box & GSM/GPRS modem in Armbian<p>For a longer time I own the NanoPi Duo2 from FriendlyARM including the IoT-Box Carrier Board. The specs of the NanoPi Duo2 and IoT-Box are as follows:<br /><br />NanoPi Duo2:<br /></p><ul style="text-align: left;"><li>CPU: Allwinner H3, Quad-core Cortex-A7 Up to 1.2GHz</li><li>DDR3 RAM: 512M</li><li>Connectivity: 10/100M Ethernet</li><li>WiFi: 802.11b/g/n</li><li>Bluetooth: Bluetooth V4.0 of 1, 2 and 3 Mbps.</li><li>Camera: OV5640</li><li>...</li></ul><p>IoT-Box Carrier Board:<br /></p><ul style="text-align: left;"><li>Onboard quad-band GSM/GPRS module</li><li>2 x USB Host</li><li>Serial port and Ethernet port</li><li>Audio input and output</li><li>MicroUSB power input and a power switch</li><li>IPX to SMA WiFi converter</li></ul><p><br />A lot of features are not accessable from the board itself like the ethernet port. One of the reason I also bought the IoT-Box. Another nice feature of the IoT-Box is the GSM/GPRS module (SIM800C), which will be the main focus of this article.<span></span></p><a name='more'></a>"Normally" you would install one of the offical roms provided by FriendlyARM, where the modem works out of the box. Since I own a couple of different ARM based devices and most of them are running Armbian, I decided to install Armbian on the NanoPi Duo2 and try to get the modem up and running.<br />When you want to do the same, you first have to activate UART3 in armbian-config (easiest way) or add UART3 to the overlay of /boot/armbianEnv.txt:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi /boot/armbianEnv.txt<br />...<br />overlays=analog-codec uart1 uart2 uart3 usbhost0 usbhost2 usbhost3<br />...</span></span><br /><br />To have UART3 available (I added all of them), a reboot is required:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># shutdown -r now</span></span><br /><br />After reboot, the modem first needs to be woken up which can be done with the following script:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi /usr/local/sbin/modem.sh<br />#!/bin/bash<br />g=203 # GPIO<br />cd /sys/class/gpio<br />echo $g > export<br />echo out > gpio${g}/direction<br />echo 1 > gpio${g}/value<br />sleep 3<br />stty -F /dev/ttyS3 115200<br />ln -s /dev/ttyS3 /dev/modem</span></span><br /><br />The above script will export GPIO PIN 203, sets the direction to out and sets the value to one. Make it executable and run it:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># chmod 755 /usr/local/sbin/modem.sh<br /># /usr/local/sbin/modem.sh</span></span><br /><br />After 2-3 seconds, the yellow led on the IoT-Box should turn on while the blue led on IoT-Box should start blinking. Additionally the script will setup the communication speed between the IoT-Box and the modem to 115200 and create a symbolic link from /dev/ttyS3 (UART3) to /dev/modem. At this point, the modem should be accessable with e.g. minicom.<br />Now continue with the ppp configuration. I am really not an expert on this and everything below this point are copies from various sources of the internet. First add the ppp interface to /etc/network/interfaces:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi /etc/network/interfaces<br />...<br />iface lo inet ppp loopback<br />...</span></span><br /><br />Add user and password to chap-secrets and pap-secrets:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi /etc/ppp/chat-secrets<br />...<br />"TM" * "TM"</span></span><br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi /etc/ppp/pap-secrets<br />...<br />"TM" * "TM"</span></span><br /><br />Create the pppd script:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi /etc/ppp/peers/gprs<br />user "TM"<br />connect "/usr/sbin/chat -v -f /etc/chatscripts/gprs -T internet.t-d1.de"<br />/dev/modem<br />115200<br />debug<br />nodetach<br />ipcp-accept-local<br />ipcp-accept-remote<br />noipdefault<br />usepeerdns<br />defaultroute<br />replacedefaultroute<br />persist<br />noauth</span></span><br /><br />Create the chatscript:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi /etc/chatscripts/gprs<br />ABORT BUSY<br />ABORT VOICE<br />ABORT "NO CARRIER"<br />ABORT "NO DIALTONE"<br />ABORT "NO DIAL TONE"<br />ABORT "NO ANSWER"<br />ABORT "DELAYED"<br />ABORT "ERROR"<br />ABORT "+CGATT: 0"<br />"" AT<br />TIMEOUT 12<br />OK ATH<br />OK ATE1<br />OK AT+CFUN=1<br />OK AT+CGDCONT=1,"IP","\T","",0,0<br />OK ATD*99#<br />TIMEOUT 22<br />CONNECT ""</span></span><br /><br />Now try to connect with the internet using the modem (example output):<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># pppd call gprs &<br />...<br />Serial connection established.<br />using channel 1<br />Using interface ppp0<br />Connect: ppp0 <--> /dev/modem<br />...<br />PAP authentication succeeded<br />...<br />replacing old default route to wlan0 [192.168.178.2]<br />local IP address 37.81.154.22<br />remote IP address 192.168.254.254<br />primary DNS address 10.74.210.210<br />secondary DNS address 10.74.210.211<br />Script /etc/ppp/ip-up started (pid 1765)<br />Script /etc/ppp/ip-up finished (pid 1765), status = 0x0</span></span><br /><br />After the ppp script is running, you can check the IP for the ppp0 device:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># ip a<br />...<br />4: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 3<br /> link/ppp<br /> inet 37.81.154.22 peer 192.168.254.254/32 scope global ppp0<br /> valid_lft forever preferred_lft forever</span></span><br /><br />Depending on your local network connection / local network setup you have to do additional steps to really use the modem's internet connection and not the local network connection. These steps can include:<br /><ul style="text-align: left;"><li>DNS setup (/etc/resolv.conf)</li><li>Routing setup (route -n)</li><li>... <br /></li></ul><br />Another interesting fact about the SIM800C modem is, that it has an additional Bluetooth controller available. So far I have only discovered how to activate it, not how to use it in Linux. To activate it, just connect with e.g. minicom again to the modem and run the following commands:<br /><br />Turn power on:<br /><br /><span style="color: #666666;"><span style="font-family: courier;">AT+BTPOWER=1<br />OK</span></span><br /><br />Query Bluetooth name and address:<br /><br /><span style="color: #666666;"><span style="font-family: courier;">AT+BTHOST?<br />+BTHOST: SIM800C,38:1c:4a:6a:21:ea<br />OK</span></span><br /><br />As I said, I haven't done too much with the Bluetooth controller on the SIM800C modem so far.<br /><br /><u><i>Links:</i></u><br />NanoPi Duo2: <a href="http://wiki.friendlyarm.com/wiki/index.php/NanoPi_Duo2">http://wiki.friendlyarm.com/wiki/index.php/NanoPi_Duo2</a><br />IoT-Box Carrier Board: <a href="http://wiki.friendlyarm.com/wiki/index.php/NanoPi_Duo2_IoT-Box">http://wiki.friendlyarm.com/wiki/index.php/NanoPi_Duo2_IoT-Box</a><br />SIM800C AT commands: <a href="https://www.waveshare.com/wiki/SIM800C_GSM/GPRS_HAT">https://www.waveshare.com/wiki/SIM800C_GSM/GPRS_HAT</a><br /><br /><p></p>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-44229273047132294972020-11-05T08:25:00.007+01:002020-11-05T08:52:04.433+01:00bacula: cannot restore without a bootstrap file<p>After a long time I decided to install and work with bacula again. After installation, configuration and running some jobs, I tried to restore a backup from the night. The result was the following:<br /><br /><span style="color: #666666;"><span style="font-family: courier;">...<br />05-Nov 07:56 bacula-dir JobId 11: Fatal error: Cannot restore without a bootstrap file.<br />You probably ran a restore job directly. All restore jobs must be run using the restore command.<br />...<span></span></span></span></p><a name='more'></a><p>This issue is basically very easy to fix, just add the "Write Bootstrap" option to each job configuration. What I did in detail:<br /><br />1. Add a dedicated directory for saving your bootstraps:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># mkdir /local/bacula_bootstrap<br /># chown bacula:bacula /local/bacula_bootstrap</span></span><br /><br />2. Configure your jobs and add the "Write Bootstrap" option to each job, e.g.:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi /etc/bacula/common/jobs.conf<br />...<br />Job {<br /> ...<br /> Write Bootstrap = "/local/bacula_bootstrap/%c.%n.bsr"<br /> ...<br />}<br />...</span></span><br /><br />3. Rerun your backups (full) to write the bootstraps per job.<br /><br />4. Optional: reconfigure your restore job and add the bootstrap file for the job you want to restore (in this example I want to restore the /etc directory from my second NAS):<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># vi /etc/bacula/common/jobs.conf<br />...<br />Job {<br /> Name = "RestoreFiles"<br /> Type = Restore<br /> Bootstrap = /local/bacula_bootstrap/nas02-fd.nas02_etc.bsr<br /> ...<br />}<br />...</span></span> </p><p>(A detailed information about adding the bootstrap option to the restore job can be found at the end of this article) <br /></p><p>5. Rerun your restore job:<br /><br /><span style="color: #666666;"><span style="font-family: courier;">*run<br />A job name must be specified.<br />...<br /> 5: RestoreFiles<br />...<br />Run Restore job<br />JobName: RestoreFiles<br />Bootstrap: /local/bacula_bootstrap/nas02-fd.nas02_etc.bsr<br />Where: /local/bacula_restore<br />...<br />OK to run? (yes/mod/no): yes<br />Job queued. JobId=15<br />*<br />You have messages.<br />*mess<br />...<br /> Job: RestoreFiles.2020-11-05_08.07.02_27<br /> Restore Client: nas02-fd<br /> Where: /local/bacula_restore<br /> ...<br /> Termination: Restore OK<br />...</span></span><br /><br />After that, all my etc files from my second NAS were restored and accessible under /local/bacula_restore. With the given Bootstrap option in the restore job configuration, the latest job id for the backup job will be choosen automatically. And at this point I want you to give a warning, assuming following situation:</p><ol style="text-align: left;"><li>Backup job for /etc configured, job id 1 till 10 ran successfully, <u>but without a bootstrap</u></li><li>Bootstrap option added to the backup job</li><li>Backup job for /etc 11 till 15 ran successfully, <u>now with a bootstrap</u></li><li>Restore jobs will only work for job id 11 till 15, because they have a bootstrap. Restore jobs for job id 1 till 10 will fail, because they don't have a bootstrap!</li></ol><p>Unfortunately, I don't know how to restore a job without a bootstrap!</p><p>This error is a very good example why you shouldn't trust your backup blindly, always test a restore, even though you don't need one.<br /></p><p></p>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-56548327609685197992020-09-18T09:01:00.004+02:002020-09-18T09:01:33.530+02:00Convert CDI to ISO<p>Today I was confronted with an "rare" format for CD images: CDI<br />Of course I needed the content from that disc but CDI is not really supported under linux and burning a small CD image for just copying some files one time was no option. So I searched a little on the internet how to deal with CDI files under linux. With iat I found a little neat program to convert CDI to ISO files. Under Armbian it has to be installed first:<span></span></p><a name='more'></a><span style="color: #666666;"><span style="font-family: courier;"># apt install iat<br />...</span></span><br /><br />The usage is more than easy. Just use an existing CDI file as input file and a new name for the output file:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># iat image.cdi image.iso<br />Iso9660 Analyzer Tool v0.1.3 by Salvatore Santagati<br />Licensed under GPL v2 or later<br /><br />Detect Signature ISO9660 START at 387784<br />Detect Signature ISO9660 END at 390120<br /><br /> Image offset start at 350408<br /> Sector header 0 bit<br /> Sector ECC 288 bit<br /> Block 2336<br />Done</span></span><br /><br />The above command will convert the file image.cdi to the new file image.iso. The new ISO image file can then be mounted regulary:<br /><br /><span style="color: #666666;"><span style="font-family: courier;"># mount -o loop image.iso /mnt/<br />mount: /mnt: WARNING: device write-protected, mounted read-only.</span></span><br /><br />The RO message can be safely ignored (or use ro as parameter). After the image was mounted I could access the content and copy the files I needed, without burning the image.<p></p>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com1tag:blogger.com,1999:blog-6358630310722018781.post-92227870135880933922020-08-08T12:16:00.001+02:002020-08-08T12:17:44.334+02:00OMV: Locked users overview<p>Since a few months I received the following mail from OMV (4.1.35-1 / Arrakis) powered NAS:<br /><br /><i><b>Subject:</b><br />[nas01.karellen.local] Locked users overview<span></span></i></p><a name='more'></a><i><br /><b>Body:</b><br />The following users are locked/banned or are candidates for too many failed login attempts:<br /><br />Login Failures Latest failure From<br />xxxxxx 1 04/27/20 16:24:57 unknown<br /><br />You can reset their counters and unlock them via the omv-firstaid command.</i><br /><br />xxxxxx is my personal user id, so I didn't cared too much about it.<br />Obviously the solution is already announced in the mail, reset the counter via omv-firstaid command. So I logged as root into my NAS and ran the command:<br /><br /><span style="color: #999999;"><b><span style="font-family: courier;"># omv-firstaid</span></b></span><br /><br />Which showed the following menu:<br /><p></p><div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDer8rCLiFFdwme2STNp5ZOYTUKsYDiiAGV1_KP8kF4Oh-kiFJLkbkMIa1waoiLIgEQ3iIGFdJiAoa-0MyuWLd3xqWOFvK6sXCFpjxSeaSLH_0rfGIiTY3L_Ste89nvBqtz4_YCkddH8N4/s800/omv_1.png" style="display: block; padding: 1em 0px;"><img border="0" data-original-height="500" data-original-width="800" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDer8rCLiFFdwme2STNp5ZOYTUKsYDiiAGV1_KP8kF4Oh-kiFJLkbkMIa1waoiLIgEQ3iIGFdJiAoa-0MyuWLd3xqWOFvK6sXCFpjxSeaSLH_0rfGIiTY3L_Ste89nvBqtz4_YCkddH8N4/s640/omv_1.png" width="640" /></a></div><p>The fourth menu entry looked promising already ("Reset failed login attempt counter"):<br /></p><div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjseB_nCEBNr9aAzYUYrlQLinch8-a9lRcP1pZAB8Kizv0Rh8IirsxTSRfBwfzRvmHVS_6GIIZHhBXq-cNjK1qkDxMtVPlsqaPrzL2fIIPsokqwQlWPVMhNQaeoG4JR8q5pnftpIcymTmxT/s800/omv_2.png" style="display: block; padding: 1em 0px;"><img border="0" data-original-height="500" data-original-width="800" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjseB_nCEBNr9aAzYUYrlQLinch8-a9lRcP1pZAB8Kizv0Rh8IirsxTSRfBwfzRvmHVS_6GIIZHhBXq-cNjK1qkDxMtVPlsqaPrzL2fIIPsokqwQlWPVMhNQaeoG4JR8q5pnftpIcymTmxT/s640/omv_2.png" width="640" /></a></div><p>So I selected it and the reset counter was set to zero again with the following message:<br /><br /><span style="color: #666666;"><b><span style="font-family: courier;">Reset failed login attempt counter for user 'xxxxxx'.</span></b></span></p><p>All too easy! <br /></p>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-24187208737879722582020-05-12T10:55:00.004+02:002020-05-12T10:56:28.032+02:00Updating the timezoneToday I was facing the issue, that my media center didn't show the right time. Instead it was always two hours back. The actual time was 08:42:1, while my media center showed this:<br /><br /><span style="color: #9e9e9e;"><span style="font-family: "courier";"># date<br /></span></span><div><span style="color: #9e9e9e;"><span style="font-family: "courier";">Tue May 12 06:42:17 UTC 2020</span></span></div><div><span style="color: #9e9e9e;"><span style="font-family: "courier";"><br /></span></span></div><span style="color: #9e9e9e;"><span style="font-family: "courier";"><span><a name='more'></a></span></span></span><div></div><div></div><div>When I checked the timezone with timedatectl, I got the following result:</div><br /><span style="color: #9e9e9e;"><span style="font-family: "courier";"># timedatectl<br /> Local time: Tue 2020-05-12 06:42:58 UTC<br /> Universal time: Tue 2020-05-12 06:42:58 UTC<br /> RTC time: n/a<br /> Time zone: Etc/UTC (UTC, +0000)<br /> System clock synchronized: yes<br />systemd-timesyncd.service active: yes<br /> RTC in local TZ: no</span></span><br /><br />UTC+0 is clearly the wrong one for me. So I first checked the content of /etc/timezone:<br /><br /><span style="color: #9e9e9e;"><span style="font-family: "courier";"># cat /etc/timezone<br />Etc/UTC</span></span><br /><br />And where the localtime file links to:<br /><br /><span style="color: #9e9e9e;"><span style="font-family: "courier";"># ls -lah /etc/localtime<br />lrwxrwxrwx 1 root root 27 Oct 4 2019 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC</span></span><br /><br />Then I updated everything to Europe/Berlin, which fits way more:<br /><br /><span style="color: #9e9e9e;"><span style="font-family: "courier";"># vi /etc/timezone<br />Europe/Berlin</span></span><br /><br />Then the link for the /etc/localtime file:<br /><br /><span style="color: #9e9e9e;"><span style="font-family: "courier";"># rm /etc/localtime<br /># ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime</span></span><br /><br />Finally I ran date again to check the current time on the media center:<br /><br /><span style="color: #9e9e9e;"><span style="font-family: "courier";"># date<br />Tue May 12 08:45:22 CEST 2020</span></span><br /><br />And checked the updated timezone again:<br /><br /><span style="color: #9e9e9e;"><span style="font-family: "courier";"># timedatectl<br /> Local time: Tue 2020-05-12 08:45:37 CEST<br /> Universal time: Tue 2020-05-12 06:45:37 UTC<br /> RTC time: n/a<br /> Time zone: Europe/Berlin (CEST, +0200)<br /> System clock synchronized: yes<br />systemd-timesyncd.service active: yes<br /> RTC in local TZ: no</span></span><br /><br />Nice, the correct time and date is now shown!Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-28539495661073626722020-03-19T13:14:00.000+01:002020-03-19T13:14:46.070+01:00vnstat file permissionsToday I had to install vnstat on a CentOS VM, which gave me a little headache. The CentOS release is the following:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># cat /etc/centos-release<br />CentOS Linux release 7.6.1810 (Core)</span></span><br />
<a name='more'></a><br />After installing vnstat via yum and playing a little with vnstat, I figured out that vnstat would not do what I want: monitor and log the network statistics for my network interface eno16777984. With this article I want to share what I experienced with vnstat on CentOS.<br /><br />After all, the first thing I did was to stop the vnstat daemon:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># systemctl stop vnstat</span></span><br /><br />Then I deleted all files which vnstat has created, and let vnstat create a new database for my network interface (the shown error can be ignored):<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># vnstat -u -i eno16777984<br />Error: Unable to read database "/var/lib/vnstat/eno16777984": No such file or directory<br />Info: -> A new database has been created.</span></span><br /><br />The next thing I checked was the file permissions for the database:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># ls -lah /var/lib/vnstat/<br />...<br />-rw-r--r-- 1 root root 2.8K Mar 18 15:50 eno16777984<br />...</span></span><br /><br />And that was already the main problem, vnstat executed as root, will create the database with root permissions. But the vnstat daemon, started by systemd, will run with specific user permissions. This user is the vnstat user, who is not allowed to update the prior created database, which has root permissions. To solve this issue, I looked up the UID and GID for the vnstat user: <br /><br /><span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># getent passwd vnstat<br />vnstat:x:994:991:vnStat user:/var/lib/vnstat:/sbin/nologin</span></span><br /><br />And updated the rights for the folder which stores the vnstat databases:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># chown -R 994:991 /var/lib/vnstat/</span></span><br /><br />To make my life a little easier and since I had to monitor only one interface, I added the interface to the configuration file:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># vi /etc/vnstat.conf<br />...<br />Interface "eno16777984"<br />...</span></span><br /><br />Then I updated the unit file for vnstat and added the --config parameter:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># vi /etc/systemd/system/multi-user.target.wants/vnstat.service<br />...<br />ExecStart=/usr/sbin/vnstatd -n --config /etc/vnstat.conf<br />...</span></span><br /><br />Very interesting, the unit file also showed that vnstat is started in foreground, not in background as I suspected. To start with the new parameter, reload systemd:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># systemctl daemon-reload</span></span><br /><br />Last thing, start vnstat again:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># systemctl start vnstat</span></span><br /><br />After adjusting the file permissions and restarting the vnstat daemon, vnstat is finally able to update the database:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># ls -lah /var/lib/vnstat/<br />...<br />-rw-r--r-- 1 vnstat vnstat 2.8K Mar 19 13:10 eno16777984<br />...</span></span><br />Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-70533888961842777032020-03-02T20:29:00.000+01:002020-03-02T20:29:03.949+01:00dreamcast.local VIII - Skies Of ArcadiaA couple of days a new/old game arrived - Skies Of Arcadia! When the game came out, I never had a chance to play it. So I bought a copy and when it arrives, the first thing that cought my eye was the cover which states: "<b>online</b>functions". The offered online functions are limited to the official website. I couldn't find a copy of the website but some downladable content, so let's get the downloadable content running again with the Dreamcast server project!<br />
<a name='more'></a>The first thing I did was looking at syslog again for messages from bind/named. After starting the game, playing with it and then trying to visit the website out of the game, the following messages appeared in syslog when going online and trying to connect to the official website:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tail -f /var/log/syslog<br />...<br />Mar 2 18:21:30 localhost named[16540]: client @0xb0b01ef8 192.168.3.1#37721 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Mar 2 18:21:30 localhost named[16540]: client @0xb0b01ef8 192.168.3.1#53856 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Mar 2 18:21:30 localhost named[16540]: resolver priming query complete<br />Mar 2 18:21:30 localhost named[16540]: client @0xb1575720 192.168.3.1#39784 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Mar 2 18:21:30 localhost named[16540]: client @0xb1575720 192.168.3.1#47973 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Mar 2 18:21:31 localhost named[16540]: client @0xb0d02548 192.168.3.1#37607 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Mar 2 18:21:31 localhost named[16540]: client @0xb0d02548 192.168.3.1#33234 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Mar 2 18:21:33 localhost named[16540]: client @0xb0d02548 172.16.12.2#1201 (www.arcadia.dream-key.com): query: www.arcadia.dream-key.com IN A + (192.168.3.1)<br />...</span></span><br />
<br />
So the game tries to connect to www.arcadia.dream-key.com and the first thing, as usual and shown in my prior articles, is to create a DNS zone for it:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/named.conf<br />...<br />zone "arcadia.dream-key.com" {<br /> type master;<br /> notify no;<br /> file "/etc/bind/zones/arcadia.dream-key.com";<br />};<br />...</span></span><br />
<br />
And then the actual zone file:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/zones/arcadia.dream-key.com<br />$ORIGIN arcadia.dream-key.com.<br />$TTL 3600<br />@ IN SOA dcs01.dreamcast.local. root.dreamcast.local. (<br /> 85; serial<br /> 28800; refresh (8 hours)<br /> 7200; retry (2 hours)<br /> 604800; expire (1 week)<br /> 10800; minimum (3 hours)<br /> );<br /><br />arcadia.dream-key.com. IN NS dcs01.dreamcast.local.<br />arcadia.dream-key.com. IN MX 10 dcs01.dreamcast.local.<br /><br />www IN CNAME dcs01.dreamcast.local.<br /><br />@ IN A 192.168.3.1</span></span><br />
<br />
After restarting bind:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl restart bind9</span></span><br />
<br />
The old Skies Of Arcadia website can be resolved locally with the Dreamcast server project now:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dig +short www.arcadia.dream-key.com<br />dcs01.dreamcast.local.<br />192.168.3.1</span></span><br />
<br />
Next step was to create a dummy website. Before a website can be created for the game, Nginx needs another block server configuration (also as shown in my prior dreamcast.local project articles):<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/nginx/sites-available/www.arcadia.dream-key.com<br />server {<br /> listen 80;<br /> listen [::]:80;<br /><br /> server_name www.arcadia.dream-key.com;<br /><br /> root /var/www/www.arcadia.dream-key.com;<br /> index index.html;<br /> autoindex on;<br /><br /> location / {<br /> try_files $uri $uri/ =404;<br /> }<br />}</span></span><br />
<br />
Then the block server configuration needs to be linked to the enabled sites folder:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># ln -s /etc/nginx/sites-available/www.arcadia.dream-key.com /etc/nginx/sites-enabled/</span></span><br />
<br />
Now the folder has to be created for the website files:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mkdir /var/www/www.arcadia.dream-key.com</span></span><br />
<br />
Since I can not find a copy of the original Skies Of Arcadia website, I created the following dummy website (the descriptions for the downloads were taken from <a href="https://www.dreamcastlive.net/skies-of-arcadia-dlc.html">https://www.dreamcastlive.net/skies-of-arcadia-dlc.html</a>): <br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /var/www/www.arcadia.dream-key.com/index.html<br /><!DOCTYPE html><br /><html><br /><head><br /><title>www.arcadia.dream-key.com</title><br /></head><br /><body><br /><h1>www.arcadia.dream-key.com</h1><br /><h2>Giant Looper Ship Battle</h2><br />A boss Looper appears in the game.<br><br />Download (4 Blocks): <a href="Looper.VMI">VMI (US)</a> | <a href="Looper (PAL).VMI">VMI (PAL)</a> | <a href="Looper.VMS">VMS</a><br /><h2>Hamachou Island</h2><br />A new island is added to the game.<br><br />Download (4 Blocks): <a href="Hamachou.VMI">VMI (US)</a> | <a href="Hamachou (PAL).VMI">VMI (PAL)</a> | <a href="Hamachou.VMS">VMS</a><br /><h2>Tuna Cutlass and Swirlmirang</h2><br />Adds two new items which can be purchased from the "Mystery Merchant" who appears in some inns.<br><br />Download (4 Blocks): <a href="TunaSwir.VMI">VMI (US)</a> | <a href="TunaSwir (PAL).VMI">VMI (PAL)</a> | <a href="TunaSwir.VMS">VMS</a><br /></body><br /></html></span></span><br />
<br />
After restarting Nginx:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl restart nginx</span></span><br />
<br />
I was able to visit the website with link from the command line and Dream Key out the game already:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># links www.arcadia.dream-key.com</span></span><br />
<br />
The last thing that was missing, was the actual downloadable content. I found the downloadable files on <a href="https://www.dreamcastlive.net/skies-of-arcadia-dlc.html">https://www.dreamcastlive.net/skies-of-arcadia-dlc.html</a>, which links back to <a href="http://dc.dreamcast-talk.com/dlc/skiesofarcadia/">http://dc.dreamcast-talk.com/dlc/skiesofarcadia/</a>. All I had to do was to download the files to the Dreamcast server to have them available locally:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># cd /var/www/www.arcadia.dream-key.com<br /># wget "http://dc.dreamcast-talk.com/dlc/skiesofarcadia/Looper.VMI"<br />...<br /># wget "http://dc.dreamcast-talk.com/dlc/skiesofarcadia/Looper%20%28PAL%29.VMI"</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span></span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># wget "http://dc.dreamcast-talk.com/dlc/skiesofarcadia/Looper.VMS"</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span></span></span></span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># wget "http://dc.dreamcast-talk.com/dlc/skiesofarcadia/Hamachou.VMI"</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span></span></span></span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># wget "http://dc.dreamcast-talk.com/dlc/skiesofarcadia/Hamachou%20%28PAL%29.VMI"</span></span><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></span></span></span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span></span></span></span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># wget "http://dc.dreamcast-talk.com/dlc/skiesofarcadia/Hamachou.VMS"</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span></span></span></span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># wget "http://dc.dreamcast-talk.com/dlc/skiesofarcadia/TunaSwir.VMI"</span></span><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></span></span></span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span></span></span></span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># wget "http://dc.dreamcast-talk.com/dlc/skiesofarcadia/TunaSwir%20%28PAL%29.VMI"</span></span><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></span></span></span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span></span></span></span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># wget "http://dc.dreamcast-talk.com/dlc/skiesofarcadia/TunaSwir.VMS"</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">... </span></span><br />
<br />
Now I was able to download all files from the Dreamcast server. After restarting the game, the game recognizes the new files and asks to include them during gameplay.Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-29130184827678003242020-03-01T16:58:00.004+01:002020-03-02T08:32:57.846+01:00dreamcast.local VII - Uploads and DownloadsUploading files from your Dreamcast the Dreamcast server sounds easy, but it is not. Downloading files from the Dreamcast server also sounds easy, but it is also not. With this article I will explain the major pitfalls and how to avoid them.<br />
<a name='more'></a><br />
<u><i><b>Part I - Uploading files</b></i></u><br />
<br />
For uploading files from your Dreamcast to the Dreamcast server, you can not use any generic file uploader (no matter if written in PHP or Perl). One reason is, that Dream Key is using a modified Netscape/Mozilla 3.0 version, which does not use the default '<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">input type="file"</span></span>' element. Instead it uses '<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">input type="vmfile"</span></span>'. Another reason is the structure of downloads for the Dreamcast. Downloads for the Dreamcast are splitted into two different files:<br />
<ul>
<li>The first file is the VMI file, which is only some sort of descriptor file.</li>
<li>The second files is them VMS file, which contains the actual content to download.</li>
</ul>
See <a href="https://vmudev.dcemulation.org/faq.html" target="_blank">the (unofficial) VMU FAQ</a> for more details about this topic.<br />
<br />
Since I am really not a developer, I searched for an alternative to develop an VMU uploader. I found an excellent alternative with <a href="https://github.com/mrneo240/NeoDC-Icondata-Tool" target="_blank">NeoDC</a>. NeoDC has the entire code that is needed to upload content from your VMU's and it also creates the VMI and VMS structure. So here is what I did:<br />
<ul>
<li>Download NeoDC</li>
<li>Extract the required code from the NeoDC project into a single neodc.php file</li>
<li>Create a very simple upload front end, that would use the neodc.php upload functions</li>
</ul>
To get these files, navigate to <a href="https://drive.google.com/open?id=13-bYNo7srDDny-jcxFUHxESc3SHJoi5Y">https://drive.google.com/open?id=13-bYNo7srDDny-jcxFUHxESc3SHJoi5Y</a> and download dc_up_down.tar.gz. Copy it on the Dramcast server to /var/www/html. Then go into the same directory and extract it:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># cd /var/www/html<br /># tar xf dc_up_down.tar.gz</span></span><br />
<br />
You should have at least the following structure now:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tree<br />.<br />├── dc_up_down.tar.gz<br />├── download.php<br />├── neodc.php<br />├── upload<br />│ ├── _SILVE_0.VMI<br />│ ├── _SILVE_0.VMS<br />│ ├── _SILVE_1.VMI<br />│ └── _SILVE_1.VMS<br />└── upload.php</span></span><br />
<br />
download.php will just list all VMI files inside the upload folder<br />
neodc.php contains the functions to upload content from your VMU<br />
upload.php will offer you to upload a file and then utilize neodc.php to actually upload a file<br />
The files under upload are my save states from the game 'Silver' as an example.<br />
<br />
Now you can navigate to your Dreamcast server, load the upload.php and save some game states.<br />
<br />
<u><i><b>Part II - Downloading files</b></i></u><br />
<br />
As I said before, downloading files is also not too easy. Fortunately, way easier than uploading files. If you try to download any VMI file from the Dreamcast server, Dream Key will only display an error meassge with: "This page can not be displayed.". To be able to download files, you have to manipulate the mime.types file for Nginx and add the following two lines:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/nginx/mime.types<br />...<br /> application/x-dreamcast-vms-info vmi;<br /> application/x-dreamcast-vms vms;<br />...</span></span><br />
<br />
And don't forget to restart Nginx again:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl restart nginx</span></span><br />
<br />
After that you will be able to download files via the download.php script from above. The (unofficial) VMU FAQ also describes a method by using the .htaccess file, but I haven't tested it.<br />
<br />
<u><i><b>Links:</b></i></u><br />
<br />
The (unofficial) VMU FAQ: <a href="https://vmudev.dcemulation.org/faq.html">https://vmudev.dcemulation.org/faq.html</a><br />
NeoDC: <a href="https://github.com/mrneo240/NeoDC-Icondata-Tool">https://github.com/mrneo240/NeoDC-Icondata-Tool</a><br />
dc_up_down.tar.gz: <a href="https://drive.google.com/open?id=13-bYNo7srDDny-jcxFUHxESc3SHJoi5Y">https://drive.google.com/open?id=13-bYNo7srDDny-jcxFUHxESc3SHJoi5Y</a>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-34784578290269744172020-02-20T10:07:00.002+01:002020-02-20T10:09:11.220+01:00dreamcast.local VI - ChuChu Rocket!Just like my prior article about Phantasy Star Online Ver. 2, I will split this article into two parts. The first part will be focusing on the website again, while the second part will focus on the game and how to go online with it again. One note about online gaming with ChuChu Rocket!: this time I will show you how to setup your own ChuChu Rocket! game server with the software from Shuouma.<br />
<a name='more'></a><br />
<u><i><b>Part I - ChuChu Rocket! website</b></i></u><br />
<br />
Insert your game disc and in the main menu select "Homepage". Then make the following changes in the Options menu and set the AT command to atx if necessarry:<br />
<br />
[Pictures will come]<br />
<br />
Before actually going online, have an eye on syslog:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tail -f /var/log/syslog | grep named<br />...</span></span><br />
<br />
Now go online and look out for queries in syslog:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tail -f /var/log/syslog | grep named<br />...<br />Feb 19 17:42:20 localhost named[1881]: client @0xb0e07970 192.168.3.1#54831 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 19 17:42:20 localhost named[1881]: client @0xb0e07970 192.168.3.1#60191 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 19 17:42:20 localhost named[1881]: resolver priming query complete<br />Feb 19 17:42:20 localhost named[1881]: client @0xb1642e48 192.168.3.1#34058 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 19 17:42:20 localhost named[1881]: client @0xb1642e48 192.168.3.1#46314 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 19 17:42:21 localhost named[1881]: client @0xb167cd38 192.168.3.1#38792 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 19 17:42:21 localhost named[1881]: client @0xb1642e48 192.168.3.1#55772 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 19 17:42:23 localhost named[1881]: client @0xb0d08e88 172.16.12.2#2001 (chuchu.web.dreamcast.com): query: chuchu.web.dreamcast.com IN A + (192.168.3.1)<br />...</span></span><br />
<br />
And here we see it already, the game tries to connect to chuchu.web.dreamcast.com when visting the games website. Start by faking the IP for chuchu.web.dreamcast.com add the zone to your bind:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/named.conf<br />...<br />zone "chuchu.web.dreamcast.com" {<br /> type master;<br /> notify no;<br /> file "/etc/bind/zones/chuchu.web.dreamcast.com";<br />};<br />...</span></span><br />
<br />
Then create the zone:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/zones/chuchu.web.dreamcast.com<br />$ORIGIN chuchu.web.dreamcast.com.<br />$TTL 604800<br />@ IN SOA dcs01.dreamcast.local. root.dreamcast.local. (<br /> 85; serial<br /> 28800; refresh (8 hours)<br /> 7200; retry (2 hours)<br /> 604800; expire (1 week)<br /> 10800; minimum (3 hours)<br /> );<br /><br />chuchu.web.dreamcast.com. IN NS dcs01.dreamcast.local.<br />chuchu.web.dreamcast.com. IN MX 10 dcs01.dreamcast.local.<br /><br />@ IN A 192.168.3.1</span></span><br />
<br />
And restart bind:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl restart bind9</span></span><br />
<br />
Finally run a query for chuchu.web.dreamcast.com:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dig +short chuchu.web.dreamcast.com<br />192.168.3.1</span></span><br />
<br />
Next create a Nginx block server configuration:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/nginx/sites-available/chuchu.web.dreamcast.com<br />server {<br /> listen 80;<br /> listen [::]:80;<br /><br /> server_name chuchu.web.dreamcast.com;<br /><br /> root /var/www/chuchu.web.dreamcast.com;<br /> index index.html;<br /> autoindex on;<br /><br /> location / {<br /> try_files $uri $uri/ =404;<br /> }<br />}</span></span><br />
<br />
And link it to the sites-enabled folder:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># ln -s /etc/nginx/sites-available/chuchu.web.dreamcast.com /etc/nginx/sites-enabled/</span></span><br />
<br />
Restart Nginx:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl restart nginx</span></span><br />
<br />
Now it is time to create the website itself. I found a copy on <a href="https://www.dreamcastlive.net/">https://www.dreamcastlive.net</a>, which I will use here. First create a folder and change into it, to download a copy of the webiste:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mkdir -p /usr/src/dc/ccr && cd /usr/src/dc/ccr</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># wget -c "https://www.dreamcastlive.net/files/Website%20Backups/chuchu.web.dreamcast.com.zip"<br />...</span></span><br />
<br />
Unzip the copy:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># unzip chuchu.web.dreamcast.com.zip</span></span><br />
<br />
And move all files into your Nginx block server folder:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mv CHUCHUROCKET/* /var/www/chuchu.web.dreamcast.com/</span></span><br />
<br />
Clean up a little and remove the folder:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># rmdir /usr/src/dc/ccr/CHUCHUROCKET/</span></span><br />
<br />
When you visit the website for ChuChu Rocket! out of the game, it will look like this:<br />
<br />
[Pictures will come]<br />
<br />
<u><i><b>Part II - ChuChu Rocket! online gaming</b></i></u><br />
<br />
Before trying to play online, you need to grep syslog again:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tail -f /var/log/syslog | grep named<br />...</span></span><br />
<br />
Next start the game and select "Network" to go online with the game. Again, look out for DNS queries when going online:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tail -f /var/log/syslog | grep named<br />...<br />Feb 19 18:09:47 localhost named[17625]: client @0xb1685270 192.168.3.1#54871 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 19 18:09:47 localhost named[17625]: client @0xb167d4c8 192.168.3.1#45582 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 19 18:09:47 localhost named[17625]: client @0xb1685270 192.168.3.1#38498 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 19 18:09:47 localhost named[17625]: client @0xb1685270 192.168.3.1#59659 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 19 18:09:48 localhost named[17625]: client @0xb1685270 192.168.3.1#52688 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 19 18:09:48 localhost named[17625]: client @0xb1651690 192.168.3.1#46053 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 19 18:09:50 localhost named[17625]: client @0xb1651690 172.16.12.2#1425 (chuchu.games.dream-key.com): query: chuchu.games.dream-key.com IN A + (192.168.3.1)<br />Feb 19 18:09:50 localhost named[17625]: client @0xb1651690 172.16.12.2#1426 (chuchu.games.dream-key.com): query: chuchu.games.dream-key.com IN A + (192.168.3.1)<br />Feb 19 18:09:51 localhost named[17625]: client @0xb1651690 192.168.3.1#59156 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 19 18:09:51 localhost named[17625]: client @0xb1651690 192.168.3.1#44939 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />...</span></span><br />
<br />
The game itself tries to connect to chuchu.games.dream-key.com. With this information we can now create a zone for bind:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/named.conf<br />...<br />zone "chuchu.games.dreamcast.com" {<br /> type master;<br /> notify no;<br /> file "/etc/bind/zones/chuchu.games.dreamcast.com";<br />};<br />...</span></span><br />
<br />
And the zone file itself:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/zones/chuchu.games.dreamcast.com<br />$ORIGIN chuchu.games.dreamcast.com.<br />$TTL 604800<br />@ IN SOA dcs01.dreamcast.local. root.dreamcast.local. (<br /> 85; serial<br /> 28800; refresh (8 hours)<br /> 7200; retry (2 hours)<br /> 604800; expire (1 week)<br /> 10800; minimum (3 hours)<br /> );<br /><br />chuchu.games.dreamcast.com. IN NS dcs01.dreamcast.local.<br />chuchu.games.dreamcast.com. IN MX 10 dcs01.dreamcast.local.<br /><br />@ IN A 192.168.3.1</span></span><br />
<br />
Next restart bind and run a query on chuchu.games.dream-key.com:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl restart bind9<br /># dig +short chuchu.games.dreamcast.com<br />192.168.3.1</span></span><br />
<br />
Now it is time to install the server software. Create a folder to download the source and change into it:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mkdir -p /usr/src/dc/ccr && cd /usr/src/dc/ccr</span></span><br />
<br />
Download the source package:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># wget -c "https://www.dreamcastlive.net/files/Downloads/chuchu_server.zip"</span></span><br />
<br />
And it extract it to the folder src:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># unzip chuchu_server.zip -d src</span></span><br />
<br />
Change into folder:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># cd src</span></span><br />
<br />
Before you can compile the source, you need to install sqlite3 first:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># apt install sqlite3 libsqlite3-dev<br />...</span></span><br />
<br />
Now run make to compile the source:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># make<br />...</span></span><br />
<br />
Note: the source compiled on my ARM based Orange Pi R1!<br />
<br />
Configure the server software and change the IP to the IP of your Dreamcast server:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi chuchu.cfg<br />...<br />CHUCHU_LOBBY_IP=192.168.3.1<br />...</span></span><br />
<br />
To run the server software, you need two terminals. One for the login server and another one for the lobby server. On the terminal for the login server change into the directory where you compiled the software and start the login server:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># cd /usr/src/dc/ccr/src/<br /># ./chuchu_login_server<br />[2020/02/19 18:21:18][ChuChu - Server] [INFO] - Reading config...<br />[2020/02/19 18:21:18][ChuChu - Server] [INFO] - Loaded Config:<br />[2020/02/19 18:21:18][ChuChu - Server] [INFO] - CHUCHU_LOGIN_PORT_: 9000<br />[2020/02/19 18:21:18][ChuChu - Server] [INFO] - CHUCHU_LOBBY_IP: 192.168.3.1<br />[2020/02/19 18:21:18][ChuChu - Server] [INFO] - CHUCHU_LOBBY_PORT: 9001<br />[2020/02/19 18:21:18][ChuChu - Server] [INFO] - CHUCHU_LOBBY_DB_PATH: db/chuchu.db<br />[2020/02/19 18:21:18][ChuChu - Server] [INFO] - CHUCHU_LOBBY_INFO_PATH: info/chuchu_info.txt<br />[2020/02/19 18:21:18][ChuChu - Server] [INFO] - CHUCHU_MAX_PUZZLES: 96<br />[2020/02/19 18:21:18][ChuChu - Server] [INFO] - CHUCHU_MAX_CLIENTS: 100<br />[2020/02/19 18:21:18][ChuChu - Server] [INFO] - CHUCHU_MAX_ROOMS: 20<br />[2020/02/19 18:21:18][ChuChu - LoginServer] [INFO] - Socket created<br />[2020/02/19 18:21:18][ChuChu - LoginServer] [INFO] - Bind done<br />[2020/02/19 18:21:18][ChuChu - LoginServer] [INFO] - Waiting for incoming connections...</span></span><br />
<br />
On the terminal for the lobby server change into the directory where you compiled the software and start the lobby server:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># cd /usr/src/dc/ccr/src/<br /># ./chuchu_lobby_server<br />[2020/02/19 18:21:44][ChuChu - Server] [INFO] - Reading config...<br />[2020/02/19 18:21:44][ChuChu - Server] [INFO] - Loaded Config:<br />[2020/02/19 18:21:44][ChuChu - Server] [INFO] - CHUCHU_LOGIN_PORT_: 9000<br />[2020/02/19 18:21:44][ChuChu - Server] [INFO] - CHUCHU_LOBBY_IP: 192.168.3.1<br />[2020/02/19 18:21:44][ChuChu - Server] [INFO] - CHUCHU_LOBBY_PORT: 9001<br />[2020/02/19 18:21:44][ChuChu - Server] [INFO] - CHUCHU_LOBBY_DB_PATH: db/chuchu.db<br />[2020/02/19 18:21:44][ChuChu - Server] [INFO] - CHUCHU_LOBBY_INFO_PATH: info/chuchu_info.txt<br />[2020/02/19 18:21:44][ChuChu - Server] [INFO] - CHUCHU_MAX_PUZZLES: 96<br />[2020/02/19 18:21:44][ChuChu - Server] [INFO] - CHUCHU_MAX_CLIENTS: 100<br />[2020/02/19 18:21:44][ChuChu - Server] [INFO] - CHUCHU_MAX_ROOMS: 20<br />[2020/02/19 18:21:44][ChuChu - Server] [INFO] - Added 0 puzzles<br />[2020/02/19 18:21:44][ChuChu - LobbyServer] [INFO] - Socket created<br />[2020/02/19 18:21:44][ChuChu - LobbyServer] [INFO] - Bind done<br />[2020/02/19 18:21:44][ChuChu - LobbyServer] [INFO] - Waiting for incoming connections...</span></span><br />
<br />
When you go online with the game now, then you are required to login first. If you don't have an account, you have to create one. I created one with username "K" and password "K". Registration and login on the server looks like:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...<br />[2020/02/19 18:23:25][ChuChu - LoginServer] [INFO] - Connection accepted from 172.16.12.2 on socket 4<br />[2020/02/19 18:23:25][ChuChu - LoginServer] [INFO] - Handler assigned<br />[2020/02/19 18:23:26][ChuChu - LoginServer] [INFO] - <- DC-ID: [d055254b8818]<br />[2020/02/19 18:23:26][ChuChu - Server] [INFO] - DC id is not in the DB<br />[2020/02/19 18:23:26][ChuChu - LoginServer] [INFO] - <- New user joining...<br />[2020/02/19 18:23:43][ChuChu - LoginServer] [INFO] - <- Username: K is trying to join...<br />[2020/02/19 18:23:43][ChuChu - Server] [INFO] - Records created successfully<br />[2020/02/19 18:23:43][ChuChu - LoginServer] [INFO] - Done, disconnecting socket 4<br />...</span></span><br />
<br />
When you select a room to play online, then the log for the lobby looks like:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...<br />[2020/02/19 18:23:43][ChuChu - LobbyServer] [INFO] - Connection accepted from 172.16.12.2 on socket 4<br />[2020/02/19 18:23:43][ChuChu - LobbyServer] [INFO] - Added client: 0x104<br />[2020/02/19 18:23:43][ChuChu - LobbyServer] [INFO] - Handler assigned<br />[2020/02/19 18:23:43][ChuChu - LobbyServer] [INFO] - <- Username: K is trying to join...<br />[2020/02/19 18:23:43][ChuChu - LobbyServer] [INFO] - Stats fetched for username: K<br />[2020/02/19 18:23:54][ChuChu - LobbyServer] [INFO] - <- 0x01 players on this dreamcast wants to play<br />[2020/02/19 18:24:25][ChuChu - LobbyServer] [INFO] - User K joined room PSO Room<br />[2020/02/19 18:24:31][ChuChu - LobbyServer] [INFO] - User K left room PSO Room<br />...</span></span><br />
<br />
Of course, since I am the only one on the server logged in, I can not play with others. One feature that really surprised me was, that server software can deal with self created puzzles. Which meeans you can create a puzzle and store it on your VMU. Then go online with the game and upload the puzzle. When you delete the self created puzzle on your VMU, you can download it again from the server.<br />
<br />
If you want to, then you can take a look at the database. Change into the directory where you compiled the source:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># cd /usr/src/dc/ccr</span></span><br />
<br />
Run sqlite3 and open the database:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># sqlite3 db/chuchu.db</span></span><br />
<br />
Check that you are conneted to the right database:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">sqlite> .databases<br />main: /usr/src/dc/ccr/src/db/chuchu.db</span></span><br />
<br />
List the available tables:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">sqlite> .tables<br />PLAYER_DATA PUZZLE_DATA</span></span><br />
<br />
Take a look at the PLAYER_DATA table:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">sqlite> pragma table_info('PLAYER_DATA');<br />cid name type notnull dflt_value pk<br />---------- ---------- ---------- ---------- ---------- ----------<br />0 ID INTEGER 0 1<br />1 DC_ID CHAR(8) 1 0<br />2 USERNAME CHAR(16) 1 0<br />3 PASSWORD CHAR(16) 1 0<br />4 WON_RNDS INTEGER 0 0<br />5 LOST_RNDS INTEGER 0 0<br />6 TOTAL_RNDS INTEGER 0 0<br /><br />sqlite> select * from PLAYER_DATA;<br />1|D055254B8818|K|K|0|0|0</span></span><br />
<br />
And the PUZZLE_DATA table:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">sqlite> pragma table_info('PUZZLE_DATA');<br />cid name type notnull dflt_value pk<br />---------- ---------- ---------- ---------- ---------- ----------<br />0 ID INTEGER 0 1<br />1 PUZZLE_NAM CHAR(16) 1 0<br />2 CREATOR CHAR(16) 1 0<br />3 PUZZLE_FIL BLOB 0 0<br />4 DOWNLOADED INTEGER 1 0<br /><br />sqlite> select * from PUZZLE_DATA;<br />1|KAR01|K||1</span></span><br />
<br />
And this is it: the recovered website and your own ChuChu Rocket! game server.<br />
<br />
<u><b><i>Links:</i></b></u><br />
<a href="https://www.dreamcastlive.net/">https://www.dreamcastlive.net</a>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-44010205367495078292020-02-16T11:39:00.005+01:002020-02-16T16:33:30.599+01:00dreamcast.local V - Phantasy Star Online Ver. 2With my prior articles about my little dreamcast.local project, you are now set to get back online with Phantasy Star Online Ver. 2. Phantasy Star Online Ver. 2 has a very good chance to be one of my all-time-favorite games, at least on the Dreamcast it is. There are two ways going online with Phantasy Star Online Ver. 2:<br />
<br />
1. Visit the website, which is offline<br />
2. Play the game online, but the official servers are offline too<br />
<a name='more'></a><br />
With this article I will show you how to redirect the IP of the website to your local Dreamcast server and then redirect the IP of the old offline game server to the Sylverant project, to play online again. <br />
<br />
<u><i><b>Part I - Phantasy Star Online Ver. 2 website</b></i></u><br />
<br />
Before you try to connect to the website, login to your Dreamcast server and grep for named on the syslog file:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tail -f /var/log/syslog | grep named<br />...</span></span><br />
<br />
Next, start your Dreamcast with the game and navigate to the startscreen. The last menu entry offers you to visit the games website. In the next screen select the link to the games website, just ignore the link to the Sonicteam website. While your Dreamcast tries to connect to the games website, have an eye on your syslog and watch out for DNS queries:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tail -f /var/log/syslog | grep named<br />...<br />Feb 16 10:07:51 localhost named[681]: client @0xb164ed18 192.168.3.1#32935 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 16 10:07:51 localhost named[681]: client @0xb164ed18 192.168.3.1#54245 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 16 10:07:51 localhost named[681]: resolver priming query complete<br />Feb 16 10:07:51 localhost named[681]: client @0xb0f17918 192.168.3.1#52733 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 16 10:07:51 localhost named[681]: client @0xb0f17918 192.168.3.1#56616 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 16 10:07:52 localhost named[681]: client @0xb0f17918 192.168.3.1#38280 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 16 10:07:52 localhost named[681]: client @0xb0e01ec8 192.168.3.1#56051 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 16 10:07:54 localhost named[681]: client @0xb0e01ec8 172.16.12.2#1409 (pso.dricas.ne.jp): query: pso.dricas.ne.jp IN A + (192.168.3.1)<br />Feb 16 10:07:54 localhost named[681]: resolver priming query complete<br />...</span></span><br />
<br />
The log above indicates that the dreamcast is trying to connect to pso.dricas.ne.jp, but can not resolve it correctly. Try it with dig and you won't get an answer:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dig +short pso.dricas.ne.jp</span></span><br />
<br />
And at this point you have to tweak your bind a little. Fist add a new zone in the named.conf file to be able to resolve the address:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/named.conf<br />...<br />zone "pso.dricas.ne.jp" {<br /> type master;<br /> notify no;<br /> file "/etc/bind/zones/pso.dricas.ne.jp";<br />};</span></span><br />
<br />
Next create the actual zone file:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/zones/pso.dricas.ne.jp<br />$ORIGIN pso.dricas.ne.jp.<br />$TTL 604800<br />@ IN SOA dcs01.dreamcast.local. root.dreamcast.local. (<br /> 85; serial<br /> 28800; refresh (8 hours)<br /> 7200; retry (2 hours)<br /> 604800; expire (1 week)<br /> 10800; minimum (3 hours)<br /> );<br /><br />pso.dricas.ne.jp. IN NS dcs01.dreamcast.local.<br />pso.dricas.ne.jp. IN MX 10 dcs01.dreamcast.local.<br /><br />@ IN A 192.168.3.1</span></span><br />
<br />
Now restart bind:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl restart bind9</span></span><br />
<br />
And check if you get an answer for pso.dricas.ne.jp with dig:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dig +short pso.dricas.ne.jp<br />192.168.3.1</span></span><br />
<br />
Perfect, the IP for pso.dricas.ne.jp is now redirected to your local Dreamcast server. Next problem: you still don't have any website available. But this can be easily resolved with the Nginx configuration I showed you in <a href="https://karellen.blogspot.com/2020/02/dreamcastlocal-iii-webserver-with-nginx.html" target="_blank">Part III</a> of this series. First create a new block server configuration for the pso.dricas.ne.jp website:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/nginx/sites-available/pso.dricas.ne.jp<br />server {<br /> listen 80;<br /> listen [::]:80;<br /><br /> server_name pso.dricas.ne.jp;<br /><br /> root /var/www/pso.dricas.ne.jp;<br /> index index.html;<br /> autoindex on;<br /><br /> location / {<br /> try_files $uri $uri/ =404;<br /> }<br />}</span></span><br />
<br />
And link it to the enable-sites folder:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># ln -s /etc/nginx/sites-available/pso.dricas.ne.jp /etc/nginx/sites-enabled/</span></span><br />
<br />
Then create the folder, which will contain your website files as configured in the above configuration file:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mkdir -p /var/www/pso.dricas.ne.jp</span></span><br />
<br />
And create a sample index.html file again:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /var/www/pso.dricas.ne.jp/index.html<br /><html><br /><head><br /><title>pso.dricas.ne.jp</title><br /></head><br /><body><br /><h1>pso.dricas.ne.jp</h1><br /></body><br /></html></span></span><br />
<br />
Restart the Nginx webserver:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl restart nginx</span></span><br />
<br />
If you want to you can check the new pso.dricas.ne.jp webiste with links or lynxon your Dreamcast server:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># links pso.dricas.ne.jp</span></span><br />
<br />
You should see the title of the webiste in the upper right corner, the next line is the heading already. If you connect with your Dreamcast again and visit the games website, then it will look like this now:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1vJRC8Ol1z6Zs3phc7-DscvmkKGBSTZVunjTNf-GtQIRde1bxNfcZbqb2Ut1aX2ZNdja9COH_9d1qpCCooRw29mvem-MYj9-QwLxjWXYo8rwISfnvfXkGm707LWp4qUNiveYpKOuorzeP/s1600/20200216_105309.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1vJRC8Ol1z6Zs3phc7-DscvmkKGBSTZVunjTNf-GtQIRde1bxNfcZbqb2Ut1aX2ZNdja9COH_9d1qpCCooRw29mvem-MYj9-QwLxjWXYo8rwISfnvfXkGm707LWp4qUNiveYpKOuorzeP/s320/20200216_105309.jpg" width="320" /></a></div>
<br />
I have recovered a few files from web.archive.org for pso.dricas.ne.jp for the startpage and now my game website looks like this already:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCa62bfqiYuuM03OrpOwrSWq8lSmtMGPLNphe_Lq_fZNY0xOJfGZkiefNYuW3-gr-QEdKlqIwYJnONSvBtfrmF2RMFZ0SgJCrEiZTwebK-0XdJupRXZchqE3gyWeMrgXRVqfVSborSBqfb/s1600/20200216_105521.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCa62bfqiYuuM03OrpOwrSWq8lSmtMGPLNphe_Lq_fZNY0xOJfGZkiefNYuW3-gr-QEdKlqIwYJnONSvBtfrmF2RMFZ0SgJCrEiZTwebK-0XdJupRXZchqE3gyWeMrgXRVqfVSborSBqfb/s320/20200216_105521.jpg" width="320" /></a></div>
<br />
The original website also tries to load some files from sonic.dricas.ne.jp, but since this website is not available online and is not part of this article, these files will not be loaded.<br />
That's it for the first part of this article, next part will be about playing some Phantasy Star Online Ver. 2 again.<br />
<br />
<u><i><b>Part II - Phantasy Star Online Ver. 2 online gaming</b></i></u><br />
<br />
In this part of this article I will mostly do what I have done already in the first part:<br />
<br />
<ol>
<li>figure out the adress where the game wants to connect</li>
<li>reconfigure bind and manipulate the IP for the adress</li>
<li>go online and play</li>
</ol>
<br />
Nginx configuration for another website is not required. Let's get started again by having an eye on syslog:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tail -f /var/log/syslog | grep named<br />...</span></span><br />
<br />
Now, start your Dreamcast, go the startscreen, select "Continue", load your character, select "Online game", confirm three more screens and go online. As I said, keep an eye on syslog:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tail -f /var/log/syslog | grep named<br />...<br />Feb 16 11:09:24 localhost named[1548]: client @0xb167cd38 192.168.3.1#33117 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 16 11:09:24 localhost named[1548]: client @0xb167cd38 192.168.3.1#58911 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 16 11:09:24 localhost named[1548]: client @0xb167cd38 192.168.3.1#56116 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 16 11:09:24 localhost named[1548]: client @0xb167cd38 192.168.3.1#33800 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 16 11:09:24 localhost named[1548]: client @0xb0c022d0 192.168.3.1#59741 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 16 11:09:24 localhost named[1548]: client @0xb1684bb0 192.168.3.1#57267 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 16 11:09:38 localhost named[1548]: client @0xb0c022d0 172.16.12.2#1089 (master.pso.dream-key.com): query: master.pso.dream-key.com IN A + (192.168.3.1)<br />Feb 16 11:09:38 localhost named[1548]: resolver priming query complete<br />...</span></span><br />
<br />
Basically, the output is the same as for the website, with one mayor difference: instead of pso.drics.ne.jp the game tries to connect to master.pso.dream-key.com - which will fail for the moment. But we have the adress now and can manipulate the IP again.<br />
First, configure bind and add the new zone again:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/named.conf<br />...<br />zone "master.pso.dream-key.com" {<br /> type master;<br /> notify no;<br /> file "/etc/bind/zones/master.pso.dream-key.com";<br />};</span></span><br />
<br />
Next create the actual zone file again:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/zones/master.pso.dream-key.com<br />$ORIGIN master.pso.dream-key.com.<br />$TTL 604800<br />@ IN SOA dcs01.dreamcast.local. root.dreamcast.local. (<br /> 85; serial<br /> 28800; refresh (8 hours)<br /> 7200; retry (2 hours)<br /> 604800; expire (1 week)<br /> 10800; minimum (3 hours)<br /> );<br /><br />master.pso.dream-key.com. IN NS dcs01.dreamcast.local.<br />master.pso.dream-key.com. IN MX 10 dcs01.dreamcast.local.<br /><br />@ IN A 138.197.20.130</span></span><br />
<br />
One thing I want to point out is the IP which I am using for master.pso.dream-key.com. This time I don't use the Dreamcast servers local IP 192.168.3.1, but the IP 138.197.20.130 to connect to the private Sylverant game server. Restart bind again and check if master.pso.dream-key.com gets resolved "correctly":<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl restart bind9<br /># dig +short master.pso.dream-key.com<br />138.197.20.130</span></span><br />
<br />
And this is it already again, start the game, connect to the network and enjoy some good old Phantasy Star Online Ver. 2 on your Dreamcast - online again!<br />
Best part for me with this method, you don't need any cheatcodes, modify your Dreamcast hardware, manipulated games discs and so on. Just start the game and connect to the network - just like in the goold old days!<br />
And this how it looks again on my Dreamcast with the Sylverant game server:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIL_p_awBoWRA-zhNYpCfHIvOQHHIuluhaGAvDXSoOweYv6eyJ3wleR0VMgJ7RaIinvSahnmqUkqyvnjmttR5lfZEUkH3oLaNLpf42XXtxuGyZDpjxWPOj2xFGkvB6Ag9aX_4HhUfL1NDb/s1600/20200216_112844.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIL_p_awBoWRA-zhNYpCfHIvOQHHIuluhaGAvDXSoOweYv6eyJ3wleR0VMgJ7RaIinvSahnmqUkqyvnjmttR5lfZEUkH3oLaNLpf42XXtxuGyZDpjxWPOj2xFGkvB6Ag9aX_4HhUfL1NDb/s320/20200216_112844.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQEuXSZcQB1McW7yvl7P0c12-pTZEJjZB9nkgHH9OIi_1dTWrhL5SQssBu0rb-t402iQJae5bngVdQ1wZQ2SrOiDnd9Odymy3IDCwdbU2J5P90gTLLMkuAl3TayVaQqaGqVdfqmGuFmPIL/s1600/20200216_113042.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQEuXSZcQB1McW7yvl7P0c12-pTZEJjZB9nkgHH9OIi_1dTWrhL5SQssBu0rb-t402iQJae5bngVdQ1wZQ2SrOiDnd9Odymy3IDCwdbU2J5P90gTLLMkuAl3TayVaQqaGqVdfqmGuFmPIL/s320/20200216_113042.jpg" width="320" /></a></div>
<br />
When I am playing online, I am mostly on the ship "Altimira", Block01. Feel free to contact me while playing!<br />
<br />
<u><i><b>Links:</b></i></u><br />
<a href="https://web.archive.org/">https://web.archive.org/</a><br />
<a href="https://sylverant.net/">https://sylverant.net/</a> Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-10805022696164715592020-02-15T12:48:00.002+01:002020-02-15T12:56:04.252+01:00dreamcast.local IV - Routing<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
To connect your Dreamcast to the ineternet again, you need to activate routing from your ppp0 (172.16.12.1) device to your eth0 (192.168.3.1) device on the Dreamcast server. Start by checking if routing is activated in your kernel:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># sysctl net.ipv4.ip_forward<br />net.ipv4.ip_forward = 0</span></span><br />
<a name='more'></a><br />
If sysctl net.ipv4.ip_forward is set to 0, then routing is not activated. Activate routing with the following command:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># sysctl -w net.ipv4.ip_forward=1<br />net.ipv4.ip_forward = 1</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf </span></span><br />
<br />
Next create the following script to activate routing and masquerading from your ppp0 device to your eth0 device:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /usr/local/sbin/routing.sh<br />#!/bin/bash<br />ppp_dev="ppp0"<br />net_dev="eth0"<br />iptables -t nat -A POSTROUTING -o $net_dev -j MASQUERADE<br />iptables -A FORWARD -i $net_dev -o $ppp_dev -m state --state RELATED,ESTABLISHED -j ACCEPT<br />iptables -A FORWARD -i $ppp_dev -o $net_dev -j ACCEPT</span></span><br />
<br />
Make it executable:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># chmod 755 /usr/local/sbin/routing.sh</span></span><br />
<br />
And execute it:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># /usr/local/sbin/routing.sh</span></span><br />
<br />
Before you can really connect to the internet now, you have to modify the prior created named.conf and enter some external nameserver to forward queries. Just add the following lines in the named.conf file in the options section:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/named.conf<br />options {<br />...<br /> allow-query { any; };<br /> forwarders {<br /> 9.9.9.9;<br /> 8.8.8.8;<br /> };<br />};</span></span><br />
<br />
And restart bind:<br />
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl restart bind9</span></span></div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
When you establish a line between your Dreamcast and your Dreamcast server now, you can surf the web with your Dreamcast again. And this is how Google looks in 2020 on your Dreamcast:</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRCfV7TPlt3sCoFqkkPe8vv3toVCK7QajzGlYTGOpa0kufYJ4cGVXWCy_WSofA3fRcmTpYFRzb3ARe1GsV7COOtcWyMkNomNCwQxL8b1XEau72OSRmq7uX0cyQVtX4FtcCvkkg5L0tgbvB/s1600/20200215_115820.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRCfV7TPlt3sCoFqkkPe8vv3toVCK7QajzGlYTGOpa0kufYJ4cGVXWCy_WSofA3fRcmTpYFRzb3ARe1GsV7COOtcWyMkNomNCwQxL8b1XEau72OSRmq7uX0cyQVtX4FtcCvkkg5L0tgbvB/s320/20200215_115820.jpg" width="320" /></a></div>
<br />Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-12117425773649111542020-02-14T18:07:00.002+01:002020-02-14T18:08:22.714+01:00dreamcast.local III - Webserver with NginxIn part III of this mini-series I will show you how to install Nginx on your Dreamcast server and how to use it with your Dreamcast. Start by install Nginx first:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># apt install nginx<br />...</span></span><br />
<a name='more'></a><br />
Next edit your nginx.conf and remove the # from the server_names_hash_bucket_size option in the http section:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/nginx/nginx.conf<br />...<br />http {<br />...<br /> server_names_hash_bucket_size 64;<br />...<br />}</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span><br />
<br />
Now enable and start Nginx:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl enable nginx<br /># systemctl start nginx</span></span><br />
<br />
Finally create a dedicated index.html for your Dreamcast server:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /var/www/html/index.html<br /><html><br /><head><br /><title>dreamcast.local</title><br /></head><br /><body><br /><h1>dreamcast.local</h1><br /></body><br /></html></span></span><br />
<br />
When you establish a line with your Dreamcast and navigate to <a href="http://dreamcast.local/">http://dreamcast.local</a>, you will be able to see the content of your index.html created before:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgShUPmQErJvZoJXqBA1HdF3oH8Q-MYdAxxB-vDuKtPMVDjLL1o1V5C-t1TxXzMumIsjoahdk1veixxR9N8_dNPPNQBChS6GScOyOVd68fCtgOOxhyphenhyphen7QDBRp4hmX33HlHyVaqxEFkfxCNT8/s1600/20200214_175000.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgShUPmQErJvZoJXqBA1HdF3oH8Q-MYdAxxB-vDuKtPMVDjLL1o1V5C-t1TxXzMumIsjoahdk1veixxR9N8_dNPPNQBChS6GScOyOVd68fCtgOOxhyphenhyphen7QDBRp4hmX33HlHyVaqxEFkfxCNT8/s320/20200214_175000.jpg" width="320" /></a></div>
<br />
<span id="goog_1516717668"></span><span id="goog_1516717669"></span>Afaik Dream Key 3.0 can handle HTML and JavaScript websites. I tried a sample page with a little CSS and the CSS part got completely ignored.Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-30740062425796770222020-02-13T17:32:00.004+01:002020-02-13T17:45:39.910+01:00dreamcast.local II - DNSAs
I stated in the first article, I have setup a dedicated
domain called dreamcast.local. To do the same, you need to install bind
first:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># apt install bind9</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span><br />
<a name='more'></a><br />
Then create a basic configuration file:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/named.conf</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">options {<br /> auth-nxdomain no;<br /> directory "/etc/bind";<br /> empty-zones-enable no;<br /> dnssec-validation no;<br /> querylog yes;<br /> listen-on { 127.0.0.1; 192.168.3.1; };<br />};<br /><br />// ZONES<br />zone "0.0.127.in-addr.arpa" {<br /> type master;<br /> file "/etc/bind/zones/0.0.127";<br />};<br /><br />zone "dreamcast.local" {<br /> type master;<br /> notify no;<br /> file "/etc/bind/zones/dreamcast.local";<br />};<br /><br />zone "3.168.192.in-addr.arpa" {<br /> type master;<br /> notify no;<br /> file "/etc/bind/zones/3.168.192";<br />};<br /><br />zone "12.16.172.in-addr.arpa" {<br /> type master;<br /> notify no;<br /> file "/etc/bind/zones/12.16.172";<br />};</span></span><br />
<br />
As you can see in the configuration file, I created four zones:<br />
<br />
<ul>
<li>0.0.127.in-addr.arpa: loopback reverse lookup</li>
<li>dreamcast.local: forward lookup local network</li>
<li>3.168.192.in-addr.arpa: reverse lookup local network</li>
<li>12.16.172.in-addr.arpa: reverse lookup ppp network</li>
</ul>
<br />
Before you begin creating all these zones files, create the required zone directoy first:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mkdir /etc/bind/zones</span></span><br />
<br />
First start with the loopback reverse lookup zone:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /</span></span><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">etc/bind</span></span>/zones/0.0.127<br />$TTL 604800<br />@ IN SOA dcs01.dreamcast.local. root.dreamcast.local. (</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 92 ; serial</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 604800 ; refresh (1 week)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 86400 ; retry (1 day)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 2419200 ; expire (4 weeks)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 604800 ; minimum (1 week)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> )<br />@ IN NS dcs01.dreamcast.local.<br />1 IN PTR localhost.</span></span><br />
<br />
Then configure the forward lookup zone for the dreamcast.local network:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /</span></span><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">etc/bind</span></span>/zones/dreamcast.local</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">$ORIGIN dreamcast.local.</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">$TTL 604800</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">@ IN SOA dcs01.dreamcast.local. root.dreamcast.local. (</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 92 ; serial</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 604800 ; refresh (1 week)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 86400 ; retry (1 day)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 2419200 ; expire (4 weeks)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 604800 ; minimum (1 week)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> )</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><br /></span></span>
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">dreamcast.local. IN NS dcs01.dreamcast.local.</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">dreamcast.local. IN MX 10 dcs01.dreamcast.local.</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">dcs01 IN A 192.168.3.1</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">@ IN A 192.168.3.1</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">dc01 IN A 172.16.12.2</span></span><br />
<br />
Followed by the reverse lookup zone for the dreamcast.local network:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /</span></span><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">etc/bind</span></span>/zones/3.168.192</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">$ORIGIN 3.168.192.in-addr.arpa.</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">$TTL 604800</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">@ IN SOA dcs01.dreamcast.local. root.dreamcast.local. (</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 92 ; serial</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 604800 ; refresh (1 week)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 86400 ; retry (1 day)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 2419200 ; expire (4 weeks)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 604800 ; minimum (1 week)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> )</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">@ IN NS dcs01.dreamcast.local.</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">@ IN MX 10 dcs01.dreamcast.local.</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">1 IN PTR dcs01.dreamcast.local.</span></span><br />
<br />
And finally the reverse lookup zone for the ppp network:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /</span></span><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">etc/bind</span></span>/zones/12.16.172</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">$ORIGIN 12.16.172.in-addr.arpa.</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">$TTL 604800</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">@ IN SOA dcs01.dreamcast.local. root.dreamcast.local. (</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 92 ; serial</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 604800 ; refresh (1 week)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 86400 ; retry (1 day)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 2419200 ; expire (4 weeks)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> 604800 ; minimum (1 week)</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> )</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">@ IN NS dcs01.dreamcast.local.</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">@ IN MX 10 dcs01.dreamcast.local.</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">1 IN PTR dcs01.dreamcast.local.</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">2 IN PTR dc01.dreamcast.local.</span></span><br />
<br />
<br />
Next reconfigure the default options file for bind and add "-4 -c /etc/bind/named.conf":<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># cat /etc/default/bind9<br />#<br /># run resolvconf?<br />RESOLVCONF=no<br /><br /># startup options for the server<br />OPTIONS="-u bind -4 -c /etc/bind/named.conf"</span></span><br />
<br />
Now it is time to enable and start bind:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl enable bind9</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl start bind9</span></span><br />
<br />
Check that bind is running with your configured options:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># pgrep -afl named<br />6337 /usr/sbin/named -u bind -4 -c /etc/bind/named.conf</span></span><br />
<br />
And edit your local resolv.conf file and enter your newly configured DNS server:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/resolv.conf<br />domain dreamcast.local<br />search dreamcast.local<br />nameserver 192.168.3.1</span></span><br />
<br />
Your
Dreamcast server will now listen on the name dcs01 and your Dreamcast
will listen on the name dc01. DNS queries with dig should look like:<br />
<br />
Dreamcast:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dig +short dc01.dreamcast.local</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">172.16.12.2</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dig </span></span><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"> +short </span></span>-x 172.16.12.2 </span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">dc01.dreamcast.local. </span></span><br />
<br />
Dreamcast server:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dig +short dcs01.dreamcast.local</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">192.168.3.1</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dig +short -x 192.168.3.1</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">dcs01.dreamcast.local. </span></span><br />
<br />
Domain dreamcast.local: <br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dig +short dreamcast.local</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">192.168.3.1 </span></span><br />
<br />
When you check your syslog file now, you will notice message like this:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tail -f /var/log/syslog | grep named<br />...<br />Feb 13 17:10:24 localhost named[6337]: client @0xb167cd38 192.168.3.1#49535 (2.12.16.172.in-addr.arpa): query: 2.12.16.172.in-addr.arpa IN PTR +E(0)K (192.168.3.1)<br />Feb 13 17:10:47 localhost named[6337]: client @0xb1684bb0 192.168.3.1#46559 (dcs01.dreamcast.local): query: dcs01.dreamcast.local IN A +E(0)K (192.168.3.1)<br />Feb 13 17:10:56 localhost named[6337]: client @0xb1642e48 192.168.3.1#57280 (1.3.168.192.in-addr.arpa): query: 1.3.168.192.in-addr.arpa IN PTR +E(0)K (192.168.3.1)<br />Feb 13 17:11:08 localhost named[6337]: client @0xb1642e48 192.168.3.1#38070 (dreamcast.local): query: dreamcast.local IN A +E(0)K (192.168.3.1)<br />...</span></span><br />
<br />
When you are dialing in to your Dreamcast server with your Dreamcast and Dream Key 3.0, then you will see the following log messages:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tail -f /var/log/syslog | grep named<br />...</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">Feb 13 17:17:58 localhost named[6337]: client @0xb1684bb0 192.168.3.1#55830 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 13 17:17:58 localhost named[6337]: client @0xb1684bb0 192.168.3.1#50623 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 13 17:17:58 localhost named[6337]: resolver priming query complete<br />Feb 13 17:17:58 localhost named[6337]: client @0xb0d025d8 192.168.3.1#48299 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 13 17:17:58 localhost named[6337]: client @0xb1642e48 192.168.3.1#40156 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 13 17:18:00 localhost named[6337]: client @0xb1642e48 192.168.3.1#45987 (ppp0.dreamcast.local): query: ppp0.dreamcast.local IN A + (192.168.3.1)<br />Feb 13 17:18:00 localhost named[6337]: client @0xb1642e48 192.168.3.1#60880 (ppp0): query: ppp0 IN A + (192.168.3.1)<br />Feb 13 17:18:02 localhost named[6337]: client @0xb1642e48 172.16.12.2#1825 (www.sega-europe.com): query: www.sega-europe.com IN A + (192.168.3.1)<br />Feb 13 17:18:02 localhost named[6337]: client @0xb1642e48 172.16.12.2#1825 (www.sega-europe.com): query (cache) 'www.sega-europe.com/A/IN' denied<br />Feb 13 17:18:02 localhost named[6337]: client @0xb1642e48 172.16.12.2#1825 (www.sega-europe.com): query failed (REFUSED) for www.sega-europe.com/IN/A at ../../../bin/named/query.c:7144</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span><br />
<br />
This is because Dream Key 3.0 treis to connect to www.sega-europe.com first, when a connection was established.<br />
<br />
That's it for the second part!Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-15946523686096006492020-02-10T13:39:00.004+01:002021-11-14T14:11:08.929+01:00dreamcast.local I - Basic connectionIn this mini-series I will describe my current project: the Dremacast Server<br />
<br />
The Dreamcast is a game console, released by Sega 14. October 1999 in Europe. The Dreamcast was also my first console and I still use it from time to time.<br />
Besides a lot of great games, the Dreamcast has a build in analog modem, which would allow you to connect your Dreamcast to the internet and play games online with your friends. Of course, most services and websites are not available anymore, why I have decided to start this small project.<br />
<a name='more'></a><br />
The main goal of this project will be the following:<br />
<br />
Setup a small server, which allows your Dreamcast to connect to, via the internal analog modem. Additionally, setup up some online services.<br />
<br />
<u><i><b>Hardware</b></i></u><br />
<br />
Let's take a look at the hardware I use first:<br />
<br />
Server: Orange Pi R1 with Armbian Buster as operating system<br />
microSD: Toshiba M203 16GB<br />
USB to RS-232 adapter (PL-2303 based)<br />
Anlog modem: Elsa Microlink 56k basic<br />
Telephone system: Keil Telecom K 106<br />
<br />
The Orange Pi R1 is perfect for this project. It has 4 Cores, 512MB memory, a microSD slot, 2 Ethernet ports (one provided via USB), Wifi and two USB ports (provided by the expansion board). During this project description, I will setup a dedicated network for my Dreamcast:<br />
<br />
Domain: dreamcast.local (192.168.3.0/24)<br />
Hostname for the Orange Pi R1: dcs01<br />
IP for the Orange Pi R1: 192.168.3.1<br />
<br />
The overall hardware setup will be like the following:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGxVRP8KOknG_hhCiWiEEF9NGzh9tnvckD4e_4ZYE2Hr687Kh3qEuvaq8AtKW7LpWUDAxcdV9uunSOI9DIGWsdFmHSoxPTITg_jgGlRoAOXU-LFVvG4bZvCZ393oC5BYGloRc-0Ie5RJdm/s1600/dreamcast_hardware_setup.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="672" data-original-width="1407" height="190" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGxVRP8KOknG_hhCiWiEEF9NGzh9tnvckD4e_4ZYE2Hr687Kh3qEuvaq8AtKW7LpWUDAxcdV9uunSOI9DIGWsdFmHSoxPTITg_jgGlRoAOXU-LFVvG4bZvCZ393oC5BYGloRc-0Ie5RJdm/s400/dreamcast_hardware_setup.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
You can use any other hardware that is supported by your installed Linux Distribution. I had a similar setup running a few years ago already with some X86 hardware. Basically, this mini-series is based on my older articles about setting up a pppd server and a nameserver with bind. Only with this article I will focus 100% on my Dreamcast.<br />
<br />
<u><i><b>Setup serial interface</b></i></u><br />
<br />
If you have PL-2303 based USB to RS-232 adapter, just plug it in any free USB port. Check out for some messages:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dmesg</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">... </span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">[ 282.967611] usb 8-1: new full-speed USB device number 2 using ohci-platform<br />[ 283.194690] usb 8-1: New USB device found, idVendor=067b, idProduct=2303, bcdDevice= 4.00<br />[ 283.194710] usb 8-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0<br />[ 283.194724] usb 8-1: Product: USB-Serial Controller D<br />[ 283.194737] usb 8-1: Manufacturer: Prolific Technology Inc.<br />[ 283.334175] usbcore: registered new interface driver usbserial_generic<br />[ 283.334295] usbserial: USB Serial support registered for generic<br />[ 283.355376] usbcore: registered new interface driver pl2303<br />[ 283.355486] usbserial: USB Serial support registered for pl2303<br />[ 283.355809] pl2303 8-1:1.0: pl2303 converter detected<br />[ 283.380336] usb 8-1: pl2303 converter now attached to ttyUSB0<br />...</span></span><br />
<br />
And check if your serial device exists:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># ls /dev/ttyUSB0<br />ttyUSB0</span></span><br />
<br />
On the RS-232 connector, connect your analog modem. At this point you should be able to communicate with your modem and a modem control program like minicom. If you want to know more about controling your modem with minicom, take a look at one of my older articles: <a href="https://karellen.blogspot.com/2011/05/setting-up-pppd-server.html">https://karellen.blogspot.com/2011/05/setting-up-pppd-server.html</a><br />
<br />
<u><i><b>Setup mgetty</b></i></u><br />
<br />
To receive incoming calls from your Dreamcast, you need mgetty. Iinstall mgetty this way:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># apt install mgetty</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span><br />
<br />
And create unit file for systemd:<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><br /># vi /lib/systemd/system/mgetty.service<br />[Unit]<br />Description=Linea 1 Modem USB<br />Documentation=man:mgetty(8)<br />Requires=systemd-udev-settle.service<br />After=systemd-udev-settle.service<br /><br />[Service]<br />Type=simple<br />ExecStart=/sbin/mgetty -x1 -s 57600 -D /dev/ttyUSB0<br />Restart=always<br />PIDFile=/var/run/mgetty.pid.ttyUSB0<br /><br />[Install]<br />WantedBy=multi-user.target</span></span><br />
<br />
<br />
The most important line is the ExecStart line, which configures how mgetty starts:<br />
<br />
<ul>
<li>x1: Debug level</li>
<li>s 57600: Max modem speed</li>
<li>D: Data only</li>
<li>/dev/ttyUSB0: Serial device</li>
</ul>
<br />
If you have changed the unit file for mgetty, you need to reload it:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl daemon-reload</span></span><br />
<br />
Next start mgetty:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl start mgetty</span></span><br />
<br />
And enable mgetty to make sure mgetty gets started during boot:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl enable mgetty</span></span><br />
<br />
Check that mgetty is really running: <br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># pgrep -afl mgetty<br />1485 /sbin/mgetty -x1 -s 57600 -D /dev/ttyUSB0</span></span><br />
<br />
<u><i><b>Setup PPP</b></i></u><br />
<br />
To be able to not just receive incoming calls, but also to answer incoming calls, you need pppd. First install the software again:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># apt install ppp</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span><br />
<br />
Then configure the base options file for pppd:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mv /etc/ppp/options /etc/ppp/options.bak<br /># vi /etc/ppp/options</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">-detach</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">asyncmap 0</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">netmask 255.255.255.255</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">proxyarp</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">lock</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">crtscts</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">ktune</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">noauth</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">usehostname</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">modem</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">disconnect /etc/ppp/ip-down</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">ms-dns 192.168.3.1</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">usepeerdns</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">debug</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">mtu 1500</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">mru 1500</span></span><br />
<br />
Since my USB to Serial adapter is using the device /dev/ttyUSB0, I have to use a specific option file where I store the ppp IP for my server (172.16.12.1) and the ppp IP for my Dreamcast (172.16.12.2). Just adjust it to your serial device and change the ttyNAME at the end:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/ppp/options.ttyUSB0</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">172.16.12.1:172.16.12.2</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">debug</span></span><br />
<br />
<span style="font-family: inherit;">Next you need to setup a user who is allowed to authenticate against your server. This user must exist in two files. The first file will be the pap-secrets file needed for pppd:</span><br />
<span style="font-family: inherit;"><br /><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mv /etc/ppp/pap-secrets /etc/ppp/pap-secrets.bak </span></span></span><br />
<span style="font-family: inherit;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/ppp/pap-secrets<br /># client server secret IP<br />dreamcast * dreamcast *</span></span></span><br />
<br />
<span style="font-family: inherit;">The second file is the /etc/passwd file, where all users are stored. Username and password have to be identical in both files:<br /><br /><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># useradd -d /home/dreamcast -m -g users -s /bin/false -u 1002 dreamcast<br /># passwd dreamcast<br />New password: dreamcast<br />Re-enter new password: dreamcast</span></span></span><br />
<br />
<u><i><b>First connection test</b></i></u><br />
<u><i><b><br /></b></i></u>
At this point you are ready for a first connection test. Connect all cables, configure your Dreamcast so it will dial the number from your Linux server. In my case I used Dream Key 3.0 to configure my Dreamcast to dial the number 11, which will be answered by my Orange Pi R1. The following photos show how to setup your Dreamcast with Dream Key 3.0 to dial the phone number 11 (sorry for the bad quality):<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNUIQ3Hf00KiQEykni12LBChVMccDZNe8uIehvNQsaDR7gtQY8hZ9WbYRk5IK0pJsoC0pp0UIwy60tamo2nkF37HgHQw1WGtBZMhY22eJ9h2jvvFI2uTPOy8zt4OkxvQAGt5zz9QAwwgnI/s1600/20200211_200814.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNUIQ3Hf00KiQEykni12LBChVMccDZNe8uIehvNQsaDR7gtQY8hZ9WbYRk5IK0pJsoC0pp0UIwy60tamo2nkF37HgHQw1WGtBZMhY22eJ9h2jvvFI2uTPOy8zt4OkxvQAGt5zz9QAwwgnI/s320/20200211_200814.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQDFnqmj60IQH1hnhTy-cMbd-J7ifqk-s7ueKR2mw_FKV8CNQAhwNQRQwSQT-f9M4UoLHbSaPRGpFhxc1XfyEVbziO3iVFXHfMgRhZxSXFSBQmleZoe-NM3q8rsmVGAvKm6CeFUlvvX_TM/s1600/20200211_200830.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQDFnqmj60IQH1hnhTy-cMbd-J7ifqk-s7ueKR2mw_FKV8CNQAhwNQRQwSQT-f9M4UoLHbSaPRGpFhxc1XfyEVbziO3iVFXHfMgRhZxSXFSBQmleZoe-NM3q8rsmVGAvKm6CeFUlvvX_TM/s320/20200211_200830.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrMfl9J5PeGv8xObwFEA4rCfly6d1539Ymnj75U9dXPmVQ7veV9WAf4QeJIC_QI3qRijzl5QbiKyRRaa6twK_uTaKI-He0gzdOyXnma7DQ9WXHnkwVts994KjUR-qJeQDD_cIqxODWBjtY/s1600/20200211_200847.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrMfl9J5PeGv8xObwFEA4rCfly6d1539Ymnj75U9dXPmVQ7veV9WAf4QeJIC_QI3qRijzl5QbiKyRRaa6twK_uTaKI-He0gzdOyXnma7DQ9WXHnkwVts994KjUR-qJeQDD_cIqxODWBjtY/s320/20200211_200847.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3Fhda13t_fh-mgA51hdKZgX0t5-5HdyVB16Uad5TbtN6p-C-etkHqk_eBp2ByUTbT4JKGKySndGxm9KFIdbWjsQpwlEjiZtbt02oSsIoOhyphenhyphenPMfJFbs2JPma-TeQdFSjtu_lFtvF1lwsM9/s1600/20200211_200923.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3Fhda13t_fh-mgA51hdKZgX0t5-5HdyVB16Uad5TbtN6p-C-etkHqk_eBp2ByUTbT4JKGKySndGxm9KFIdbWjsQpwlEjiZtbt02oSsIoOhyphenhyphenPMfJFbs2JPma-TeQdFSjtu_lFtvF1lwsM9/s320/20200211_200923.jpg" width="320" /></a></div>
<br />
My telephone system does not offer a dial tone (at least not that I know). In my case I had to configure my Dreamcast to execute the atx AT command first, to ignore any kind of dial tone or missing dial tone: <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi489KunupNEfh_W3se8o7eprMssICvmLMBtDN5YQlGZZEvKhSH1KP5EKqvJqx11JZ55PpUTmQue_LzrCxyF4QO1qsQyX1Yzoeh2enQum9d2QcVH2AtwNX-7by6q2kGyoLbe0khzb34Nwbi/s1600/20200211_200941.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi489KunupNEfh_W3se8o7eprMssICvmLMBtDN5YQlGZZEvKhSH1KP5EKqvJqx11JZ55PpUTmQue_LzrCxyF4QO1qsQyX1Yzoeh2enQum9d2QcVH2AtwNX-7by6q2kGyoLbe0khzb34Nwbi/s320/20200211_200941.jpg" width="320" /></a></div>
<br />
For username and password use the same as you have configured in your pap-secrets: <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1NwnmyDtEarHc39W1xVBdtDOilADbYiBRlrGlpqOSg39ERAhz7oQnXvt0QsBol8ZCrhu3fF63LHS1zgyR_0M3de8muXeajI1-DKFDNO6oz0MOmxL-5A16pZ3yKMHtm-6O5hIrNXDsswQm/s1600/20200211_201013.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1NwnmyDtEarHc39W1xVBdtDOilADbYiBRlrGlpqOSg39ERAhz7oQnXvt0QsBol8ZCrhu3fF63LHS1zgyR_0M3de8muXeajI1-DKFDNO6oz0MOmxL-5A16pZ3yKMHtm-6O5hIrNXDsswQm/s320/20200211_201013.jpg" width="320" /></a></div>
<br />
As shown in the overview picture, the Orange Pi R1 is connected to the first line on my telephone system, which can be reached by dialing 11: <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjp1s70G2_Sw5ZvY2VbYNCH3mUsQDpJS4_R00x8ROvmekxTm72wRDmIts579VK2iD1oj-MT1866PuG9AoRTv89C3QYeZM6FoAQZ1qyjFXxuyt8oECLT3wsHBoEAHwoqHr8AvQhmLLFHJf5g/s1600/20200211_201027.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjp1s70G2_Sw5ZvY2VbYNCH3mUsQDpJS4_R00x8ROvmekxTm72wRDmIts579VK2iD1oj-MT1866PuG9AoRTv89C3QYeZM6FoAQZ1qyjFXxuyt8oECLT3wsHBoEAHwoqHr8AvQhmLLFHJf5g/s320/20200211_201027.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyZ0ljFsrQ7sCzO0NlUlcaRylvexEYw0lUx_IMQduh_i2j-NmHho-ux0yWzvDZtOK8_X-8AwYCZmo3gsOGBjcvGjDSFkw5awl_hWmDmqjpGnYZusNpLRrEyhDuu1VhuxiliQOAqLciWoWi/s1600/20200211_201043.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyZ0ljFsrQ7sCzO0NlUlcaRylvexEYw0lUx_IMQduh_i2j-NmHho-ux0yWzvDZtOK8_X-8AwYCZmo3gsOGBjcvGjDSFkw5awl_hWmDmqjpGnYZusNpLRrEyhDuu1VhuxiliQOAqLciWoWi/s320/20200211_201043.jpg" width="320" /></a></div>
<br />
After configuration is finished, you are ready to connect: <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit-tjkfbw49GWzhwN60Cgm-cNl8ta0_0AMdiKB5TQyvTDaeGU32tDrZr1818j8gc6vo4syX4lX9zmafRUTNFDr9U3aXMa8G8CfK5e3FXUZKZiiBRpPtqO1HgRlBJrPIZed3oSb63hmLzO_/s1600/20200211_201123.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit-tjkfbw49GWzhwN60Cgm-cNl8ta0_0AMdiKB5TQyvTDaeGU32tDrZr1818j8gc6vo4syX4lX9zmafRUTNFDr9U3aXMa8G8CfK5e3FXUZKZiiBRpPtqO1HgRlBJrPIZed3oSb63hmLzO_/s320/20200211_201123.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFokpT3LEJSCSZabjyugOMJ_0lluHfvcmjRTfjhT_afcYYOvKrtYle4LWTplQJyNhSTrkTrmVCXmMDMZYMZ1iUhGmXyxDlXCf_aOYJHH6tvdjIaJIvWh63UijQ0aBFle0k4IUahL-np2Mf/s1600/20200211_201133.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFokpT3LEJSCSZabjyugOMJ_0lluHfvcmjRTfjhT_afcYYOvKrtYle4LWTplQJyNhSTrkTrmVCXmMDMZYMZ1iUhGmXyxDlXCf_aOYJHH6tvdjIaJIvWh63UijQ0aBFle0k4IUahL-np2Mf/s320/20200211_201133.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU41nK_ZSh0Og-iRnphW4jMy2-Wwfw5x5vMn1mp-e7ODug1o7JfyUDbDlxvGZRESurswLUltdgSVzfYl_M6mLXndS2uFGp4pfaEeUvXdKdOZxHW6tWOG12Ngir5LoxkjxtWovLe-f7tVZN/s1600/20200211_201213.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU41nK_ZSh0Og-iRnphW4jMy2-Wwfw5x5vMn1mp-e7ODug1o7JfyUDbDlxvGZRESurswLUltdgSVzfYl_M6mLXndS2uFGp4pfaEeUvXdKdOZxHW6tWOG12Ngir5LoxkjxtWovLe-f7tVZN/s320/20200211_201213.jpg" width="320" /></a></div>
<br />
Dream Key 3.0 first tries to connect to www.sega-europe.com. Since I haven't configured DNS or routing tables, no connection will be established: <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhICwCNy6B6rI_ce3ju4lL-DZ9S6mHJ-J5_AQRiuH7Q5LSppDZRVchqoQ3kbfTclWNEps1DfyoLpjfbh0HsPsQmJL081dgru7ItyZGwsOnAZ16Jqf4h4MdYp1N90_TZj5YWhW1KBDQ2nqmz/s1600/20200211_201330.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhICwCNy6B6rI_ce3ju4lL-DZ9S6mHJ-J5_AQRiuH7Q5LSppDZRVchqoQ3kbfTclWNEps1DfyoLpjfbh0HsPsQmJL081dgru7ItyZGwsOnAZ16Jqf4h4MdYp1N90_TZj5YWhW1KBDQ2nqmz/s320/20200211_201330.jpg" width="320" /></a></div>
<br />
The connection will be stable for a few minutes, after some time of inactivity the Dreamcast willl disconnect the line. Before disconnecting the line, check on your server for your ppp0 device. on my Ornage Pi R1 it looks lik this, when a connection is established:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># ifconfig -a<br />...<br />ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500<br /> inet 172.16.12.1 netmask 255.255.255.255 destination 172.16.12.2<br /> ppp txqueuelen 3 (Point-to-Point Protocol)<br /> RX packets 19 bytes 573 (573.0 B)<br /> RX errors 0 dropped 0 overruns 0 frame 0<br /> TX packets 20 bytes 854 (854.0 B)<br /> TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0<br />...</span></span><br />
<br />
That's for the first part of this project, next time I will show you how to setup a DNS for the dreamcast.local network.<br />
<br />
<u><i><b>Links:</b></i></u><br />
<br />
<a href="http://www.orangepi.org/OrangePiR1/">http://www.orangepi.org/OrangePiR1/</a><br />
<a href="https://www.armbian.com/">https://www.armbian.com/</a>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-62808541534383888482020-02-05T08:59:00.001+01:002020-02-05T09:01:16.267+01:00Nginx server_names_hash_bucket_sizeToday I installed nginx to support multiple Server Blocks/Virtual Hosts. When I configured the second or third Server Block and restarted Nginx, I encountered the following error:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl start nginx<br />Job for nginx.service failed because the control process exited with error code.<br />See "systemctl status nginx.service" and "journalctl -xe" for details.</span></span><br />
<a name='more'></a><br />
journalctl only gave me the same error as the Nginx log did:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"># journalctl -xe<br />-- Unit nginx.service has begun starting up.<br />Feb 04 19:14:17 op01 nginx[13528]: nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 32<br />Feb 04 19:14:17 op01 nginx[13528]: nginx: configuration file /etc/nginx/nginx.conf test failed<br />Feb 04 19:14:17 op01 systemd[1]: nginx.service: Control process exited, code=exited status=1<br />Feb 04 19:14:17 op01 systemd[1]: Failed to start A high performance web server and a reverse proxy server.<br />...<br /><br /># cat /var/log/nginx/error.log<br />2020/02/04 19:14:17 [emerg] 13528#13528: could not build server_names_hash, you should increase server_names_hash_bucket_size: 32</span></span><br />
<br />
To make it short: even though I only configured the second or third Server Block, the name I used for the Server Block was to long. I needed to increase the value for server_names_hash_bucket_size in the nginx.conf file:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/nginx/nginx.conf<br />http {<br />...<br /> server_names_hash_bucket_size 64;<br />...<br />}</span></span><br />
<br />
After adjusting the value, Nginx started again:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># systemctl start nginx</span></span><br />
<br />
<i><u>Links:</u></i><br />
<br />
<a href="http://nginx.org/en/docs/http/server_names.html">http://nginx.org/en/docs/http/server_names.html</a>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-58281070308024940942020-01-11T15:52:00.000+01:002020-01-11T15:53:55.322+01:00Adblock with BIND DNSIf you're annoyed as me, watching all these advertisement when surfing the web, then this article might be something for you. In this article I will explain how to modify BIND to use as an Adblocker.<br />
<a name='more'></a>As stated already, I'm using BIND as DNS Server, running on Armbian on my Banana PI R2. Also I assume that you have BIND already configured and running.<br />
<br />
The first step you need to do is to download the following list of known advertisment servers:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># wget "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=bindconfig&showintro=0&mimetype=plaintext" -O /etc/bind/ad-server-list.conf</span></span><br />
<br />
The second step is to reconfigure your existing BIND configuration and include the downloaded advertisement list, e.g.:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/bind/named.conf<br />...<br />// ZONES<br />include "/etc/bind/ad-block.conf";<br /><br />zone "0.0.127.in-addr.arpa" {<br /> ...<br />};<br /><br />zone "karellen.local" {<br /> ...<br />};<br />...</span></span><br />
<br />
In step three you need to check for your directory directive in your BIND configuration file:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># grep "directory" /etc/bind/named.conf<br /> directory "/var/named";</span></span><br />
<br />
The above grep command indicates that /var/named is the directory where BIND looks for other files.<br />
Step four: in exactly this directory you need to create a new zones file, where all advertisement servers get redirected to 127.0.0.1:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /var/named/null.zone.file<br />$TTL 86400 ; one day<br />@ IN SOA ads.karellen.local. hostmaster.karellen.local. (<br /> 2014090101<br /> 28800<br /> 7200<br /> 864000<br /> 86400 )<br /> NS bp01.karellen.local<br /> A 127.0.0.1<br />@ IN A 127.0.0.1<br />* IN A 127.0.0.1</span></span><br />
<br />
<u>Notes:</u><br />
<br />
<ul>
<li>karellen.local is my domain, you need to change it to your domain</li>
<li>bp01.karellen.local is my DNS, you need to change it to your DNS</li>
</ul>
<br />
For step five, update file permissions and reload your bind using rndc:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># chown bind:bind </span></span><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">/etc/bind/ad-server-list.conf</span></span> /var/named/null.zone.file<br /># rndc reload</span></span><br />
<br />
And the final step, check if the new configuration works and that lookups for advertisement servers get redirected to 127.0.0.1:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dig zzhc.vnet.cn<br />...<br />zzhc.vnet.cn. 86400 IN A 127.0.0.1<br />...</span></span><br />
<br />
If you want to redirect to another webserver, change 127.0.0.1 to your web server IP, e.g. 192.168.178.2:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dig zzhc.vnet.cn<br />...<br />zzhc.vnet.cn. 86400 IN A 192.168.178.2<br />...</span></span><br />
<br />
Enjoy surfing the web advertisement free!<br />
<br />
<u><i><b>Links:</b></i></u><br />
<a href="https://charlieharvey.org.uk/page/adblocking_with_bind_apache">https://charlieharvey.org.uk/page/adblocking_with_bind_apache</a><br />
<a href="https://advanxer.com/blog/2015/05/adblocking-using-bind-dns-server/">https://advanxer.com/blog/2015/05/adblocking-using-bind-dns-server/</a>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-61230457779416803882020-01-04T14:05:00.004+01:002020-01-04T18:44:12.556+01:00Orange Pi Zero NASToday my Orange Pi Zero with the NAS Extension Board arrived and I decided immediatly to setup it up as a very minor NAS. So here is what I am using:<br />
<br />
Orange Pi Zero with an Allwinner H2+ and 512MB RAM<br />
NAS Extension Board with 1x SATA and 1x mSATA<br />
Adata SP310 128GB mSATA<br />
Samsung Evo 840 250GB SATA<br />
<a name='more'></a><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJpDvKeNdyEBVzUnZLzXlwkUsiQwAimkpDBLorUvDPyQUswZravtPNdWZJzLc8scQA7uyBljBjUvthdN5owWOyNGQsR_zfK8oLumFf3DFrZtICvDcfOKuXUglIUZnr6M7Ec_VlQOeBFSB8/s1600/pi_nas_1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="750" data-original-width="1000" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJpDvKeNdyEBVzUnZLzXlwkUsiQwAimkpDBLorUvDPyQUswZravtPNdWZJzLc8scQA7uyBljBjUvthdN5owWOyNGQsR_zfK8oLumFf3DFrZtICvDcfOKuXUglIUZnr6M7Ec_VlQOeBFSB8/s320/pi_nas_1.jpg" width="320" /></a></div>
<br />
As most cheap boards the SATA connectors are not real SATA connectors, just USB-SATA converters.<br />
Also, when using both SATA connectors, then the Orange PI Zero can not be powered via the USB-OTG port. For powering the Orange Pi Zero with both SATA connectors in use, the NAS Extension Board provides an extra Power connector to use (which works very well with Cubietruck/Cubiboard 3 Power Supply). Using only the mSATA port surprisingly worked with power from the USB-OTG port.<br />
As operating System I am using Armbian again (just like on most of my ARM based boards)<br />
<br />
After assembling all parts and powering up, my first command was lsscsi to check if both disks are available:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># lsscsi<br />[0:0:0:0] disk JMicron Generic 0404 /dev/sda<br />[1:0:0:0] disk JMicron Generic 0404 /dev/sdb</span></span><br />
<br />
Then I checked the size of each disk with fdisk:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"># fdisk -l /dev/sda<br />Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors<br />...<br /><br /># fdisk -l /dev/sdb<br />Disk /dev/sdb: 232.9 GiB, 250059350016 bytes, 488397168 sectors<br />...</span></span><br />
<br />
The Samsung Evo 840 showed only 232GB, not 250GB as advertised but OK. Then I prepared both disks to use with LVM:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># pvcreate /dev/sda<br /> Physical volume "/dev/sda" successfully created.<br /><br /># pvcreate /dev/sdb<br /> Physical volume "/dev/sdb" successfully created.</span></span><br />
<br />
And created a Volume Group called nas02-local (no RAID):<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vgcreate nas02-local /dev/sda /dev/sdb<br /> Volume group "nas02-local" successfully created</span></span><br />
<br />
A quick check with vgs showed me that I have ~350GB for usage:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #666666;"># vgs -v<br /> VG Attr Ext #PV #LV #SN VSize VFree VG UUID VProfile<br /> nas02-local wz--n- 4.00m 2 0 0 352.12g 352.12g lONfiY-8U00-10zm-zHks-5JgH-eGbs-b22z89</span></span><br />
<br />
Then I created two 60GB Volumes, one for my images and another one for my music across both disks:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># lvcreate -i 2 -n image -L 60G nas02-local<br /> Logical volume "image" created.<br /><br /># lvcreate -i 2 -n music -L 60G nas02-local<br /> Logical volume "music" created.</span></span><br />
<br />
And of course the filesystem must not be missing:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mkfs.ext4 /dev/mapper/nas02--local-image -m 0 -L image<br />...<br /># mkfs.ext4 /dev/mapper/nas02--local-music -m 0 -L music<br />...</span></span><br />
<br />
Created the mountpoints:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mkdir /local/image<br /># mkdir /local/music</span></span><br />
<br />
Before I modify the fstab file for automatic mount during boot, I checked both disks and volumes with lsblk:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># lsblk -f<br />NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT<br />sda LVM2_member mvkeEr-FVB2-TUW0-bb38-ghJO-UpqM-bEOfyA<br />|-nas02--local-image ext4 image 978ba6c7-13a2-463b-95b4-bd5703238a0e<br />`-nas02--local-music ext4 music cd0c7305-fed2-45ed-940c-2c0dd272c1cc<br />sdb LVM2_member GUrMN3-eM0f-moAA-Wb66-7h6p-OAHv-fD0XWj<br />|-nas02--local-image ext4 image 978ba6c7-13a2-463b-95b4-bd5703238a0e<br />`-nas02--local-music ext4 music cd0c7305-fed2-45ed-940c-2c0dd272c1cc</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;">...</span></span><br />
<br />
Both volumes are using both available disks, which means when one disk fails, then the data is unrecoverable lost on both volumes!<br />
I use the UUID information from lsblk to modify my fstab file:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/fstab<br />...<br />UUID=978ba6c7-13a2-463b-95b4-bd5703238a0e /local/image ext4 defaults,noatime,nodiratime,commit=600,errors=remount-ro 0 1<br />UUID=cd0c7305-fed2-45ed-940c-2c0dd272c1cc /local/music ext4 defaults,noatime,nodiratime,commit=600,errors=remount-ro 0 1</span></span><br />
<br />
And a first test:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mount /local/image<br /># mount /local/music</span></span><br />
<br />
And a final check:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># df -h<br />Filesystem Size Used Avail Use% Mounted on<br />...<br />/dev/mapper/nas02--local-music 59G 53M 59G 1% /local/music<br />/dev/mapper/nas02--local-image 59G 53M 59G 1% /local/image<br />...</span></span><br />
<br />
Perfect, a small mini NAS for minor data storing tasks. And this is how it looks assembled:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvuvgI5lg54cDc1TvaVXPtbbOaptZt3wrc6FkNoAcOY7813J523c-7quiOHA50wdkzeaZsRgVHx4wiDVCj4iIyAAFMxpBPF6t5dlrbrBEHiIiIPzDZfop3UA5471AjQg_fPCjR2E1oKbG4/s1600/pi_nas_2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1000" data-original-width="750" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvuvgI5lg54cDc1TvaVXPtbbOaptZt3wrc6FkNoAcOY7813J523c-7quiOHA50wdkzeaZsRgVHx4wiDVCj4iIyAAFMxpBPF6t5dlrbrBEHiIiIPzDZfop3UA5471AjQg_fPCjR2E1oKbG4/s320/pi_nas_2.jpg" width="240" /></a></div>
<br />
<i><u>Links:</u></i><br />
<br />
<a href="http://www.orangepi.org/orangepizero/">http://www.orangepi.org/orangepizero/</a>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-14896291517083848922019-12-26T17:52:00.005+01:002019-12-26T17:54:29.431+01:00DIY Digital Photo FrameOnce I stumbled upon the Orange Pi Zero Plus2, which comes with the following features and is perfect to setup a simple DIY Digital Photo Frame:<br />
<br />
CPU: Cortax-A53 (4 64bit cores up to 816 MHz (H5))<br />
Memory: 512MB<br />
EMMC: 8GB<br />
MicroSD Slot, HDMI, WIFI and more<br />
<a name='more'></a><br />
The 8GB EMMC holds the operating system (Armbian). HDMI is needed to connect the Photo Frame to any HDMI capable monitor. The MicroSD Slot holds a 128GB card for storing some photos and music.<br />
After installing the operating system, I created two folders on my MicroSD card:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mkdir -p /local/photos<br /># mkdir -p /local/music</span></span><br />
<br />
The first directory stores all my photos I want to display, the second directory stores some music to play during the slideshow.<br />
<br />
I have created only two scripts, ony for displaying the photos with fim. And another to play the music with ogg123. Both packages must be installed first.<br />
<br />
Then I have created the first script to display my photos in a random slideshow:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /usr/local/bin/slideshow.sh<br />#!/bin/bash<br />find /local/photos/ -name "*" -type "f" > /home/karellen/photos.txt<br />cat /home/karellen/photos.txt | shuf > /home/karellen/photos_shuf.txt<br />cat /home/karellen/photos_shuf.txt | fim --load-image-descriptions-file /home/karellen/photos.dsc - -c 'while(1){display;sleep "60";next;}' > /dev/null 2>&1</span></span><br />
<br />
The second script will play some music in the background:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># cat /usr/local/bin/autoplay.sh<br />#!/bin/bash<br />find /local/music/ -name "*.ogg" -type f > /home/karellen/music.txt<br />while :; do<br /> cat /home/karellen/music.txt | shuf | while read f; do<br /> /usr/bin/ogg123 "$f" > /dev/null 2>&1<br /> done<br />done</span></span><br />
<br />
The last step was to add both scripts to /etc/rc.local to start them after booting:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/rc.local<br />...<br />/usr/local/bin/autoplay.sh &<br />/usr/local/bin/slideshow.sh &<br /><br />exit 0</span></span><br />
<br />
After reboot the Photo Frame will display some photos in a slideshow and play some music in the background.<br />
<br />
<u><i>Links:</i></u><br />
<br />
Orange Pi Zero Plus2: <a href="http://www.orangepi.org/OrangePiZeroPlus2/">http://www.orangepi.org/OrangePiZeroPlus2/</a><br />
Armbian: <a href="https://www.armbian.com/orange-pi-zero-2-h5/">https://www.armbian.com/orange-pi-zero-2-h5/</a>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-46818267065605183422019-12-23T16:10:00.002+01:002019-12-23T16:11:25.942+01:00TFA SINUS + te923tool<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: left;">
I have a small weather station, a TFA SINUS. Last year, I started to capture the data from the weather station. To do so, I needed a software
that can communicate with the weather station. And that is where
te923tool comes in handy.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
In this article I will explain, how to install the te923tool and how to run it.</div>
<a name='more'></a><div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
To get te923tool, download it with e.g. wget:</div>
<div style="text-align: left;">
<br /></div>
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># mkdir /usr/src/te923 && cd /usr/src/te923<br /># wget -c "http://te923.fukz.org/downloads/te923tool-0.6.1.tgz"<br />...</span></span><br />
<br />
Extract the sources and change into the new directory:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># tar xf te923tool-0.6.1.tgz<br /># cd te923tool-0.6.1</span></span><br />
<br />
Just run make to create the te923con binary (libusb headers are required):<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># make<br />gcc -Wall -lusb -o te923con te923con.c te923usb.c te923com.c<br /># ls te923con<br />te923con</span></span><br />
<br />
Copy the new binary:<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"><br /># cp te923con /usr/local/bin/</span></span><br />
<br />
When the weather station is connected, execute te923con as root:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># te923con<br />1577111460:23.60:49:9.60:54:i:i:i:i:i:i:i:i:999.8:i:6:0:13:0.2:0.0:8.7:0</span></span><br />
<br />
The values for each sensors are seperated by colons with the following meaning (excerpt only):<br />
<br />
1577111460 - Timestamp<br />
23.60 - Temperature from internal sensor in degree<br />
49 - Humidity from internal sensor in percent<br />
9.60 - Temperature from external sensor in degree<br />
54 - Humidity from external sensor in percent<br />
<br />
And
so on. Depending on the connected sensor, you get more and more values.
In my above output, I have also the wind sensor connected (I still
don't understand what Wind Gust means). All sensors are described when
the help option is used:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># te923con -h<br />...</span></span><br />
<br />
You can also query the status of the batteries per sensor:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># te923con -s<br />0x29:0x17:0x14:0x10:0x26:1:1:0:1:1:1:1:1</span></span><br />
<br />
Output is again seperated by colons. The output also indicates that I need to change the battery for my wind sensor soon.<br />
<br />
I
have added the te923con queries to my Nagios setup (including
pnp4nagios) to capture and keep the states for each sensor. The graph
for my outdor temperature looks in my case like this: <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7J3QkTBb0-m47qZ3ayCtnlwXDw6wFc7IcQxxzyTwNWi7L4rZ2xNsGHARgYE5KIU0T-nkENU-35ui9SWoiBr_zwqAbCThYCL7lo7qDXcz3mwdhz4_r4yCNnadvAuIXc-_0pJGj-Y_xvkuD/s1600/outdoor_temp.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="329" data-original-width="1097" height="95" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7J3QkTBb0-m47qZ3ayCtnlwXDw6wFc7IcQxxzyTwNWi7L4rZ2xNsGHARgYE5KIU0T-nkENU-35ui9SWoiBr_zwqAbCThYCL7lo7qDXcz3mwdhz4_r4yCNnadvAuIXc-_0pJGj-Y_xvkuD/s320/outdoor_temp.png" width="320" /></a></div>
<br />
At the beginning of this it was somewhat cold and with some negative temperatures. Then Summer came and between July and August we see a spike with temperatures up to 40 degree. Now in Winter temperatures are between 0 and 10 degree again.<br />
<br />
<u><i><b>Links:</b></i></u><br />
te923tool: <a class="external text" href="http://te923.fukz.org/index.html" rel="nofollow">http://te923.fukz.org/index.html</a><br />
TFA SINUS (item number: 35.1095): <a class="external text" href="https://www.tfa-dostmann.de/en/produkt/radio-controlled-weather-station-with-wind-and-rain-gauge-sinus/" rel="nofollow">https://www.tfa-dostmann.de/en/produkt/radio-controlled-weather-station-with-wind-and-rain-gauge-sinus/</a>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-16648048706784507342019-12-22T16:35:00.001+01:002019-12-26T17:21:55.829+01:00FramebufferJust some quick notes about framebuffer.<br />
<br />
<u><i><b>Clear screen</b></i></u><br />
<br />
To clear the screen, write zeros on the framebuffer device with dd:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># dd if=/dev/zero of=/dev/fb0<br />dd: writing to '/dev/fb0': No space left on device<br />301+0 records in<br />300+0 records out<br />153600 bytes (154 kB, 150 KiB) copied, 0.00251834 s, 61.0 MB/s</span></span><br />
<a name='more'></a><br />
<u><i><b>X</b></i></u><br />
<br />
To run X on the framebuffer device, check first if the framebuffer X driver is installed:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># Xorg -configure<br />...<br />List of video drivers:<br /> modesetting<br />...</span></span><br />
<br />
If not, install it on Armbian with:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># apt install xserver-xorg-video-fbdev<br />...</span></span><br />
<br />
And recheck:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># Xorg -configure<br />...<br />List of video drivers:<br /> modesetting<br /> fbdev<br />...</span></span><br />
<br />
Configure your xorg.conf like the following:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/X11/xorg.conf<br />Section "Device"<br /> Identifier "ODROID"<br /> Driver "fbdev"<br /> Option "fbdev" "/dev/fb0"<br /> Option "Debug" "false"<br /> Option "DPMS" "false"<br />EndSection<br /><br />Section "Screen"<br /> Identifier "Default Screen"<br /> Device "ODROID"<br />EndSection<br /><br />Section "ServerLayout"<br /> Identifier "Default Layout"<br /> Option "BlankTime" "0"<br /> Option "StandbyTime" "0"<br /> Option "SuspendTime" "0"<br /> Option "OffTime" "0"<br />EndSection<br /><br />Section "DRI"<br /> Mode 0666<br />EndSection</span></span><br />
<br />
<b><u><i>LightDM</i></u></b><br />
<br />
To enable autologin into X and Fluxbox, configure LightDM:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf<br />[Seat:*]<br />autologin-user=karellen<br />autologin-user-timeout=0<br />user-session=fluxbox</span></span><br />
<br />
Then restart LightDM:<br />
<span style="color: #666666;"><br /><span style="font-family: "courier new" , "courier" , monospace;"># systemctl start lightdm</span></span><br />
<br />
<u><i><b>Framebuffer device information</b></i></u><br />
<br />
Current framebuffer device settings can be checked with: <br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># fbset -i -fb /dev/fb0<br /><br />mode "1920x1080"<br /> geometry 1920 1080 1920 1080 32<br /> timings 0 0 0 0 0 0 0<br /> accel true<br /> rgba 8/16,8/8,8/0,0/0<br />endmode<br /><br />Frame buffer device information:<br /> Name : DRM emulated<br /> Address : 0<br /> Size : 8294400<br /> Type : PACKED PIXELS<br /> Visual : TRUECOLOR<br /> XPanStep : 1<br /> YPanStep : 1<br /> YWrapStep : 0<br /> LineLength : 7680<br /> Accelerator : No</span></span><br />
<br />
<u><i><b>Resolution</b></i></u><br />
<br />
The rsolution can be changed with the fbset command, e.g.:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New", Courier, monospace;"># fbset -fb /dev/fb0 -xres 1366 -yres 768 -match</span></span>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-43000740106798389432015-08-20T21:18:00.000+02:002015-08-20T21:29:43.822+02:00ext4 block reservationThe filesystem ext4 has a feature called block reservation. When you create an ext4 filesystem then 5% of your available space will be reserved for block reservation by default. For an 20GB filesystem it is only 1GB of reserved space. But if you have an 1.5TB filesystem then 5% are about 75GB already. And that is my case. I have a 1.5TB partition with an ext4 filesystem:<br />
<a name='more'></a><br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># df -h /local/data/<br />Filesystem Size Used Avail Use% Mounted on<br />/dev/mapper/local-data 1.5T 1.4T 46G 97% /local/data</span></span><br />
<br />
As you can see only 49GB of space are available and currently I'm really to cheap to buy a new hard disk. So let's take a closer look at the block reservation for this partition:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># tune2fs -l /dev/mapper/local-data | grep -i "block"<br />...<br />Reserved block count: 19398656<br />...<br />Block size: 4096<br />...</span></span><br />
<br />
There are 19398656 reserved blocks with a block size of 4096 byte. When you multiply them and divide the result 3 times by 1024 you'll get the reserved space in GB:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># echo 19398656*4096/1024/1024/1024 | bc <br />74</span></span><br />
<br />
74GB is a lot of space for a slow growing archiving file system! Let's reduce the block reservation to 0%:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># tune2fs -m 0 /dev/mapper/local-data <br />tune2fs 1.42.8 (20-Jun-2013)<br />Setting reserved blocks percentage to 0% (0 blocks)</span></span><br />
<br />
And recheck with tune2fs:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># tune2fs -l /dev/mapper/local-data | grep -i "Block"<br />...<br />Reserved block count: 0<br />...</span></span><br />
<br />
A final look with df clearly indicates that the available space has grown to 120GB:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># df -h /local/data/<br />Filesystem Size Used Avail Use% Mounted on<br />/dev/mapper/local-data 1.5T 1.4T 120G 92% /local/data<br /><br /># echo 120-46 | bc <br />74</span></span><br />
<br />
Just a note/hint: only reduce the block reservation to 0% for eg. archiving filesystems (your personal music or movie collection). Don't reduce the block reservation to 0% for the root filesystem, special logging file systems or else.Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-9873603190933191592015-07-08T20:44:00.000+02:002019-12-22T16:08:43.879+01:00Turning off the Leds on the CubietruckSince the Cubietruck (running Linaro) has replaced my home server and has its place in my living room I figured out that the Leds are very annoying! So I deceided to turn them off - all of them! The easiest way is to set the brightness to 0:<br />
<a name='more'></a><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># echo 0 > /sys/devices/platform/leds-sunxi/leds/white\:ph11\:led3/brightness</span></span><br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># echo 0 > /sys/devices/platform/leds-sunxi/leds/blue\:ph21\:led1/brightness<br /># echo 0 > /sys/devices/platform/leds-sunxi/leds/green\:ph07\:led4/brightness<br /># echo 0 > /sys/devices/platform/leds-sunxi/leds/orange\:ph20\:led2/brightness</span></span><br />
<br />
A much more comfortable way is to use find and put into a simple script:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /usr/local/sbin/turn_off_led.sh<br />#!/bin/bash<br />find /sys/devices/platform/leds-sunxi/ -name "brightness" | sed s'/:/\\:/g' | while read l; do echo 0 > "$l"; done</span></span><br />
<br />
Don't forget to make the script executable before executing it:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># chmod 755 /usr/local/sbin/turn_off_led.sh<br /># /usr/local/sbin/turn_off_led.sh</span></span><br />
<br />
I've put the script into /etc/rc.local to make sure it gets executed during booting:<br />
<br />
<span style="color: #666666;"><span style="font-family: "courier new" , "courier" , monospace;"># vi /etc/rc.local<br />...<br /># DISABLE LEDS<br />/usr/local/sbin/turn_off_led.sh<br /><br />exit 0</span></span><br />
<br />
When the scripts works then the Leds turn off after the Cubietruck has booted.<br />
<br />Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-77247102649258966922015-05-28T11:53:00.000+02:002015-05-28T15:24:46.623+02:00Extend a VXFS filesystem in HP-UX with LVMToday I needed to extend a VXFS filesystem in HP-UX with LVM. The first thing I did was to figure out the logical volume, the volume group and the size of the volume:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># mount<br />...<br />/u04 on /dev/vg02/u04 ioerror=mwdisable,largefiles,delaylog,nodatainlog,dev=40020003 on Thu May 28 11:11:30 2015</span></span><br />
<a name='more'></a><span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"><br />...<br /># df -k /u04<br />/u04 (/dev/vg02/u04 ) : 467543436 total allocated Kb<br /> 1823354 free allocated Kb<br /> 465720082 used allocated Kb<br /> 100 % allocation used</span></span><br />
<br />
vg02 is the volumegroup, u04 is the logical volume, /dev/vg02/u04 is the device mounted on /u04. Next things I needed to know were the attributes for the volume group:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># vgdisplay -v vg02<br />--- Volume groups ---<br />VG Name /dev/vg02<br />VG Write Access read/write<br />VG Status available<br />Max LV 3<br />Cur LV 2<br />Open LV 2<br />Max PV 2<br />Cur PV 2<br />Act PV 2<br />Max PE per PV 65535<br />VGDA 4<br />PE Size (Mbytes) 256<br />Total PE 2226<br />Alloc PE 2184<br />Free PE 42<br />Total PVG 0<br />Total Spare PVs 0<br />Total Spare PVs in use 0<br />VG Version 1.0<br />VG Max Size 33553920m<br />VG Max Extents 131070<br /><br /> --- Logical volumes ---<br /> LV Name /dev/vg02/u02<br /> LV Status available/syncd<br /> LV Size (Mbytes) 102400<br /> Current LE 400<br /> Allocated PE 400<br /> Used PV 1<br /><br /> LV Name /dev/vg02/u04<br /> LV Status available/syncd<br /> LV Size (Mbytes) 456704<br /> Current LE 1784<br /> Allocated PE 1784<br /> Used PV 2<br /><br /><br /> --- Physical volumes ---<br /> PV Name /dev/dsk/c1t8d0<br /> PV Status available<br /> Total PE 1113<br /> Free PE 40<br /> Autoswitch On<br /> Proactive Polling On<br /><br /> PV Name /dev/dsk/c1t9d0<br /> PV Status available<br /> Total PE 1113<br /> Free PE 2<br /> Autoswitch On<br /> Proactive Polling On</span></span><br />
<br />
The physical extents have a size of 256MB and there were 42 free physical extents. These values needed to be multiplied to continue:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># echo 42*256 | bc -l<br />10752</span></span><br />
<br />
Which means the volume u04 can be extended by 10752MB. Next I needed to know the current size of the volume u04:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># echo 1784*256 | bc -l<br />456704</span></span><br />
<br />
456704MB is the current size of the volume u04. The correct value to extend the volume u04 is the sum of the current used MB and free MB:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># echo 456704+10752 | bc -l<br />467456</span></span><br />
<br />
The value 467456MB is the value we can work with. First the volume itself must be extended:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># lvextend -L 467456 /dev/vg02/u04<br />Logical volume "/dev/vg02/u04" has been successfully extended.<br />Volume Group configuration for /dev/vg02 has been saved in /etc/lvmconf/vg02.conf</span></span><br />
<br />
Then the filesystem must be extended. You can extend the filesystem online with fsadm:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># fsadm -F vxfs -b 467456M /u04<br />UX:vxfs fsadm: ERROR: V-3-25255: fsadm: You don't have a license to run this program</span></span><br />
<br />
If you encounter the above error like me then you don't have the license to extend the filesystem online. In this case you need to extend the filesystem offline:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># umount /u04<br /># extendfs -F vxfs /dev/vg02/u04<br /># mount /u04</span></span><br />
<br />
Next recheck the size of the volume:<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># df -k /u04<br />/u04 (/dev/vg02/u04 ) : 476376623 total allocated Kb<br /> 34476272 free allocated Kb<br /> 441900351 used allocated Kb<br /> 93 % allocation used</span></span><br />
<br />
And the volume group (output truncated):<br />
<br />
<span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># vgdisplay -v vg02<br />...<br />PE Size (Mbytes) 256<br />Total PE 2226<br />Alloc PE 2226<br />Free PE 0<br />...<br /> LV Name /dev/vg02/u04<br /> LV Status available/syncd<br /> LV Size (Mbytes) 467456<br /> Current LE 1826<br /> Allocated PE 1826<br /> Used PV 2<br />...</span></span>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0tag:blogger.com,1999:blog-6358630310722018781.post-18797015131345580212015-04-03T09:33:00.001+02:002015-04-03T09:33:26.254+02:00Implementing autofsOn the NFS server create your shares by editing the /etc/exports file:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># vi /etc/exportfs<br />/local/music 192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check)<br />/local/movie 192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check)</span></span><a name='more'></a><br /><br />Then (re-)start your NFS services on the server:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># /etc/rc.d/rc.nfs restart<br />...</span></span><br /><br />Next edit the /etc/auto.master and add a line for the /export entry:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># vi /etc/auto.master<br />...<br />/misc /etc/auto.misc<br />/export /etc/auto.export<br />...</span></span><br /><br />And create /etc/auto.export file with the music and movie entries (where 192.168.1.22 is the IP of the NFS server):<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># vi /etc/auto.export<br />music -rw,soft,intr,rsize=8192,wsize=8192 192.168.1.22:/local/music<br />movie -rw,soft,intr,rsize=8192,wsize=8192 192.168.1.22:/local/movie</span></span><br /><br />Finally create the /export directory (without any sub directories) and start rc.autofs:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;"># mkdir /export<br /># chmod 755 /etc/rc.d/rc.autofs<br /># /etc/rc.d/rc.autofs start</span></span><br /><br />As a user you can change into eg. /export/music which gets mounted automatically now:<br /><br /><span style="color: #666666;"><span style="font-family: "Courier New",Courier,monospace;">$ cd /export/music<br />$ ls<br />...<br /><br />$ mount<br />...<br />192.168.1.22:/local/music on /export/music type nfs (rw,soft,intr,rsize=8192,wsize=8192,addr=192.168.1.22)<br />....</span></span>Karellenhttp://www.blogger.com/profile/15785252764059435378noreply@blogger.com0