Quantcast
Channel: Astr0baby's not so random thoughts _____ rand() % 100;
Viewing all 183 articles
Browse latest View live

Running HP-UX 11.11 on the Apple M1

$
0
0

After some time I decided to write another entry here that some might find useful, especially if they wish to run HP-UX (32bit) guest under Qemu on their Apple M1 hardware.

What is HP-UX ? Well it is one of the UNIX systems that was designed by HP (thus it is called HewlettPackard Unix) and runs on PA-RISC and IA64 CPU architectures. Here we will only focus on the PA-RISC1.1 simulation under Qemu

HP-UX can run under qemu-system-hppa simulator but only the PA-RISC1.1 versions and up to 11.11 Since the latest release of Qemu (from git April 2021)

QEMU emulator version 5.2.92 (v6.0.0-rc2-66-gc1e90def01-dirty)
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers

The only version of HP-UX that installs and boots is HP-UX 11.11 2005-09-MCOE release, possibly the HP-UX 11.11 2006-12-MCOE (but I have not tested this one) I have tried to install/run on the Apple M1 10.20 and 11.00 and 11.11 from pre 2005 but none of them installed and qemu crashed (this could be an issue with Qemu)

So here we will use the verified HP-UX 11.11 2005-09-MCOE disk images and procedures to get almost full 32bit HP-UX experience on your modern Apple M1 hardware.

