Re: netbsd crashes when using fat filesys

2024-05-02 Thread Michael van Elst
rhia...@falu.nl (Rhialto) writes:

>$ sudo ./rump_msdos -o rw -o rump ./efi.img /tmp/t
>rump_msdos: "./efi.img" is a relative path.
>rump_msdos: using "/mnt/scratch/scratch/tmp/xcrash/efi.img" instead.
>[   1.000] entropy: ready

>terminal 2:

>$ cd /tmp/t
>$ ls -l
>total 4
>drwxr-xr-x  1 rhialto  wheel  4096 Apr 21  2021 efi/
>-rwxr-xr-x  1 rhialto  wheel 0 May  2 22:32 file*
>$ mv file file2
>mv: rename file to file2: Device not configured


I can repeat this with rump, but not with the kernel filesystem.
After my suggested change, rump no longer crashes.

N.B. the code change is in /usr/lib/librumpfs_msdos.so.0.0.



Re: netbsd crashes when using fat filesys

2024-05-02 Thread Michael van Elst
rhia...@falu.nl (Rhialto) writes:

>I had something similar recently when doing a rename of a file on a FAT
>file system (in this case my /efi file system). Fortunately I had it
>mounted with -o rump, because it was 100% repeatable.

>I filed http://gnats.netbsd.org/58146 for it.


Maybe that's rump.

msdosfs:
KASSERT(tcnp->cn_cred == cred);

genfs:  /*
 * XXX Want a better equality test.  `tcnp->cn_cred == cred'
 * hoses p2k because puffs transmits the creds separately and
 * allocates distinct but equivalent structures for them.
 */
KASSERT(kauth_cred_uidmatch(cred, tcnp->cn_cred));


Can you still repeat the crash when you change the assertion
to match the genfs check ?




Re: RPi 4b Wifi Device

2024-04-21 Thread Michael van Elst
michael.chepo...@gmail.com (Michael Cheponis) writes:

>I use the built-in GigE adaptor on the RPi 4B, because it's convenient as I
>have wired ethernet most places.   So I can't help with WiFi.

Ethernet is also faster, even when the WiFi chip does 802.11ac.

For Wifi on a RPI4b:

With RPI-OS running iperf3 shows about 80Mbit/s.
NetBSD (-current, but -10 should be similar) gets me about 40MBit/s.

Wifi is connected to a SDHC controller, and handling I/O there generates
quite some overhead (while iperf3 is running):

  PID   LID USERNAME PRI STATE   TIME   WCPUCPU NAME  COMMAND
0   118 root 123 CPU/1   1:33 39.45% 39.45% sdmmc0[system]
 7467 12269 mlelstv   85 mutex/2 0:03  4.79%  4.79% - iperf3
0 3 root 222 IDLE/0  0:04  2.59%  2.59% softnet*0 [system]
0   101 root 222 IDLE/3  0:03  1.81%  1.81% softnet*3 [system]
030 root 222 IDLE/2  0:02  1.32%  1.32% softnet*2 [system]
024 root 222 IDLE/1  0:02  0.93%  0.93% softnet*1 [system]

That's about 80% of one core.



Re: RPi 4b Wifi Device

2024-04-20 Thread Michael van Elst
tomd...@wavecable.com ("Thomas D. Dean") writes:

># wpa_cli status
>Selected interface 'bwfm0'
>21:58:44.815: bssid=60:38:e0:db:a9:7a
>freq=0
>ssid=tddhome
>id=0
>mode=station
>pairwise_cipher=TKIP
>group_cipher=TKIP
>key_mgmt=WPA-PSK
>wpa_state=GROUP_HANDSHAKE
>ip_address=169.254.135.120
>address=e4:5f:01:da:eb:46

>I don't understand where the inet 169.254.135.120 comes from. The router 
>pool is 192.168.1.xxx.

169.254.x.x is a "link local" address. dhcpcd falls back to such an
address, if it doesn't get an answer from a dhcp server. Apparently
wpa_supplicant cannot connect to the network.

>wpa_state=GROUP_HANDSHAKE

says that it still tries to associate. When it's done this would
change to COMPLETED.



Re: RPi 4b Wifi Device

2024-04-19 Thread Michael van Elst
tomd...@wavecable.com ("Thomas D. Dean") writes:

>How do I setup wpa_supplicant?

That depends on what you want to do.

Here are some examples:
https://wiki.netbsd.org/tutorials/how_to_use_wpa_supplicant/


Greetings,


Re: RPi 4b Wifi Device

2024-04-19 Thread Michael van Elst
tomd...@wavecable.com ("Thomas D. Dean") writes:

>On 4/18/24 22:00, Michael van Elst wrote:
>> bwfm0: Firmware file default:brcmfmac43455-sdio.bin
>> bwfm0: Firmware file model-spec: brcmfmac43455-sdio.raspberrypi,4-model-b.bin
>> bwfm0: Found Firmware file: brcmfmac43455-sdio.raspberrypi,4-model-b.bin

>> bwfm0: NVRAM file default:brcmfmac43455-sdio.txt
>> bwfm0: NVRAM file model-spec: brcmfmac43455-sdio.raspberrypi,4-model-b.txt
>> bwfm0: Found NVRAM file: brcmfmac43455-sdio.raspberrypi,4-model-b.txt

>> bwfm0: CLM file default:brcmfmac43455-sdio.clm_blob
>> bwfm0: CLM file model-spec: brcmfmac43455-sdio.raspberrypi,4-model-b.clm_blob
>> bwfm0: Found CLM file: brcmfmac43455-sdio.raspberrypi,4-model-b.clm_blob


>I saw bwfm0: in /var/log/messages, from memory, similar to the ones listed.
>One error. autoconfiguration error: NVRAM file not available.
>The CHIPACTIVE line is missng.


This means, a firmware file isn't found, because it is searched under
a different name.

You should have:

-r--r--r--  1 root  wheel  1863 Mar 28 17:45 
libdata/firmware/if_bwfm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt

and need to create a symlink like:

cd /libdata/firmware/if_bwfm
ln -s brcmfmac43455-sdio.raspberrypi,4-model-b.txt 
"brcmfmac43455-sdio.Raspberry Pi 4 Model B.txt"

Reason is that the platform is canonically named "raspberrypi,4-model-b"
but UEFI chose "Raspberry Pi 4 Model B" instead.


Greetings,


Re: RPi 4b Wifi Device

2024-04-18 Thread Michael van Elst
tomd...@wavecable.com ("Thomas D. Dean") writes:

>What is the wifi device in the RPi 4b? Driver?

It's a chip similar to the one in the older RPIs:

bwfm0: chip 0x4345 rev 6
bwfm0: Firmware file default:brcmfmac43455-sdio.bin
bwfm0: Firmware file model-spec: brcmfmac43455-sdio.raspberrypi,4-model-b.bin
bwfm0: Found Firmware file: brcmfmac43455-sdio.raspberrypi,4-model-b.bin
bwfm0: NVRAM file default:brcmfmac43455-sdio.txt
bwfm0: NVRAM file model-spec: brcmfmac43455-sdio.raspberrypi,4-model-b.txt
bwfm0: Found NVRAM file: brcmfmac43455-sdio.raspberrypi,4-model-b.txt
bwfm0: CLM file default:brcmfmac43455-sdio.clm_blob
bwfm0: CLM file model-spec: brcmfmac43455-sdio.raspberrypi,4-model-b.clm_blob
bwfm0: Found CLM file: brcmfmac43455-sdio.raspberrypi,4-model-b.clm_blob
bwfm0: CHIPACTIVE

bwfm0: flags=0x8843 mtu 1500
ssid  nwkey *
powersave off
bssid ##:##:##:##:##:## chan 100
address: ##:##:##:##:##:##
media: IEEE802.11 autoselect (VHT mode 11ac)
status: active
inet6 fe80:::::%bwfm0/64 flags 0 scopeid 0x3




Re: hostapd

2024-04-04 Thread Michael van Elst
On Thu, Apr 04, 2024 at 11:28:41AM +0100, Patrick Welche wrote:
> 10:15:22.135344 IP (tos 0x0, ttl 64, id 12912, offset 0, flags [DF], proto 
> TCP (6), length 60)
> 192.168.100.3.60610 > 192.168.100.62.80: Flags [S], cksum 0x783f 
> (correct), seq 50981267, win 65535, options [mss 1460,sackOK,TS val 2022496 
> ecr 0,nop,wscale 6], length 0

> I assume
> 
> hostapd: urtwn0: interface state UNINITIALIZED->ENABLED
> hostapd: urtwn0: AP-ENABLED 
> 
> rules out a monitor mode? or ? The dhcpd response was fine...

dhcpd uses BPF to receive and transmit DHCP packets. So the symptoms would 
point to an issue in the ARP or IP layer.

-- 
        Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: hostapd

2024-04-03 Thread Michael van Elst
pr...@welche.eu (Patrick Welche) writes:

>The system httpd via inetd doesn't receive a web page request from the
>device.
>tcpdump shows the device requesting it, but no response.

If httpd wouldn't run, the request would be answered with
a TCP RST.

If httpd does run, the request (SYN) is answered with a 
TCP SYN/ACK.

Can you say what exactly is "no response" here?


>on the server, telnet localhost 80, GET /, works

Did you configure (in /etc/inetd.conf) http for tcp or tcp6 ?
A 'telnet localhost 80' would see either, but a pure IPv4 client
only sees the 'tcp' one.


Greetings,



Re: mbrlabel question

2024-03-15 Thread Michael van Elst
ea1...@gmail.com (Ramiro Aceves) writes:

> The following options are available:
> -f Force an update, even if there has been no change.
> -q Performs operations in a quiet fashion.
> -r In conjunction with -w, also update the on-disk label.
> -s sector  Specifies the logical sector number that has to be read from
>the disk in order to find the MBR.  Useful if the disk has
>remapping drivers on it and the MBR is located in a non-
>standard place.  Defaults to 0. 
> -w Update the in-core label if it has been changed.  See also -r.

>I do not know the difference between the in-core and on-disk options,
>what I should use and if I can break something with it.


The BSD partition information (aka "disklabel") exists in memory ("in-core")
and is also written to disk ("on-disk").

If you change only in-core, the change is temporary and volatile. When
the disk is no longer in use, or after a reboot, the changes are gone.

For permanent changes you need to write the on-disk label.

I.e. use

mbrlabel wd0

to show how the disklabel would look like, and use

mbrlabel -rw wd0

to actually change the disklabel permanently.



Re: NetBSD and ECC RAM?

2024-02-29 Thread Michael van Elst
kevin.bowl...@kev009.com (Kevin Bowling) writes:

>Servers tend to have BMCs, so you can execute 'ipmitool sensors' and
>'ipmi sel elist' to get the information out.

ECC information is usually not provided by sensors. ECC errors may
be listed in the SEL, but even this usually occurs only when some
undocumented limit is reached. Often the messages also do not indicate
the memory module that produced the error.


>Linux has the 'EDAC' subsystem but I don't think it gains you so much
>if you have a BMC.

It gives you the data from the ECC circuits, immediately. So data is
no longer hidden by the BMC, you get precise information and you can
apply your own policies for e.g. replacing memory modules or migrating
services to other hardware.

The OS could be smart, lock out bad memory regions, recover some
errors by e.g. paging in text data again or even use mirrored RAM
(with motherboard support).


>A lot of fragile chipset specific code to get that.

Indeed.


Greetings,



Re: NetBSD and ECC RAM?

2024-02-18 Thread Michael van Elst
michael.chepo...@gmail.com (Michael Cheponis) writes:

