Importing Plex jail failure

I was relocating my jails from one storage pool to another. Shout to digimoot for some good documentation.

When I went to import the Plex jail it failed.

root@ale[~]# iocage import plex -p /mnt/u02/images
Importing dataset: plex
Importing dataset: plex/root
cannot receive: failed to read from stream
zsh: killed     iocage import plex -p /mnt/u02/images

The problem is the plex jail is 64Gb before exporting 48Gb exported. The database for it should probably be separate from the Jail.

This was the first post that I ran across on this issue

Which led me to discover FreeNAS 11 has a defect. It tries to uncompress the jail root into memory before sending it to ZFS RECV. That's right, we load the 64Gb file into memory (BANG).

This bug still exists in FreeNAS-11.3-U5: /usr/local/lib/python3.7/site-packages/iocage_lib/ioc_image.py

                if compression_algo == 'zip':
                    data = f.open(name).read()
                else:
                    data = f.extractfile(member).read()

                recv.stdin.write(data)
                recv.communicate()

This results in running out of swap and the import being terminated. Python3.7 is the IOCAGE command running “iocage import plex”

root@ale[/var/log]# fgrep 'out of swap space' messages
Aug 17 07:29:21 ale kernel: pid 67038 (python3.7), jid 0, uid 0, was killed: out of swap space
Aug 17 07:29:21 ale kernel: pid 67038 (python3.7), jid 0, uid 0, was killed: out of swap space

swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(32): failed

Code was fixed in TrueNAS 12 - https://github.com/iocage/iocage/blob/master/iocage_lib/ioc_image.py#L288

                chunk_size = 10 * 1024 * 1024

                with (f.open(name) if compression_algo == 'zip' else f.extractfile(member)) as file:
                    data = file.read(chunk_size)
                    while data is not None and len(data) > 0:
                        recv.stdin.write(data)
                        data = file.read(chunk_size)

                recv.communicate()

It has not been backported FreeNAS 11, we will do that ourselves so we can continue to use the “iocage import” process without hacking about with workaround commands.

That worked well.

root@ale[~]# iocage import plex -p /mnt/u02/images
Importing dataset: plex
Importing dataset: plex/root

Imported: plex
2021/08/17 14:40 · 0 Linkbacks

Backing up a FreeNas jails

A simple script that backups up each JAIL in turn, sorted alphabetically by its name. An export requires the jail to be shutdown.

#!/bin/sh
# Backup each JAIL
# Will restart the jail if required

iocage list -h -s name | cut -f 2,3 | while read jail state; do
  test $state = "up" && iocage stop $jail
  iocage export $jail
  test $state = "up" && iocage start $jail
done

The images will be in /mnt/[pool]/iocage/images

2021/08/14 16:59 · 0 Linkbacks

Installing the Moin2rst plugin

I was trying to install this plugin into my MoinMoin 1.9 wiki → https://github.com/dwf/moin2rst

The installation instruction are incorrect

wiki/data/plugin/action/RenderAsRestructuredtext.py
wiki/data/plugin/formatter/text_x-rst.py

Errors and changes to make this work with MoinMoin 1.9

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/support/werkzeug/wsgi.py", line 766, in __call__
    return self.app(environ, start_response)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 264, in __call__
    response = run(context)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 89, in run
    response = dispatch(request, context, action_name)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 137, in dispatch
    response = handle_action(context, pagename, action_name)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 203, in handle_action
    handler(context.page.page_name, context)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/action/__init__.py", line 277, in do_format
    do_show(pagename, request, count_hit=0, cacheable=0, mimetype=u'text/plain')
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/action/__init__.py", line 267, in do_show
    content_only=content_only,
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1165, in send_page
    Formatter = wikiutil.searchAndImportPlugin(request.cfg, "formatter", self.output_mimetype)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wikiutil.py", line 1194, in searchAndImportPlugin
    raise PluginMissingError("Plugin not found! (%r %r %r)" % (type, name, what))
MoinMoin.wikiutil.PluginMissingError: Plugin not found! ('formatter' 'text/x-rst' 'Formatter')

