Re: Default partitions allocate only 1GB to /

2021-03-01 Thread tetrahedra

On Sun, Feb 28, 2021 at 08:30:14PM +0100, Janne Johansson wrote:

Is /var a filesystem of its own? Otherwise it could be /var/tmp or
some other place under /var which is used for unpacking packages.


Yes, /var is on its own filesystem, with 10.4G available.



Re: Default partitions allocate only 1GB to /

2021-03-01 Thread tetrahedra

On Sun, Feb 28, 2021 at 05:17:15PM +, James Cook wrote:

> This makes little sense to me. Why should deleting a 20MB file on a
> filesystem with >700MB free space be sufficient for the install to go
> through? Especially when the install obviously doesn't need that much space
> on the filesystem in question?

That doesn't make sense to me either. Something strange is going on.
Maybe someone else will have a guess.


It did occur to me that between the first (unsuccessful) and 2nd 
(successful) attempts I also rebooted the machine and ran `pkg_add -u`.




Re: OpenBSD 6.8 - softraid issue: "uvm_fault(0xffffffff821f5490, 0x40, 0, 1) -> e"

2021-03-01 Thread Mark Schneider

Hi,

Thank you for your feeeback.

Also OpenBSD 6.9beta snapshot is crashing when I setup RAID5 with three 
"Samsung PRO 860 1TB" SSDs.

OpenBSD obsd69b.it-infra.org 6.9 GENERIC.MP#368 amd64

obsd69b# dmesg | grep  -i bios
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xdc312018 (61 entries)
bios0: vendor American Megatrends Inc. version "2201" date 03/23/2015
bios0: ASUSTeK COMPUTER INC. CROSSHAIR V FORMULA-Z
acpi0 at bios0: ACPI 5.0

# ---
sha512sum install69_amd64_snapshot.img
9bcf7feae186966cecf0de041d283ef27678ef350fd5c17e953e3d27d719aa8e3b034634b65ac04794d8568a7bb4807f7673fcdb6a86a66808ba0a55f4087368 
install69_amd64_snapshot.img

md5sum -b install69_amd64_snapshot.img
0408ba32001dccb6465f76faefc6eb8a *install69_amd64_snapshot.img

OpenBSD 6.8 or 6.9beta do not crash writing big files to RAID5 when the 
SSDs are "Samsung PRO 850 1TB" or "Intel DC S3520 150GB"


Today I have used only 6G SATA cables for the RAID configuration.

What I really worry about is the fact, that OpenBSD 6.8 or 6.9beta is 
crashing with RAID5 based on Samsung PRO 860 512MB or 1TB SSD drives.


Kind regards
Mark



On 01.03.21 15:35, Atanas Vladimirov wrote:

On 2021-02-27 03:35, Mark Schneider wrote:

Hi,


I face system crash on OpenBSD 6.8 when trying to use softraid RAID5
drive trying to write big files (like 10GBytes) to it.

I can reproduce the error (tested on two different systems with
OpenBSD 6.8 installed on an SSD drive or an USB stick). The RAID5
drive itself consist of six Samsung PRO 860 512GB SSDs.

In short:

bioctl -c 5 -l sd0a,sd1a,sd2a,sd3a,sd4a,sd5a softraid0

obsdssdarc# disklabel sd7
# /dev/rsd7c:
type: SCSI
disk: SCSI disk
label: SR RAID 5
duid: a50fb9a25bf07243
flags:
bytes/sector: 512
sectors/track: 255
tracks/cylinder: 511
sectors/cylinder: 130305
cylinders: 38379
total sectors: 5001073280
boundstart: 0
boundend: 5001073280
drivedata: 0

16 partitions:
#    size   offset  fstype [fsize bsize cpg]
  a:   5001073280    0  4.2BSD   8192 65536 52270
  c:   5001073280    0  unused

#
 



obsdssdarc# time dd if=/dev/urandom of=/arc-ssd/1GB-urandom.bin bs=1M 
count=1024

1024+0 records in
1024+0 records out
1073741824 bytes transferred in 8.120 secs (132218264 bytes/sec)
    0m08.13s real 0m00.00s user 0m08.14s system

# Working as expected 
^^



obsdssdarc# time dd if=/dev/urandom of=/arc-ssd/10GB-urandom.bin
bs=10M count=1024

# Error messages