>I've been running ECC in the Windows box for years, it seems like a 'no
>brainer' for servers. Servers usually run for years, and Stuff Happens over
>the years [1].
>But I'd prefer a reliable, unhackable, trustable compute fabric.  ECC is
>part of the 'reliable' part.

I agree, but the "box" will run with ECC, even when the OS doesn't
know about it. OS support is needed to get information about errors
and for better fault tolerance.


>I would also like to see per /dev entry ACLs.  I would like to see better
>security than owner-group-everbody permissions.

I have rarely seen ACLs being used for "better security". Even when that
was possible, the complexity usually outweighed any gain in control.

Systems that implied access control through simple rules worked much
better. It's still not a feature that you had to enable or a switch
you toggled, it requires constant effort, in particular on systems
that don't just perform a fixed set of functions.



Re: NetBSD and ECC RAM?

2024-02-15 Thread Michael van Elst
h...@spg.tu-darmstadt.de ("Hauke Fath (SPG)") writes:

>one my favourite blogs is sporting a page on AMD ECC RAM support
>,

>Is this of any relevance to NetBSD, or do we just not bother?


We should have EDAC drivers that should at least report events,
but so far there is nothing...




Re: Raspberry Pi Zero W almost useless

2024-02-09 Thread Michael van Elst
ea1...@gmail.com (Ramiro Aceves) writes:

>Oh yes, that would be a right technical fix for the problem but it's a 
>bit of an aberration in terms of cost and size to use a powered HUB with 
>its own power supply to fix a little thing like the ZeroW, you know ;-)

RPI0-3 models all have issues with power.

Especially on the original RPI1 and RPI0 variants you shouldn't
consider USB as being "hot pluggable". For the other models
hot-plugging low power USB devices (i.e. using 100mA or less)
should be fine. Unfortunately that might rule out things like
many gaming keyboards and also some WLAN dongles.



Re: NetBSD 10.0 RC_3 GENERIC amd64 home built kernel doesn't boot

2024-02-04 Thread Michael van Elst
fekete.zol...@minux.hu (=?UTF-8?Q?Fekete_Zolt=C3=A1n?=) writes:

>Hi There,

Hi,

maybe you can provide more information.


>I have a laptop from 2013, and I'm playing around with it.
>I've just compiled a kernel with the command:

>./build.sh -T ../tools -O ../obj -U -N1 -j2 kernel=GENERIC

is that from netbsd-10 sources? Did you change the GENERIC
configuration?


>... boot device: wd0
>... root on wd0c dumps on wd0b
>... vfs_mountroot: can't open root device

wd0c wouldn't be a standard installation. Usually you write a disklabel
that uses wd0a as the root partition.


>... cannot mount root, error = 6

error 6 could mean that the wd0 disk doesn't exist or that partition
wd0c doesn't contain a valid filesystem or that you have a stripped
kernel that lacks the filesystem code.


>I've checked, and as expected, DKWEDGE options are set properly as 
>mentioned in 'man dk(4)'.

What DKWEDGE options did you set?



>The system just boots fine with the kernel bundled in the installation 
>image.

Then you could show your disk layout as seen by the bundled kernel,
also what that kernel prints for 'boot device' and 'root on' and
what filesystem you used.




Re: shrinking a filesystem using resize_ffs(8)

2024-02-01 Thread Michael van Elst
jscha...@netmeister.org (Jan Schaumann) writes:

>Hi,

Hi,

>$ sudo newfs -C 2 /dev/rvnd0a

There is no '-C'. Maybe -O 2 ?

But resize_ffs doesn't support shrinking FFS2 and should
complain when you try.


>[ back to two '1048576' sized partitions ]

>$ sudo fsck_ffs -y -f /dev/rvnd0b
>[ all ok ]

The 'b' filesystem was probably never changed but maybe trashed in
a way that fsck doesn't understand.


>$ sudo resize_ffs -v /dev/rvnd0b
>No change requested: already 524288 blocks

The superblock and partition agree. Nothing
to do and nothing to check.


>$ sudo fsck_ffs -y -f /dev/rvnd0a
>** /dev/rvnd0a

>CANNOT READ: BLK 2010160
>CONTINUE? yes

The 'a' filesystem still thinks it is 1GB and you try to shrink
it. But the disklabel already restricts access to the lower half.
Any attempt to access data from the upper half fails.


>$ sudo resize_ffs -v /dev/rvnd0a
>resize_ffs: read failed: Invalid argument

Dito. Shrinking requires access to all the data.


>So... how do I shrink a filesystem?

You tell resize_fsck the new size with -s and then
reduce the partition size accordingly.






Re: WireGuard setup in NetBSD 10

2024-01-18 Thread Michael van Elst
k...@krot.org (Kirill Miazine) writes:

>> Maybe he still has auto_ifconfig=NO ?

>no, he didn't... but issue was if_wg not being loaded upon boot -- but
>loaded when ifconfig wg0 create was called.

The perils of the module autoloader.



Re: WireGuard setup in NetBSD 10

2024-01-18 Thread Michael van Elst
mar...@duskware.de (Martin Husemann) writes:

>On Thu, Jan 18, 2024 at 10:23:11AM +0100, Kirill Miazine wrote:
>> Does your custom kernel provide some wg devices initially?

>No, but "ifconfig -C" lists wg as a clonable device, so /etc/ifconfig.wg0
>is loaded.

Maybe he still has auto_ifconfig=NO ?



Re: Network and port redirection with QEMU not working with package compiled on 10.0_RC1

2024-01-03 Thread Michael van Elst
baba...@babafou.eu.org (Marc Baudoin) writes:

>Has anybody got a working QEMU (at least network-wise) compiled
>on NetBSD 10.0_RC[12]?

No problems here, neither with qemu-8.1.0 (2023Q3) nor qemu-8.1.3 (2023Q4):

Host:
NetBSD tazz 10.99.10 NetBSD 10.99.10 (TAZZ) #311: Sun Dec 24 15:24:24 UTC 2023  
mlelstv@slowpoke:/scratch2/obj.amd64/scratch/netbsd-current/src/sys/arch/amd64/compile/TAZZ
 amd64

Guest:
NetBSD standalone 10.99.5 NetBSD 10.99.5 (GENERIC) #0: Sun Jul  9 00:01:55 UTC 
2023  mkre...@mkrepro.netbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64

configured with:

-netdev user,id=n1
-device virtio-net,netdev=n1



Re: Prob using CPIO

2024-01-01 Thread Michael van Elst
tgru...@gmail.com (Todd Gruhn) writes:

>I zip up much  music:

>   find . -depth -print | cpio -ov > file.cpio

>To unzip it , I must undo *cpio severa times severa times:

>   cpio -iv < file.cpio

Your 'zip' packs the local directory including the cpio file that
is being created. You don't have to cpio several times to unpack,
but the data (most likely) exists twice in the archive.


>Am I messing this up somehow? The *.cpio file is about 250MB...

Yes, don't include the resulting cpio file, easiest by writing
it to a separate directory.



Re: After -10 patch that fixes kern/57669

2023-12-27 Thread Michael van Elst
joel.bertr...@systella.fr (=?UTF-8?Q?BERTRAND_Jo=c3=abl?=) writes:

>   I have seen Michael has applied patch to fix ccb_timout to -10 kernel.
>Thus, I have rebuilt my tree to have a unpatched kernel and I cannot now
>access to my NAS over iSCSI. Of course, I have reinstalled kernel /and/
>userland.

>   In dmesg, I only obtain :

>[71,854636] Invalid socket 7


Looks like there is a bug with the default port number.

Quick workaround is to specify the target with port number
like 1.2.3.4:3260.




Re: Are The Packages Gone Again?

2023-12-19 Thread Michael van Elst
j...@m5.chicago.il.us ("Jay F. Shachter") writes:

>I was able to reinstall ghostscript (as I stated).  The others --
>ImageMagick6, atril, gv, libspectre and okular -- are gone.

At least there was no problem to build them.

-rw-r--r--  1 root  wheel  11102472 Sep 29 14:25 
final-amd64-10.0-2023Q3/All/ImageMagick6-6.9.12.91.tgz
-rw-r--r--  1 root  wheel   4430189 Sep 29 18:01 
final-amd64-10.0-2023Q3/All/atril-1.26.1nb1.tgz
-rw-r--r--  1 root  wheel220628 Sep 29 17:37 
final-amd64-10.0-2023Q3/All/gv-3.7.4nb12.tgz
-rw-r--r--  1 root  wheel 71680 Sep 29 13:50 
final-amd64-10.0-2023Q3/All/libspectre-0.2.9nb2.tgz
-rw-r--r--  1 root  wheel   9531552 Sep 30 00:34 
final-amd64-10.0-2023Q3/All/okular-23.04.3.tgz



Re: Are The Packages Gone Again?

2023-12-19 Thread Michael van Elst
j...@m5.chicago.il.us ("Jay F. Shachter") writes:

>Are the NetBSD 10 packages gone again?  I recently removed ghostscript
>with the intention of re-installing it (gs was complaining that there
>was no libtiff.so, which is preposterous, because there was, but I
>didn't want to argue with it).

Can't tell why they are gone. My last private bulk build yielded:

-rw-r--r--  1 root  wheel  1390 Sep 29 07:47 
final-amd64-10.0-2023Q3/All/ghostscript-9.05nb31.tgz
-rw-r--r--  1 root  wheel  23276644 Sep 29 07:47 
final-amd64-10.0-2023Q3/All/ghostscript-agpl-10.01.2.tgz
-rw-r--r--  1 root  wheel  5460 Sep 30 01:12 
final-amd64-10.0-2023Q3/All/ghostscript-cidfonts-2901nb6.tgz
-rw-r--r--  1 root  wheel  5456 Sep 30 14:37 
final-amd64-10.0-2023Q3/All/ghostscript-cmaps-20020913nb3.tgz
-rw-r--r--  1 root  wheel827591 Sep 29 07:30 
final-amd64-10.0-2023Q3/All/ghostscript-fonts-8.11nb3.tgz
-rw-r--r--  1 root  wheel  14937225 Sep 30 04:45 
final-amd64-10.0-2023Q3/All/ghostscript-gpl-9.06nb47.tgz




Re: iscsid - lfs and ipv6 issues

2023-11-19 Thread Michael van Elst
On Sun, Nov 19, 2023 at 12:34:13PM +0100, Ede Wolf wrote:
> Hello,
> 
> first of all a very big thanks to all of you. Since it seems I am the only
> one who is using ipv6 with iscsi, I do not need a fix. I can live (as I am
> doing now) with ipv4.
> I just know I do not have to waste any time in trying to figure out the
> syntax.

I think I've fixed IPv6 handling now (needs patches to iscsictl and
iscsid), at least it works here.


> Secondly: The iscsi target is ctld on FreeBSD. Currently even without any
> authentication.
> Now I doubt that an offline reporting is the case, because, relabelling the
> lun to 4.2BSD and mounting it with ffs does work. Without anything else
> being done on either side.

I can currently only test against istgt (from pkgsrc) on NetBSD and
a qnap NAS.

The error message (ENODEV) is only generated by LFS on failures to mount
a root filesystem. So no idea yet what error is triggered.

On the other hand, attempting to use LFS showed errors with handling
block sizes and running the filesystem tester (fsx) somewhen paniced
the system. Whatever was "fixed" in LFS was not good enough :-/



Greetings,
-- 
    Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CGD - unable to open after closing, using '-V gpt', argon2id and adiantum

2023-11-19 Thread Michael van Elst
luisvmen...@yandex.com (Luis Mendes) writes:

