04:02:14 How do I have a rc service file change the working directory? 04:07:45 tuaris: cd ? 04:27:18 Ah, I remembered about `_chdir`. I tried that once in rc.conf, but it didn't work. I think that variable can only be set in the service script/ 06:15:49 tuaris, What rc script are you talking about? It would help if we knew and then could look at it. 06:16:20 I found what I needed: https://man.freebsd.org/cgi/man.cgi?query=rc.subr&sektion=8&format=html 06:17:36 Woot! 08:14:30 i can run ping from my user account, but when i run a some ping code using a ping lib i get an error Protocol not supported (os error 43) any clue what's causing that? 08:42:05 i tried some other ping code from my 14.3 user account and it errors saying permissiondenied operation not permitted 08:42:14 but i can run `ping` and it works 08:43:22 kerneldove: the system ping runs as root. you need to be root to access SOCK_RAW afaik 08:44:47 what's the difference between system ping and `ping` bin that i run as regular user? 08:45:27 system ping runs as root afaik 08:46:50 i.e. if you copy system ping somewhere and make it owned by your user, you will get the error 08:47:49 true. /sbin/ping is setuid-root 08:52:41 https://docs.rs/surge-ping/latest/src/surge_ping/config.rs.html#20-29 is the code i'm trying to use 09:01:00 i don't need to be root to ping using dgram right? 09:02:14 if you can, try running your program as root and see what it does 09:06:26 kerneldove: normally, you need to be root to open a raw sockets (that traditional /sbin/ping uses) 09:06:57 i ran it as sudo and it worked as expected 09:07:14 otis ya but i can run `ping` and it works fine, so it must not be sending raw? 09:09:36 kerneldove: when you 'ls -l /sbin/ping' you'll see a 's' field, which causes the program to run as root 09:11:45 ya but i don't run sudo ping, i just run ping, and it works 09:11:50 am i misunderstanding? 09:12:34 kerneldove: https://en.wikipedia.org/wiki/Setuid 09:15:28 so the setuid bit means any regular user can run it, and when it runs it runs as root? 09:15:39 yes 09:15:54 ok so there's actually no way for freebsd users to send pings unprivileged? 09:16:48 no, because you need a raw socket for that and only root can open raw sockets 09:17:18 i read that to send unprivileged pings, you can send a dgram ping, but that's not true? 09:17:23 dgram instead of raw 09:17:48 do you mean UDP echo aka what Windows used to use by default 09:18:01 not sure but maybe 09:19:05 ya looks like it 09:19:21 it's not enabled by default 09:19:21 is there any way to enable that so unprivileged users can ping? 09:19:28 how can i enable it? 09:21:04 you shouldn't 09:21:17 why not? 09:21:24 you'd have to drop the privileged ports restriction almost entirely 09:22:09 well how am i going to make a ping bin in rust that runs unpriv? 09:22:23 the answer is you don't 09:22:50 im making a server monitor tho 09:23:05 i need to test reachability 09:23:29 does ssh have ping built in? 09:27:05 no 09:27:12 so what do i do? 09:36:03 Remilia? 09:37:06 do what everyone else does, spawn a new process running a laser-focussed SUID binary 09:37:31 why are you asking me? look at munin, nagios, etc. 09:37:49 ugh i dont wanna run privileged 09:38:07 you don't want to read 09:38:35 no i heard you it just makes me sad 09:40:11 I'm not sure why executing a tiny SUID binary made purely to do ECHO requests makes you sad 09:40:54 you could either do that, or compromise your system by setting privileged port limit to something like 6 09:41:25 which would let any user listen on ports like 25, 53, 80, 443, and so on 09:41:58 UDP echo requires port 7 and UDP echo responses are not enabled by default 09:43:05 if i have a tiny setuid binary for doing ping, i'd just have my program run the system `ping` and parse its output 09:43:26 like it's great that you want to use UDP datagrams to ping stuff, but have you considered that the hosts you ping need to have inetd running and the echo service enabled in inetd.conf? 09:43:42 another idea is i could use the ssh connection to each server that my tool will initiate, send a message over the ssh connection and time how long it takes to get output? 09:43:56 TCP is slow 09:44:25 though if your host listens on a given port, you could TCP connect and time it 09:45:05 it'll still extremely unreliable for timing, of course 09:45:08 be* 09:47:52 i wonder if `ping` supports libxo so i could take json output 09:49:20 doesn't look like it from man page 09:49:22 dang 09:49:39 so i gotta parse the output for "time=x" 09:49:43 ugh 09:54:15 implement your own ping tool and SUID it 09:54:49 but then i just need to parse its output so what's the difference from parsing output of system ping bin? 09:55:11 make it output in json so i can parse its output easier? 09:55:20 yours might give you more options and produce JSON or whatever you prefer 09:55:44 ya hm i might need to do that 09:55:45 for example it could take a list of hosts 10:13:27 ok ty i'll think it over. maybe i can get away with scrapping ping, and just make reachability based on if it can establish an ssh connection and if that later disconnects and fails to reconnect 17:42:56 is there any way to allow unprivileged user accounts to send raw sockets so they can ping without setuid root? looks like jail has that but not base system? 17:47:14 jails do not support that, the allow raw sockets option for jails only allows it for root 17:47:39 ahh ok, dang 17:48:08 Are BSD Apps cross platform ? 17:50:10 maccampus: what do you mean by "BSD Apps"? 17:50:57 things you can open & run & do things BSD doesn't do by its own ? 17:51:28 Firefox 17:51:34 so you mean third-party applications like vim, or KDE? those generally also run on other platforms, yes 17:51:55 it would be quite odd if Firefox only ran on FreeBSD 17:52:42 most third party programmes are built against POSIX, not Linux or FreeBSD; POSIX is the common standard to which both operating systems adhere, meaning programmes written to it can compile with minimal, nowadays automatically-done, modifications 17:52:47 yes but obvious Linux Firefox will not work, but will FreeBSD Firefox work on NetBSD ? 17:52:52 nope 17:52:55 no 17:53:01 have to build it separately for each of the BSDs 17:53:42 And why is that, on linux it works on multiple distro's 17:54:03 FreeBSD and NetBSD are not "distros", they are completely separate operating systems 17:54:38 the only connection is that they are both descended from 4.4BSD, which was released in 1992. a lot has changed in 30 years 17:55:38 Same about linux they all desend from the thing that Swidish guy made, and a lot has changed the last 20 years too 17:56:18 maccampus: Linux distros don't "descent" from the Linux kernel, they *are* Linux. they all use the same kernel. 17:56:23 different linux distros all share the same kernel ABI, and generally all include GNU libc. BSDs each have their own kernel and libc. 17:57:22 So why did you never decide to use the same Kernel ? 17:58:13 what would be the point? 17:58:51 a lot of source code is shared between the various BSD forks, but binary compatibility would be a huge amount of effort for very little gain 18:01:28 Because then one could switch distro when one's preferences and needs changed, want to be mainline, want to be secure, want to be open (nah no point in that changing platform will brake applications anyway) 18:02:24 A bit like asking why an x86 binary won't run on ARM, you need the binary compiled for your platform 18:03:00 thats why i said nah on the OpenBSD see above 18:03:54 again, the BSD forks are not "distros", they are completely separate operating systems 18:03:56 But thee is that OS that manages just that 18:04:17 They call is UB2, UB & FAT 18:04:40 A third party application built on one Linux distribution isn't guaranteed to work on another. 18:05:18 then i was lucky so far 18:05:25 you may as well why why FreeBSD doesn't have binary compatibility with Solaris so you can switfch OS as your preferences change 18:05:39 sure, in theory it would be possible to implement that, but it's a huge amount of work for very little benefit 18:05:41 it instaled on 3 distro's and worked 18:06:03 Great, whatever "it" is. 18:06:15 Firefox 18:07:03 Ubuntu, Fedora and even RHEL all build firefox differently. If you happened to copy the firefox binary from Ubuntu and got it working on RHEL, that is amazing indeed. 18:08:21 good god 18:08:47 how old are you, maccampus ? and how long have you been involved in computers at this level? 18:14:59 TommyC: well, RPMs generally work across RH-derived distros just as if it's .deb it will *probably* work on Debian-derived 18:15:09 you can't just copy the Firefox binary after all 18:15:34 Copying binaries between systems, I've done it too on my first 8-bit pc :) 18:16:26 divlamir: I think binaries would generally work between CP/M, MP/M, and MSX-DOS, though for the latter you'd need to do some patching iirc 18:17:28 the OS was very little, in those days 18:17:34 UNIX operating systems are a lot more 18:17:39 oh but Turbo Pascal 3.0 for CP/M, as an example, would fail to give you command line arguments if you compile on MSX-DOS 18:18:06 there was Pascal/TURBO+ which was a clone of TP3 I think 18:18:50 Llampec: yeah it's like trying to copy an OS/2 binary to Windows and expecting it to work 18:19:03 (note: a Windows 3.x binary will run on OS/2 Warp 3.0) 18:19:07 Remilia: I'm aware. 18:20:25 Remilia: Truth is I don't believe that maccampus got a binary copied from to and got it working unless the copied-from distro used the Mozilla-provided static firefox binary. 18:20:29 actually what if you compile Firefox as an entirely static binary? that would theoretically work on every Linux distro as long as syscalls are fine 18:21:55 lol, that would be a fat one :) 18:29:06 Remilia: or compile it normally but ship the shared libraries with the binary 18:29:39 ivy: I guess if you install it in something like /opt 18:29:46 it would be easy to move around 18:29:46 my brain is full of cursed nonsense 18:30:15 provided the appropriate namespace 18:30:28 there could be the remote psosibility of conflicts 18:36:25 Is it possible to convert a FreeBSD installation from BIOS to UEFI? The system supports both. 18:38:05 I can see no reason it would not be. 18:38:37 This is what gpart show is: https://bin.morante.net/?c4b5668c2ae52def#3EakJoHWPmLKarjLUKwuEdSjngN8YUHLMgp9gLccmYqJ 18:39:56 I'd have to add an efi partition, wouldn't I? 18:51:41 tuaris: if you are already using GPT this is somewhat easy, even if you do not have an EFI partition 18:53:11 tuaris: you have a 512K partition of type freebsd-boot; delete that and create a 512K EFI partition instead, the loader will fit 18:53:52 tuaris: https://pastee.dev/p/LH0o4rgS from my scratchpad 18:54:17 double check indices, device names, etc. 18:54:21 Remilia: are you sure? the 15.0 amd64 EFI loader is 647KB 18:54:26 oh 18:55:15 I guess things changed since 13 18:55:33 can't cheat any more 18:55:35 i would suggest reducing the size of the swap partition to create an EFI partition 18:55:58 and delete the freebsd-boot partition at the same time 18:56:11 I can expand the volume. It's a VM. 18:56:43 if you can expand the volume, just add another 256MB or something and create an EFI partition there, that's probably the easiest way 18:57:01 Oh, it doesn't have to be at the start? 18:57:16 it does not, it only needs to have the 'efi' partition type and the firmware will find it 18:57:24 oo, interesting 18:59:34 well... the quality of EFI firmwares does vary and i could imagine a firmware that requires the partition to be at the start of the disk 18:59:45 but it *shouldn't* require that 19:00:18 EFI needs to be formated as FAT, correct? 19:00:39 yes, use newfs_msdos(8) 19:01:16 if it's a VM you probably have that open source EFI thing which definitely does not care about where the partition is 19:01:28 EDK-II, yeah 19:01:47 Then I just mounnt it and "cp /boot/loader.efi /mnt/efi/efi/freebsd/loader.efi " 19:01:56 or something like that 19:02:16 you'd need to set EFI boot variables for that to work 19:02:16 This should be a fun experiment 19:02:18 tuaris: i recommend placing the loader in \EFI\BOOT\BOOTX64.EFI, this is the most compatible path 19:02:24 ^ this 19:02:31 tuaris: so if it's mounted on /mnt/efi, then /mnt/efi/efi/boot/bootx64.efi 19:03:10 cool, let me do a backup of my VM, then I'll give this a try. 19:04:04 what annoys me is that the UEFI firmware for apu4d4 is borked so I am stuck with gptzfsboot 19:04:49 like, it boots and works but the watchdog timer triggers every hour :D 19:05:07 Remilia: that sounds weird and annoying 19:05:21 can you not disable the watchdog? 19:05:32 ivy: it's in the firmware and it just hard resets the system 19:05:39 known issue 19:05:39 hm 19:05:48 does it need a driver? or is it just a firmware bug? 19:06:10 I'd tell you more but I last poked it in late 2019 19:06:37 and I cannot poke it now because there's 2000+ km between me and the router, and there is no one who can console into it to fix 19:08:32 ivy: apparently it does need a driver and you can disable it at firmware compile time now... 19:41:43 I think NetBSD will greatly benefit from all SciTECO power users that are now considering switching to NetBSD. 19:42:07 Oops, wrong channel. Sorry. 19:43:12 shit happens 19:48:41 Thought about it and decided that I'd probably want to move the swap to the end in case I ever need to grow my ZFS partition. So this is what I ended up with: https://bin.morante.net/?ac7ac36869c9eb70#C7CKvyUEXzXoiY2LKvCpwyLiyRZtGcaei9uBFQNu97JC 19:49:15 it wasts about 2GB, but that's not a big deal 19:54:52 Okay, the loader is in place: https://bin.morante.net/?ef9ece2594158db7#9WuBtKy1VnZTD514f79Vvu2wQquymQ3x8YHmq73e3Chr 19:55:21 What do I need to do for this? "set EFI boot variables for that to work" 19:55:31 nothing 19:56:04 remilia's comment about EFI vars was if you did not use \EFI\BOOT\BOOTX64.EFI as the loader path 19:56:11 but since you did, it should it detected automatically 19:56:40 ah okay. So I'll just reconfigure the vm to boot with UEFI and see if it works. 19:56:44 lets see... 20:02:13 wow, it booted 20:02:37 I'll post some links to before/after vids 20:03:11 btw, your pastebin site's TLS certificate is not trusted by Firefox 20:03:27 yeah I know :) 20:09:05 You know what's interesting... I forgot to update the swap entry in fstab. The system didn't complain at all and swapinfo says the device is activated 20:20:21 what about swap size? 20:29:00 It was showing something small, but usage was 0, so I wonder if it was going to just write to the EFI partition. I turned off swap and fixed it asap 20:34:12 writing to EFI can be bad news (I hope it didn't). Next boot will tell. 20:34:25 it didn't. It booted up fine 20:35:07 The before and after videos: https://download.morante.net/unibia/screenshots/freebsd/VM-FreeBSD-BIOS-Boot.mkv and https://download.morante.net/unibia/screenshots/freebsd/VM-FreeBSD-UEFI-Boot.mkv 20:36:08 great. Apologies for interrupting a constructive conversation. 20:37:14 Oops, -current pkg repos are currently almost empty.. :D 20:38:01 Ltning: they did a special build for re@ containing only the packages required to build the snapshots, the next build will include all packages again 20:39:16 Yea I almost did pkg upgrade -y here. Would have been fun. But anything to get snapshots and release building :D 23:42:26 In editline I can use `bind -v` to set vi mode. Is there a way to display a mode indicator prompt?