Prerequisites

  • Working instance of fresh qemu (recent git clone from https://github.com/qemu/qemu)
  • XQuartz 2.8.1 for M1 ARM64 (https://www.xquartz.org/releases/index.html)
  • Approximately 20 GB of disk space on the Apple M1 SSD
  • A lot of patience and time (installation of HP-UX takes time) ☕☕☕☕☕☕☕
  • HP-UX 11.11 ISOs
  • Telnet client on the M1 MacOS (I compiled one from pkgsrc, or you can use Putty)

Step 1 Preparation

Lets start by setting up the simulation environment on the Apple M1 for the HP-UX 11.11 and dedicate a working directory $HOME/HPPA/HPUX for the qcow2, ISOs and install/loader scripts

We create a 20GB qcow2 disk image to hold the HP-UX system

$ qemu-img create -f qcow2 disk.img 20G 

Download the ISOs (there are 4 ISOs to install HP-UX from and all are needed)

wget 'http://tenox.pdp-11.ru/hpux/OS/11.11/2005-09%20MCOE/hp-ux-1of4.iso'  
wget 'http://tenox.pdp-11.ru/hpux/OS/11.11/2005-09%20MCOE/hp-ux-2of4.iso'
wget 'http://tenox.pdp-11.ru/hpux/OS/11.11/2005-09%20MCOE/hp-ux-3of4.iso'
wget 'http://tenox.pdp-11.ru/hpux/OS/11.11/2005-09%20MCOE/hp-ux-4of4.iso'  

Prepare the install.sh script to load the installation (graphical install )

qemu-system-hppa \
-boot d \
-drive if=scsi,bus=0,index=6,file=disk.img,format=qcow2 \
-m 512 \
-d nochain \
-cdrom hp-ux-1of4.iso \
-net nic,model=tulip \
-net user

Prepare the run.sh script to run the simulation

qemu-system-hppa \
-smp cpus=2 \
-accel tcg,thread=multi \
-boot c \
-drive if=scsi,bus=0,index=6,file=disk.img,format=qcow2  \
-monitor telnet::4441,server,nowait \
-m 512 \
-d nochain \
-cdrom hp-ux-1of4.iso \
-nographic -vga none \
-net nic,model=tulip \
-net user,hostfwd=tcp::2222-:22

Make both the install.sh and run.sh executable (make sure qemu-system-hppa is in your $PATH)

The contents of you $HOME/HPPA/HPUX directory should have these files now

-rw-r--r--  1 user staff 642865152 Oct  6  2020 hp-ux-1of4.iso
-rw-r--r--  1 user staff 357793792 Oct  6  2020 hp-ux-2of4.iso
-rw-r--r--  1 user staff 648380416 Oct  6  2020 hp-ux-3of4.iso
-rw-r--r--  1 user staff 309100544 Oct  6  2020 hp-ux-4of4.iso
-rw-r--r--  1 user staff    196928 Apr 20 23:47 disk.img
-rwxr-xr-x  1 user staff       195 Apr 18 20:22 install.sh
-rwxr-xr-x  1 user staff       287 Apr 19 20:17 run.sh

Step 2 Installation

Now run install.sh and after a few moments you should see the installer program. Please note that you can use the TAB and arrow keys to move around the menu.

IMPORTANT – The VGA emulation in HPPA is labelled as artist and you need to use a zoom-to-fit and fullscreen mode to see the whole display if you use MacBook Air M1. However what worked better for me is to keep the artist display windowed and move it slightly to a corner of the desktop, since the installer does not take the whole screen.

The console curses interface text gets corrupted during the installation menu/process so we will not use this since it gets really unreadable later on. The final X11/CDE session does not work properly in the artist (VGA) for me – the mouse cursor cannot move the edge of the right side of the desktop, only to some imaginary wall in the middle. I also found out that the mouse gets erratic if you switch between the host MacOS and the HP-UX VM a lot so be prepared for that. It might be a bug in the current qemu-system-hppa git build) so for the final HP-UX we will use the console curses based loader and connect to CDE via ssh tunnel and Xnest for best experience.

install.sh output (To exit from Full screen Qemu-Artist on Mac press Ctrl+Option+g to get a mouse cursor back, and then Command+f)

Chose the keyboard type 62 and confirm by <ENTER>

Here we will choose the default values (unless you want to setup custom partition layouts, filesystems, etc …) since the defaults are quite safe for the qemu-system-hppa simulation, you can use TAB, arrow keys to navigate in the installer.

Hit Next

Keep hitting Next

Keep hitting Next

Keep hitting Next

Keep hitting Next

Keep hitting Next

Keep hitting Next

Keep hitting Next

Keep hitting Next

And finally hit Finish to begin the actual installation, here we need to return to full screen again since the installer will use the full display.

Now this next process will take approx 1 hour during which swinstall extracts content from CD1

When we finish with the CD1 we need to swap the ISOs

Change to the

The ISO swapping will happen over the QEMU monitor server this can be done

And point to the $HOME/HPPA/HPUX directory and choose the hp-ux-2of4.iso once done hit <ENTER> in the Qemu artist main console window (Please note that we will have to do this for all the 4 CD ISOs so be patient)

The installer will continue with CD2

Go on and finish the installation (with CD2/3 and 4 its much faster than with CD1) .. eventually the installed gets to the part when the kernel gets built

Once all is done system reboots to the next stage install, yet again be patient for the installer to chew through the 2nd stage setup (it takes some time)

IMPORTANT:

Now the next step during the installation seems to look like the whole system is stuck infinitely – CIM Repository is being built – please be patient

Now you have two choices now, first to be patient, second to break this and move on – break in the console by CTRL+c if you dont do this it can take a few hours but it will eventually finish (its up to you – I left it running to finish) There will be a FAIURE message and the system will reboot yet again

Again choose the keyboard type 62

Now the semi-functional X11 will load – it works but is really ugly and leaves artifacts behind – get a grip of a weird mouse movement and interaction (keyboard helps here :)

Try to choose English language option with TAB and <ENTER> mouse interaction seems to be broken

Hit Finish (with TABs and <ENTER>) and close the GEO CUSTOMS window

Next we will setup networking (DHCP)

So answer Yes (remember that arrow keys work here )

And we choose Yes for DHCP (Qemu on Apple M1 can only do -net user network)

Confirm Yes is above looks the same for you

Next we chose a hostname (keep it max 8 characters and simple)

Hit Yes

Next chose your time-zone

Hit Yes

If time is OK hit Yes (you can always change this stuff later)

Next setup your root password

If all went well you should get the above

And finally an important message about the disk space on the LVM keep this in mind (we used a 20GB qcow2 disk image remember ?)

Hooray – we got to the end finally !

So wait for the system to boot up, login as root

And shut down the system

Once the shutdown procedure gets to this stage you can power-off the Qemu VM

Congratulations you made it to the next stage !

Step 3 Running HP-UX

OK, we are now ready to start the HP-UX, remember the loader script run.sh ? We will use that now to load the system.

$ ./run.sh 

NOW BE VERY CAREFUL NOT TO HIT CTRL+C in this session, otherwise you will kill the whole Qemu simulator, it is better to connect over SSH to the host once the system comes up and keep this window open just for emergency operations

So now you are ready to do some HP-UX hacking !

POST INSTALL THINGS TO CONSIDER

In order get to the Qemu monitor console which is needed for the ISO swapping and other useful task use telnet (or putty) on the MacOS to connect to localhost 4441 (keep this in mind if you are on a public WiFi network !!!!! and use a Firewall)

First thing after logging to the HP-UX 11.11 I modified the /.profile for root user

export TERM=vt100
export DISPLAY=macos:1
stty erase ^?

The macos is an alias to 10.0.2.2 host that we need to make sure we define for the Xnest to work over SSH

Create the following file on the HP-UX /etc/nsswitch.conf and add

hosts:files [NOTFOUND=continue] nis[NOTFOUND=continue] dns

And then add macos to /etc/hosts

10.0.2.2 macos

You dont want to run everything as root, so create some users. Keep in mind that on HP-UX 11.11 root is allowed to SSH to the machine by default !

SSH login to HP-UX from MacOS

Since MacOS (BigSur) cannot use tun/tap interfaces we are stuck with the -net user networking, so in order to use SSH a Qemu port forwarding has to be used. In the run.sh script we ports forward the HP-UX TCP 22 to MacOS TCP 2222 (change accordingly)

Also keep in mind that this opens up SSH TCP 2222 on your Mac to the rest of the surrounding network so you can login to HP-UX from other systems in the LAN – so keep this in mind if you are in a public network full of evil hax0rs and setup your firewall accordingly

By default SSH is enabled and running on the HP-UX but it is old so one needs to allow for older weaker algos in their SSH client config (On MacOS $home/.ssh/config I have the following)

Host localhost
KexAlgorithms +diffie-hellman-group1-sha1
HostKeyAlgorithms +ssh-dss

This way you can then SSH to the HP-UX Guest from your Mac, but even better is to allow X forwarding so we can use Xnest from XQuartz ! I connect to the HP-UX from the Mac as follows :

ssh -XC -p 2222 user@localhost

Then on the MacOS I run Xnest as follows (save it as a script on your Mac)

/opt/X11/bin/Xnest :1 -listen tcp -ac :1.0

And from the above ssh session on HP-UX run the following (save it as a shell script in your home user directory)

export DISPLAY=macos:1
/usr/dt/bin/Xsession

You should now catch the CDE session on your Mac – this is much more comfortable way of working that with the unstable artist VGA buffer on Qemu

Installing some useful software

I have put together a small collection of useful tools you can download/upload to HP-UX and play around with. These include the GCC compiler , GNU debugger, bash and links web browser

http://45.76.81.249/HPPA/HP-UX-11.11/

gcc-3.4-32-11i-hppa1.1.tar
gdb-6.2.1.tar.gz

Extract in /usr/local 
Set $PATH to include new GCC 

/usr/local/pa11_32/bin 

Once you have GCC and GDB installed you can compile some code (which works out of the box without source modification on the HP-UX 11.11) and I leave this to the reader to exercise on

http://45.76.81.249/HPPA/HP-UX-11.11/Tools/

Shutting down the system

As root got to the / directory and run

# shutdown -h now 

When it is safe to power down the simulator either kill -$PID Qemu process or enter monitor console via telnet localhost 4441 and quit

Known Issues:

If the qemu-system-hppa gets stuck during boot, kill the VM either from shell kill -$PID or from telnet monitor console. If by any chance a disk corruption happens then you would need to run fsck upon next successful boot of HP-UX

Xephyr is probably better to use than Xnest – but for me the session dies within a minute and I have not figured out yet why (if you know please let me know)

Xnest display needs updating if screen-saver hits from CDE session (so right-click on the CDE desktop and refresh) and setup a large timeout for screensaver in CDE (2 hours)

Reference:

https://en.wikipedia.org/wiki/HP-UX

https://parisc.wiki.kernel.org/index.php/Qemu#HP-UX_booting_up

http://mirrors.develooper.com/hpux/downloads.html

https://supratim-sanyal.blogspot.com/2019/11/hpux-11i-v1-hpux-1111-pa-risc-guest.html


NetBSD -current on RPI4 Model B (8GB RAM)

$
0
0

For anybody that wishes to experiment and track NetBSD evbarm(aarch64) -current on the latest Raspberry Pi4 – I have compiled this how-to guide.

Pre-requisites

  • RPi4 Model B
  • Working Linux distribution on which we will prepare the environment
  • microSD card + USB adapter (4 GB minimum)
  • 2 USB flash drives/sticks (try to use different size USBs – it makes Identification much easier)
  • one 32 GB minimum to hold the NetBSD system (I have used 32GB SanDisk USB fash)
  • one 1 GB minimum to hold the NetBSD installer ISO (I have used 8GB Kingston USB flash)
  • Keyboard + Mouse (best experience is with wireless keyboard + touchpad combo which uses one USB HID slot on the RPI4)
  • HDMI monitor or LCD attached to the RPi4 (I have used the Waveshare 800×480 LCD)
  • working network environment (wireless works only with 3rd party USB dongles) – Ethernet

A little note on the USB flash sticks I have used here

32GB USB 3.1 SanDisk 3.2Gen1 attaches to the “blue” USB ports of the RPi4

8 GB USB DataTraveler 2.0 attaches to the “black” USB ports of the RPi4

What does not work on NetBSD

  • Inbuilt Wireless/Bluetooth – works with 3rd party dongles
  • HDMI audio
  • DRM/KMS graphics acceleration

1.1 Preparing the UEFI drive

First we need to build an UEFI microSD card

mkdir -p $HOME/RPI4/UEFI
cd $HOME/RPI4/UEFI

wget https://github.com/raspberrypi/firmware/archive/master.zip
wget https://github.com/pftf/RPi4/releases/download/v1.20/RPi4_UEFI_Firmware_v1.20.zip

unzip master.zip
rm master.zip

Remove the kernel files in firmware-master/boot/ extracted directory

rm -f firmware-master/boot/kernel*

Now we will prepare a microSD card (I have used a 32GB with a USB adapter) Attach it to the computer USB port. We will re-format and re-label the microSD card now.
Unmount it first if there as a FS already present when you attached the card

sudo umount /path/to/mount

Make sure to check the partition is W95 FAT32 on the corresponding device
node of the microSD card (in this example it is /dev/sdc – make sure you check yours ! )
If unsure run dmesg and check for the last events to see what device node
the microSD card registered as. Adjust accordingly ! Otherwise data-loss may occur

sudo fdisk /dev/sdc

Make sure we only have one partition type B (W95 FAT32), if not create it.
Next we will need to re-format the microSD and label it as UEFI

sudo mkfs.vfat /dev/sdc1 -n UEFI

Eject the drive or re-insert. If you dont have automount, mount the miscoSD accordingly.
In this example it is mounted under /media/user/UEFI
Now we will copy over the boot UEFI directory as follows to the microSD

cd $HOME/RPI4/UEFI
sudo cp -rv firmware-master/boot /media/user/UEFI/
sudo cp RPi4_UEFI_Firmware_v1.20.zip /media/user/UEFI
cd /media/user/UEFI
sudo unzip RPi4_UEFI_Firmware_v1.20.zip
sudo rm RPi4_UEFI_Firmware_v1.20.zip

The resulting files should look like this

UEFI layout

Now we should be done with the UEFI microSD card, unmount it and remove the USB adapter !
lets move on to the NetBSD -current installation ISO

sudo umount /media/user/UEFI 

1.2 Preparing the NetBSD install ISO

Download the NetBSD -current evbarm (aarch64) installation ISO
The daily images change each day so download the one that matches
the current day from here http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/

cd $HOME/RPI4
wget http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/202105230300Z/images/NetBSD-9.99.82-evbarm-aarch64.iso

I have used an 8GB size drive to make identification easier for the Installer USB. We will take the smaller USB flash drive/stick which should have enough size to hold the NetBSD ISO (minimum 1GB size) and attach it to computer – again if the system automounts the external storage, unmount it and check the device node the USB drive registers under – in this example we use /dev/sdd USB mass-storage device labelled as USB

sudo umount /media/user/USB

And move the NetBSD ISO to a flash drive – I have used an 8GB size drive to make identificiation easier. (unmounted – check the device node it registers under !! Otherwise data-loss may occur – if unsure check dmesg)

cd $HOME/RPI4
sudo dd if=NetBSD-9.99.82-evbarm-aarch64.iso  of=/dev/sdd

This should not take long since the ISO file is about 240MB big, once done remove the USB stick and remember that this is the Installer USB drive.

1.3 Preparing the NetBSD install ISO

Next we prepare the larger 32GB USB flash and completely wipe it so that no partitions exist on it whatsoever. Easiest way is to use sgdisk on the drive after you attached it to a Linux computer and unmounted it (if it contained any partitions) Adjust accordingly and be careful what you do ! Data loss may occur if you mistake the drives

sudo umount /media/user/SANDISK
sudo sgdisk -Z /dev/sdd 

Once done unplug the drive from the Linux machine.

2.1 Booting RPi4 and installing NetBSD

Insert the UEFI microSD card into the RPI4 slot and attach the USB installer flash (8GB to the black USB port) , plus the larger USB flash(32GB to the blue USB port) to the RPi4. Also make sure you have an external keyboard attached to the RPi4.

USB flash disk layout

As you can see above the “Silver” 8GB Kingston drive is in the “black” USB slot and the faster/larger SanDisk is attached to the “blue” USB slot. Once all is in place we can power on the RPi4

When the device powers up a Raspberry Pi logo shows up, make sure to hit <ESC> to get to the boot menu

RPi4 UEFI boot logo

Hit <ESC> and enter the UEFI menu (if you are not fast enough just unplug the power cord the RPi4 and repeat again)

UEFI Firmware

In the menu you can use the arrow keys and choose the Boot Manager

Boot disk selection

Locate the smaller USB drive that hold the NetBSD installer image – in this case it is UEFI Kingston Data Traveler – check those nice USB identifiers Im leaking here :) and hit <ENTER>

