Opensuse h4ckweek 23

Logo

Opensuse h4ckweek 23 navigation log

View the Project on GitHub mpagot/opensuse.hackweek.23

9 November 2023

Day4 is busy and distracted

by mpagot

Back

This day is mostly dedicated to cockpit. Can it be a good replacement for the TrueNAS web interface?

DONE

Read some documentation

From SUSE SLE

Very good documentation but it is for SLE and I’m playing with openSUSE

The official project documentation

cockpit-project. Nothing about openSUSE

blog posts

install-cockpit-opensuse-15-1 expose some basic concepts. It is about an old openSUSE but not MicroOS with transactional update.

udisks-udisks2-udisksctl-what-is-the-differences is an article relevant for the storage cockpit plugin.

Video

Cockpit-machine as virt-manager replacement. It is about cockpit-machine package: video

Give it a try

MicroOS (TW rolling one)

There are some known issue:

https://bugzilla.suse.com/show_bug.cgi?id=1215653 https://github.com/cockpit-project/cockpit-project.github.io/issues/666

I decided to report it as https://bugzilla.opensuse.org/show_bug.cgi?id=1216997

Installation can be done with a pattern + one package.

Installation

On openSUSE MicroOS

%  transactional-update pkg install -t pattern microos_cockpit

...

Please reboot your machine to activate the changes and avoid data loss.
New default snapshot is #3 (/.snapshots/3/snapshot).
transactional-update finished

It is installing 31 packages.

Install the essential package that is missing in the pattern

% transactional-update --continue pkg install cockpit-ws
...

Please reboot your machine to activate the changes and avoid data loss.
New default snapshot is #4 (/.snapshots/4/snapshot).
transactional-update finished

reboot, and…

% systemctl status cockpit.socket
○ cockpit.socket - Cockpit Web Service Socket
     Loaded: loaded (/usr/lib/systemd/system/cockpit.socket; disabled; preset: disabled)
     Active: inactive (dead)
   Triggers: ● cockpit.service
       Docs: man:cockpit-ws(8)
     Listen: [::]:9090 (Stream)

Enable it:

% systemctl enable --now cockpit.socket

Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket → /usr/lib/systemd/system/cockpit.socket.

And check again

% systemctl status cockpit.socket

● cockpit.socket - Cockpit Web Service Socket
     Loaded: loaded (/usr/lib/systemd/system/cockpit.socket; enabled; preset: disabled)
     Active: active (listening) since Thu 2023-11-09 11:12:21 UTC; 3s ago
   Triggers: ● cockpit.service
       Docs: man:cockpit-ws(8)
     Listen: [::]:9090 (Stream)
    Process: 1247 ExecStartPost=/usr/share/cockpit/motd/update-motd  localhost (code=exited, status=0/SUCCESS)
    Process: 1261 ExecStartPost=/bin/ln -snf active.motd /run/cockpit/motd (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 4915)
        CPU: 19ms
     CGroup: /system.slice/cockpit.socket

Nov 09 11:12:21 dhcp13.qa.suse.cz systemd[1]: Starting Cockpit Web Service Socket...
Nov 09 11:12:21 dhcp13.qa.suse.cz systemd[1]: Listening on Cockpit Web Service Socket.

And voila’

Image

The adjustment on the firewall seems not necessary in this OS version

More plugins

This is a list of cockpit plugins that seems potentially useful for a NAS

List of installed plugins is visible in

Image

accessible from

Image

There are few or no extensions available as zypper package and on top of this I’m not sure how to activate them: no matter what I tried (not so much to be honest) I do not manage to have more than the original set of extensions listed in the About page.

Here two of them that I tried.

% transactional-update pkg install udisks2

this one installed fine but apparently does not activate anything special or new on the cockpit WebUI

% transactional-update pkg install cockpit-pcp

LeapMicro

In particular I tested image from here. This image has cockpit pre-installed. Seem just a matter to enable the service

Image

Here the official documentation about it sec-cockpit-storage.

And voila’ (for the second time in this article):

Image

Let’s try doing something with cockpit. For example try installing OS updates

Image

In LeapMicro, cockpit also comes with some extensions pre-installed:

Image

For example storaged is preinstalled

Image

It is possible to create RAID with the cockpit. Let’s try using it to obtain the same BTRFS RAID configuration created in day3. The cockpit storage extension correctly detect all the available devices and easily allow to create a RAID Device.

Image

Checking the result with lsblk reveals that the created RAID Device is not a BTRFS RAID one but more like mdadm linux RAID.

Image

On the cockpit web interface it is presented as a kind of special device

Image

It is possible to create a BTRFS FS on that

Image

Image

The cockpit interface seems also allowing to later add a device in the “pool”

