The Linux Page

Copying large directories between computers

Twin Windows — perfect duplication

Copying Data between Computers

Since I'm moving to a new server, I need to copy all of Gb or Gb of data from my old computer to the new one. This is mainly three folders:

/home
/mnt/cvs
/var/www

There are two main problems here:

1. the files have various permissions and ownership which I do not want to lose, especially for websites and the cvs repositories (I still have a CVS, but that folder also include SVN and GIT repositories)

2. the files on the source computer require various permissions to be read, "namely", I have to be root to make sure I can read all those ...

Setting up your static IP address since Ubuntu 18.04

Spider Web representing various Internet and Intranet network of users.

Older Versions (Ubuntu 17.10-)

With older versions I would just go to /etc/network and edit the interfaces file.

This file would have definitions about the computer interfaces, whether each computer gets a static IP or uses DHCP, etc.

Here is a sample setup for older versions:

auto eth0
iface eth0 inet static
        address 10.0.0.1
        netmask 255.0.0.0
        network 10.0.0.0
        broadcast 10.255.255.255
        gateway 10.0.0.1
        dns-nameservers 10.0.0.8 10.0.0.9
        dns-search m2osw.com
        pre-up /etc/network/firewall

The pre-up is a script run ...

How to avoid creating a sparse file in C/C++?

A hill of sparsely distributed trees.

Introduction

As I'm doing some work to create an RDBM like library to write data to a database, I wanted to make sure that my file was NOT sparse. I don't mind sparse files at all, they save us some space on disk. Only, when creating a database, pretty much all my blocks of data will need to exist, otherwise we may take the risk of not being able to allocate the inodes later and write in those blocks.

So I search Google to try to find information on NOT to create a sparse file. Make sure that my software prevents the OS from creating a sparse file. I could not really find ...

Start remote process on my X11 computer without encryption, how do I do that?

A modern tunnel.

Running X Tool from a Remote Connection

I have been using SSH to connect to my LAN network computers and make all sorts of changes to the machines running in a console and X tools. Works just fine.

Setup the SSH Tunnel

I actually setup the X11 capability with two changes:

1) setup the SSH server with:

X11Forwarding yes
X11DisplayOffset 10

Then restart the SSH server.

2) setup your client with a ~/.ssh/config file where you enter:

Host remote
  ForwardX11 yes

This is the equivalent to the -X command line option, without you having to remember to enter the ...

Boot into the command line console in Ubuntu 16.04 and newer

An Ubuntu 16.04 login prompt just after boot, ready for you to log in.

As I just upgraded my 14.04 installation to 16.04, it booted right up to lightdm.

I had it properly setup to boot in a console before, but somehow it changed the behavior on me.

This is because the computer is now using systemd to boot.

I already had the GRUB variables setup as expected:

GRUB_CMDLINE_LINUX_DEFAULT="text"
GRUB_CMDLINE_LINUX="text"
GRUB_TERMINAL=console

But this is not enough if you want to start in the console when running systemd (which is running since 15.04). See X11 Auto-starting for details about older versions.

systemd has a list of ...

USB over IP to add USB devices over your IP network

Setting up a USB over IP environment

Many times, under Linux, you have a device that uses a USB port and not the network. Yet, if you want multiple users to have access to said device, you need to somehow share it.

One solution is to have a driver which allows for network connections from remote systems. However, the likelihood of such is close to 0.

Another solution under Linux is to have the USB/IP (read USB over IP) modules setup and share any USB device from any computer to any other computer.

The reason why I looked for this is the limited number of USB port I have on my new server. I did not realize that I'd need 9 ...

Setting up BIND to get the letsencrypt wildcards to work on your system using RFC 2136

Which destination has to be used?

Wildcard Certificate with letsencrypt

I have my own DNS, so I need to set it up myself to get letsencrypt to work as expected and generate a wildcard certificate for my websites.

They decided to test the DNS because that way they know you are in control of the domain and its sub-domains (only the owner  of a domain name would be able to allow such a test to work.) When creating a certificate for just one website they can ask you to place a file there, which is very easy, but for an entire domain, that wouldn't be quite enough, especially since some business endeavors actually ...

Reading a binary zone file from Bind

Binary code to Zones

Today I needed to check a zone file to see why the IP address was wrong on one of my servers.

Sure enough, the IP was the old one (We switch servers about 9 months ago). Although once in a while I would get the right IP, the second name server still had the old IP. I thought the cache would be renewed more often than that, but I guess this is well optimized!

The error I made is not change the time info which means that the second name server never saw the change. This is just a domain name I redirect so I never noticed the problem before.

To check the cached file, though, I needed a way ...

My New 1Tb Server

New Computer supporting 1Tb of RAM

Preface

My old computer only has 8Gb of RAM. The motherboard was supposed to support 16Gb, but it looks like the one model I got did not work with that much memory.

I've used that computer for too long now and I have been looking at upgrading for a few years, but I was not quite ready to do it. In 2019, now I'm finally moving forward with an upgrade. Why? Because 1Tb computers are actually becoming affordable!

For now, I'll be getting only 512Gb of RAM, but even just that will allow me to run 24/7 without having to close my X-Windows sessions every night (which is sad ...

localstack error: ImportError: cannot import name requests

Localstack — services simulating the Amazon S3 environment

Today I had a need to run the localstack services to emulate Amazon S3 and get some work done.


Note that below I talk about how to get localstack run on your own. The latest, though, offers a Docker which I highly recommend (see section about the Docker install below). You have nothing to do. Download and run with docker instead of trying to get the correct version of python on a system which does not offer that exact version...

Also, since Sep 15, 2020, the library took a sharp turn in regard to all the ports it manages, Instead of opening one port per feature, it will only open 4566 ...