Surenoo LCD2USB LCD display in lcd4Linux

Some time ago i bough a 20×4 LCD display with an LCD2USB controller mounted from AliExpress (https://www.aliexpress.com/item/4000219655381.html).

My idea was to use this for an Openmediavault Server when i need to go to a LAN party, to prevent the need for a Monitor connected to the server i could use the display to show the IP and possible other usefull information, that could be handy.

Seems there is little information around the internet, about how to get one of these, displays working compared to back in the days.

Every note that i can locate says that when powering on the display from the USB port it should come up and say lcd2usb version x.xx but in my case the display is blank and looks to be more or less dead, in the beginning i was sure that i had bought a bad display, until i remembered that if the controller somehow was setup to keep the display in a low contrast and brightness in off mode, that would result in a display looking to be dead, so tweeking the contrast and brightness paramaters made the display come to life.

My lcd4linux.conf file:

Note: contrast and brightness are are still a work in progress, but it works.

Display LCD2USB {
Driver 'LCD2USB' #Model: LCD2USB
Size '20x4' #LCD dimension: 1602
# Port '/dev/usbdev3.2' #Port: /dev/usbdev3.2
Contrast 80
Brightness 40
icons 0
}

Widget IPaddress {
class 'Text' #Type: Text
expression netinfo::ipaddr('ens33') #eth0's ip
prefix 'IP:' #display "IP:"
width 16 #display width: 16
align 'C' #display: central
update 1000
}

Widget Time {
class 'Text'
expression strftime('%a %H:%M:%S',time())
width 16
align 'C'
update 1000
}

Layout Default {
Row1 {
Col1 'IPaddress' #Display Widget IPaddress in the first row and first column
}
Row2 {
Col1 'Time' #Display Widget Time in the second row and first column
}

}

Display 'LCD2USB'
Layout 'Default'

to test you can use the following command

root@Debian-test:/etc# lcd4linux -vv -F

the output should look something like this:

root@Debian-test:/etc# lcd4linux -vv -F
LCD4Linux 0.11.0-SVN-1193 starting
Dump of /etc/lcd4linux.conf:
Display 'LCD2USB'
Display:LCD2USB.Brightness 40
Display:LCD2USB.Contrast 80
Display:LCD2USB.Driver 'LCD2USB'
Display:LCD2USB.icons 0
Display:LCD2USB.Size '20x4'
Layout 'Default'
Layout:Default.Row1.Col1 'IPaddress'
Layout:Default.Row2.Col1 'Time'
Widget:IPaddress.align 'C'
Widget:IPaddress.class 'Text'
Widget:IPaddress.expression netinfo::ipaddr('ens33')
Widget:IPaddress.prefix 'IP:'
Widget:IPaddress.update 1000
Widget:IPaddress.width 16
Widget:Time.align 'C'
Widget:Time.class 'Text'
Widget:Time.expression strftime('%a %H:%M:%S',time())
Widget:Time.update 1000
Widget:Time.width 16

[DBus] Error connecting to the dbus session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

plugin_mpd.c: [MPD] v0.83, check lcd4linux configuration file...
[MPD] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)
[raspi] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)
lcd4linux.c: initializing driver LCD2USB
LCD2USB: $Rev: 1130 $
LCD2USB: scanning USB for LCD2USB interface ...
LCD2USB: found LCD2USB interface on bus 001 device 008
LCD2USB: echo test successful
LCD2USB: firmware version 2.02
LCD2USB: installed controllers: CTRL0
initializing layout 'Default'
layout.c: Layout:Default: migrating 'row1.col1' to 'Layer:1.row1.col1'
layout.c: Layout:Default: migrating 'row2.col1' to 'Layer:1.row2.col1'
Creating new timer group (1000 ms)
widget 'IPaddress': Class 'text', Parent '<root>', Layer 1, Row 0, Col 0 (to 0,16)
widget 'Time': Class 'text', Parent '<root>', Layer 1, Row 1, Col 0 (to 1,16)
lcd4linux.c: starting main loop
Timer #0 skipped 31 interval(s) or 3100 ms.

and tada!, the displays show information.

How to See Samba Shares on a Windows 10 Network

wsdd is a service by christgau on GitHub, which implements a Web Service Discovery host daemon for Ubuntu. This enables Samba hosts to be found by Web Service Discovery Clients like Windows 10.

If you are experiencing any issues with this service, please let us know in the comments or submit an issue on GitHub.

Change to /tmp directory.

cd /tmp

Download and unzip the archive.

wget https://github.com/christgau/wsdd/archive/master.zip

unzip master.zip

Rename wsdd.py to wsdd.

sudo mv wsdd-master/src/wsdd.py wsdd-master/src/wsdd

Copy to /usr/bin.

sudo cp wsdd-master/src/wsdd /usr/bin

Copy wsdd to /etc/systemd/system.

sudo cp wsdd-master/etc/systemd/wsdd.service /etc/systemd/system

Open wsdd.service in nano and comment out User=nobody and Group=nobody with a ; semicolon.

sudo nano /etc/systemd/system/wsdd.service
[Unit]
Description=Web Services Dynamic Discovery host daemon
; Start after the network has been configured
After=network-online.target
Wants=network-online.target
; It makes sense to have Samba running when wsdd starts, but is not required
;Wants=smb.service