A change in wikiutil.py#Mime means the formatter plug in is not being found. The file we are looking for won't be what is supplied with the GIT repo.

   modname = mimetype.replace("/", "_").replace("-", "_").replace(".", "_")

Rename the file from text_x-rst.py TO text_x_rst.py

   -rw-r--r--  1 root  www  34417 Jan 21 17:11 text_x_rst.py

Next problem

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/support/werkzeug/wsgi.py", line 766, in __call__
    return self.app(environ, start_response)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 264, in __call__
    response = run(context)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 89, in run
    response = dispatch(request, context, action_name)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 137, in dispatch
    response = handle_action(context, pagename, action_name)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 203, in handle_action
    handler(context.page.page_name, context)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/action/__init__.py", line 277, in do_format
    do_show(pagename, request, count_hit=0, cacheable=0, mimetype=u'text/plain')
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/action/__init__.py", line 267, in do_show
    content_only=content_only,
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1332, in send_page
    start_line=pi['lines'])
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1422, in send_page_content
    self.format(parser)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1443, in format
    parser.format(self.formatter)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1553, in format
    formatted_line = self.scan(line, inhibit_p=inhibit_p)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1363, in scan
    result.append(self.replace(match, inhibit_p))
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1407, in replace
    result.append(replace_func(hit, match.groupdict()))
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1330, in _macro_repl
    return self.formatter.macro(self.macro, macro_name, macro_args, markup=groups.get('macro'))
TypeError: macro() got an unexpected keyword argument 'markup'

text_x_rst.py: Change the definition of this call:

    def macro(self, macroObj, name, argString):
 to:
    def macro(self, macroObj, name, argString, **kwargs):

Next problem

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/support/werkzeug/wsgi.py", line 766, in __call__
    return self.app(environ, start_response)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 264, in __call__
    response = run(context)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 89, in run
    response = dispatch(request, context, action_name)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 137, in dispatch
    response = handle_action(context, pagename, action_name)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/wsgiapp.py", line 203, in handle_action
    handler(context.page.page_name, context)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/action/__init__.py", line 277, in do_format
    do_show(pagename, request, count_hit=0, cacheable=0, mimetype=u'text/plain')
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/action/__init__.py", line 267, in do_show
    content_only=content_only,
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1332, in send_page
    start_line=pi['lines'])
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1422, in send_page_content
    self.format(parser)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/Page.py", line 1443, in format
    parser.format(self.formatter)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1553, in format
    formatted_line = self.scan(line, inhibit_p=inhibit_p)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1363, in scan
    result.append(self.replace(match, inhibit_p))
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 1407, in replace
    result.append(replace_func(hit, match.groupdict()))
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/parser/text_moin_wiki.py", line 876, in _link_repl
    self._link_description(desc, target, page_name_and_anchor) +
  File "/usr/local/www/wiki/data/plugin/formatter/text_x_rst.py", line 488, in pagelink
    url = self.request.normalizePagename(pagename)
  File "/usr/local/lib/python2.7/site-packages/MoinMoin/web/contexts.py", line 224, in __getattr__
    return super(HTTPContext, self).__getattribute__(name)
AttributeError: 'AllContext' object has no attribute 'normalizePagename'

Change these two calls in the text_x_rst.py file

def pagelink...

            url = self.request.normalizePagename(pagename)
            urlPath = url.split("/")
            thisPath = self.request.normalizePagename(self.page.page_name).split("/")
TO

            url = wikiutil.normalize_pagename(pagename, self.request.cfg)
            urlPath = url.split("/")
            thisPath = wikiutil.normalize_pagename(self.page.page_name, self.request.cfg).split("/")

After all this and getting it working I decided it was just easier to use docbook !

2020/01/23 15:38 · 0 Linkbacks

FreeNAS 11.2-U5 and 10Gbe

This is just a note as I see a lot of posts out there saying use Chelsio cards for FreeNAS as they are well supported. Well I tried this and yes the card was recognized but the DAC cable was not.

