OpenBSD

Post Reply
user1111

OpenBSD

Post by user1111 »

Fatdog to boot, OpenBSD run in a kvm/qemu ... to browse

s.jpg
s.jpg (79.97 KiB) Viewed 604 times

Image is the kvm/qemu booted OpenBSD, full-screen, with the choice of jwm window manager and rox desktop installed.

A great combo IMO as you can boot/run the OpenBSD using snapshot. where all changes are lost at shutdown. So a pristine/clean desktop/system at each reboot.

OpenBSD sets up the correct partitioning and permissions, along with also having pledge and unveil ... that further restrict programs to what they can run/see/do, and better ensures that areas not intended to be written to and be executable are protected (W^R).

Quebes in effect runs things in separate virtual machines. But for me Quebes isn't necessary, a simple separation of two is sufficient when also combined with frugal/snapshot booting. Data and ssh keys ...etc. under Fatdog, general browsing/use using OpenBSD. Both (concurrently) frugal/snapshot based 'dual booted'.

Downside is that once you see just how many security holes that OpenBSD do plug, that are otherwise wide open in Puppy/Linux, you may very well become hooked into never using Puppy/Linux for any online activities. Indeed if OpenBSD supported my laptop wifi - which it doesn't, and if I could easily boot OpenBSD in a frugal, no changes saved type manner (which it can, but not as quickly), then it would be my choice of bare metal install.

OpenBSD is also a full OS, no kernel and userland separation (such as with busybox userland). And their documentation is great. man pages are part of that OS, very detailed, and very specific to the installed version. Their policy is that a man page error is no different to a software bug - if incorrectly documented that could lead to a configuration error that could lead to a security hole.

User avatar
rockedge
Site Admin
Posts: 6571
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2779 times
Been thanked: 2650 times
Contact:

Re: OpenBSD

Post by rockedge »

@rufwoof

I'm wondering if one could WeeDog that OpenBSD........

r96chase
Posts: 225
Joined: Sat Nov 07, 2020 1:27 am
Location: Brookings
Has thanked: 105 times
Been thanked: 13 times
Contact:

Re: OpenBSD

Post by r96chase »

@rockedge Maybe a Puppy/WeeDog version of any BSD-based distro. I think FreeBSD would be a good start too.

I am a crash-course Linux novice. :lol:

user1111

Re: OpenBSD

Post by user1111 »

@rockedge

I'm wondering if one could WeeDog that OpenBSD

Perhaps. The process is relatively simple and similar, but different. OpenBSD is a cli based installation process, as is the package manager, so well suited to being scripted. The installation iso is around 10MB.

With kvm/qmu available/installed ...

qemu-img create -f qcow2 disk.qcow2 32G

... creates a qcow2 disk image. Disk space actually used is only what is used, i.e. qcow2 grows as more space is used. Uses zlib compression, so somewhat like a dynamic sfs.

Download the installation iso, which for 6.8/latest version ...

wget https://www.mirrorservice.org/pub/OpenB ... 4/cd68.iso

Run installer:

Code: Select all

qemu-system-x86_64 -m 1500 \
  -cdrom cd68.iso \
  -drive if=virtio,file=disk.qcow2,format=qcow2 \
  -enable-kvm \
  -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:2222-:22 \
  -device virtio-net,netdev=mynet0 \
  -smp 2

mostly just a case of pressing Enter to accept the defaults, and takes around 10 minutes. You do have to enter values for keyboard (uk in my case), a password for root, optionally create a userid (spot for instance) and enter the password for that. Also enter a hostname (I tend to go with obsd) and a domain name (I tend to just enter 'org').

Then you can boot that installed system

Code: Select all

 qemu-system-x86_64 -m 1500 \
  -drive if=virtio,file=disk.qcow2,format=qcow2 \
  -enable-kvm  \
  -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:2222-:22 \
  -device virtio-net,netdev=mynet0

Packages are installed using pkg_add, again textual based. For example
pkg_add jwm rox geany mtpaint firefox-esr ... etc.