uvm_fault(0x821f5490, 0x40, 0, 1) -> e
kernel: page fault trap, code=0
Stopped at  sr_validate_io+0x44:    cmpl $0,0x40(%r9)
ddb{2}>

# Crashing OpenBSD 6.8
^^^


# After reboot:

obsdssdarc# mount /dev/sd7a /arc-ssd/
mount_ffs: /dev/sd7a on /arc-ssd: Device not configure

obsdssdarc# grep sd7 /var/run/dmesg.boot
softraid0: trying to bring up sd7 degraded
softraid0: sd7 was not shutdown properly
softraid0: sd7 is offline, will not be brought online


More details in attached files. Thanks a lot in advance for short 
feedback.



Kind regards

Mark


Hi,

I can't reproduce this on a resent snapshot:

```
temp# bioctl sd5
Volume  Status   Size Device
softraid0 1 Online  2356352188416 sd5 RAID5
  0 Online   785450747904 1:0.0   noencl 
  1 Online   785450747904 1:1.0   noencl 
  2 Online   785450747904 1:2.0   noencl 
  3 Online   785450747904 1:3.0   noencl 
temp# time dd if=/dev/urandom of=20GB-urandom.bin bs=10M count=2048
2048+0 records in
2048+0 records out
21474836480 bytes transferred in 1845.313 secs (11637500 bytes/sec)
   30m45.95s real 0m00.01s user 2m21.61s system
temp# ls -lh
total 41948288
-rw-r--r--  1 root  wheel  20.0G Mar  1 13:05 20GB-urandom.bin
```

```
OpenBSD 6.9-beta (GENERIC.MP) #366: Sun Feb 28 07:15:39 MST 2021
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 17134055424 (16340MB)
avail mem = 16599408640 (15830MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xeb5a0 (56 entries)
bios0: vendor American Megatrends Inc. version "2.3a" date 01/06/2021
bios0: Supermicro X9SCL/X9SCM
```


# OpenBSD 6.9beta RAID5 configuration with three 1TB "Samsung SSD PRO 860" 
drives 


sysctl hw.disknames

disklabel sd1
disklabel -E sd1
disklabel -E sd2
odisklabel -E sd3

bioctl -c 5 -l sd1a,sd2a,sd3a softraid0
disklabel -E sd4

newfs sd4a

obsdarc# mkdir /arc-3xssd
obsdarc# mount /dev/sd4a /arc-3xssd/


  
obsdarc# df -h | grep 3xss

Re: 4k sector disk on APU2 problems

2021-03-01 Thread Stuart Henderson
On 2021-03-01, Raimo Niskanen  wrote:
> Hi Misc!
>
> Unfortunately I do not have one clear question here, but I wonder if somebody
> could shed som light on some problems I have encountered on my PC Engines 
> APU2.
>
> It runs OpenBSD 6.7 from a 32 GB mSATA SSD disk, and I would like to change
> the disk since it is a few years old now, so I buyed a 128 GB Kingston
> mSATA SSD, and an mSATA -> SATA adapter and put that combo in an USB 2
> external disk adapter.
>
> The disk showed up as a 4k sector disk, and after installing OpenBSD 6.7
> over USB over the mSATA-SATA adapter I plugged it in the internal mSATA
> connector, and it did not boot.

This is a problem with some USB-SATA adapters. See e.g.
https://www.klennet.com/notes/2018-04-14-usb-and-sector-size.aspx

> Much fumbling later it seems that when the disk is connected to the
> internal mSATA slot it is seen as a 512 bytes per sector disk.  I do not
> know what the BIOS thinks of it (factory SeaBIOS 1.10.something).  When I
> re-installed with the disk in the mSATA slot I got a bootable installation.
> Both fdisk and disklabel now says the disk has got 512 bytes per sector.
> (fdisk says nothing but for a 4k disk it should say it is a 4k disk)
>
> My old 32 GB mSATA disk is readable over the mSATA-SATA adapter USB adapter
> as a 512 bytes per sector disk.

You could try looking for a different adapter but at this point 
I would probably install on the new drive (PXE boot or use another USB
drive to boot the installer), then copy files back from the old drive.

> So I am just curious about how to handle this disk.  I can install to it
> in the internal mSATA connector and read the old installation over the
> mSATA-SATA-USB-adapter.  But one day when I want to install to a new disk
> again, I will not be able to read from the disk in the mSATA-SATA-USB-adapter,
> so the next re-installation looks unpromising.