Image

but it is only added as spare

Image

Checking the BTRFS filesystem using btrfs cli interface confirm that:

% btrfs filesystem usage /mnt
Overall:
    Device size:                  49.97GiB
    Device allocated:            536.00MiB
    Device unallocated:           49.44GiB
    Device missing:                  0.00B
    Used:                        320.00KiB
    Free (estimated):             49.45GiB      (min: 24.73GiB)
    Free (statfs, df):            49.45GiB
    Data ratio:                       1.00
    Metadata ratio:                   2.00
    Global reserve:                3.25MiB      (used: 0.00B)
    Multiple profiles:                  no

Data,single: Size:8.00MiB, Used:64.00KiB (0.78%)
   /dev/md127      8.00MiB

Metadata,DUP: Size:256.00MiB, Used:112.00KiB (0.04%)
   /dev/md127    512.00MiB

System,DUP: Size:8.00MiB, Used:16.00KiB (0.20%)
   /dev/md127     16.00MiB

Unallocated:
   /dev/md127     49.44GiB

and

dhcp97:~ #  btrfs device stats /
[/dev/vda3].write_io_errs    0
[/dev/vda3].read_io_errs     0
[/dev/vda3].flush_io_errs    0
[/dev/vda3].corruption_errs  0
[/dev/vda3].generation_errs  0
dhcp97:~ # btrfs filesystem usage /
Overall:
    Device size:                  14.97GiB
    Device allocated:              2.52GiB
    Device unallocated:           12.45GiB
    Device missing:                  0.00B
    Used:                          2.02GiB
    Free (estimated):             12.53GiB      (min: 6.31GiB)
    Free (statfs, df):            12.53GiB
    Data ratio:                       1.00
    Metadata ratio:                   2.00
    Global reserve:                5.11MiB      (used: 0.00B)
    Multiple profiles:                  no

Data,single: Size:2.01GiB, Used:1.92GiB (95.69%)
   /dev/vda3       2.01GiB

Metadata,DUP: Size:256.00MiB, Used:51.45MiB (20.10%)
   /dev/vda3     512.00MiB

System,DUP: Size:8.00MiB, Used:16.00KiB (0.20%)
   /dev/vda3      16.00MiB

Unallocated:
   /dev/vda3      12.45GiB
   

Lets try to get a different approach, Let’s try to create the BTRFS device using the cli and later on check how the cockpit WebUI detect it.

Delete the device and start from scratch but using the cli

%  mkfs.btrfs -f -L "Arca" -d raid1 -m raid1 /dev/sda /dev/sdb /dev/sdc
btrfs-progs v5.14
See http://btrfs.wiki.kernel.org for more information.

Label:              Arca
UUID:               a669a169-c324-42ca-b354-7a346fe7e370
Node size:          16384
Sector size:        4096
Filesystem size:    150.00GiB
Block group profiles:
  Data:             RAID1             1.00GiB
  Metadata:         RAID1             1.00GiB
  System:           RAID1             8.00MiB
SSD detected:       no
Zoned device:       no
Incompat features:  extref, skinny-metadata
Runtime features:
Checksum:           crc32c
Number of devices:  3
Devices:
   ID        SIZE  PATH
    1    50.00GiB  /dev/sda
    2    50.00GiB  /dev/sdb
    3    50.00GiB  /dev/sdc

The WebUI present it like

Image

now mount it

mount /dev/sda /mnt/

Image

Try the “Mount automatically on boot” button. It did something but it does not understand it is BTRFS

% btrfs filesystem usage /mnt
Overall:
    Device size:                 150.00GiB
    Device allocated:              4.02GiB
    Device unallocated:          145.98GiB
    Device missing:                  0.00B
    Used:                          1.25MiB
    Free (estimated):             73.99GiB      (min: 73.99GiB)
    Free (statfs, df):            48.99GiB
    Data ratio:                       2.00
    Metadata ratio:                   2.00
    Global reserve:                3.25MiB      (used: 0.00B)
    Multiple profiles:                  no

Data,RAID1: Size:1.00GiB, Used:512.00KiB (0.05%)
   /dev/sdb        1.00GiB
   /dev/sdc        1.00GiB

Metadata,RAID1: Size:1.00GiB, Used:112.00KiB (0.01%)
   /dev/sdb        1.00GiB
   /dev/sdc        1.00GiB

System,RAID1: Size:8.00MiB, Used:16.00KiB (0.20%)
   /dev/sdb        8.00MiB
   /dev/sdc        8.00MiB

Unallocated:
   /dev/sda       50.00GiB
   /dev/sdb       47.99GiB
   /dev/sdc       47.99GiB
tags: