-
tuaris
How do I have a rc service file change the working directory?
-
TommyC
tuaris: cd ?
-
tuaris
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/
-
rwp
tuaris, What rc script are you talking about? It would help if we knew and then could look at it.
-
tuaris
-
rwp
Woot!
-
kerneldove
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?
-
kerneldove
i tried some other ping code from my 14.3 user account and it errors saying permissiondenied operation not permitted
-
kerneldove
but i can run `ping` and it works
-
bradd
kerneldove: the system ping runs as root. you need to be root to access SOCK_RAW afaik
-
kerneldove
what's the difference between system ping and `ping` bin that i run as regular user?
-
bradd
system ping runs as root afaik
-
bradd
i.e. if you copy system ping somewhere and make it owned by your user, you will get the error
-
otis
true. /sbin/ping is setuid-root
-
kerneldove
-
kerneldove
i don't need to be root to ping using dgram right?
-
bradd
if you can, try running your program as root and see what it does
-
otis
kerneldove: normally, you need to be root to open a raw sockets (that traditional /sbin/ping uses)
-
kerneldove
i ran it as sudo and it worked as expected
-
kerneldove
otis ya but i can run `ping` and it works fine, so it must not be sending raw?
-
bradd
kerneldove: when you 'ls -l /sbin/ping' you'll see a 's' field, which causes the program to run as root
-
kerneldove
ya but i don't run sudo ping, i just run ping, and it works
-
kerneldove
am i misunderstanding?
-
ivy
-
kerneldove
so the setuid bit means any regular user can run it, and when it runs it runs as root?
-
ivy
yes
-
kerneldove
ok so there's actually no way for freebsd users to send pings unprivileged?
-
ivy
no, because you need a raw socket for that and only root can open raw sockets
-
kerneldove
i read that to send unprivileged pings, you can send a dgram ping, but that's not true?
-
kerneldove
dgram instead of raw
-
Remilia
do you mean UDP echo aka what Windows used to use by default
-
kerneldove
not sure but maybe
-
kerneldove
ya looks like it
-
Remilia
it's not enabled by default
-
kerneldove
is there any way to enable that so unprivileged users can ping?
-
kerneldove
how can i enable it?
-
Remilia
you shouldn't
-
kerneldove
why not?
-
Remilia
you'd have to drop the privileged ports restriction almost entirely
-
kerneldove
well how am i going to make a ping bin in rust that runs unpriv?
-
Remilia
the answer is you don't
-
kerneldove
im making a server monitor tho
-
kerneldove
i need to test reachability
-
kerneldove
does ssh have ping built in?
-
kerneldove
no
-
kerneldove
so what do i do?
-
kerneldove
Remilia?
-
Remilia
do what everyone else does, spawn a new process running a laser-focussed SUID binary
-
Remilia
why are you asking me? look at munin, nagios, etc.
-
kerneldove
ugh i dont wanna run privileged
-
Remilia
you don't want to read
-
kerneldove
no i heard you it just makes me sad
-
Remilia
I'm not sure why executing a tiny SUID binary made purely to do ECHO requests makes you sad
-
Remilia
you could either do that, or compromise your system by setting privileged port limit to something like 6
-
Remilia
which would let any user listen on ports like 25, 53, 80, 443, and so on
-
Remilia
UDP echo requires port 7 and UDP echo responses are not enabled by default
-
kerneldove
if i have a tiny setuid binary for doing ping, i'd just have my program run the system `ping` and parse its output
-
Remilia
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?
-
kerneldove
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?
-
Remilia
TCP is slow
-
Remilia
though if your host listens on a given port, you could TCP connect and time it
-
Remilia
it'll still extremely unreliable for timing, of course
-
Remilia
be*
-
kerneldove
i wonder if `ping` supports libxo so i could take json output
-
kerneldove
doesn't look like it from man page
-
kerneldove
dang
-
kerneldove
so i gotta parse the output for "time=x"
-
kerneldove
ugh
-
Remilia
implement your own ping tool and SUID it
-
kerneldove
but then i just need to parse its output so what's the difference from parsing output of system ping bin?
-
kerneldove
make it output in json so i can parse its output easier?
-
Remilia
yours might give you more options and produce JSON or whatever you prefer
-
kerneldove
ya hm i might need to do that
-
Remilia
for example it could take a list of hosts
-
kerneldove
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
-
kerneldove
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?
-
ivy
jails do not support that, the allow raw sockets option for jails only allows it for root
-
kerneldove
ahh ok, dang
-
maccampus
Are BSD Apps cross platform ?
-
ivy
maccampus: what do you mean by "BSD Apps"?
-
maccampus
things you can open & run & do things BSD doesn't do by its own ?
-
maccampus
Firefox
-
ivy
so you mean third-party applications like vim, or KDE? those generally also run on other platforms, yes
-
ivy
it would be quite odd if Firefox only ran on FreeBSD
-
Llampec
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
-
maccampus
yes but obvious Linux Firefox will not work, but will FreeBSD Firefox work on NetBSD ?
-
Llampec
nope
-
TommyC
no
-
Llampec
have to build it separately for each of the BSDs
-
maccampus
And why is that, on linux it works on multiple distro's
-
ivy
FreeBSD and NetBSD are not "distros", they are completely separate operating systems
-
ivy
the only connection is that they are both descended from 4.4BSD, which was released in 1992. a lot has changed in 30 years
-
maccampus
Same about linux they all desend from the thing that Swidish guy made, and a lot has changed the last 20 years too
-
ivy
maccampus: Linux distros don't "descent" from the Linux kernel, they *are* Linux. they all use the same kernel.
-
batdog
different linux distros all share the same kernel ABI, and generally all include GNU libc. BSDs each have their own kernel and libc.
-
maccampus
So why did you never decide to use the same Kernel ?
-
ivy
what would be the point?
-
ivy
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
-
maccampus
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)
-
divlamir
A bit like asking why an x86 binary won't run on ARM, you need the binary compiled for your platform
-
maccampus
thats why i said nah on the OpenBSD see above
-
ivy
again, the BSD forks are not "distros", they are completely separate operating systems
-
maccampus
But thee is that OS that manages just that
-
maccampus
They call is UB2, UB & FAT
-
TommyC
A third party application built on one Linux distribution isn't guaranteed to work on another.
-
maccampus
then i was lucky so far
-
ivy
you may as well why why FreeBSD doesn't have binary compatibility with Solaris so you can switfch OS as your preferences change
-
ivy
sure, in theory it would be possible to implement that, but it's a huge amount of work for very little benefit
-
maccampus
it instaled on 3 distro's and worked
-
TommyC
Great, whatever "it" is.
-
maccampus
Firefox
-
TommyC
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.
-
Llampec
good god
-
Llampec
how old are you, maccampus ? and how long have you been involved in computers at this level?
-
Remilia
TommyC: well, RPMs generally work across RH-derived distros just as if it's .deb it will *probably* work on Debian-derived
-
Remilia
you can't just copy the Firefox binary after all
-
divlamir
Copying binaries between systems, I've done it too on my first 8-bit pc :)
-
Remilia
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
-
Llampec
the OS was very little, in those days
-
Llampec
UNIX operating systems are a lot more
-
Remilia
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
-
Remilia
there was Pascal/TURBO+ which was a clone of TP3 I think
-
Remilia
Llampec: yeah it's like trying to copy an OS/2 binary to Windows and expecting it to work
-
Remilia
(note: a Windows 3.x binary will run on OS/2 Warp 3.0)
-
TommyC
Remilia: I'm aware.
-
TommyC
Remilia: Truth is I don't believe that maccampus got a binary copied from <insert very different distro A> to <insert very different distro B> and got it working unless the copied-from distro used the Mozilla-provided static firefox binary.
-
Remilia
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
-
divlamir
lol, that would be a fat one :)
-
ivy
Remilia: or compile it normally but ship the shared libraries with the binary
-
Remilia
ivy: I guess if you install it in something like /opt
-
Remilia
it would be easy to move around
-
Llampec
my brain is full of cursed nonsense
-
Llampec
provided the appropriate namespace
-
Llampec
there could be the remote psosibility of conflicts
-
tuaris
Is it possible to convert a FreeBSD installation from BIOS to UEFI? The system supports both.
-
Llampec
I can see no reason it would not be.
-
tuaris
-
tuaris
I'd have to add an efi partition, wouldn't I?
-
Remilia
tuaris: if you are already using GPT this is somewhat easy, even if you do not have an EFI partition
-
Remilia
tuaris: you have a 512K partition of type freebsd-boot; delete that and create a 512K EFI partition instead, the loader will fit
-
Remilia
tuaris:
pastee.dev/p/LH0o4rgS from my scratchpad
-
Remilia
double check indices, device names, etc.
-
ivy
Remilia: are you sure? the 15.0 amd64 EFI loader is 647KB
-
Remilia
oh
-
Remilia
I guess things changed since 13
-
Remilia
can't cheat any more
-
ivy
i would suggest reducing the size of the swap partition to create an EFI partition
-
ivy
and delete the freebsd-boot partition at the same time
-
tuaris
I can expand the volume. It's a VM.
-
ivy
if you can expand the volume, just add another 256MB or something and create an EFI partition there, that's probably the easiest way
-
tuaris
Oh, it doesn't have to be at the start?
-
ivy
it does not, it only needs to have the 'efi' partition type and the firmware will find it
-
tuaris
oo, interesting
-
ivy
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
-
ivy
but it *shouldn't* require that
-
tuaris
EFI needs to be formated as FAT, correct?
-
ivy
yes, use newfs_msdos(8)
-
Remilia
if it's a VM you probably have that open source EFI thing which definitely does not care about where the partition is
-
ivy
EDK-II, yeah
-
tuaris
Then I just mounnt it and "cp /boot/loader.efi /mnt/efi/efi/freebsd/loader.efi "
-
tuaris
or something like that
-
Remilia
you'd need to set EFI boot variables for that to work
-
tuaris
This should be a fun experiment
-
ivy
tuaris: i recommend placing the loader in \EFI\BOOT\BOOTX64.EFI, this is the most compatible path
-
Remilia
^ this
-
ivy
tuaris: so if it's mounted on /mnt/efi, then /mnt/efi/efi/boot/bootx64.efi
-
tuaris
cool, let me do a backup of my VM, then I'll give this a try.
-
Remilia
what annoys me is that the UEFI firmware for apu4d4 is borked so I am stuck with gptzfsboot
-
Remilia
like, it boots and works but the watchdog timer triggers every hour :D
-
ivy
Remilia: that sounds weird and annoying
-
ivy
can you not disable the watchdog?
-
Remilia
ivy: it's in the firmware and it just hard resets the system
-
Remilia
known issue
-
ivy
hm
-
ivy
does it need a driver? or is it just a firmware bug?
-
Remilia
I'd tell you more but I last poked it in late 2019
-
Remilia
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
-
Remilia
ivy: apparently it does need a driver and you can disable it at firmware compile time now...
-
rhaberkorn
I think NetBSD will greatly benefit from all SciTECO power users that are now considering switching to NetBSD.
-
rhaberkorn
Oops, wrong channel. Sorry.
-
flatdog
shit happens
-
tuaris
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:
bin.morante.net/?ac7ac36869c9eb70#C…zXoiY2LKvCpwyLiyRZtGcaei9uBFQNu97JC
-
tuaris
it wasts about 2GB, but that's not a big deal
-
tuaris
-
tuaris
What do I need to do for this? "set EFI boot variables for that to work"
-
ivy
nothing
-
ivy
remilia's comment about EFI vars was if you did not use \EFI\BOOT\BOOTX64.EFI as the loader path
-
ivy
but since you did, it should it detected automatically
-
tuaris
ah okay. So I'll just reconfigure the vm to boot with UEFI and see if it works.
-
tuaris
lets see...
-
tuaris
wow, it booted
-
tuaris
I'll post some links to before/after vids
-
ivy
btw, your pastebin site's TLS certificate is not trusted by Firefox
-
tuaris
yeah I know :)
-
tuaris
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
-
flatdog
what about swap size?
-
tuaris
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
-
flatdog
writing to EFI can be bad news (I hope it didn't). Next boot will tell.
-
tuaris
it didn't. It booted up fine
-
tuaris
-
flatdog
great. Apologies for interrupting a constructive conversation.
-
Ltning
Oops, -current pkg repos are currently almost empty.. :D
-
ivy
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
-
Ltning
Yea I almost did pkg upgrade -y here. Would have been fun. But anything to get snapshots and release building :D
-
topcat001
In editline I can use `bind -v` to set vi mode. Is there a way to display a mode indicator prompt?