backup/restore over the network via another machine perhaps?

> Some more specific questions:
> * Would upgrading the BIOS be a good idea

yes but it won't help with this problem.
(https://github.com/pcengines/apu2-documentation/blob/master/docs/apu_CPU_boost.md)

> * Sould upgrading to OpenBSD 6.8 improve the situation

it won't.

> * How is the disk sector size determined, and can I affect that?

by the manufacturer.




Re: 4k sector disk on APU2 problems

2021-03-01 Thread Chris Cappuccio
Raimo Niskanen [raimo+open...@erix.ericsson.se] wrote:
> 
> Much fumbling later it seems that when the disk is connected to the
> internal mSATA slot it is seen as a 512 bytes per sector disk.  I do not
> know what the BIOS thinks of it (factory SeaBIOS 1.10.something).  When I
> re-installed with the disk in the mSATA slot I got a bootable installation.
> Both fdisk and disklabel now says the disk has got 512 bytes per sector.
> (fdisk says nothing but for a 4k disk it should say it is a 4k disk)
> 

You have to install and boot as 4k or install and boot as 512. You can't
mix. Perhaps try and upgrade the bios to see if it changes, but ultimately,
you have to install and boot with the same setting.



Re: 4k sector disk on APU2 problems

2021-03-01 Thread Marcus MERIGHI
Hello, 

raimo+open...@erix.ericsson.se (Raimo Niskanen), 2021.03.01 (Mon) 14:30 (CET):
> The disk showed up as a 4k sector disk, and after installing OpenBSD 6.7
> over USB over the mSATA-SATA adapter I plugged it in the internal mSATA
> connector, and it did not boot.

I've recently had the same encounter. 14TB HDD in an external USB
enclosure, to sync the data to it before putting it in the machine. 

The disk showed 4k sectors in the external enclosure.

After days of data transfer (~11TB) I finally put the HDD it in the
machine and learned the same lesson as you did: the 4k sectors turned to
512 byte sectors when connected internally via SATA. 

Unpleasant, but actually OT for an OpenBSD list, I'm afraid.

Marcus



4k sector disk on APU2 problems

2021-03-01 Thread Raimo Niskanen
Hi Misc!

Unfortunately I do not have one clear question here, but I wonder if somebody
could shed som light on some problems I have encountered on my PC Engines APU2.

It runs OpenBSD 6.7 from a 32 GB mSATA SSD disk, and I would like to change
the disk since it is a few years old now, so I buyed a 128 GB Kingston
mSATA SSD, and an mSATA -> SATA adapter and put that combo in an USB 2
external disk adapter.

The disk showed up as a 4k sector disk, and after installing OpenBSD 6.7
over USB over the mSATA-SATA adapter I plugged it in the internal mSATA
connector, and it did not boot.

Much fumbling later it seems that when the disk is connected to the
internal mSATA slot it is seen as a 512 bytes per sector disk.  I do not
know what the BIOS thinks of it (factory SeaBIOS 1.10.something).  When I
re-installed with the disk in the mSATA slot I got a bootable installation.
Both fdisk and disklabel now says the disk has got 512 bytes per sector.
(fdisk says nothing but for a 4k disk it should say it is a 4k disk)

My old 32 GB mSATA disk is readable over the mSATA-SATA adapter USB adapter
as a 512 bytes per sector disk.

Some time during my fumbling with the 120 GB disk in the mSATA slot, fdisk -v
claimed it could not read from sector 0, but the disklabel command could read
a disklabel.  I think the disklabel then claimed the disk was a 4k sector disk.

So I am just curious about how to handle this disk.  I can install to it
in the internal mSATA connector and read the old installation over the
mSATA-SATA-USB-adapter.  But one day when I want to install to a new disk
again, I will not be able to read from the disk in the mSATA-SATA-USB-adapter,
so the next re-installation looks unpromising.

Some more specific questions:
* Would upgrading the BIOS be a good idea
* Sould upgrading to OpenBSD 6.8 improve the situation
* How is the disk sector size determined, and can I affect that?

Cheers!
-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



Re: PC Engines APU2 boot problem

2021-03-01 Thread Raimo Niskanen
On Wed, Feb 17, 2021 at 02:05:27PM +0100, Raimo Niskanen wrote:
> On Wed, Feb 17, 2021 at 12:36:57PM +0100, Stefan Sperling wrote:
> > On Wed, Feb 17, 2021 at 12:08:52PM +0100, Raimo Niskanen wrote:
> > > Hello misc!
> > > 
> > > I have problem booting an APU2 from SD card and USB stick.
> > > It boots fine from the mSATA disk where I have the OpenBSD installation
> > > that I have upgraded several times using sysupgrade(8).
> > > 
> > > I have tried to write install67.fs and install68.img to an SD card and to
> > > an USB stick from a Linux machine using e.g
> > > dd if=install67.fs of=/dev/sdc bs=1M
> > > 
> > > On the APU:s serial console, I press [F10] to get a boot prompt, and then
> > > select the SD card or the USB stick.  The kernel is loaded and the last
> > > printout is "Entry point: 0x..." something.  The next line
> > > [ELF ... whatnot] does not come.  After a while the APU resets and boots
> > > again, or sometimes hangs.
> > 
> > Before loading a kernel the serial console needs to be enabled with:
> > 
> >   stty com0 115200
> >   set tty com0
> > 
> > On an installed system /etc/boot.conf is usually set up to do this
> > automatically but manual setup is still required when booting from
> > other media.
> 
> Oh, bummer!  Of course.  I hope it is such a stupid mistake!
> I will try when I get a new opportunity...
> 
> Thank you very much.

Confirmed.  It was nothing more than that silly beginner's mistake.
Than you for the cluestick!

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



Re: OpenIKED and Strongswan

2021-03-01 Thread Riccardo Giuntoli
Ok. I've reduced the strongswan configuration. By the way when connecting
to an OpenIKED as initiator I've got a lot of errors. Now I've got a couple
of scripts that control the PTP IPSEC IKE2 connections and I can work, but
I'm preparing an ISP based upon IPSEC and it's very important to me got a
solution.
What I can add is that I've searched in *BSD based router/firewall
distribution like OPNsense and what I've found is that they don't use
OpenIKED but strongswan. Strongswan seems to be the piece of software more
tunable. Now this is my configuration:

ca XXX
  cacert=/etc/ipsec.d/cacerts/ca.XXX.crt
  auto=add

conn %default
keyexchange=ikev2
auto=start
reauth=no
dpdaction=clear
closeaction=clear
type=transport

conn telecomlobby-jp
left=%defaultroute
leftsourceip=%config4
leftauth=pubkey
leftid=%in...@ca.xxx
leftprotoport=gre
leftupdown=/config/ipsec/ESJP-updown.sh

right=YYY
rightsubnet=YYY
rightauth=pubkey
rightid=%jp.XXX
rightcert=/etc/ipsec.d/certs/jp.XXX.crt
rightprotoport=gre

This is my updown:

#!/bin/bash

set -o nounset
set -o errexit

TUN_IFACE="tun2"

case "${PLUTO_VERB}" in
up-host)
echo "Putting interface ${TUN_IFACE} up"
ifconfig $TUN_IFACE up
echo "Disabling IPsec policy (SPD) for ${TUN_IFACE}"
sysctl -w "net.ipv4.conf.${TUN_IFACE}.disable_policy=1"
echo "Accepting gre keepalive"
sysctl -w "net.ipv4.conf.${TUN_IFACE}.accept_local=1"
;;
down-host)
ifconfig $TUN_IFACE down
;;
esac