NetBSD efiboot installer

The NetBSD installer should load and you will end up in the classic setup ncurses menu

NetBSD sysinst
NetBSD sysinst

We will choose to install NetBSD to a hard disk (but we will use USB Flash)

Disk selection

Now this is an important screen to understand which USB drives we can chose (remember the different USB flash sizes ? This helps here greatly) We will chose the larger one sd0 as the disk to install to

Partition scheme

We need to use GPT for the evbarm NetBSD disk

Partition setup

Chose Set the sizes of NetBSD partitions and configure them as follows

NetBSD partition layout

Use MB for input units, set 28299M for root / , 1024 for swap and 5% for /tmp

Distribution selection

Now select what you want to install – we want a: Full installation (there seems to be a bug present in the aarch64 evbarm installer – since the xorg-

packages wont be installed, but we will fix that manually over SSH once the system is installed)

Source install

Next we will tell the sysinst installer from where to install the sets (CD-ROM)

Source install

And tell the installer to use sd1 since it does not know the real CDROM drive (we have none)

Installing NetBSD

Finally the sysinst installer starts installing the filesets ! The speed here depends on how fast your USB flash stick is, but on the USB 3.1 it is really fast. Once done we will need to configure a couple of last things like network passwords etc.

NetBSD configuration

Go on and configure the network (genet0) , users, enable SSHD and NTPD and finish your configuration. Please note here that for static IP address the installer leaves dhcpd=YES in /etc/rc.conf so after you reboot the RPi4 this needs to be changed if you use static IPs (like me) – also remember that because of some bug the Xorg packages don’t get installed so we will do that later once the system is up and usable.