Aug  9 18:45:00 ale cxgbc0: <Chelsio T310, 1 port> mem 0xfb881000-0xfb881fff,0xfb000000-0xfb7fffff,0xfb880000-0xfb880fff irq
 42 at device 0.0 on pci10
Aug  9 18:45:00 ale kernel: PHY 0 i2c read of dev.addr a0.0 timed out
Aug  9 18:45:00 ale kernel: PHY 0 i2c read of dev.addr a0.0 timed out
Aug  9 18:45:00 ale cxgbc0: using MSI-X interrupts (9 vectors)
Aug  9 18:45:00 ale kernel: found old FW minor version(7.10), driver compiled for version 7.11
Aug  9 18:45:00 ale kernel: found old FW minor version(7.10), driver compiled for version 7.11
Aug  9 18:45:00 ale cxgbc0: firmware needs to be updated to version 7.11.0
Aug  9 18:45:00 ale cxgb0: <Port 0 10GBASE-R> on cxgbc0
Aug  9 18:45:00 ale cxgb0: Using defaults for TSO: 65518/35/2048
Aug  9 18:45:00 ale cxgb0: Ethernet address: 00:07:43:05:fe:ae
Aug  9 18:45:00 ale cxgbc0: Firmware Version 7.10.0

Firmware update - I don't think this was necessary as the driver auto updates we just need a reboot

cxgbtool cxgb0 loadfw t3fw-7.11.0.bin
Reboot

Next time around the firmware has been updated

Aug  9 18:55:44 ale cxgbc0: using MSI-X interrupts (9 vectors)
Aug  9 18:55:44 ale cxgb0: <Port 0 10GBASE-R> on cxgbc0
Aug  9 18:55:44 ale cxgb0: Using defaults for TSO: 65518/35/2048
Aug  9 18:55:44 ale cxgb0: Ethernet address: 00:07:43:05:fe:ae
Aug  9 18:55:44 ale cxgbc0: Firmware Version 7.11.0

The drive is plumbed into the kernel but the link won't come up to ACTIVE.

I was using SPF+ CISCO Passive Twinax cable part 74752-9519 connected to Mikrotik CRS305 switch but the link would not activate. I switched to a different 10Gbe card and presto.

MNPA19-XTR | Mellanox EN ConnectX-2 1-Port 10GbE Network Adapter

Aug 22 19:52:55 ale mlx4_core0: <mlx4_core> mem 0xfaa00000-0xfaafffff,0xf5000000-0xf57fffff irq 42 at device 0.0 on pci10
Aug 22 19:52:55 ale kernel: mlx4_core: Mellanox ConnectX core driver v3.4.1 (October 2017)
Aug 22 19:52:55 ale kernel: mlx4_core: Initializing mlx4_core
Aug 22 19:52:55 ale mlx4_core0: Unable to determine PCI device chain minimum BW
Aug 22 19:52:55 ale kernel: mlx4_en mlx4_core0: Activating port:1
Aug 22 19:52:55 ale mlxen0: Ethernet address: 00:02:c9:51:35:34
Aug 22 19:52:55 ale kernel: mlx4_en: mlx4_core0: Port 1: Using 12 TX rings
Aug 22 19:52:55 ale kernel: mlx4_en: mlx4_core0: Port 1: Using 12 TX rings
Aug 22 19:52:55 ale kernel: mlxen0: link state changed to DOWN
Aug 22 19:52:55 ale kernel: mlxen0: link state changed to DOWN
Aug 22 19:52:55 ale kernel: mlx4_en: mlx4_core0: Port 1: Using 8 RX rings
Aug 22 19:52:55 ale kernel: mlx4_en: mlx4_core0: Port 1: Using 8 RX rings
Aug 22 19:52:55 ale kernel: mlx4_en: mlxen0: Using 12 TX rings
Aug 22 19:52:55 ale kernel: mlx4_en: mlxen0: Using 12 TX rings
Aug 22 19:52:55 ale kernel: mlx4_en: mlxen0: Using 8 RX rings
Aug 22 19:52:55 ale kernel: mlx4_en: mlxen0: Using 8 RX rings
Aug 22 19:52:55 ale kernel: mlx4_en: mlxen0: Initializing port
Aug 22 19:52:55 ale kernel: mlx4_en: mlxen0: Initializing port