[Service]
Type=simple
ExecStart=/usr/bin/wsdd --shortlog
; Replace those with an unprivledged user/group that matches your environment,
; like nobody/nogroup or daemon:daemon or a dedicated user for wsdd
; User=nobody
; Group=nobody
; The following lines can be used for a chroot execution of wsdd.
; Also append '--chroot /run/wsdd/chroot' to ExecStart to enable chrooting
;AmbientCapabilities=CAP_SYS_CHROOT
;ExecStartPre=/usr/bin/install -d -o nobody -g nobody -m 0700 /run/wsdd/chroot
;ExecStopPost=rmdir /run/wsdd/chroot



[Install]
WantedBy=multi-user.target

Save and exit (press CTRL + X, press Y and then press ENTER)

Start and enable wsdd.

sudo systemctl start wsdd
sudo systemctl enable wsdd

Output:

Created symlink /etc/systemd/system/multi-user.target.wants/wsdd.service β†’ /etc/systemd/system/wsdd.service.

Now check that the service is running.

sudo service wsdd status

Output:

wsdd.service - Web Services Dynamic Discovery host daemon
Loaded: loaded (/etc/systemd/system/wsdd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-06-10 10:51:39 CEST; 8s ago
Main PID: 40670 (python3)
Tasks: 1 (limit: 6662)
Memory: 10.8M
CGroup: /system.slice/wsdd.service
└─40670 python3 /usr/bin/wsdd --shortlog



jun 10 10:51:39 ubuntu systemd[1]: Started Web Services Dynamic Discovery host daemon.
jun 10 10:51:40 ubuntu wsdd[40670]: WARNING: no interface given, using all interfaces

You should now be able to browse your Ubuntu machines and Samba shares in the Windows 10 file explorer. You may need to restart the Windows 10 machines to force discovery.

You may also want to reboot the Ubuntu server just to make sure the wsdd service starts up automatically without issue.
How to Uninstall wsdd

If you want to completely uninstall wsdd, stop and disable the service.

sudo systemctl stop wsdd
sudo systemctl disable wsdd

Remove wsdd from /usr/bin.

sudo rm /usr/bin/wsdd

Remove service file.

sudo rm /etc/systemd/system/wsdd.service

Figuring out what hardware version of the Raspberry Pi you are using

So you are spending the night messing around with your Raspberry Pi’s and forgotten what version you are using, instead of having to take the cover of the RPi or walk over to the closet, to see what version it is, you can do this remote from the command line.

From the command line issue the following command:

cat /proc/cpuinfo

output should be something like this:

processor       : 3
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : BCM2835
Revision        : a02082
Serial          : 0000000000000000
pi@bifrost:~ $

look for the part in the bottom saying Revision (in my case it’s a02082)

now use the following list to fire out what hardware it is.:

Code Model Revision RAM Manufacturer

900021

A+

1.1

512MB

Sony UK

900032

B+

1.2

512MB

Sony UK

900092

Zero

1.2

512MB

Sony UK

900093

Zero

1.3

512MB

Sony UK

9000c1

Zero W

1.1

512MB

Sony UK

9020e0

3A+

1.0

512MB

Sony UK

920092

Zero

1.2

512MB

Embest

920093

Zero

1.3

512MB

Embest

900061

CM

1.1

512MB

Sony UK

a01040

2B

1.0

1GB

Sony UK

a01041

2B

1.1

1GB

Sony UK

a02082

3B

1.2

1GB

Sony UK

a020a0

CM3

1.0

1GB

Sony UK

a020d3

3B+

1.3

1GB

Sony UK

a02042

2B (with BCM2837)

1.2

1GB

Sony UK

a21041

2B

1.1

1GB

Embest

a22042

2B (with BCM2837)

1.2

1GB

Embest

a22082

3B

1.2

1GB

Embest

a220a0

CM3

1.0

1GB

Embest

a32082

3B

1.2

1GB

Sony Japan

a52082

3B

1.2

1GB

Stadium

a22083

3B

1.3

1GB

Embest

a02100

CM3+

1.0

1GB

Sony UK

a03111

4B

1.1

1GB

Sony UK

b03111

4B

1.1

2GB

Sony UK

b03112

4B

1.2

2GB

Sony UK

b03114

4B

1.4

2GB

Sony UK

c03111

4B

1.1

4GB

Sony UK

c03112

4B

1.2

4GB

Sony UK

c03114

4B

1.4

4GB

Sony UK

d03114

4B

1.4

8GB

Sony UK

c03130

Pi 400

1.0

4GB

Sony UK

a03140

CM4

1.0

1GB

Sony UK

b03140

CM4

1.0

2GB

Sony UK

c03140

CM4

1.0

4GB

Sony UK

d03140

CM4

1.0

8GB

Sony UK

See More here:

https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md

How To Configure BIND as a Private DNS Server

Found this great tutorial for setting up Bind as a private DNS server.

https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-ubuntu-14-04

copied the article for later use πŸ™‚

How To Configure BIND as a Private Network DNS Server on Ubuntu 14.04

Introduction

An important part of managing server configuration and infrastructure includes maintaining an easy way to look up network interfaces and IP addresses by name, by setting up a proper Domain Name System (DNS). Using fully qualified domain names (FQDNs), instead of IP addresses, to specify network addresses eases the configuration of services and applications, and increases the maintainability of configuration files. Setting up your own DNS for your private network is a great way to improve the management of your servers.

In this tutorial, we will go over how to set up an internal DNS server, using the BIND name server software (BIND9) on Ubuntu 14.04, that can be used by your Virtual Private Servers (VPS) to resolve private host names and private IP addresses. This provides a central way to manage your internal hostnames and private IP addresses, which is indispensable when your environment expands to more than a few hosts.

The CentOS version of this tutorial can be found here.

Prerequisites

To complete this tutorial, you will need the following:

  • Some servers that are running in the same datacenter and have private networking enabled
  • A new VPS to serve as the Primary DNS server, ns1
  • Optional: A new VPS to serve as a Secondary DNS server, ns2
  • Root access to all of the above (steps 1-4 here)

If you are unfamiliar with DNS concepts, it is recommended that you read at least the first three parts of our Introduction to Managing DNS.

Example Hosts

For example purposes, we will assume the following:

  • We have two existing VPS called “host1” and “host2”
  • Both VPS exist in the nyc3 datacenter
  • Both VPS have private networking enabled (and are on the 10.128.0.0/16 subnet)
  • Both VPS are somehow related to our web application that runs on “example.com”

With these assumptions, we decide that it makes sense to use a naming scheme that uses “nyc3.example.com” to refer to our private subnet or zone. Therefore, host1‘s private Fully-Qualified Domain Name (FQDN) will be “host1.nyc3.example.com”. Refer to the following table the relevant details:

Host Role Private FQDN Private IP Address
host1 Generic Host 1 host1.nyc3.example.com 10.128.100.101
host2 Generic Host 2 host2.nyc3.example.com 10.128.200.102

Note: Your existing setup will be different, but the example names and IP addresses will be used to demonstrate how to configure a DNS server to provide a functioning internal DNS. You should be able to easily adapt this setup to your own environment by replacing the host names and private IP addresses with your own. It is not necessary to use the region name of the datacenter in your naming scheme, but we use it here to denote that these hosts belong to a particular datacenter’s private network. If you utilize multiple datacenters, you can set up an internal DNS within each respective datacenter.

Our Goal

By the end of this tutorial, we will have a primary DNS server, ns1, and optionally a secondary DNS server, ns2, which will serve as a backup.

Here is a table with example names and IP addresses:

Host Role Private FQDN Private IP Address
ns1 Primary DNS Server ns1.nyc3.example.com 10.128.10.11
ns2 Secondary DNS Server ns2.nyc3.example.com 10.128.20.12

Let’s get started by installing our Primary DNS server, ns1.

Install BIND on DNS Servers

Note: Text that is highlighted in red is important! It will often be used to denote something that needs to be replaced with your own settings or that it should be modified or added to a configuration file. For example, if you see something like host1.nyc3.example.com, replace it with the FQDN of your own server. Likewise, if you see host1_private_IP, replace it with the private IP address of your own server.

On both DNS servers, ns1 and ns2, update apt:

  • sudo apt-get update

Now install BIND:

  • sudo apt-get install bind9 bind9utils bind9-doc

IPv4 Mode

Before continuing, let’s set BIND to IPv4 mode. On both servers, edit the bind9 service parameters file:

  • sudo vi /etc/default/bind9

Add “-4” to the OPTIONS variable. It should look like the following:

/etc/default/bind9
OPTIONS="-4 -u bind"

Save and exit.

Now that BIND is installed, let’s configure the primary DNS server.

Configure Primary DNS Server

BIND’s configuration consists of multiple files, which are included from the main configuration file, named.conf. These filenames begin with “named” because that is the name of the process that BIND runs. We will start with configuring the options file.

Configure Options File

On ns1, open the named.conf.options file for editing:

  • sudo vi /etc/bind/named.conf.options

Above the existing options block, create a new ACL block called “trusted”. This is where we will define list of clients that we will allow recursive DNS queries from (i.e. your servers that are in the same datacenter as ns1). Using our example private IP addresses, we will add ns1, ns2, host1, and host2 to our list of trusted clients:

/etc/bind/named.conf.options β€” 1 of 3
acl "trusted" {
        10.128.10.11;    # ns1 - can be set to localhost
        10.128.20.12;    # ns2
        10.128.100.101;  # host1
        10.128.200.102;  # host2
};

Now that we have our list of trusted DNS clients, we will want to edit the options block. Currently, the start of the block looks like the following:

/etc/bind/named.conf.options β€” 2 of 3
options {
        directory "/var/cache/bind";
...
}

Below the directory directive, add the highlighted configuration lines (and substitute in the proper ns1 IP address) so it looks something like this:

/etc/bind/named.conf.options β€” 3 of 3
options {
        directory "/var/cache/bind";

        recursion yes;                 # enables resursive queries
        allow-recursion { trusted; };  # allows recursive queries from "trusted" clients
        listen-on { 10.128.10.11; };   # ns1 private IP address - listen on private network only
        allow-transfer { none; };      # disable zone transfers by default

        forwarders {
                8.8.8.8;
                8.8.4.4;
        };
...
};

Now save and exit named.conf.options. The above configuration specifies that only your own servers (the “trusted” ones) will be able to query your DNS server.

Next, we will configure the local file, to specify our DNS zones.

Configure Local File

On ns1, open the named.conf.local file for editing:

  • sudo vi /etc/bind/named.conf.local

Aside from a few comments, the file should be empty. Here, we will specify our forward and reverse zones.

Add the forward zone with the following lines (substitute the zone name with your own):

/etc/bind/named.conf.local β€” 1 of 2
zone "nyc3.example.com" {
    type master;
    file "/etc/bind/zones/db.nyc3.example.com"; # zone file path
    allow-transfer { 10.128.20.12; };         # ns2 private IP address - secondary
};

Assuming that our private subnet is 10.128.0.0/16, add the reverse zone by with the following lines (note that our reverse zone name starts with “128.10” which is the octet reversal of “10.128”):

/etc/bind/named.conf.local β€” 2 of 2
zone "128.10.in-addr.arpa" {
    type master;
    file "/etc/bind/zones/db.10.128";  # 10.128.0.0/16 subnet
    allow-transfer { 10.128.20.12; };  # ns2 private IP address - secondary
};

If your servers span multiple private subnets but are in the same datacenter, be sure to specify an additional zone and zone file for each distinct subnet. When you are finished adding all of your desired zones, save and exit the named.conf.local file.

Now that our zones are specified in BIND, we need to create the corresponding forward and reverse zone files.

Create Forward Zone File

The forward zone file is where we define DNS records for forward DNS lookups. That is, when the DNS receives a name query, “host1.nyc3.example.com” for example, it will look in the forward zone file to resolve host1‘s corresponding private IP address.

Let’s create the directory where our zone files will reside. According to our named.conf.local configuration, that location should be /etc/bind/zones:

  • sudo mkdir /etc/bind/zones

We will base our forward zone file on the sample db.local zone file. Copy it to the proper location with the following commands:

  • cd /etc/bind/zones
  • sudo cp ../db.local ./db.nyc3.example.com

Now let’s edit our forward zone file:

  • sudo vi /etc/bind/zones/db.nyc3.example.com

Initially, it will look something like the following:

/etc/bind/zones/db.nyc3.example.com β€” original
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.      ; delete this line
@       IN      A       127.0.0.1       ; delete this line
@       IN      AAAA    ::1             ; delete this line

First, you will want to edit the SOA record. Replace the first “localhost” with ns1‘s FQDN, then replace “root.localhost” with “admin.nyc3.example.com”. Also, every time you edit a zone file, you should increment the serial value before you restart the named process–we will increment it to “3”. It should look something like this:

/etc/bind/zones/db.nyc3.example.com β€” updated 1 of 3
@       IN      SOA     ns1.nyc3.example.com. admin.nyc3.example.com. (
                              3         ; Serial

Now delete the three records at the end of the file (after the SOA record). If you’re not sure which lines to delete, they are marked with a “delete this line” comment above.

At the end of the file, add your nameserver records with the following lines (replace the names with your own). Note that the second column specifies that these are “NS” records:

/etc/bind/zones/db.nyc3.example.com β€” updated 2 of 3
; name servers - NS records
    IN      NS      ns1.nyc3.example.com.
    IN      NS      ns2.nyc3.example.com.

Then add the A records for your hosts that belong in this zone. This includes any server whose name we want to end with “.nyc3.example.com” (substitute the names and private IP addresses). Using our example names and private IP addresses, we will add A records for ns1, ns2, host1, and host2 like so:

/etc/bind/zones/db.nyc3.example.com β€” updated 3 of 3
; name servers - A records
ns1.nyc3.example.com.          IN      A       10.128.10.11
ns2.nyc3.example.com.          IN      A       10.128.20.12

; 10.128.0.0/16 - A records
host1.nyc3.example.com.        IN      A      10.128.100.101
host2.nyc3.example.com.        IN      A      10.128.200.102

Save and exit the db.nyc3.example.com file.

Our final example forward zone file looks like the following:

/etc/bind/zones/db.nyc3.example.com β€” updated
$TTL    604800
@       IN      SOA     ns1.nyc3.example.com. admin.nyc3.example.com. (
                  3       ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;
; name servers - NS records
     IN      NS      ns1.nyc3.example.com.
     IN      NS      ns2.nyc3.example.com.

; name servers - A records
ns1.nyc3.example.com.          IN      A       10.128.10.11
ns2.nyc3.example.com.          IN      A       10.128.20.12

; 10.128.0.0/16 - A records
host1.nyc3.example.com.        IN      A      10.128.100.101
host2.nyc3.example.com.        IN      A      10.128.200.102

Now let’s move onto the reverse zone file(s).

Create Reverse Zone File(s)

Reverse zone file are where we define DNS PTR records for reverse DNS lookups. That is, when the DNS receives a query by IP address, “10.128.100.101” for example, it will look in the reverse zone file(s) to resolve the corresponding FQDN, “host1.nyc3.example.com” in this case.

On ns1, for each reverse zone specified in the named.conf.local file, create a reverse zone file. We will base our reverse zone file(s) on the sample db.127 zone file. Copy it to the proper location with the following commands (substituting the destination filename so it matches your reverse zone definition):

  • cd /etc/bind/zones
  • sudo cp ../db.127 ./db.10.128

Edit the reverse zone file that corresponds to the reverse zone(s) defined in named.conf.local:

  • sudo vi /etc/bind/zones/db.10.128

Initially, it will look something like the following:

/etc/bind/zones/db.10.128 β€” original
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.      ; delete this line
1.0.0   IN      PTR     localhost.      ; delete this line

In the same manner as the forward zone file, you will want to edit the SOA record and increment the serial value. It should look something like this:

/etc/bind/zones/db.10.128 β€” updated 1 of 3
@       IN      SOA     ns1.nyc3.example.com. admin.nyc3.example.com. (
                              3         ; Serial

Now delete the two records at the end of the file (after the SOA record). If you’re not sure which lines to delete, they are marked with a “delete this line” comment above.

At the end of the file, add your nameserver records with the following lines (replace the names with your own). Note that the second column specifies that these are “NS” records:

/etc/bind/zones/db.10.128 β€” updated 2 of 3
; name servers - NS records
      IN      NS      ns1.nyc3.example.com.
      IN      NS      ns2.nyc3.example.com.

Then add PTR records for all of your servers whose IP addresses are on the subnet of the zone file that you are editing. In our example, this includes all of our hosts because they are all on the 10.128.0.0/16 subnet. Note that the first column consists of the last two octets of your servers’ private IP addresses in reversed order. Be sure to substitute names and private IP addresses to match your servers:

/etc/bind/zones/db.10.128 β€” updated 3 of 3
; PTR Records
11.10   IN      PTR     ns1.nyc3.example.com.    ; 10.128.10.11
12.20   IN      PTR     ns2.nyc3.example.com.    ; 10.128.20.12
101.100 IN      PTR     host1.nyc3.example.com.  ; 10.128.100.101
102.200 IN      PTR     host2.nyc3.example.com.  ; 10.128.200.102

Save and exit the reverse zone file (repeat this section if you need to add more reverse zone files).

Our final example reverse zone file looks like the following:

/etc/bind/zones/db.10.128 β€” updated
$TTL    604800
@       IN      SOA     nyc3.example.com. admin.nyc3.example.com. (
                              3         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
; name servers
      IN      NS      ns1.nyc3.example.com.
      IN      NS      ns2.nyc3.example.com.

; PTR Records
11.10   IN      PTR     ns1.nyc3.example.com.    ; 10.128.10.11
12.20   IN      PTR     ns2.nyc3.example.com.    ; 10.128.20.12
101.100 IN      PTR     host1.nyc3.example.com.  ; 10.128.100.101
102.200 IN      PTR     host2.nyc3.example.com.  ; 10.128.200.102

Check BIND Configuration Syntax

Run the following command to check the syntax of the named.conf* files:

  • sudo named-checkconf

If your named configuration files have no syntax errors, you will return to your shell prompt and see no error messages. If there are problems with your configuration files, review the error message and the Configure Primary DNS Server section, then try named-checkconf again.

The named-checkzone command can be used to check the correctness of your zone files. Its first argument specifies a zone name, and the second argument specifies the corresponding zone file, which are both defined in named.conf.local.

For example, to check the “nyc3.example.com” forward zone configuration, run the following command (change the names to match your forward zone and file):

  • sudo named-checkzone nyc3.example.com db.nyc3.example.com

And to check the “128.10.in-addr.arpa” reverse zone configuration, run the following command (change the numbers to match your reverse zone and file):

  • sudo named-checkzone 128.10.in-addr.arpa /etc/bind/zones/db.10.128

When all of your configuration and zone files have no errors in them, you should be ready to restart the BIND service.

Restart BIND

Restart BIND:

  • sudo service bind9 restart

Your primary DNS server is now setup and ready to respond to DNS queries. Let’s move on to creating the secondary DNS server.

Configure Secondary DNS Server

In most environments, it is a good idea to set up a secondary DNS server that will respond to requests if the primary becomes unavailable. Luckily, the secondary DNS server is much easier to configure.

On ns2, edit the named.conf.options file:

  • sudo vi /etc/bind/named.conf.options

At the top of the file, add the ACL with the private IP addresses of all of your trusted servers:

/etc/bind/named.conf.options β€” updated 1 of 2 (secondary)
acl "trusted" {
        10.128.10.11;   # ns1
        10.128.20.12;   # ns2 - can be set to localhost
        10.128.100.101;  # host1
        10.128.200.102;  # host2
};

Below the directory directive, add the following lines:

/etc/bind/named.conf.options β€” updated 2 of 2 (secondary)
        recursion yes;
        allow-recursion { trusted; };
        listen-on { 10.128.20.12; };      # ns2 private IP address
        allow-transfer { none; };          # disable zone transfers by default

        forwarders {
                8.8.8.8;
                8.8.4.4;
        };

Save and exit named.conf.options. This file should look exactly like ns1‘s named.conf.options file except it should be configured to listen on ns2‘s private IP address.

Now edit the named.conf.local file:

  • sudo vi /etc/bind/named.conf.local

Define slave zones that correspond to the master zones on the primary DNS server. Note that the type is “slave”, the file does not contain a path, and there is a masters directive which should be set to the primary DNS server’s private IP. If you defined multiple reverse zones in the primary DNS server, make sure to add them all here:

/etc/bind/named.conf.local β€” updated (secondary)
zone "nyc3.example.com" {
    type slave;
    file "slaves/db.nyc3.example.com";
    masters { 10.128.10.11; };  # ns1 private IP
};

zone "128.10.in-addr.arpa" {
    type slave;
    file "slaves/db.10.128";
    masters { 10.128.10.11; };  # ns1 private IP
};

Now save and exit named.conf.local.

Run the following command to check the validity of your configuration files:

  • sudo named-checkconf

Once that checks out, restart bind

  • sudo service bind9 restart

Now you have primary and secondary DNS servers for private network name and IP address resolution. Now you must configure your servers to use your private DNS servers.

Configure DNS Clients

Before all of your servers in the “trusted” ACL can query your DNS servers, you must configure each of them to use ns1 and ns2 as nameservers. This process varies depending on OS, but for most Linux distributions it involves adding your name servers to the /etc/resolv.conf file.

Ubuntu Clients

On Ubuntu and Debian Linux VPS, you can edit the head file, which is prepended to resolv.conf on boot:

  • sudo vi /etc/resolvconf/resolv.conf.d/head

Add the following lines to the file (substitute your private domain, and ns1 and ns2 private IP addresses):

/etc/resolvconf/resolv.conf.d/head
search nyc3.example.com  # your private domain
nameserver 10.128.10.11  # ns1 private IP address
nameserver 10.128.20.12  # ns2 private IP address

Now run resolvconf to generate a new resolv.conf file:

  • sudo resolvconf -u

Your client is now configured to use your DNS servers.

CentOS Clients

On CentOS, RedHat, and Fedora Linux VPS, simply edit the resolv.conf file:

  • sudo vi /etc/resolv.conf

Then add the following lines to the TOP of the file (substitute your private domain, and ns1 and ns2 private IP addresses):

/etc/resolv.conf
search nyc3.example.com  # your private domain
nameserver 10.128.10.11  # ns1 private IP address
nameserver 10.128.20.12  # ns2 private IP address

Now save and exit. Your client is now configured to use your DNS servers.

Test Clients

Use nslookup to test if your clients can query your name servers. You should be able to do this on all of the clients that you have configured and are in the “trusted” ACL.

Forward Lookup

For example, we can perform a forward lookup to retrieve the IP address of host1.nyc3.example.com by running the following command:

  • nslookup host1

Querying “host1” expands to “host1.nyc3.example.com because of the search option is set to your private subdomain, and DNS queries will attempt to look on that subdomain before looking for the host elsewhere. The output of the command above would look like the following:

Output:
Server:     10.128.10.11
Address:    10.128.10.11#53

Name:   host1.nyc3.example.com
Address: 10.128.100.101

Reverse Lookup

To test the reverse lookup, query the DNS server with host1‘s private IP address:

  • nslookup 10.128.100.101

You should see output that looks like the following:

Output:
Server:     10.128.10.11
Address:    10.128.10.11#53

11.10.128.10.in-addr.arpa   name = host1.nyc3.example.com.

If all of the names and IP addresses resolve to the correct values, that means that your zone files are configured properly. If you receive unexpected values, be sure to review the zone files on your primary DNS server (e.g. db.nyc3.example.com and db.10.128).

Congratulations! Your internal DNS servers are now set up properly! Now we will cover maintaining your zone records.

Maintaining DNS Records

Now that you have a working internal DNS, you need to maintain your DNS records so they accurately reflect your server environment.

Adding Host to DNS

Whenever you add a host to your environment (in the same datacenter), you will want to add it to DNS. Here is a list of steps that you need to take:

Primary Nameserver

  • Forward zone file: Add an “A” record for the new host, increment the value of “Serial”
  • Reverse zone file: Add a “PTR” record for the new host, increment the value of “Serial”
  • Add your new host’s private IP address to the “trusted” ACL (named.conf.options)

Then reload BIND:

  • sudo service bind9 reload

Secondary Nameserver

  • Add your new host’s private IP address to the “trusted” ACL (named.conf.options)

Then reload BIND:

  • sudo service bind9 reload

Configure New Host to Use Your DNS

  • Configure resolv.conf to use your DNS servers
  • Test using nslookup

Removing Host from DNS

If you remove a host from your environment or want to just take it out of DNS, just remove all the things that were added when you added the server to DNS (i.e. the reverse of the steps above).

Conclusion

Now you may refer to your servers’ private network interfaces by name, rather than by IP address. This makes configuration of services and applications easier because you no longer have to remember the private IP addresses, and the files will be easier to read and understand. Also, now you can change your configurations to point to a new servers in a single place, your primary DNS server, instead of having to edit a variety of distributed configuration files, which eases maintenance.

Once you have your internal DNS set up, and your configuration files are using private FQDNs to specify network connections, it is critical that your DNS servers are properly maintained. If they both become unavailable, your services and applications that rely on them will cease to function properly. This is why it is recommended to set up your DNS with at least one secondary server, and to maintain working backups of all of them.

list package after size in Debian/Ubuntu

I had a Ubuntu system where the root drive almost was full i suspected it was some packages that apt-get autoremove couldn’t remove, that was using the drive.

This small script will list the installed packages on your system ending with the biggest.

dpkg-query -W --showformat='${Installed-Size;10}\t${Package}\n' | sort -k1,1n

On my system this was a huge amount of old kernel images, and kernel sources that was installed.

to remove the packages i used:

apt-get remove --purge

to see the total amount of storage used and exclude the /mnt (all my discs are mounted here) use:

du -shc --exclude /mnt /*

Installing VMware tools on Debian Wheezy 7.x

06-01-2018: instead of using the below guide Install Open VM Tools:Β  https://kb.vmware.com/s/article/2073803

Install the tools for building VMware tools on the host:

$ aptitude update
$ aptitude install gcc make
$ aptitude install build-essential
$ aptitude install linux-headers-$(uname -r)

Press the Install vmware tools in vSpehere Client for the VM.

Copy the VMware tools to the VM:

$ mount /dev/cdrom /mnt
$ cp /mnt/VMwareTools-8.6.10-913593.tar.gz /opt/
$ cd /opt
$ tar xfzv VMwareTools-8.6.10-913593.tar.gz

Install VMware tools:

$ cd vmware-tools-distrib/
$ perl vmware-install.pl

Next follow the installation instructions on the screen.

Then reboot the virtual machine and check the VMware Tools is running, by checking the status in the virtual machine with the vSphere client.

you can check locally on the VM that the tool is running by doing the following command:

$ service vmware-tools status
  vmtoolsd is running

Screen and irssi encodning.

Got this from a thread on the internet:

Section 1. Configuration

Follow the following steps. Please do not use scandinavic
characters until you have proceeded configuring irssi & screen
since they probably will not work properly while the
configuration is not finished.

Step 1. Connect to the server to run your irssi on

Step 2. Shut down your irssi

/quit

Step 3. Close the screen you were running it in (if it didn’t already)

Step 4. Backup your current irssi & screen configuration:

$ tar czf irssi-backup.tar.gz .irssi .screenr*

Step 5. If you have a line starting “defencoding” in ~/.screenrc, remove it

Step 6. Start screen like you usually do, but add a -U parameter

$ screen -U

or perhaps

$ screen -U -S irc

This makes screen understand that irssi talks utf-8 to screen

Step 7. Configure irssi to talk utf-8 to screen but use iso-8859-15 charset by default for all windows

Copy-paste the following commands to the irssi console:

/set term_charset utf-8
/set recode_autodetect_utf8 ON
/set recode_fallback ISO-8859-15
/set recode_out_default_charset ISO-8859-15
/set recode_transliterate ON
/set recode ON

Step 8. Detach screen (typically by pressing ctrl-a d)

Ta-da! Now you have configured irssi and screen to work properly.

HDHomeRun HD3-4DC and Linux (Yousee and Stofa)

A buddy of mine bought 2 HDHomeRun HD3-4DC and wanted to use this on a Ubuntu 12.04 Server
the problem with Ubuntu 12.04 is that the DVB kernel headers was removed from the normal header packages.

first make sure that your network has a working DHCP server, and that the HDhomeRun is connected to the network and that the antenna cable is connected.

first we need to add the ppa repository from
https://launchpad.net/~tfylliv/+archive/dvbhdhomerun

Adding the PPA repository:

$ add-apt-repository ppa:tfylliv/dvbhdhomerun
$ apt-get update

Kernel driver:
Next we need the kernel headers and the missing headers:
i my case the server was using the following kernel, linux-image-3.8.0-39-generic
the missing DVB headers i grapped from Kernel.org

# apt-get install linux-headers-3.8.0-39-generic
$ wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.tar.gz

Unpack the headers:

$ tar zxfv linux-3.8.tar.gz

Next copy the missing headers to the Ubuntu headers:

$ cp -R /linux-3.8/drivers/media/dvb-core/* /usr/src/linux-headers-3.8.0-39/drivers/media/dvb-core/
$ cp -R /linux-3.8/drivers/media/dvb-frontends/* /usr/src/linux-headers-3.8.0-39/drivers/media/dvb-frontends/

Installing the hdhomerun dkms and utils:

$ apt-get install dvbhdhomerun-dkms dvbhdhomerun-utils

This should build the dvb_hdhomerun kernel driver and the userhdhomerun userspace and the necessary script to run the userspace service,

try initialize the kernel driver:

$ modprobe dvb_hdhomerun

this should give something like this when looking at dmesg

[   17.893873] HDHomeRun: Begin init, version 0.0.16
[   17.897220] HDHomeRun: Waiting for userspace to connect
[   17.897228] HDHomeRun: End init

Setup Tuners:

We need to locate the names of the tuner in my case we actually have 2 of them :).

$ hdhomerun_config discover
hdhomerun device 141001A7 found at 192.168.1.136
hdhomerun device 14101464 found at 192.168.1.130

make a note of the name of the tuners i my case they are named: 141001A7 and 14101464.
next edit /etc/dvbhdhomerun

$ nano /etc/dvbhdhomerun

my config file looks like this:

# Remember to exchange the XXXXYYYY-Z with the serial number of your HDHomeRun
# tuner:

# Auto detect tuner type is not possible in all cases, so you can force it
# DVB-C
# DVB-T
# ATSC

[141001A7-0]
tuner_type=DVB-C

[141001A7-1]
tuner_type=DVB-C

[141001A7-2]
tuner_type=DVB-C

[141001A7-3]
tuner_type=DVB-C

[14101464-0]
tuner_type=DVB-C

[14101464-1]
tuner_type=DVB-C

[14101464-2]
tuner_type=DVB-C

[14101464-3]
tuner_type=DVB-C

# You can use a full name including tuner ID. Meaning the tuner will appear as
# "HDHomeRun DVB-C 1234EA3D-0" instead of just "HDHomeRun DVB-C" in for example
# TVHeadend.

[141001A7-0]
use_full_name=true

[141001A7-1]
use_full_name=true

[141001A7-2]
use_full_name=true

[141001A7-3]
use_full_name=true



[14101464-0]
use_full_name=true

[14101464-1]
use_full_name=true

[14101464-2]
use_full_name=true

[14101464-3]
use_full_name=true


# You can disable certain tuners. As default all detected hdhomeruns are used

#[XXXXYYYY-2]
#disable=true


# Enable additional logging  from libhdhomerun itself
[libhdhomerun]
enable=true
enable=true
logfile=/var/log/dvbhdhomerun_libhdhomerun.log

Now restart the dvbhdhomerun-utils

$ service dvbhdhomerun-utils restart

dmesg should show something like this:

[   19.050534] hdhomerun: userhdhomerun connected
[   19.050574] hdhomerun: userhdhomerun connected
[   19.050588] hdhomerun: creating dvb device for 141001A7-0
[   19.050688] DVB: registering new adapter (HDHomeRun)
[   19.110568] HDHomeRun HDHomeRun.0: DVB: registering adapter 0 frontend 0 (HDHomeRun DVB-C 141001A7-0)...
[   19.110685] HDHomeRun0: DVB Frontend registered
[   19.110688] HDHomeRun0: Registered DVB adapter0
[   19.110728] hdhomerun: device /dev/hdhomerun_data0 created
[   19.110971] hdhomerun: userhdhomerun connected
[   19.110984] hdhomerun: creating dvb device for 141001A7-1
[   19.111065] DVB: registering new adapter (HDHomeRun)
[   19.112681] HDHomeRun HDHomeRun.1: DVB: registering adapter 1 frontend 0 (HDHomeRun DVB-C 141001A7-1)...
[   19.112722] HDHomeRun1: DVB Frontend registered
[   19.112724] HDHomeRun1: Registered DVB adapter1
[   19.112762] hdhomerun: device /dev/hdhomerun_data1 created
[   19.112959] hdhomerun: userhdhomerun connected
[   19.112969] hdhomerun: creating dvb device for 141001A7-2
[   19.113058] DVB: registering new adapter (HDHomeRun)
[   19.115142] HDHomeRun HDHomeRun.2: DVB: registering adapter 2 frontend 0 (HDHomeRun DVB-C 141001A7-2)...
[   19.115221] HDHomeRun2: DVB Frontend registered
[   19.115223] HDHomeRun2: Registered DVB adapter2
[   19.115264] hdhomerun: device /dev/hdhomerun_data2 created
[   19.115456] hdhomerun: userhdhomerun connected
[   19.115467] hdhomerun: creating dvb device for 141001A7-3
[   19.115558] DVB: registering new adapter (HDHomeRun)
[   19.115904] HDHomeRun HDHomeRun.3: DVB: registering adapter 3 frontend 0 (HDHomeRun DVB-C 141001A7-3)...
[   19.115951] HDHomeRun3: DVB Frontend registered
[   19.115953] HDHomeRun3: Registered DVB adapter3
[   19.115985] hdhomerun: device /dev/hdhomerun_data3 created

The hdhomerun is now connected.

Scanning for DVB-C channels:
As i live in Denmark, the most common DVB-C providers are Yousee and Stofa

for Yousee use the following setup:

$ hdhomerun_config XXXXXXXX set /sys/dvbc_modulation a8qam64-6875

for Stofa use the following setup:

$ hdhomerun_config XXXXXXXX set /sys/dvbc_modulation a8qam64-6900

Next we need to setup the tuners:

$ hdhomerun_config  XXXXXXXX set /tuner0/channelmap eu-cable
$ hdhomerun_config  XXXXXXXX set /tuner1/channelmap eu-cable
$ hdhomerun_config  XXXXXXXX set /tuner2/channelmap eu-cable
$ hdhomerun_config  XXXXXXXX set /tuner3/channelmap eu-cable

finally we can scan the muxes for channels:

$ hdhomerun_config XXXXXXXX scan 0 hdhomerun.log

the scan takes some time so be patience

if you are going to install TVheadend you should do the following to the log file:

For Yousee:

awk '{if ($1 ~ /SCANNING/) print "\n" $2; else print $0}' hdhomerun.log | awk 'BEGIN { RS = "" ; FS = "\n" } { if (length($4) > 0) print "C " $1 " 6875000 NONE QAM64" }' > dk-YouSee

For Stofa:

awk '{if ($1 ~ /SCANNING/) print "\n" $2; else print $0}' hdhomerun.log | awk 'BEGIN { RS = "" ; FS = "\n" } { if (length($4) > 0) print "C " $1 " 6875000 NONE QAM64" }' > dk-Stofa

the generated file is readable by TVheadend and should make it more easy to find the channels.

Notes:

If you wanne update the firmware for the hdhomerun you can do this with the hdhomerun_config tool by doing:
(check Silicondust’s homepage for newer releases)

$ wget http://download.silicondust.com/hdhomerun/hdhomerun3_dvbc_firmware_20140121.bin
$ hdhomerun_config 14101464 upgrade hdhomerun3_dvbc_firmware_20140121.bin

References:

http://tommy.winther.nu/wordpress/2013/06/21/opsaetning-af-hdhomerun-dual/
https://launchpad.net/~tfylliv/+archive/dvbhdhomerun
http://sourceforge.net/apps/trac/dvbhdhomerun/wiki/FAQ#RebuildkernelmodulesinUbuntu
http://sourceforge.net/apps/trac/dvbhdhomerun/wiki/UbuntuPackages