That hostfwd parameter sets up host port 2222 forwarded to guest (OpenBSD) port 22 i.e. you can ssh into it. If the host is running sshd then you can also ssh from the guest the host using 10.0.2.2 (IIRC, I don't tend to have sshd running).

The default boot is into a old version of fvwm. Simply creating .xsession and adding jwm to that (assuming you've pkg_add jwm to install jwm) has it boot into jwm instead. To also get rox to start its something like a .xsession content of

rox -p ~/pinboard
jwm

... or whatever alternative window manager, for example cwm is built in so just edit .xsession to a content of 'cwm'

Note that the -m 1500 sets up qemu to allocate 1.5GB/ram for the guest. As does -smp 2 allocate 2 cores. I tend to match that to the actual host (nproc), but you can even allocate more cores than actually available ... could for instance use -smp 4 for the guest system on a 2 core host system.

For snapshots, you first run
qemu-img create -f qcow2 -b disk.qcow2 snapshot.img
to create a snapshot image of the main disk image, and then boot that snapshot.img instead of booting the disk.qcow2 image. i.e. same command as above but with -drive if=virtio,file=snapshot.img,format=qcow2 If you shutdown and leave that snapshot (again starts off very small, but grows as files are changed i.e. copy on write ... similar to a save file) available, then you can reboot into those changes again later. Or to simply lose changes, remove snapshot.img and create another snapshot.img prior to booting.

For sound, I find that using sndiod is pretty good. Which requires compiling sndiod in Linux (pretty simple to do https://sndio.org/) and then running it as a server on the host (listener) sndiod -f rsnd/1 -L- ... for sound card 1 (rsnd/0 for sound card 0), and then within OpenBSD set it to forward firefox sound to that (AUDIODEVICE=snd@192.168.1.5/0 firefox-esr .... assuming the hosts LAN IP address is 192.168.1.5). Out of the box mpv pretty much also supports that i.e. you just have to add a -ao sndio to the mpv command line.

OpenBSD more rigidly/consistently follows standard pathnames/locations, so things like /usr/local/share/icons instead of /usr/share/icons ...etc.).

For configuring things you use rcctl, for instance if you want to install dbus its
pkg_add dbus
and then
rcctl enable messagebus
rcct start messagebus

Similarly to start sshd
rcctl start sshd
or
rcctl stop sshd
to stop it.

First port of call for help should be the man pages. Online and developers etc. are more inclined to use mail/maillists https://marc.info/?l=openbsd-misc&r=1

user1111

Re: OpenBSD

Post by user1111 »

... should also perhaps mention that to scp file from the host (Linux) into OpenBSD, with that port 2222 forwarding defined, its (run on host/linux) ...

scp -P 2222 somefile spot@localhost:/home/spot/somefile

or

scp -P 2222 spot@localhost:/home/spot/somefile somefile

in the other direction.

Similar to mount a folder using sshfs its

mkdir /mnt/spot
sshfs -p 2222 spot@localhost:/home/spot /mnt/spot

The capital P for port number when using scp and little p when using ssh/sshfs ..etc is just one of those quirky things.

sshfs is nice as once mounted the folder(s) become available within rox/whatever - just like any other folder.

PS One other note, adding
-usbdevice tablet
to the qemu boot command line can help with the mouse/touchpad, including or excluding that is just something you have to try to find which works best for you.

User avatar
wiak
Posts: 4085
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 65 times
Been thanked: 1211 times
Contact:

Re: OpenBSD

Post by wiak »

You have so many good ideas rufwoof, and I already have so many of my own (some very similar) that I am overloaded with things I want to try but already overloaded with things I'm doing and these lists are themselves only a small part of some more mundane non-linux priorities I keep putting on the back-burner. The other thing is rockedge's 'Zoneminder' install creations - I have nothing particularly worth stealing, but still, I'd like to be able to login and view my property when I'm away on holiday. All so easy to do with all the ideas on here, but just never finding myself yet getting round to it. Yes, I'm also really interested in using kvm/qemu (for all sorts of things).

rufwoof wrote:

PS One other note, adding
-usbdevice tablet
to the qemu boot command line can help with the mouse/touchpad, including or excluding that is just something you have to try to find which works best for you.

nice tip thanks

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

user1111

Re: OpenBSD

Post by user1111 »

Out of interest I kvm/qemu booted (using Fatdog) a snapshot of my base OpenBSD system, i.e. nothing else installed in that (pkg_info returns empty)

default.png
default.png (167.59 KiB) Viewed 511 times

and from there installed tigervnc and vnc'd into another OpenBSD box (i.e. ran x0vncserver on that other box and then vnc'd into it). Videos played using firefox-esr on that server were fine. For sound I just ran sndiod on Fatdog and had the OpenBSD server forward sound to that. Crystal clear with no jitter.

Also installed ffmpeg within OpenBSD on the base system (that runs on the same box (laptop) as Fatdog), and that also played great, again the OpenBSD forwarding sndio to the Fatdog sndiod.

default2.png
default2.png (194.98 KiB) Viewed 511 times

A nice thing with older X style desktop (I use cwm as the window manager), is that you can size the ffplay window to fit within the area allocated as a form of 'tray', so you can mouse over that and use the arrow keys to step back/forward through the video. With cwm you maximise the window using ctrl-alt-M. The other main cwm key combinations are ctrl-alt-enter to open a terminal, alt / ... to list/switch to another window, alt ? to exec a program (in both cases you just type the first few characters of a program to be presented with a filtered list). Alt-tab will also step through open windows.

OpenBSD's man pages are great, in the above (second) image I opened a terminal to the right of the small ffplay window and ran man ffplay, ctrl-alt-m would maximise that and then you can scroll through all of the details for ffplay.

I guess that's a nice feature about using sndiod, even though I had video going through three layers, OpenBSD server to OpenBSD running in kvm/qemu to Fatdogs X/display, the sound was direct between the server and Fatdog. If anything using direct kvm/qemu OpenBSD to OpenBSD for the vnc leg was better than using Fatdog to OpenBSD for the vnc leg. Seemed even more responsive. However its already quick enough that that could just be perception.

Post Reply

Return to “Other Distros”