Now exit the installer and reboot the device. Once the device is rebooted – remember to hit <ESC> again in the UEFI firmware to get to the boot menu and choose the new USB disk with the installed NetBSD

UEFI firmware

3.1 Booting RPi4 with NetBSD

Now we will finally boot into the newly installed NetBSD system

NetBSD

Now if you are using static IP, you need to remove the dhcpd=YES from /etc/rc.conf and reboot again to verify the network is working well. Once done lest move on to install the forgotten Xorg packages from the installer ISO (the USB 8GB stick should still be attached to your RPi4)

Now for the convenience I just ssh to the NetBSD system from my Linux machine (static IP assigned to NetBSD is 10.0.2.91)

NetBSD 9.99.82 (GENERIC64) #0: Sun May 23 01:34:17 UTC 2021

Welcome to NetBSD!

This is a development snapshot of NetBSD for testing -- user beware!

Bug reports: https://www.NetBSD.org/support/send-pr.html
Donations to the NetBSD Foundation: https://www.NetBSD.org/donations/
rpi4$ 
rpi4$ su 
Password:
rpi4# 

Remember the “CDROM” installer USB was sd1 ? We will mount it and copy over the missing installsets to the root /

rpi4# mkdir /mnt/disk
rpi4# mount /dev/sd1a /mnt/disk
rpi4# cd /mnt/disk/evbarm-aarch64/binary/
rpi4# 
rpi4# ls -la 
total 20
drwxr-xr-x  4 1003  1002  2048 May 23 01:34 .
drwxr-xr-x  4 1003  1002  2048 May 23 01:34 ..
drwxr-xr-x  2 1003  1002  2048 May 23 01:34 kernel
drwxr-xr-x  2 1003  1002  4096 May 23 01:34 sets
rpi4# cd sets
rpi4# ls
MD5                         kern-GENERIC64.tar.xz       xbase.tar.xz
SHA512                      man.tar.xz                  xcomp.tar.xz
base.tar.xz                 misc.tar.xz                 xetc.tar.xz
comp.tar.xz                 modules.tar.xz              xfont.tar.xz
dtb.tar.xz                  rescue.tar.xz               xserver.tar.xz
etc.tar.xz                  tests.tar.xz
games.tar.xz                text.tar.xz
rpi4# 