And this is my crontab script in the linux box that control the endpoint on
the GRE interface:

#!/bin/bash
ROUTER_IP=YYY
IPSEC="telecomlobby-jp"
GRE="tun2"

PING_RESULT=$(/usr/bin/fping -I$GRE $ROUTER_IP 2>&1)
ALIVE="alive"
STATUS=$(/usr/sbin/ipsec status $IPSEC)
ESTABLISHED="INSTALLED"

if [[ "$PING_RESULT" != *"$ALIVE"* ]]; then
if [[ "$STATUS" == *"$ESTABLISHED"* ]]; then
/usr/sbin/ipsec stroke down-nb $IPSEC
/usr/sbin/ipsec up $IPSEC
else
/usr/sbin/ipsec up $IPSEC
fi
fi

This is the OpenBSD part:

set dpd_check_interval 15
#set cert_partial_chain

ikev2 "RT-01.cat.telecomlobby.com" passive transport \
proto gre \
from XXX to ZZZ \
local jp.telecomlobby.com peer any \
ikesa auth hmac-sha2-256 enc aes-256 group ecp256  \
childsa auth hmac-sha2-256 enc aes-256 group ecp256 \
srcid "sh...@ca.telecomlobby.com"  \
ikelifetime 86400 lifetime 3600

Next there is some control about the other side public address because it
is a dynamic one:

# Global Configuration

init-state auto

JPES_up = "gre1.link.up"
newip = '( "[[ $(dig +short @8.8.8.8 cat-01.ZZZ) != $(ifconfig gre1 | grep
tunnel | cut -d ' ' -f5;exit;}\') ]]" every 126)'

# States

state auto {
if (! $JPES_up) {
run "logger -t ifstated '(auto) US-ES down'"
set-state JPES_down
}
}


state JPES_down {
run "mail -s 'JPES  down' root@localhost"
run "logger JPES down"
if ($newip) {
run "/root/Bin/change_endpoint.sh gre1"
run "rcctl restart ospfd"
}
}

root@shiva:/root/Bin# cat change_endpoint.sh



#!/bin/ksh

NEWIP=$(dig +short @8.8.8.8 cat-01.ZZZ)
OLDIP=$(ifconfig $1 | grep tunnel | cut -d ' ' -f5)

echo "updating PF"
sed -i 's/$OLDIP/$NEWIP/g' /etc/pf.conf
pfctl -f /etc/pf.conf
echo "updating IKED"
sed -i 's/$OLDIP/$NEWIP/g' /etc/iked.conf
ipsecctl -f /etc/iked.conf
echo "updating GRE"
sed -i 's/$OLDIP/$NEWIP/g' /etc/hostname.$1
ifconfig $1 destroy
sh /etc/netstart $1

Connection simply drop, in log you can appreciate in the charon side:

Mar  1 10:27:06 06[IKE]  establishing CHILD_SA
telecomlobby-jp{50065}
Mar  1 10:28:05 14[IKE]  establishing CHILD_SA
telecomlobby-uk{50066}
Mar  1 10:28:05 09[IKE]  establishing CHILD_SA
telecomlobby-jp{50067}
Mar  1 10:29:05 13[IKE]  establishing CHILD_SA
telecomlobby-jp{50068}
Mar  1 10:29:05 11[IKE]  establishing CHILD_SA
telecomlobby-uk{50069}
Mar  1 10:30:05 06[IKE]  establishing CHILD_SA
telecomlobby-uk{50070}
Mar  1 10:30:05 08[IKE]  establishing CHILD_SA
telecomlobby-jp{50071}
Mar  1 10:31:06 08[IKE]  establishing CHILD_SA
telecomlobby-jp{50072}
Mar  1 10:31:06 14[IKE]  establishing CHILD_SA
telecomlobby-uk{50073}
Mar  1 10:32:05 08[IKE]  establishing CHILD_SA
telecomlobby-uk{50074}
Mar  1 10:32:05 05[IKE]  establishing CHILD_SA
telecomlobby-jp{50075}
Mar  1 10:33:06 09[IKE]  establishing CHILD_SA
telecomlobby-jp{50076}
Mar  1 10:33:06 14[IKE]  establishing CHILD_SA
telecomlobby-uk{50077}
Mar  1 10:34:05 07[IKE]  establishing CHILD_SA
telecomlobby-jp{50078}
Mar  1 10:34:05 09[IKE]  establishing CHILD_SA
telecomlobby-uk{50079}
Mar  1 10:35:06 13[IKE]  establishing CHILD_SA
telecomlobby-uk{50080}
Mar  1 10:35:06 15[IKE]  establishing CHILD_SA
telecomlobby-jp{50081}
Mar  1 10:36:05 15[IKE]  establishing CHILD_SA
telecomlobby-jp{50083}
Mar  1 10:36:05 12[IKE]  establishing CHILD_SA
telecomlobby-uk{50084}
Mar  1 10:37:06 13[IKE]  establishing CHILD_SA
telecomlobby-uk{50085}
Mar  1 10:37:06 08[IKE]  establishing CHILD_SA
telecomlobby-jp{50086}
Mar  1 10:38:05 13[IKE]  establishing CHILD_SA
telecomlobby-uk{50087}
Mar  1 10:38:05 12[IKE]  establishing CHILD_SA
telecomlobb