ifconfig output for the device. Its alive and happy.

mlxen0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu   1500
        options=ad00b9<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,VLAN  _HWFILTER,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6>
        ether 00:02:c9:51:35:34
        hwaddr 00:02:c9:51:35:34
        inet 192.168.1.22 netmask 0xffffff00 broadcast 192.168.1.255
        nd6 options=9<PERFORMNUD,IFDISABLED>
        media: Ethernet autoselect (10Gbase-SR <full-duplex,rxpause,txpause>)
        status: active
root@ale[~]#
2019/08/23 14:19 · 0 Linkbacks

Transparent I2P tunneling

These notes are to setup an I2P FreeNAS jail to transparently tunnel .i2p traffic using a Ubiquiti EdgeRouter ER-X

Huge kudos to these notes that got me moving in the right direction:

This is the logical flow of what we are going to setup. Pictures really help the understanding.

As I have an EdgeRouter ER-X the instructions will cover what you need to configure on this device in terms of the router setup

Setup DNSMASQ on server to catch .i2p DNS requests return the IP 10.191.0.1 as the domain lookup

/etc/dnsmasq.conf
address=/i2p/10.191.0.1

Test it out. Any domain ending in .i2p will return the IP 10.191.0.1

# dig @127.0.0.1 hello.i2p

; <<>> DiG 9.9.4-RedHat-9.9.4-51.el7 <<>> @127.0.0.1 hello.i2p
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8423
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;hello.i2p.                     IN      A

;; ANSWER SECTION:
hello.i2p.              0       IN      A       10.191.0.1

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Dec 19 02:13:21 UTC 2017
;; MSG SIZE  rcvd: 43

We need to configure a NAT rule to redirect our 10.191.0.1:80 traffic to the server running the privoxy/i2p software.

ubnt@ubnt# show service nat
 nat {
     rule 1 {
         description i2p
         destination {
             address 10.191.0.1
             port 80
         }
         inbound-interface switch0
         inside-address {
             address 192.168.1.14
             port 8118
         }
         log disable
         protocol tcp
         source {
             group {
                 address-group !I2P_EXCLUDE
             }
         }
         type destination
     }
     rule 5001 {
         description "masquerade for WAN"
         outbound-interface eth0
         type masquerade
     }
     rule 5002 {
         description "hairpin for i2p"
         destination {
             address 192.168.1.0/24
             port 8118
         }
         log disable
         outbound-interface switch0
         protocol tcp
         source {
             address 192.168.1.0/24
         }
         type masquerade
     }
 }

ubnt@ubnt# show firewall group
 address-group I2P_EXCLUDE {
     address 192.168.1.14
     description "exclude these IP address from being routed via i2p proxy"
 }

We will end up with a NAT configuration like this:

With the following firewall rule.

I run i2p and privoxy inside a FreeNAS jail so these instructions reflect this.

Follow the instructions to setup the I2P jail

Now the I2P jail is setup we need install the privoxy for transparent routing. The jail does not install privoxy.

Install privoxy into the jail and forward .i2p domain name requests to the router.

# pkg install privoxy

Allow it to autostart edit /etc/rc.conf

privoxy_enable="YES"

We need to pre-create this

# mkdir /var/run/privoxy
# chown privoxy:privoxy /var/run/privoxy

Start Privoxy manually to create the necessary config files run:

# /usr/local/etc/rc.d/privoxy forcestart

This will create the file /usr/local/etc/privoxy/config

That is hokey. You have to run it to create the config file so you can edit it ?

Edit the configuration file

listen-address  192.168.1.14:8118
accept-intercepted-requests 1
forward .i2p 127.0.0.1:4444

Restart after making those changes

/usr/local/etc/rc.d/privoxy restart
2019/06/25 22:37 · 0 Linkbacks

Older entries >>