We will need all the x-packages so copy them over to the root /

rpi4# cp x* /
rpi4# cd /
rpi4# ls -la 
total 146422
drwxr-xr-x  21 root  wheel       512 May 23 02:10 .
drwxr-xr-x  21 root  wheel       512 May 23 02:10 ..
-r--r--r--   2 root  wheel      1186 May 23 01:34 .cshrc
-r--r--r--   2 root  wheel       702 May 23 01:34 .profile
drwxr-xr-x   2 root  wheel       512 May 23 01:34 altroot
drwxr-xr-x   2 root  wheel      1024 May 23 01:34 bin
drwxr-xr-x   1 root  wheel     16384 Jan  1  1980 boot
drwxr-xr-x   9 root  wheel     33792 May 23 01:38 dev
drwxr-xr-x  30 root  wheel      2560 May 23 01:57 etc
drwxr-xr-x   3 root  wheel       512 May 23 01:48 home
dr-xr-xr-x   2 root  wheel       512 May 23 02:10 kern
drwxr-xr-x   3 root  wheel      2560 May 23 01:34 lib
drwxr-xr-x   3 root  wheel       512 May 23 01:34 libdata
drwxr-xr-x   5 root  wheel       512 May 23 01:34 libexec
drwxr-xr-x   3 root  wheel       512 May 23 02:08 mnt
-rwxr-xr-x   1 root  wheel  17152160 May 23 01:34 netbsd
dr-xr-xr-x   1 root  wheel       512 May 23 02:10 proc
drwxr-xr-x   2 root  wheel      3072 May 23 01:37 rescue
drwxr-xr-x   2 root  wheel       512 May 23 01:36 root
drwxr-xr-x   2 root  wheel      3072 May 23 01:34 sbin
drwxr-xr-x   3 root  wheel       512 May 23 01:34 stand
drwxrwxrwt   2 root  wheel         0 May 23 01:57 tmp
drwxr-xr-x  12 root  wheel       512 May 23 01:38 usr
drwxr-xr-x  24 root  wheel       512 May 23 01:34 var
-rw-r--r--   1 root  wheel   5925028 May 23 02:10 xbase.tar.xz
-rw-r--r--   1 root  wheel   6046184 May 23 02:10 xcomp.tar.xz
-rw-r--r--   1 root  wheel     27340 May 23 02:10 xetc.tar.xz
-rw-r--r--   1 root  wheel  28993608 May 23 02:10 xfont.tar.xz
-rw-r--r--   1 root  wheel  17439548 May 23 02:10 xserver.tar.xz
rpi4# 