>== Now, trying to open the container again:
>cgdconfig -V gpt cgd0 NAME=nvme-crypt /etc/cgd/nvme-crypt
>After entering the four zeroes password, there's the message:
>"cgdconfig: verification failed, please reenter passphrase".

>What is wrong with this setup?

This way cgdconfig is looking inside the container for a GPT
label for validation. Did you create one ?

If you don't need to partition the container, you could
format a ffs filesystem for the whole disk (cgd0) and use
the 'ffs' verification method, which checks for a ffs 
superblock.

For other filesystems you need to partition (disklabel, mbr
or gpt) if you want the validation step and validate using
the partition information. But it's not strictly necessary to
validate, -V none will accept a wrong passphrase but e.g.
a mount will likely see garbage and fail.



Re: iscsid - lfs and ipv6 issues

2023-11-18 Thread Michael van Elst
On Sat, Nov 18, 2023 at 07:47:47PM +0700, Robert Elz wrote:
> 
> Using getaddrinfo() would be much better of course.

That's what I have now


-- 
    Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: iscsid - lfs and ipv6 issues

2023-11-18 Thread Michael van Elst
k...@munnari.oz.au (Robert Elz) writes:

>That looks to me as if it should work, and is a lot cleaner, though
>I doubt there's a great need to remove the [] if they were given.

getaddrinfo() doesn't strip or handle brackets.



Re: iscsid - lfs and ipv6 issues

2023-11-18 Thread Michael van Elst
k...@munnari.oz.au (Robert Elz) writes:

>  | The address parser looks broken.
>It certainly is, it is horrid.

>and the relevant function is get_address()

Maybe the patch below. It's still a bit naive (you can bracket anything,
not just ipv6 literals).

The address string is later used in iscsid_driverif.c, a name
is resolved with gethostbyname(), so while an ipv6 address might
be accepted, the code lacks ipv6 support.