And extract them

rpi4# unxz xbase.tar.xz 
rpi4# unxz xcomp.tar.xz 
rpi4# unxz xetc.tar.xz 
rpi4# unxz xfont.tar.xz 
rpi4# unxz xserver.tar.xz 

rpi4# tar -xvf xbase.tar 
rpi4# tar -xvf xcomp.tar 
rpi4# tar -xvf xetc.tar 
rpi4# tar -xvf xfont.tar 
rpi4# tar -xvf xserver.tar  

rpi4# rm *.tar 

Once we are done we can test th X server if we have an external HDMI attached. Now as user we have created login to the console on the RPi4 and run startx

Xorg session over HDMI

So now a working X session on the HDMI attached to the RPi4 should be available !

One last thing is to shutdown NetBSD now (this is done via root shell # shutdown -p now) command and remove the USB drives (we will not need the Installer anymore) and re-plug the 32GB larger USB flash to the “black” USB port of the RPi4 while keeping the “blue” free.

We will use the “blue” USB port for additional dongles like Wi-Fi.

If you want to use Wi-Fi then attach a compatible USB dongle to the free “Blue” USB port on the RPi4 (generally Realtek based devices work well – DWA-131 example here)

[    51.325931] urtwn0 at uhub2 port 1
[    51.325931] urtwn0: Realtek (0x2001) Wireless N Nano USB Adapter (0x3319), rev 2.10/2.00, addr 5
[    51.395933] urtwn0: MAC/BB RTL8192EU, RF 6052 2T2R, address aa:bb:cc:dd:ee:ff
[    51.395933] urtwn0: 1 rx pipe, 3 tx pipes

Next we will install CDE on the latest NetBSD evbarm aarch64 RPi4 device so we can make it look even more nicer with some 1337 retro CDE look !

Sources used :

https://wiki.netbsd.org/ports/evbarm/raspberry_pi/h

https://www.virtualizationhowto.com/2020/10/install-esxi-arm-step-by-step-on-raspberry-pi-4/

Compiling and Running native Neo4j on Apple M1 ARM64

$
0
0

If one needs to run neo4j natively on the Apple M1 hardware (for example to analyze/query BloodHound ingestor data from an Active Directory) and benefit from the fast CPU it seems to be possible to build and run from source.

I have prepared this “experimental” howto so that others can reproduce this

Pre-Requisites :

  • make or gnu-make
  • wget or curl (to download sources from terminal – otherwise just use your browser)
  • git
  • Xcode full setup (better to have this for development, not entirely sure you need it for neo4j build, but I have it installed since it is a must)

First we need to get a working native version of Java on the M1 ARM64 Apple. This can be achieved by downloading and installing a package from AZUL and selecting the proper options for our platform -> Java 11 (LTS) macOS ARM 64-bit JDK as seen below

Azul Java for MacOS ARM 64-bit

Once installed, verify that we can use Java by running the following in the terminal

Shell java version command

Once Java is installed on the M1 we move on to download Maven from Apache foundation site – available here https://maven.apache.org/download.cgi

Maven Download

I have configured Maven on my Apple M1 ARM64 system as follows

mkdir -p $HOME/SRC/maven
cd $HOME/SRC/maven 
wget https://apache.miloslavbrada.cz/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz 
gunzip apache-maven-3.8.1-bin.tar.gz 
tar -xvf apache-maven-3.8.1-bin.tar
rm apache-maven-3.8.1-bin.tar

# Now we need to define this new path to our environment 
# I have added the path to my $PATH as follows (adjust to your needs accordingly) 

export PATH=bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/pkg/sbin:/opt/pkg/bin:/Library/Apple/usr/bin:/Users/user/.cargo/bin:/usr/local/go/bin:/Users/user/go/bin:/Users/user/SRC/maven/apache-maven-3.8.1/bin

Now we should have mvn in our paths so we can move on to build Neo4j

We will now git clone Neo4j source to our SRC directory and set some variables

cd $HOME/SRC
git clone https://github.com/neo4j/neo4j 
cd neo4j 
ulimit -n 40000 
export MAVEN_OPTS="-Xmx512m" 
mvn clean install

Now after a while the build will fail on the following test

maven build tests fail
Neo4j kernel test fail

Im not really sure why this happens right now and I did not investigate this more right now , but we can build Neo4j without these tests and it will compile and run on the M1

So run the build with these options instead

mvn clean install -DskipTests
Build neo4j success

So now we can test the newly compiled Neo4j instance, but before we do we need to extract the TGZ build

cd $HOME/SRC/neo4j/packaging/standalone/target/
tar -zxvf neo4j-community-4.3.1-SNAPSHOT-unix.tar.gz 

To start the Neo4j DB run the following command (if you built it in $HOME/SRC/neo4j)

/Users/user/SRC/neo4j/packaging/standalone/target/neo4j-community-4.3.1-SNAPSHOT/bin/neo4j console

Following should be visible on your console after it starts

Neo4j running on Apple M1 ARM64

What seems to be broken right now on the M1 is the web console interface to Neo4j – I could not get it to render the web page interface and was left only with a blank window when accessing http://127.0.0.1:7474

I needed to access the console so that I could change the default passwords so instead I tried to connect with the cypher-shell and it allowed me to reset the default credentials and password neo4j (neo4j:neo4j)

/Users/user/SRC/neo4j/packaging/standalone/target/neo4j-community-4.3.1-SNAPSHOT/bin/cypher-shell
cypher-shell connection to Neo4j

So one this was done I wanted to see if I could populate the fresh Neo4j DB with some data – mainly Bloodhound ingestor data from an Active Directory.

BloodHound 4.0.2 can be downloaded from the projects Git and the MacOS x86-64 binary works fine with Rosetta2, however it fails to build for me – I have used pkgsrc/lang/nodejs (version 14.16.0) for this but I could not build yet a native ARM64 BloodHound

cd $HOME/SRC 
mkdir BLOODHOUND 
cd BLOODHOUND 
wget https://github.com/BloodHoundAD/BloodHound/releases/download/4.0.2/BloodHound-darwin-x64.zip 
unzip BloodHound-darwin-x64.zip 
cd $HOME/SRC/BLOODHOUND/BloodHound-darwin-x64/BloodHound.app/Contents/MacOS
./BloodHound 

Before BloodHound is fully executed you need to allow the unsigned app in the MacOS security menu to run.

Login with your new neo4j password (user: neo4j)

BloodHound 4.0.2

Now you can try and upload some BloodHound ingestor data from some AD of yours to test the fresh Neo4j on the Apple M1 ARM64 platform – It would be great to benchmark Neo4j on the M1 compared to other architectures (x86_64) but my expertise on that is limited – what I noticed however is the BloodHound ZIP imports to the DB are faster on the M1 than on my Core i5 Panasonic Toughbook C31 with an SSD disk.

BloodHound session

Happy Graphing on the M1!

Viewing all 183 articles
Browse latest View live