Index: sbin/iscsictl/iscsic_parse.c
===
RCS file: /cvsroot/src/sbin/iscsictl/iscsic_parse.c,v
retrieving revision 1.4
diff -p -u -r1.4 iscsic_parse.c
--- sbin/iscsictl/iscsic_parse.c3 Dec 2021 13:27:38 -   1.4
+++ sbin/iscsictl/iscsic_parse.c18 Nov 2023 10:35:17 -
@@ -48,50 +48,55 @@
 STATIC void
 get_address(iscsi_portal_address_t * portal, char *str, char *arg)
 {
-   char *sp, *sp2;
+   char *sp;
int val;
 
if (!str || !*str)
arg_error(arg, "Address is missing");
 
-   /* is there a port? don't check inside square brackets (IPv6 addr) */
-   for (sp = str + 1, val = 0; *sp && (*sp != ':' || val); sp++) {
-   if (*sp == '[')
-   val = 1;
-   else if (*sp == ']')
-   val = 0;
-   }
-
-   /* */
-   if (*sp) {
-   for (sp2 = sp + 1; *sp2 && *sp2 != ':'; sp2++);
-   /* if there's a second colon, assume it's an unbracketed IPv6 
address */
-   if (!*sp2) {
-   /* truncate source, that's the address */
-   *sp++ = '\0';
-   if (sscanf(sp, "%d", ) != 1)
-   arg_error(arg, "Bad address format: Expected 
port number");
-   if (val < 0 || val > 0x)
-   arg_error(arg, "Bad address format: Port number 
out of range");
-   portal->port = (uint16_t) val;
-   }
-   /* is there a group tag? */
-   for (; isdigit((unsigned char)*sp); sp++);
-   if (*sp && *sp != ',')
-   arg_error(arg, "Bad address format: Extra character(s) 
'%c'", *sp);
-   } else
-   for (sp = str + 1; *sp && *sp != ','; sp++);
-
-   if (*sp) {
+   /* parse and strip trailing group tag */
+   sp = strchr(str, ',');
+   if (sp != NULL) {
if (sscanf(sp + 1, "%d", ) != 1)
arg_error(arg, "Bad address format: Expected group 
tag");
if (val < 0 || val > 0x)
arg_error(arg, "Bad address format: Group tag out of 
range");
portal->group_tag = (uint16_t) val;
-   /* truncate source, that's the address */
*sp = '\0';
}
-   /* only check length, don't verify correct format (too many 
possibilities) */
+
+   /* parse and strip trailing port number */
+   sp = strchr(str, ':');
+   if (sp != NULL) {
+   if (strchr(sp + 1, ':') != NULL) {
+   /*
+* if there's a second colon, assume
+* it's an unbracketed IPv6 address.
+*/
+   portal->port = 0;
+   } else {
+   if (sscanf(sp + 1, "%d", ) != 1)
+   arg_error(arg, "Bad address format: Expected 
port number");
+   if (val < 0 || val > 0x)
+   arg_error(arg, "Bad address format: Port number 
out of range");
+   portal->port = (uint16_t) val;
+   *sp = '\0';
+   }
+   }
+
+   /* remove brackets */
+   if (*str == '[') {
+   sp = strchr(str, ']');
+   if (sp != NULL && !*(sp+1)) {
+   str = str + 1;
+   *sp = '\0';
+   }
+   }
+
+   /*
+* only check length, don't verify correct format
+* (too many possibilities)
+*/
if (strlen(str) >= sizeof(portal->address))
arg_error(arg, "Bad address format: Address string too long");
 


Re: iscsid - lfs and ipv6 issues

2023-11-17 Thread Michael van Elst
lis...@nebelschwaden.de (Ede Wolf) writes:

>I am having two issues with iscsid/iscsictl. First, it seems, I cannot 
>mount an lfs formatted iscsi lun, no matter wether this drive is 
>gpt/wedge or plain disklabelled:

># mount -t lfs /dev/dk0 /import/
>mount_lfs: /dev/dk0 on /import: Operation not supported by device

This works here (as far as lfs works), but the error message is
rare. One possibility is that the SCSI driver reports an offline
unit. Can you tell what the iSCSI server is ?

>scsictl: add_send_target: Invalid option at or near '-a': Bad address 
>format: Extra character(s) ':'

The address parser looks broken. For some reason the first character is skipped 
when it tries to identify IPv6, I was successful with

iscsictl add_send_target -a 'x[ipv6-address]'


Greetings,


Re: rc.local nightmare

2023-10-30 Thread Michael van Elst
ea1...@gmail.com (Ramiro Aceves) writes:

>My script says on the console "Network connectivity to $TARGET is OK." 
>several times before the script dies. So ping works fine. (I have set 
>INTERVAL=3 seconds just to speed things up during testing.


Your script shouldn't create output from a background process.
When booting, output is piped through a logging process, and when
that exits, the next output will abort your process.

nohup doesn't help, it only redirects terminal output.

Ideally you should not print anything directly in a background
process but write a log file (or use logger / syslog).

To avoid any accidential problem, you should also redirect all
three standard handles (e.g. to /dev/null).

N.B. the connectivity check is a bit sensitive. I suggest to
probe with more than 1 packet and to also set a deadline (-w)
which allows for one extra second, e.g. ping -n -c 3 -w 4.




Re: NetBSD 10 Beta: Updating The Base System

2023-10-10 Thread Michael van Elst
On Tue, Oct 10, 2023 at 11:24:15AM -0500, Jay F. Shachter wrote:

> Please forgive my ignorance; how do I update my NetBSD 10 Beta system?

You can run sysinst to fetch sets from

http://cdn.netbsd.org/pub/NetBSD-daily/netbsd-10/latest/amd64/

or download the sets and unpack them manually.

There is also the sysupgrade tool in pkgsrc, but I never have used it.


> And does my PKG_PATH variable remain
> http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/10.0/All or
> do I now change it to something else?  Thank you in advance for any
> and all replies.

The path stays the same.


Greetings,
-- 
            Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: Bluetooth status, compatible USB Bluetooth adapters?

2023-10-04 Thread Michael van Elst
dyo...@pobox.com (David Young) writes:

>By the way, to interoperate with Bluetooth Low Energy devices, is
>anything beyond a compatible USB Bluetooth adapter needed?  For example,
>kernel or utility changes?

So far we don't support BLE at all. Devices that talk only BLE cannot be
used.

My Logitech mouse is BLE only, fortunately it comes with a dongle that
makes it appear as a regular (wired) USB mouse.



Re: Where are the 10.0 packages?

2023-09-28 Thread Michael van Elst
j...@m5.chicago.il.us ("Jay F. Shachter") writes:

>system a dhcp client of the other laptop), and I cannot, because the
>packages are no longer at
>http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/10.0/All where
>they used to be.

netbsd-10 got a second flag day, first when updating openssl, second
when bumping versions of dependent libraries.

The packages are being rebuilt and you should also update the base
system.



Re: UEFI installation

2023-08-14 Thread Michael van Elst
g...@lexort.com (Greg Troxel) writes:

>For the EFI partition, what are the rules?  It seems like

>  the size is at least X and less than Y

100MB is the minimum, some systems reject smaller EFI partitions.

It also should be FAT32.



Re: ZFS Bogosity

2023-08-14 Thread Michael van Elst
On Mon, Aug 14, 2023 at 07:50:01AM -0400, Greg Troxel wrote:
> 
> In this case, wedges show up as logical disks in hw.disknames, so it's
> really that partitions aren't disks.

Indeed, partitions are disks and wedges appear as a disk that doesn't
support partitions.


> > You can avoid this by ignoring and phasing out disklabel
> > partitions (which only work for "small" disks anyway) and use wedges
> > also to handle the bsd disklabel.
> 
> Do you mean "create dkN entries from the disklabel"?  That doesn't
> happen by default.

You have to set a kernel option. Since changing behaviour is a flag day,
it never happened (actually it happened and was reverted immediately).


> I still use disklabels on disks that are <= 2T, and I don't see that as
> really odd.

It's odd to treat disks differently, i.e. small disks with "physical"
driver names and a partition suffix, large disks with a name (or
an UUID as unique default name).

Make small disks using wedges, indepenent of disklabel or GPT, would
unify both.


> > Makeing zfs scan disklabel partitions derived from hw.disknames seems
> > to be the easier method though.
> 
> Yes, that seems not to have any real downsides and would make it behave
> as expected.

SMOP

-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: ZFS Bogosity

2023-08-13 Thread Michael van Elst
On Sun, Aug 13, 2023 at 08:22:08PM -0400, Greg Troxel wrote:
> 
> Given that wd3e is a name for a disk special file with defined size, it
> would seem that we should change that.  It seems to make just as much
> sense to probe wd3[a-p] as it does to probe wd3 (which is wd3d).

You can change the code to scan partitions instead. It gets a bit
more complicated, if wedges are involved.


> Alternatively, I see that we add wedges to hw.disknames. My system has
> a NetBSD boot image on a flash drive this minute, and:
>   hw.disknames = wd0 cd0 sd0 dk0 dk1
> so if we add dk0, which is really no different logically than sd0a, it
> seems like we should add disklabel partitions like wd3e.

The sysctl value reflects the device drivers from the autoconfig
process. It has no knowledge about disk content. This discrepancy
between disklabel partitions and wedges is maybe the largest problem
of wedges. You can avoid this by ignoring and phasing out disklabel
partitions (which only work for "small" disks anyway) and use wedges
also to handle the bsd disklabel.


> It also seems odd to special case /dev, vs using the dir if passed and
> doing hw.disknames->dev if not, but it seems best to minimally munge
> upstream.

That's an optimization to avoid scanning and probing all entries
in /dev/ which can take some time and may have unwanted side effects
when you scan non-disk devices.


> What happens on FreeBSD?  Are they so firm on gpt-only, geom and
> zfs-on-whole disk that this doesn't come up?  It seems obvious that
> people easing into zfs are going to use partial disks, if only as
>   / sw /usr on ffs, and
>   rest as sole storage for a pool
> .

For ZFS it rarely makes sense to use partitions. You need this as
a workaround to allow bootstrap without ZFS support in the boot
process, and you need it to exchange media with other systems
that use the partition table as identifier (but who uses disklabel?).


> 
> > You can also cache devices, then the pool devices are just used as
> > stored in the cache instead of scanning all disks for labels. But
> > that doesn't work nicely with wedges or anything else with changing
> > device units.
> 
> I found that my single pool tank0 with a single component wd0f has a
> cache file in /etc/zfs/zpool.cache.   But that seems not a general
> solution for import.

That is the general solution of ZFS to avoid the time consuming scanning
of /dev/ at startup, and you could arrange disk devices into something
like /dev/disk to avoid side effects on non-disk devices You see,
it's a design for something else.

Or you could arrange for "volume labels" to be visible in the filesystem
(e.g. use devpubd to create symlinks for wedges, or invent a device
filesystem that is filled by the kernel) and let zfs scan these.


Makeing zfs scan disklabel partitions derived from hw.disknames seems
to be the easier method though.



Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: ZFS Bogosity

2023-08-13 Thread Michael van Elst
g...@lexort.com (Greg Troxel) writes:

>David Brownlee  writes:
>> https://gnats.netbsd.org/57583

>Do you think this is just a bug that  it fails to look at wd3e
>etc. wrongly if there is /dev/zfs?

The code scans all devices in the specified device directory, unless
it's /dev/. Then it uses sysctl hw.disknames to enumerate disk devices,
and it doesn't care about disklabel partitions.

You can also cache devices, then the pool devices are just used as
stored in the cache instead of scanning all disks for labels. But
that doesn't work nicely with wedges or anything else with changing
device units.



Re: would anybody use binary packages for NetBSD/i386 10?

2023-08-13 Thread Michael van Elst
g...@lexort.com (Greg Troxel) writes:

>it was underpowered, that I might or might not ever power up again, and
>if I did I wouldn't use ftp.n.o packages on it.

What else? Self-compiling on a system you already consider outdated? :)

Binary packages are more important on systems that we consider old,
doesn't have to be a VAX.



Re: NetBSD 10 BETA successfully installed, does not recognize my wireless network device

2023-08-07 Thread Michael van Elst
j...@m5.chicago.il.us ("Jay F. Shachter") writes:

>else.  According to the output that I obtain when I boot my computer
>into OpenBSD and invoke the "pcidump -v" command -- and I have to
>engage in this roundabout procedure because I do not see a pcidump
>command, or anything resembling it, on my NetBSD system

It's something like
pcictl pci0 list

Detailed information with
pcictl pci0 dump 
plus parameters to specify which device.


>-- my wireless
>network device is a Broadcom BCM4313, Vendor ID 14e4, Product ID 4727.

I fear there is no driver for that chip. FreeBSD might have support for
it in the bwn driver, but that won't help you.

For Wifi you probably need something like an USB dongle, something like
an Edimax EW-7811Un should work. Since NetBSD so far only supports
802.11a/b/g, you also need to make sure that your WiFi (accesspoint/router)
has this enabled (it usually has).




Re: Network interface slowness

2023-08-01 Thread Michael van Elst
joel.bertr...@systella.fr (=?UTF-8?Q?BERTRAND_Jo=c3=abl?=) writes:

>CISCO FTTH adapter
>   ||
>   ||
>netbsdLinux
>   |
>   |
>  lan

>On NetBSD (-10) or workstations on LAN:
>- 400 Mbps downlink;
>- 4 (!) Mbps uplink, yes, 4 Mbps.


What happens when you unplug one of the lagg0 legs ?




Re: zfs pool behavior - is it ever freed?

2023-07-29 Thread Michael van Elst
g...@lexort.com (Greg Troxel) writes:

>mlel...@serpens.de (Michael van Elst) writes:

>> t...@netbsd.org (Tobias Nygren) writes:
>>
>>>There exists ZFS code which hooks into UVM to drain memory -- but part
>>>of it is ifdef __i386 for some reason. See arc_kmem_reap_now().
>>
>> That's an extra for 32bit systems (later code replaced __i386 with
>> the proper macro) where kernel address space is much smaller.

>Sure, but I don't see why it shouldn't always be hooked up.

It might have negative effects, as its used to reduce non-zfs-related
pools. The zfs-related-pools are freed in any case.

I think our problem is that the vcache doesn't get enough pressure.
For FreeBSD you will find the dnlc_reduce_cache() function in arc.c
that (in a separate thread) reduces metadata held by the kernel so that
buffers actually get unreferenced and can be freed afterwards.

We do have the vdrain_thread() that tries to keep cached vnodes
(and associated metadata) below the 'desiredvnodes' value. That
value however doesn't change under memory pressure. You can manually
change the value (as kern.maxvnodes) to get an immediate effect
(for e.g. UFS).

For ZFS however that apparently isn't enough. I can shrink the
vcache, but the ZFS buffers seem to be unaffected.



Re: zfs pool behavior - is it ever freed?

2023-07-29 Thread Michael van Elst
t...@netbsd.org (Tobias Nygren) writes:

>There exists ZFS code which hooks into UVM to drain memory -- but part
>of it is ifdef __i386 for some reason. See arc_kmem_reap_now().

That's an extra for 32bit systems (later code replaced __i386 with
the proper macro) where kernel address space is much smaller.



Re: zfs pool behavior - is it ever freed?

2023-07-28 Thread Michael van Elst
On Fri, Jul 28, 2023 at 12:26:57PM -0400, Greg Troxel wrote:
> mlel...@serpens.de (Michael van Elst) writes:
> 
> > g...@lexort.com (Greg Troxel) writes:
> >
> >>I'm not either, but if there is a precise description/code of what they
> >>did, that lowers the barrier to us stealing* it.  (* There is of course
> >>a long tradition of improvements from various *BSD being applied to
> >>others.)
> >
> > The FreeBSD code is already there and I have exposed a few settings:
> >
> > vfs.zfs_arc.meta_limit = 0
> > vfs.zfs_arc.meta_min = 0
> > vfs.zfs_arc.shrink_shift = 0
> > vfs.zfs_arc.max = 5292193280
> > vfs.zfs_arc.min = 661524160
> > vfs.zfs_arc.compressed = 1
> >
> > but that's not enough to control the behaviour.
> 
> Is that in current only?   I don't see that in netbsd-10.


Only in my local tree.


-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: zfs pool behavior - is it ever freed?

2023-07-28 Thread Michael van Elst
g...@lexort.com (Greg Troxel) writes:

>I'm not either, but if there is a precise description/code of what they
>did, that lowers the barrier to us stealing* it.  (* There is of course
>a long tradition of improvements from various *BSD being applied to
>others.)

The FreeBSD code is already there and I have exposed a few settings:

vfs.zfs_arc.meta_limit = 0
vfs.zfs_arc.meta_min = 0
vfs.zfs_arc.shrink_shift = 0
vfs.zfs_arc.max = 5292193280
vfs.zfs_arc.min = 661524160
vfs.zfs_arc.compressed = 1

but that's not enough to control the behaviour.



Re: zfs pool behavior - is it ever freed?

2023-07-27 Thread Michael van Elst
On Thu, Jul 27, 2023 at 06:42:02PM +0100, Mike Pumford wrote:
> 
> Now I might be reading it wrong but that suggest to me that it would be an
> awful idea to run ZFS on a system that needs memory for things other than
> filesystem caching as there is no way for those memory needs to force ZFS to
> give up its pool usage.

At least not in the current incarnation. There are lots of tunables
though that are supposed to limit ZFS memory usage, but so far we do
not expose these (FreeBSD does).


-- 
            Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: zfs pool behavior - is it ever freed?

2023-07-27 Thread Michael van Elst
g...@lexort.com (Greg Troxel) writes:

>  RAM and/or responds to pressure.  That's why we see almost no reports
>  of trouble expect for zfs.


There is almost no pressure on pools and several effects prevent
pressure from actually draining pool caches.

There is almost no pressure on vcache and the ZFS equivalents. Impact
by ZFS is much higher, because of the amount of memory locked up
this way. These data structures are significant as these actually
reference other data structures and buffers.

Swapping out userland pages is done much earlier, so with high ZFS
utilization you end with a system that has a huge part of real memory
allocated to the kernel. When you run out of swap (and processes
already get killed), then you see some effects on kernel data.




Re: NetBSD & disks with 4K sector size

2023-07-20 Thread Michael van Elst
g...@lexort.com (Greg Troxel) writes:

>mlel...@serpens.de (Michael van Elst) writes:
>> The xbd driver lies about the sector size and always reports 512byte
>> sectors. If you pass through a 4k sector host disk, this make some
>> I/O operations fail.

>What do you suggest we do?

I suggested to make it tell the truth, all data is provided by the
backend. Then it just works like other drivers.



Re: NetBSD & disks with 4K sector size

2023-07-20 Thread Michael van Elst
g...@lexort.com (Greg Troxel) writes:

>With any luck, this is supported and the xbd driver in NetBSD is just
>not noticing the sector size variable and it's a fairly small matter of
>programming.

The xbd driver lies about the sector size and always reports 512byte
sectors. If you pass through a 4k sector host disk, this make some
I/O operations fail.



Re: NetBSD & disks with 4K sector size

2023-07-20 Thread Michael van Elst
li...@nerdbynature.de (Christian Kujau) writes:

>So, my question is: does NetBSD work with 4k sector size disks? I found 
>two[1][2] threads from 11 years ago, but nothing conclusive and with 
>somewhat conflicting[3][4] information.


The NetBSD Xen PV xbd device lies about sector sizes so that you can
pretend that you can copy images between disks with different
sector sizes.



Re: bioctl cosmetic issue

2023-06-24 Thread Michael van Elst
j...@ziaspace.com (John Klos) writes:

>[ 1.033007] mfii0 at pci1 dev 0 function 0: "LSI MegaRAID SAS 9271-4i", 
>firmware 23.34.0-0019, 1024MB cache

>Where is bioctl supposed to get the sector size?

bioctl prints a struct bioc_vol which has the volume size in bytes.

The calculation is done by the particular driver:

mfi.c:
mfii.c:

bv->bv_size = sc->sc_ld_details.mld_size * 512; /* bytes per block */

mpt_netbsd.c:

bv->bv_size = (uint64_t)rvol0->MaxLBA * 512;

But e.g.:

mpii.c:
bv->bv_size = le64toh(vpg->max_lba) * le16toh(vpg->block_size);




Re: Call for testing: Diagnostics for broken downloads from NetBSD.org CDN

2023-06-18 Thread Michael van Elst
On Sat, Jun 17, 2023 at 08:14:20AM -0400, Greg Troxel wrote:
> mlel...@serpens.de (Michael van Elst) writes:
> > Fastly caches data in segments:
> > https://docs.fastly.com/en/guides/segmented-caching


> Is a client that writes a partial file and exits considered buggy?

May depend on the client and is sometimes a user preference.


> Or
> are users obligated to check for exit status 0 and if not rm the file?

They should always check for exit status and that is unrelated to the
problem or whether this is an CDN or just a simple web server.



Greetings,
-- 
        Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: Call for testing: Diagnostics for broken downloads from NetBSD.org CDN

2023-06-17 Thread Michael van Elst
riastr...@netbsd.org (Taylor R Campbell) writes:

>We've been hearing reports of intermittent issues with broken partial
>downloads via our content delivery network, Fastly, from
>cdn.NetBSD.org, nycdn.NetBSD.org, and/or archive.NetBSD.org,
>particularly of large files like the installer images.

Fastly caches data in segments:

https://docs.fastly.com/en/guides/segmented-caching

If some segments of a file can be fetched from the backend
and others cannot, fastly will deliver a partial file and
return an error. For a complete file all segments must have
been fetched and cached succssfully.

This can easily happen with a backend that applies a connection
rate limit. And so it does



Re: touch screen support

2023-05-29 Thread Michael van Elst
dty...@anduin.org.uk (Dave Tyson) writes:

>I guess these touch screens need some calibration to set the x/y bounds
>and maybe some mods to the driver. Can anyone hit me with a cluebat as
>to where to start...

There are lots touchpads that need a more relaxed interpretation of their
capabilities. The uts driver already ignores the missing Digitizer:In_Range
HID usage for Elan touchpads.

The FreeBSD driver (wmt(4)) seems to ignore it completely. I'm not
sure if that is sufficient (Linux applies a ton of quirks to the
different touch screen models).

For a start it might be sufficient to go the FreeBSD way:

Index: uts.c
===
RCS file: /cvsroot/src/sys/dev/usb/uts.c,v
retrieving revision 1.16
diff -p -u -r1.16 uts.c
--- uts.c   10 May 2023 00:12:44 -  1.16
+++ uts.c   29 May 2023 08:38:50 -
@@ -215,7 +215,7 @@ uts_attach(device_t parent, device_t sel
} else {
aprint_error_dev(sc->sc_dev,
"touchscreen has no range report\n");
-   return;
+   // return;
}
}



Re: Raspberry Pi 3 and NetBSD 10.0_BETA - WiFi stops working after few hours and wonky USB keyboard

2023-03-27 Thread Michael van Elst
bbartlomiej.m...@gmail.com (Bartek Krawczyk) writes:

>> Perhaps the device is going into power saving mode and your connection 
>> terminates?

>There's "powersave off" in the ifconfig output and I've issued the 
>ifconfig bwfm0 -powersave command explicitly as well. No change.

The default in netbsd-10 and -current is to have powersave disabled.
With powersave you often see latencies of ~100ms.


>> Another thing, change the channel of the router, perhaps there's 
>> interference from others around you?

>It's not the interference - other devices near it work just fine. And 
>have been working fine for years.

RPI has a weak antenna, so "other devices" may not be a good reference.


>I'll be raising a wpa_supplicant bug 
>then. Since it's working after wpa_supplicant restart and it's rekeying 
>periodically. Interference would impact it intermittently, not 
>completely after few hours. Thanks for suggestion, though.

I'd suspect a firmware bug. I should reactivate my RPI3 for a test.

N.B. I don't see issues with a RPI0w, a RPI4 and a BPI M2 Zero
which comes with a bwfm compatible chip.



Re: Prob with my speakers

2023-03-01 Thread Michael van Elst
tgru...@gmail.com (Todd Gruhn) writes:

>Speakers where cracking a lot. I noticed that when I reboot
>NetBSD I saw some info printed.

>How to I catch this and send it in? Is it in a log I can view?


The early messages should be in /var/run/dmesg.boot.
Output from starting services is logged in /var/run/rc.log.

/var/run is tmpfs, so the data is lost after a reboot.

Some, but not all of the dmesg output is also logged in /var/log/messages.



Re: Keeping NetBSD disklabel up to date

2023-01-30 Thread Michael van Elst
wolfg...@solfrank.net (Wolfgang Solfrank) writes:

>> Or you can run mbrlabel (without -w) and replace the previous entries
>> accordingly.

>No, without -w, mbrlabel will just print out the modified disklabel,
>but will neither change the in-core label nor the one on disk.

Indeed. you print the modified label and you then modify the entries
(with disklabel -e or similar).




Re: Keeping NetBSD disklabel up to date

2023-01-27 Thread Michael van Elst
bea...@sdf.org writes:

>So it sounds like mbrlabel by itself would not have been sufficient for
>avoiding this scenario; it's output still needs to be applied via the
>disklabel tool; is that correct?

Yes.


> I'm sort of surprised as the mbrlabel(8)
>manpage says

>  "mbrlabel is used to update a NetBSD disk label from the Master Boot
>   Record (MBR) label and Extended Boot Record (EBR) label(s) found on
>   disks that were previously used on DOS/Windows systems (or other MBR
>   using sys tems)."

>Perhaps it's grammatically correct but not literally correct -- it is
>used to update the disklabel but doesn't actually do it itself?

mbrlabel does the following:

- read the current disklabel from disk
- enumerate the MBR partitions, for each partition
  - ignore if a disklabel entry with the same offset and size exists.
  - ignore if a disklabel entry exists that overlaps
  - otherwise add a corresponding disklabel entry
- with -w option, write back the modified disklabel to disk

So the best thing that can happen is that the modified partitions
are appended. But usually it will just clash with with a previous
entry.

You can remove the previous disklabel entries for the non-NetBSD
partitions, and then run mbrlabel -w to append the new entries.

Or you can run mbrlabel (without -w) and replace the previous entries
accordingly.



>Regarding the GPT scheme as a possibility I'll have to get educated
>on that but perhaps it's the better way to go since I'm goning to
>have to start over with this disc anyway.  I had it in my head that
>GPT was a 64bit only option.

GPT is something that is understood by Linux and NetBSD, so there
cannot be any confusion, no need to synchronize the view between
both sides.

But it is also a change. You need a new bootloader that supports GPT
for both systems, GAG is too old for this. With NetBSD you also
get a new scheme to access the disk using "wedges".




Re: Keeping NetBSD disklabel up to date

2023-01-26 Thread Michael van Elst
bea...@sdf.org (beaker) writes:

>Is it safe and sufficient to run 'mbrlabel -fw ' on NetBSD
>whenever there has been partition resizing (usually via Gpartd)
>such that the disklabel no longer reflects the current partitioning
>state?

mbrlabel creates disklabel entries for MBR partition entries, nothing
generic. It also won't move any data.


>System in question is an old 32bit i386 with an MBR partition scheme
>on a SATA disc hosting several Linux partitions and one NetBSD FFS2
>partition.  Bootloader is GAG, not GRUB nor native NetBSD bootloader.

If you only change the Linux partitions, you can use mbrlabel
(without -w) to print the necessary disklabel entries. mbrlabel
doesn't know how to delete or modify existing entries, so you need
to do that and use the mbrlabel output as a template.

If you want to modify or even resize the NetBSD partitions, it gets
much more complicated. A save approach is to boot from an alternate
installation (Live- or Installation-CD), backup the partitions,
modify them accordingly and restore the partition content from
the backup. You may also have to reinstall the bootloader.



Re: FFSv2ea

2023-01-16 Thread Michael van Elst
clays.sh...@sdf.org (Clay Daniels) writes:

>If I try this:    #gpt show wd0
>I get this:        GPT part - NetBSD FFSv1/FFSv2

>Then the next installation I deliberately used the default of FFSv2, I 
>get the same thing. I'm sure I must be expecting the gpt command to do 
>more than it really does. What other commands shows the fast file system 
>in use?

gpt shows the entry in the partition table, there is only one type value
for NetBSD FFS which is independent of version.

To see details about FFS you can use the dumpfs tool as in:

   dumpfs -s /dev/...
or
   dumpfs -s /mount/point

e.g.:

# dumpfs -s /
file system: /dev/rdk3
format  FFSv2
endian  little-endian
...

# dumpfs -s /dev/vnd0a
file system: /dev/vnd0a
format  FFSv2ea
endian  little-endian
...





Re: NetBSD-10.0_BETA: clock: unknown CMOS layout

2022-12-23 Thread Michael van Elst
dposto...@yandex.ru (Dmitrii Postolov) writes:

>"clock: unknown CMOS layout"

The message says that no century information is found in the CMOS RAM,
the hardware clock itself seems to keep only 2 year digits. The century
is then deduced as 1900 if the year number is less than 70 and 2000
otherwise.

This heuristic will fail 2030. Then the clock will start with a
date 100 years in the past and gets corrected later during the
boot process. Ugly, but probably not fatal.



Re: NetBSD-10.0_BETA: clock: unknown CMOS layout

2022-12-23 Thread Michael van Elst
dposto...@yandex.ru (Dmitrii Postolov) writes:

>On boot of NetBSD-10.0_BETA the message "clock: unknown CMOS layout" is 
>printed. There is no this message at boot on NetBSD-9.x.

It's a DIAGNOSTIC message, if you run NetBSD-9.x release, the kernel
is built without DIAGNOSTIC checks and messages, but NetBSD-10.0-BETA
still is.




Re: resolv.conf

2022-12-10 Thread Michael van Elst
tgru...@gmail.com (Todd Gruhn) writes:

>Spectrum upgraded. I start NetBSD, and /etc/resolv.conf has nothing.

>How do I fix this?
>Should there be any minimal resolv.conf settings???

You either get network settings automatically via DHCP (and that
should include data for resolv.conf) or you have set it manually,
then you do the configuration yourself.



Re: IBM IMM shared port

2022-12-09 Thread Michael van Elst
kab...@lich.phys.spbu.ru (Dima Veselov) writes:

>I have an IBM x3200 M3 server with built-in IMM IPMI service
>processor. This server have IPMI network port shared with first network 
>card. This setup is quite popular and I have several different servers 
>having no issues with that. While booting, OS initialize network 
>interface and IPMI stop responding for a while, then connection is 
>restored. My guess is that happens because of internal switch reset when 
>network interface get reset.

The ethernet controller is shared between BMC and OS. While this construct
may work in single-user mode, if BMC and OS driver co-operate, it tends
to fail exactly when you need it, i.e. when the system crashed and you
need IPMI to recover.
So I try to avoid it whenever possible and dedicate that interface to
the BMC.



Re: Debugging socket options

2022-12-04 Thread Michael van Elst
br...@nmsu.edu (Brook Milligan) writes:

> 18808  18808 guppy_basecaller CALL  socketpair(1,5,0,0x7f7fdb98)

socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, );


> 18808  18808 guppy_basecaller CALL  =
>setsockopt(3,1,0x10,0x7f7fda14,4)

setsockopt(3, SOL_SOCKET, SO_PASSCRED, , sizeof(val));


I don't think that could work with our Linux emulation as we
do not support SO_PASSCRED.






Re: ldd-linux

2022-12-03 Thread Michael van Elst
On Sat, Dec 03, 2022 at 05:08:57PM -0700, Brook Milligan wrote:
> 
> Does it make sense to have updated linux library packages?

That always makes sense, but libstdc++ is the GNU C++ runtime
and this has usually very limited compatibility. A program
ususally wants (and often needs) exactly the version is was built for.


Greetings,
-- 
    Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: timers slow (sleep 1 taking five seconds)

2022-12-03 Thread Michael van Elst
r...@reedmedia.net ("Jeremy C. Reed") writes:

>acpi0: fixed power button present
>timecounter: Timecounter "ACPI-Fast" frequency 3579545 Hz quality 1000
>hpet0 at acpi0: high precision event timer (mem 0xfed0-0xfed00400)
>timecounter: Timecounter "hpet0" frequency 14318180 Hz quality 2000

>attimer1 at acpi0 (TMR, PNP0100): io 0x40-0x43 irq 0

>t1:reed$ date ; time sleep 1 ; date 
>Sat Dec  3 00:31:40 UTC 2022
>5.01s real 0.00s user 0.00s system
>Sat Dec  3 00:31:45 UTC 2022


Can you check

sysctl kern.timecounter.choice
sysctl kern.timecounter.hardware

Maybe you use a mis-calibrated TSC ? The ACPI-Fast and hpet0 counters
look reasonable.



Re: ldd-linux

2022-12-03 Thread Michael van Elst
br...@nmsu.edu (Brook Milligan) writes:

>All but one of these are provided by the emulators/suse131_base and =
>emulators/suse131_glib2 packages; the missing one is libstdc++.so.6.  =

Hmm. emulators/suse131_base (from 2022Q3 release) comes with:

/usr/pkg/emul/linux/usr/lib64/libstdc++.so.6
/usr/pkg/emul/linux/usr/lib64/libstdc++.so.6.0.18



Re: Local-only (non-ip) rpcbind(8)?

2022-11-18 Thread Michael van Elst
h...@spg.tu-darmstadt.de (Hauke Fath) writes:

>>  if (ipv6_only == 1 && 

>And here is where I naively would insert a commandline option flag to 
>disable all things non-local. Unless something like that already exists, 
>and I just didn't see it.

>>  strcmp(nconf->nc_protofmly,"inet") == 0) {
>>  /* DO NOTHING */

Nope, just the commandline option that filters out IPv4.



Re: Local-only (non-ip) rpcbind(8)?

2022-11-18 Thread Michael van Elst
h...@spg.tu-darmstadt.de (Hauke Fath) writes:

>Hi,

>can rpcbind(8) be set up to only use local transport, as opposed to 
>binding to interfaces?

>The closest I seem to come to that goal is by specifying '-h 127.0.0.1', 
>which results in a pointless

>Nov 18 15:45:05 HOST rpcbind: cannot bind 127.0.0.1 on udp: Address 
>already in use
>Nov 18 15:45:05 HOST rpcbind: cannot bind 127.0.0.1 on tcp: Address 
>already in use

When you specify hosts, rpcbind automatically adds 127.0.0.1 to the
list of addresses, thus the duplicate.

Here is what rpbind does:

-> bind to local transport
nconf = getnetconfigent("local");
init_transport(nconf);

-> bind to all visible transports configured
while ((nconf = getnetconfig(nc_handle))) {
if (nconf->nc_flag & NC_VISIBLE) {
if (ipv6_only == 1 && strcmp(nconf->nc_protofmly,
"inet") == 0) {
/* DO NOTHING */
} else
init_transport(nconf);
}
}
endnetconfig(nc_handle);

The configuration is in /etc/netconfig:

udp6   tpi_clts  v inet6udp -   -
tcp6   tpi_cots_ord  v inet6tcp -   -
udptpi_clts  v inet udp -   -
tcptpi_cots_ord  v inet tcp -   -
rawip  tpi_raw   - inet  -  -   -
local  tpi_cots_ord  - loopback  -  -   -

where 'v' is the NC_VISIBLE flag.

Of course that's a global setting and RPC clients use is too.




Re: switched from 9.99 to 9.3, init dies

2022-11-17 Thread Michael van Elst
riccardo.mott...@libero.it (Riccardo Mottola) writes:

>After the upgrade (which I believe is partially a downgrade, I don't 
>know when 9.3 was forked) boot dies with "panic: init died" apparently 
>in snprintf.

I would guess that "upgrading" killed your libc.

You can try to boot with -a (ask) and when the kernel asks for the
init program, tell it to run /rescue/init (assuming you have installed
the rescue set).

Otherwise you probably need to boot from a different medium (e.g.
an USB stick with the installation image).



Re: More floppy oddities

2022-11-17 Thread Michael van Elst
michael.chepo...@gmail.com (Michael Cheponis) writes:

>--7795b905eda356fd
>Content-Type: text/plain; charset="UTF-8"

># scsictl sd1 format
>/dev/rsd1: Check Condition on CDB: 1a 00 03 00 24 00
>SENSE KEY: No Additional Sense
> ASC/ASCQ: No Additional Sense Information

>I don't know what that means.


'1a' is a "mode sense" command that is used to query some information
(like geometry) and that failed.


>The console prints:
>[ 2207.9560928] sd1(umass1:0:0): medium error, data = 00 00 00 00 30 01 00
>00 00 00
>[ 2207.9610935] sd1c: error reading fsbn 64 (sd1 bn 64; cn 1 tn 1 sn 10)


Reading failed and the drive returned 'medium error', i.e. it couldn't
read anything. That could mean the medium is defective, but it could
also mean that the drive assumes some different formatting. It's possible
that the drive requires some configuration that our sd driver doesn't
provide.


>When trying 'fdformat'

>fdformat -f /dev/rsd1a -t 1440
>fdformat: Device `/dev/rsd1a' does not support floppy formatting:
>Inappropriate ioctl for device

fdformat is only for the fd driver.


>These diskettes have been pre-formatted under Windows 11, they work fine on
>that OS.  I have two different USB floppy drives, one is Teac, one is Sony;
>both work fine in Windows.

That would rule out a "real" medium error.




Re: noob Question: How to format a floppy on a USB floppy disk drive (on RPi 4) ?

2022-11-15 Thread Michael van Elst
On Tue, Nov 15, 2022 at 04:04:05PM -0800, Michael Cheponis wrote:

> Nov 15 23:42:22 arm64 /netbsd: [ 1728677.3990874] sd1(umass1:0:0): not
> ready, data = 00 00 00 00 3a 00 00 00 00 00
> Nov 15 23:42:22 arm64 /netbsd: [ 1729062.2630115] sd1: detached
> Nov 15 23:42:22 arm64 /netbsd: [ 1729062.2630115] atapibus0: detached
> Nov 15 23:42:22 arm64 /netbsd: [ 1729062.2670131] umass1: detached
> Nov 15 23:42:22 arm64 /netbsd: [ 1729062.2700137] umass1: at uhub2 port 1
> (addr 3) disconnected
> 
> Nov 15 23:42:29 arm64 /netbsd: [ 1729069.0440298] umass1 at uhub2 port 1
> configuration 1 interface 0
> Nov 15 23:42:29 arm64 /netbsd: [ 1729069.0480306] umass1: TEACV0.0 (0x0644)
> TEACV0.0 (0x), rev 1.10/2.00, addr 3
> Nov 15 23:42:29 arm64 /netbsd: [ 1729069.0550327] umass1: using UFI over
> CBI with CCI
> Nov 15 23:42:29 arm64 /netbsd: [ 1729069.0560337] atapibus0 at umass1: 2
> targets
> Nov 15 23:42:29 arm64 /netbsd: [ 1729069.1262885] sd1 at atapibus0 drive 0:
>  disk removable
> Nov 15 23:42:30 arm64 /netbsd: [ 1729069.9404460] sd1: 1440 KB, 80 cyl, 2
> head, 18 sec, 512 bytes/sect x 2880 sectors


A bit strange, but otherwise ok. A real SCSI device would attach
as sd1 in offline mode and will become online when the medium is
recognized.



> I see other unexpected behavior; when I copy to identical files that are
> exactly 1/2 of 1.4 MB long
> # ll f1 f2
> 
> -rw-r--r--  1 mac  wheel  737280 Nov 15 02:53 f1
> -rw-r--r--  1 mac  wheel  737280 Nov 15 02:54 f2
> 
> Each of these is 1440 sectors (std 512-byte sectors); I know the diskette
> is 'perfect' (no defects), yet when I write both of these files to the
> mounted "/a" filesystem, only f1 gets fully written, and then it complains
> there's not enough room for f2:


A filesystem needs to store more data than just the file contents.


> total 2592
> -rwxr-xr-x  1 root  wheel  737280 Nov 15 08:06 f1*
> -rwxr-xr-x  1 root  wheel  589824 Nov 15 23:59 f2*
> 
> If I rm /a/f2 and then write it again, there is even less 'space':
> 
> # rm /a/f2
> arm64# cp f2 /a
> cp: /a/f2: No space left on device
> arm64# ll /a
> total 1568
> -rwxr-xr-x  1 root  wheel  737280 Nov 15 08:06 f1*
> -rwxr-xr-x  1 root  wheel   65536 Nov 16 00:00 f2*


This looks like a bug somewhere, but maybe you did remove the
mounted medium at some point?

So what kind of filesystem did you use? FFS? FAT?

My guess is that you need to use fsck to fix the inconsistencies
and find out when they occur. The usual culprits are media removal
while mounted, hard reset of the system, or failure to unmount
when rebooting.



Re: noob Question: How to format a floppy on a USB floppy disk drive (on RPi 4) ?

2022-11-14 Thread Michael van Elst
On Mon, Nov 14, 2022 at 09:33:07AM -0800, Michael Cheponis wrote:
> *# scsictl sd1 format/dev/rsd1: device had unknown status 4*

Is there any other message (on console) ?

There are 3 cases that produce a 'status 4':

- "have short sense" (printed only with SCSI debugging)
- "passthrough: adapter inconsistency"
- "unknown error category %d from adapter"

Greetings,
-- 
        Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: noob Question: How to format a floppy on a USB floppy disk drive (on RPi 4) ?

2022-11-14 Thread Michael van Elst
michael.chepo...@gmail.com (Michael Cheponis) writes:

>I would think 'fdformat' would work, but...

>*arm64# ./fdformat -f /dev/rsd1
>*fdformat: Device `/dev/rsd1' does not support floppy formatting:
>Inappropriate ioctl for device*


Try 'scsictl sd1 format'.



Re: Used HDs

2022-11-11 Thread Michael van Elst
tgru...@gmail.com (Todd Gruhn) writes:

>WOW! 15+ years?

  9   10 no  online  positivePower-on hours count108926
  5 200  140 yes online  positiveReallocated sector count0

That's >12 years.

Part of the equation is that it's running almost continously at a rather
constant temperature.

  4 1000 no  online  positiveStart/stop count224
193 2000 no  online  positiveLoad cycle count86
194 1070 no  online  positiveTemperature 40


Numbers like "lifetime" are only statistics. You cannot predict how
long a specific drive lasts, only what lifetime you may expect
for a large set of drives.

It's mirror disk from the RAID started to fail after 4 years, the
replacement now runs for >7 years.



Re: building new kernel on upgraded system

2022-11-09 Thread Michael van Elst
r0l...@freemail.hu (r0ller) writes:

> Hi All,I've just tried to build a custom configured kernel on a
> system that was installed originally as 9.1 and later upgraded to
> 9.2 and 9.3. Executed in /usr/srcbuild.sh toolswhich ended successfully
> but the (beginning part of the) summary looks like:build.sh command:
> ./build.sh toolsbuild.sh started: Wed Nov 9 21:56:45 CET 2022NetBSD
> version: 9.1_STABLEMACHINE: amd64MACHINE_ARCH: x86_64Build platform:
> NetBSD 9.3 amd64HOST_SH: /bin/shWhat does NetBSD version 9.1_STABLE
> refer to? Weren't the system sources updated during the upgrades?
> Honestly, I cannot recall how I upgraded the system (sysinst/sysupgrade).In
> the end the question is: does that indicate that the custom kernel
> will be built from a 9.1 source when I issue 'build.sh
> kernel=MYKERNEL'?Thanks,r0ller


The system sources weren't updated. You could unpack the source sets to get
the release sources, but most people who build from sources prefer to track
the stable branch.

Here is the chapter from the guide that describes how you can fetch NetBSD 
sources:

https://www.netbsd.org/docs/guide/en/chap-fetch.html



Re: Adding files to the NetBSD source tree

2022-11-09 Thread Michael van Elst
stephan...@googlemail.com (Stephan) writes:

>Hallo,

>1) Put the header file into sys/sys in the source tree:
>2) Made sure it contains an (I think) RCS tag. 

RCS tags are maintained by the version control system. For most
parts these are just documentation and you either leave them out or
provide an "empty" template like "$NetBSD: $"



>./build.sh -u -U -m amd64 -a x86_64 -j4 release
...
>cd /home/stephan/src/distrib/sets &&
...
>Files in DESTDIR but missing from flist.


The release build uses explict file lists stored in src/distrib/sets/lists/
for checking the result of the build. You need to keep the file lists in
sync for everything that ends in the installation sets.

Machine independent system headers that should be installed go into the
'comp' set and the file list is therefore src/distrib/sets/lists/comp/mi.




Re: Does any common mortals here (not programmers or sysads) use NetBSD as their daily productivity driver?

2022-10-11 Thread Michael van Elst
bl...@internode.on.net (Brett Lymn) writes:

>On Wed, Sep 28, 2022 at 05:16:37PM +0530, Mayuresh wrote:
>> 
>> - Laptop touchpad behaving erratically. (Workaround is to use external
>>   mouse - if that is workable. However even little unintentional touch can
>>   irk the touchpad.)
>> 

>For this one can you please do the following:

>1) grep pms /var/run/dmesg.boot
>2) set hw.synaptics.debug=30  and do some simple movements that
>demonstrate the erratic behaviour.
>Send me the output from both (number 2 will be in the /var/log/messages)
>and I will have a look at what is going wrong.
>You can turn off the trackpad using hw.synaptics.movement_enable=0


I have fixed part of the synaptics code recently, but nothing has been
pulled up.



Re: Growing sshd process count

2022-10-08 Thread Michael van Elst
On Sat, Oct 08, 2022 at 07:51:48AM +0530, Mayuresh wrote:
> On Fri, Oct 07, 2022 at 02:14:09PM -0000, Michael van Elst wrote:
> > Someone is brute-forcing your account passwords.
> 
> Thanks. I think blacklistd is protecting me.
> 
> But doesn't this qualify as a DDOS attack? The VPS provider (Hetzner)
> claims to provide DDOS protection. Shouldn't it have triggered in this
> scenario?

No idea what kind of protection Hetzner is offering. But such attacks
rarely qualify as DDOS, it's usually a single bot that does rapid login
attempts. Sometimes you have several concurrent independent attacks.

If you have a slow machine, blacklistd might not be sufficient. The
login attempt times out before sshd can check the password and trigger
the blacklist entry.


Greetings,
-- 
            Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: Growing sshd process count

2022-10-07 Thread Michael van Elst
mayur...@acm.org (Mayuresh) writes:

>On NetBSD 9.2 amd64 VPS I noticed system slowness and top showed too many
>ssh processes - 49 to be precise.

>I have blacklistd enabled and approximately in every 2 to 3 minutes a new
>IP address is getting blocked.

>Using console access I stopped ssh service, killed sshd processes and
>restarted. As of writing this the count of sshd processes is 10 again,
>when only 2 ssh sessions are shown in `who'.

>What explains the count of these processes and what precautions shall I be
>taking?


Someone is brute-forcing your account passwords.

Easiest counter-measure is to use a different port for ssh. So far these
attacks go to the standard port (22).

You can also restrict access to known IPs, either by configuring sshd
(for example using /etc/hosts.allow, /etc/hosts.deny) or by adding a
permanent IP filter to block access and cloud providers world-wide.



Re: Multiple instances of the same mount point in fstab not possible? (want to layer multiple filesystems into one namespace via union mount option)

2022-09-24 Thread Michael van Elst
m...@petermann-it.de (Matthias Petermann) writes:

>NAME=data1 /export   ffs rw,log,union  0 0
>NAME=data2 /export   ffs rw,log,union  0 0
>NAME=data3 /export   ffs rw,log,union  0 0

>Here, only the first file system is mounted, the other two are ignored. 
>I suspect that multiple occurrences of the same mount point are not 
>supported in fstab.

It's a feature. mount -a skips filesystems that are already mounted,
so you don't get failures from the attempt to mount a filesystem twice.
(mount -A forces all mounts).

But your example has another issue, there is no information about the
order of mounts, so you may end with filesystems stacked incompletely
or even the wrong order.

The easiest is probably to declare the filesystem 'noauto' and add
a custom rc script that creates and removes your stacked filesystems.



Re: NetBSD iSCSI target on ZVOL used as block device for Qemu - iSCSI: NOP timeout

2022-09-19 Thread Michael van Elst
m...@petermann-it.de (Matthias Petermann) writes:

>Just out of interest - how can the state of the iscsi implementation in 
>NetBSD-Base be assessed in general? Is the implementation outdated 
>and/or unstable, or are there (compatibility?) reasons for this? 

There is a userland implementation (iscsi-target / iscsi-initiator)
that is basically the reference (or maybe example) code plus some
integration as userland filesystem.

The code lacks features and isn't compatible with other iscsi
implementations. It's stable but there is no development.


Then there is a the kernel iscsi initiator (iscsctl / iscsid).
It's more compatible, much faster, but probably still a little buggy.
Most bugs and fixes in the last years came from me.

I use the kernel iscsi initiator together with istgt or the Linux
iSCSI target.



>According to the description, isgt is the same as the FreeBSD iscsi 
>implementation. As far as I can tell, both target implementations run in 
>user space, i.e. operate on the same logical level, and neither can 
>claim any advantages, e.g. running directly in kernel space and thus 
>saving context switches.

There is no real reason to run the target in the kernel.



>Of course, I realise that there are more 
>important issues and that such a complex protocol does not port itself. 
>But would it be a far-future option to adopt the istgt implementation in 
>NetBSD-base?

Would probably be a good thing to drop the reference code and to adopt
istgt.





Re: NetBSD iSCSI target on ZVOL used as block device for Qemu - iSCSI: NOP timeout

2022-09-18 Thread Michael van Elst
m...@petermann-it.de (Matthias Petermann) writes:

>thanks for your suggestion. Do you mean this package:

>   http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/net/netbsd-iscsi-target/
>? I'm not sure if you mean this one, because the last change here was 9 
>years ago.

Use the net/istgt package.



Re: Build original Csh on Linux and FreeBSD.

2022-09-12 Thread Michael van Elst
h...@spg.tu-darmstadt.de (Hauke Fath) writes:

>[hf@Gstoder] ~ > csh
>[ 3270305.6523634] load: 0.23  cmd: csh 21649 [ttyraw] 0.00u 0.00s 0% 2252k

>Ah well...

Doesn't "hang", but doesn't prompt.

Despite

el_set(el, EL_PROMPT, printpromptstr);

the function printpromptstr isn't called.

When 'set edit' is executed in csh.cshrc the edit library
is initialized with:

el_init_fd (prog=0xff870a15 "csh", 
fin=0xfc46a63e1960 <__sF>, fout=0xfc46a63e19f8 <__sF+152>, 
ferr=0xfc46a63e1a90 <__sF+304>, fdin=3, fdout=17, fderr=18)

fdin=3 is the open csh.cshrc file.

When 'set edit' is used in the interactive shell it is called
with the real tty input descriptor:

el_init_fd (prog=0xffad8af5 "csh", 
fin=0xf04b446c1960 <__sF>, fout=0xf04b446c19f8 <__sF+152>, 
ferr=0xf04b446c1a90 <__sF+304>, fdin=16, fdout=17, fderr=18)




Re: Access FFS partition on GPT on ZVOL

2022-09-07 Thread Michael van Elst
m...@petermann-it.de (Matthias Petermann) writes:

>saturn$ doas dmsetup create net-export --table "34 2147483581 linear 
>/dev/zvol/rdsk/tank/backup/vhost/vol/net-export 0"
>create and load called

Please try:

--table "0 2147483581 linear /dev/zvol/dsk/tank/backup/vhost/vol/net-export 34"

left side is the offset + size of a chunk of your new mapped device

right side is the backing store (must be the block device) and the offset on 
the backing store.



Re: Qemu/nvmm - time in NetBSD guest system lags behind (with estd on host)

2022-09-04 Thread Michael van Elst
p...@whooppee.com (Paul Goyette) writes:

>You would have to modify the appropriate module's Makefile to add
>the HZ=1000 definition.

ZFS doesn't use HZ, but in osnet/sys/sys/time.h it uses a value hz=100
to compute the lbolt time.

Does this help ?

Index: external/cddl/osnet/sys/sys/time.h
===
RCS file: /cvsroot/src/external/cddl/osnet/sys/sys/time.h,v
retrieving revision 1.13
diff -p -u -r1.13 time.h
--- external/cddl/osnet/sys/sys/time.h  29 Aug 2021 08:43:12 -  1.13
+++ external/cddl/osnet/sys/sys/time.h  5 Sep 2022 05:28:33 -
@@ -82,7 +82,7 @@ static inline int64_t
 ddi_get_lbolt64(void)
 {
struct timespec ts;
-   const int hz = 100;
+   extern int hz;
 
getnanouptime();
return (int64_t)(SEC_TO_TICK(ts.tv_sec) + NSEC_TO_TICK(ts.tv_nsec));



Re: Access FFS partition on GPT on ZVOL

2022-09-03 Thread Michael van Elst
m...@petermann-it.de (Matthias Petermann) writes:

>saturn$ doas dkctl /dev/zvol/rdsk/tank/backup/vhost/vol/net-export=20
>addwedge myexport 34 2147483581 ffs
>dkctl: /dev/zvol/rdsk/tank/backup/vhost/vol/net-export: addwedge:=20
>Inappropriate ioctl for device

A zvol is no disk and doesn't support partitions or wedges.


>/dev/zvol/rdsk/tank/backup/vhost/vol/net-export
>ccdconfig: ioctl (CCDIOCSET): /dev/rccd0d: Block device required
>saturn$ doas ccdconfig -cv ccd0 0=20
>/dev/zvol/dsk/tank/backup/vhost/vol/net-export
>ccdconfig: ioctl (CCDIOCSET): /dev/rccd0d: Inappropriate ioctl for device=

ccd learned about wedges in 9.99.74, it wasn't pulled up to netbsd-9.


Maybe the diskmapper (LVM driver) can help, without LVM metadata you
need to manually create a mapping table and install it with 'dmsetup create'.



Re: newfs_msdos says vnconfiged device read-only, newfs doesn't say so

2022-08-08 Thread Michael van Elst
mayur...@acm.org (Mayuresh) writes:

>4 partitions:
>#sizeoffset fstype [fsize bsize cpg/sgs]
> a:   4194304 0 4.2BSD  0 0 0  # (Cyl.  0 -   
> 2047)
> d:   4194304 0 unused  0 0# (Cyl.  0 -   
> 2047)
>disklabel: boot block size 0
>disklabel: super block size 0

>newfs_msdos says it's read-only:

># newfs_msdos -F 32 /dev/rvnd0a
>/dev/rvnd0a: 4186096 sectors in 523262 FAT32 clusters (4096 bytes/cluster)
>MBR type: 11
>bps=512 spc=8 res=32 nft=2 mid=0xf0 spt=32 hds=64 hid=0 bsec=4194304 
> bspf=4088 rdcl=2 infs=1 bkbs=2
>newfs_msdos: /dev/rvnd0a: Read-only file system


Only the 'label sector' that would carry the BSD disklabel is write protected.
This is not a problem for ffs as it doesn't use the first sectors, but the
FAT filesystem does.

For regular hard drive images, this isn't a problem either, these use the
first sectors (usually the first track) for MBR and bootloaders, and
the BSD disklabel goes either there or into the first blocks of the
"NetBSD MBR partition".

But if you want to create an unpartitioned "super floppy" that only stores
the FAT filesystem, you cannot avoid the collision. I.e. you must never
write a disklabel, and you need to enable writes to the label sector with
something like:

disklabel -W vnd0

# newfs_msdos vnd0a
/dev/rvnd0a: 20424 sectors in 2553 FAT12 clusters (4096 bytes/cluster)
MBR type: 1
bps=512 spc=8 res=1 nft=2 rde=512 sec=20480 mid=0xf0 spf=8 spt=32 hds=64 hid=0
newfs_msdos: /dev/rvnd0a: Read-only file system
# disklabel -W vnd0
# newfs_msdos vnd0a
/dev/rvnd0a: 20424 sectors in 2553 FAT12 clusters (4096 bytes/cluster)
MBR type: 1
bps=512 spc=8 res=1 nft=2 rde=512 sec=20480 mid=0xf0 spf=8 spt=32 hds=64 hid=0


Without partitioning (and the proper partition type) you need to
specify the filesystem type when mounting.

# mount /dev/vnd0a /mnt
mount_ffs: /dev/vnd0a on /mnt: incorrect super block
# mount -t msdos /dev/vnd0a /mnt


N.B. enabling writes on the label sector is not persisent. Depending on
the filesystem layout, it can be possible to mount without writes being
enabled but subsequent filesystem operations may fail.

It's usually easier to use a partitioned hard disk image.



Re: PCIe --> NVMe adapters?

2022-07-16 Thread Michael van Elst
p...@whooppee.com (Paul Goyette) writes:

>Is anyone using such beasts on NetBSD?  For example, on a x86
>mothrboard that doesn't have an NVMe slot the adapter can convert
>an unused PCIe 3.0 x4 into an NVMe?

If it is a card for a single M.2 device, it's just wires.
If it is a card for multiple M.2 devices, it contains a PCI bridge
that may or may not be supported.

There is also a tiny chance you have an adapter that doesn't
actually pass through the PCIe lanes but is a SATA or USB
controller. Obviously that cannot talk to NVMe, but the M.2 slot
is then also supposed to be keyed to be incompatible with an
NVMe card.


>Anyone out there using one of these?  Does it work?  What does
>it's dmesg config info look like?

You don't see a card, just the NVME device as if the M.2 slot
would be on the motherboard.

 nvme0 at pci1 dev 0 function 0: vendor 144d product a802 (rev. 0x01)
 nvme0: NVMe 1.1
 nvme0: for admin queue interrupting at msix0 vec 0
 nvme0: Samsung SSD 950 PRO 512GB, firmware 1B0QBXX7, serial S2GMNXAH105150Z
 nvme0: for io queue 1 interrupting at msix0 vec 1 affinity to cpu0
 nvme0: for io queue 2 interrupting at msix0 vec 2 affinity to cpu1
 nvme0: for io queue 3 interrupting at msix0 vec 3 affinity to cpu2
 nvme0: for io queue 4 interrupting at msix0 vec 4 affinity to cpu3
 ld0 at nvme0 nsid 1




Re: Setting keyboard layout on xterm

2022-06-30 Thread Michael van Elst
dic...@his.com (Thomas Dickey) writes:

>NetBSD doesn't have any "in-tree" X applications (that's all from pkgsrc,
>which is supposedly distinct from src).

You will find "native" X in the xbase,xcomp,.. sets.



Re: how to limit /etc/daily to local only, and cleasring bad nfs

2022-06-18 Thread Michael van Elst
st...@prd.co.uk (Steve Blinkhorn) writes:

>Some off-list discussion has clarified matters.  The fundamental problem is 
>that nfs
>mounts are not restored automatically when an nfs server is rebooted - and that
>may happen automatically so the sysadmin is unaware.

Actually that's the opposite from what NFS does. When the server comes back, the
file operations will continue. I haven't seen anything else.


>The connection with /etc/daily (etc.) is that find(1) hangs when it encounters 
>a broken
>nfs mount point, gets stuck in tstile, and can't be killed.

Here a find gets stalled in nfscn2 when the NFS server goes down.

When mounted interruptibly (mount_nfs -i) you can kill the hanging operation, 
at least
the hanging find.

But interrupting is broken for other operations, e.g.:

A read will keep the client process stuck non-interruptibly in uvnfp2, waiting 
for
a page to become available.

A write hangs in nfsaio which can be interrupted, but the process will then hang
on exit as it waits for a synchronous close to succeed. The close operation
requires the ioflush kernel thread to complete outstanding I/Os, and ioflush 
will
be stuck in nfsrcv. The hanging ioflush will also impact all other I/O 
operations
in the system.



Re: how to limit /etc/daily to local only, and cleasring bad nfs mounts

2022-06-18 Thread Michael van Elst
mpumf...@mudcovered.org.uk (Mike Pumford) writes:

>I've got 2 BSD system both 9.2-STABLE one of which provides an NFS /home 
>and a few other odd paths as well to the other. The /etc/daily process 
>on the client isn't scanning the server filesystems in my setup and I'm 
>not aware of any specific setting I had to turn on to get that behaviour.

find will lstat() the mountpoint and decide not to enter it. The lstat()
operation however may hang if the NFS server is down.

Depending on mount options, it will either time out (soft mount) or
wait indefinitely for the server to come back (hard mount). You need
to mount interruptibly, so that you can kill the client process,
otherwise it may be stuck until reboot like with a damaged hard drive.

The default is a hard, but non-interruptible mount.



Re: Disk label problem?

2022-06-14 Thread Michael van Elst
tsp...@talent-free-studios.com (Ted Spradley) writes:

>As long as it's the only disk attached this boots up and works fine:
>But if there is any other drive attached, that other drive gets mounted as 
>root (apparently).

What is on that other drive ?

Here is a rough description of the default boot process:

1. BIOS reads the MBR, usually a BIOS setting that identifies from which drive 
that is read.
2. The secondary bootloaders are read from the same drive.
3. The kernel is usually read from the same drive.
4. The kernel tries to guess what the root partition is, usually by identifying 
the partition bootblock.

So "that other drive gets mounted as root" may mean that BIOS boots
from it, or that it gets misidentified by the kernel. The latter
can happen if it is (to some degree) a copy of the first drive.



Re: Strange formatting of literal block in bc(1) man page

2022-05-26 Thread Michael van Elst
p...@whooppee.com (Paul Goyette) writes:

>   define py (y) { print "--->", y, "<---", "\n"; }

>define py (y) { print "--->", y, "<---", "0; }

   Backslashes
 To include a literal backslash (\) into the output, use the (\e)
 escape sequence.

 Note that doubling it (\\) is not the right way to output a backslash.
 Because mandoc(1) does not implement full roff(7) functionality, it may
 work with mandoc(1), but it may have weird effects on complete roff(7)
 implementations.

The sequence \n" retrieves the numeric register named ", which probably
isn't used and has the value 0.



Re: Intermittent loss of connectivity while with iwm

2022-04-29 Thread Michael van Elst
bsd...@gmail.com (Salil Wadnerkar) writes:

>--f839dd05ddcb7a0c
>Content-Type: text/plain; charset="UTF-8"

>Hi,

>My laptop has `Intel Dual Band Wireless AC 8265`, and I get
>`autoconfiguration error: pms_enable` for this device, and lose
>connectivity. I observed this on NetBSD 9.2 first, and I thought upgrading
>to -current will solve the problem. But, the issue is the same.

Funny thing. 'pms_enable' comes from the PS/2 driver trying to
probe for a PS/2 mouse.

Apparently you do not have a (working) PS/2 interface which causes
these messages. These probes also needs time and maybe that interferes
with the iwm driver.

You can try to disable the PS/2 driver to avoid the errors,
but this doesn't mean that this solves the iwm problem.

You can put
  
userconf=disable pckbc*
userconf=disable pckbd*
userconf=disable pms*

into /boot.cfg to disable PS/2 controller, PS/2 keyboard, PS/2 mouse.



Re: unrecognized root device and kernel panic during 9.2 amd64 installation

2022-04-29 Thread Michael van Elst
ti...@seco.ws (Tiago Seco) writes:

>I'm trying to install via the NetBSD-9.2-amd64-install.img image, and 
>the root device is not recognized:

>https://imgur.com/a/uqHgZNV

>If I press `enter` I get the following suggested options:
>https://imgur.com/a/glrU9JY

Looks like 'dk1' is the correct one (the only one of type ffs).

The NetBSD bootloader should pass that information to the kernel, but
maybe you try something else (there is a ext2fs filesystem) and need
to configure a different bootloader ?

This also looks like a UEFI boot (EFI partition exists, a GPT is used)
and UEFI could have an issue. In that case you can add information
to the boot.cfg file to tell the kernel where the root disk is.


>However, if I press `enter` a few more times, I get a kernel panic:
>https://imgur.com/a/tKNowDP

>I don't know if these issues are related, or how I should proceed with 
>either the installation or further debug.

Doesn't look related. The latter looks like a bug in the USB stack.



Greetings,



Re: Couldn't boot NetBSD-9.2-amd64-install.img on bhyve VM

2022-04-20 Thread Michael van Elst
u...@e-yuuki.org (Yuuki Enomoto) writes:

># gpt create -p 128 ld0
>gpt: /dev/rld0: Media size can't be 0


The media size is read as:

ld->sc_secperunit = virtio_read_device_config_8(vsc,
VIRTIO_BLK_CONFIG_CAPACITY) / (ld->sc_secsize / VIRTIO_BLK_BSIZE);

So the host appears to send a size of zero.



Re: NetBSD-Archive down?

2022-04-15 Thread Michael van Elst
mdehl...@gmail.com (Malte Dehling) writes:

>;; ANSWER SECTION:
>archive.netbsd.org. 1603IN  CNAME
>dualstack.o.ssl.global.fastly.net.
>dualstack.o.ssl.global.fastly.net. 30 IN A  151.101.1.6
>dualstack.o.ssl.global.fastly.net. 30 IN A  151.101.65.6
>dualstack.o.ssl.global.fastly.net. 30 IN A  151.101.129.6
>dualstack.o.ssl.global.fastly.net. 30 IN A  151.101.193.6

All these CDN servers answer successfully from here and also
from California (San Jose).

For a quick test you can use something like:

curl -v --proxy '' --resolve archive.netbsd.org:443:151.101.1.6 
https://archive.netbsd.org

Either the problem is gone by now or it's more a local (or local provider)
issue.



Re: how to install a Fortran compiler on NetBSD?

2022-04-01 Thread Michael van Elst
ac.russ...@live.com (Adam Russell) writes:

>There doesn't seem to be a fortran compiler available in pkgsrc? I saw
>some mentions of gfortran but that must be out of date information as I
>cannot find it. I understand, of course, that gfortran is part of the
>gcc suite but that doesn't help me as I cannot seem to grasp how to
>specify it should be installed.

>How do you get a fortran compiler on NetBSD?

The gcc packages (GNU Compiler Collection) also include the gfortran frontend.




Re: restore super block? recover missing data?

2022-03-20 Thread Michael van Elst
r...@reedmedia.net ("Jeremy C. Reed") writes:

>FFSv2 sb at 2176 size 623508480, last mounted on 
>FFSv2 sb at 2240 size 623508480, last mounted on /


One more thing. Since the first superblock is found, it might be
still ok and you only need to recover the disklabel (and handle the
bad blocks that started everything).




  1   2   3   4   5   6   >