Next we can move on to upgrading the version of MongoDB extension version from what was part of my install as version 2.1.7 up to the current 2.3.2 via the following:
sudo pecl upgrade mongodb
Not knowing what all the various configuration questions mean I left them as the defaults.
Hopefully later point releases of Ubuntu 26.04 will already contain the later drivers. We need 2.2.x or upwards for any vector support.
If the compile completed then do the following :
echo "extension=mongodb.so" | sudo tee /etc/php/8.5/mods-available/mongodb.ini
Centos systemd-networkd … The tale of the missing packets.
The symptoms are strange to say the least. It appears that the traffic leaving the virtual interface are correctly being processed by the POSTROUTING chains and yet even with replies from the outside world the traffic does not return to the virtual interface. Almost as if it were being dropped on the external interface. Checking the usual ip_forward file will show that it is indeed forwarding and the fact that the traffic leaves the virtual interface and goes out to the world shows that works. Each interface also has its own forwarding file called .. ‘forwarding’ and they reside in the /proc/sys/net/ipv4/conf directory separated by their own directories per interface.
Enter systemd-networkd. The apparent issue is that systemd-networkd sets the forwarding for the specific interfaces it controls to 0 by default and fights to keep it that way. That’s the simple version. Change it to a 1 and a few minutes later your back to 0. Constant appearances of ‘systemd-networkd: eno1: link configured’ in the logs following a sysctl -w net.ipv4.ip_forward=0 and then sysctl -w net.ipv4.ip_forward=1 give the problem away.
Libvirtd will by default set any interface created from the virbr0-nic, virbr0 to vnet0 etc. to forwarding=1 but systemd-networkd will keep resetting this for interfaces it ‘manages’. This stuffs up the ability of the lan / wan interface to forward traffic BACK to the virtual interfaces. The solution is actually rather simple… Locate /etc/systemd/network/YOUR_INTERFACE and then find the [Network] section.
There you need to change the forwarding policy for the interface with the line :
IPForward=ipv4
and perhaps
IPForward=ipv6
Don’t disable or remove systemd-networkd else you will need to get the rescue console fired up … note to self 🙂
I think Hetzner has started to push this in the Centos 7.7 install image because he-8 says [root@isdhe-8 ~]# systemctl status systemd-networkdUnit systemd-networkd.service could not be found.
Which implies it’s not installed and hence no issues. This is Centos 7.7 but an upgrade.
I recently looked at Digital Ocean as a possible replacement VM host as a company project and have now chosen to use them for my own personal VM. Since I am using a prepaid option the need to get some warning when my prepaid amount was due to run out became a requirement. Below is the Ruby code I use to pull the remaining credit and email on a daily basis. Hope you find it useful. I run this daily via a cron entry. The requirements are Ruby 1.9+ (I am sure it will work on lower but only tested on 1.9+) and the mechanize Ruby gem.
#!/usr/bin/ruby
require 'mechanize'
require 'net/smtp'
user = 'your_username_here'
pass = 'your_password_here'
The current credit is : $#{balance.to_s}
MESSAGE_END
Net::SMTP.start('localhost') do |smtp|
smtp.send_message message, 'your_email_address_here', 'your_email_address_here'
end
Recently I needed to re-create a backuppc virtual machine from an existing one. The reason for this was to create a smaller primary partition which would take up less space on the host machine. After some searching, and I must admit rather unsuccessful searching, the solution appears to be far simpler than expected. Basically on Ubuntu 12.04 it appears that there are two main directories that are required. The first is the /etc/backuppc directory which seems to house a series of perl scripts, one for each machine that is being backed up. This directory also houses the htpasswd and apache config files. The second is the /var/lib/backuppc directory which contains the all important .ssh files. This directory contains the know_hosts and ssh keys required to migrate the config to another machine without having to login and update the keys for each machine. Given that all the machines the backuppc is syncing use rsyncd this would have taken a load of time. The host file is also important as is the resolv.conf files. These are used to resolve the names given to your backups within backuppc. So basically setup a new machine or VM and install backuppc from the Ubuntu repositories. In my case I was lucky enough to migrate to another VM which has the same version of OS as the previous setup. Once the /etc/backuppc, /var/lib/backuppc/.ssh, /etc/hosts and /etc/resolv.conf are copied / update you are almost ready to go. Update the permissions on the. /var/lib/backuppc/.ssh and /etc/backups files and restart your apache2 service. From there your setup may be different since in my case SSL was used for the apache2 setup. As a test start the backuppc service and login to your backuppc interface. A good sign is if the username and passwords are the same 🙂 I am sure there are hundreds of other scenarios that are not covered here but this seems to have worked for me.
For fun I wanted to improve on my fuzzydates gem and rather add a new method to the Date class. Here is the code that seems to work for me.
class Date
class << self
def end_of_this_month
return Date.current+1.month-Date.current.day
end
def first_of_next_month
Date.end_of_this_month+1.day
end
end
end
I decided to create a simple gem to hold some date requirements that I had. Basically here is what you need to build a simple gem.
Create a working directory. In my case this was called fuzzydates. Change into the directory and create a lib directory so that you now have a directory structure that looks like this:
fuzzydates
fuzzydates/lib
For a very basic gem all we need is a gemspec file and the actual code in a .rb file. Firstly lets create the gemspec file in the base directory that you created (fuzzydates). Mine is called fuzzydates.gemspec
Gem::Specification.new do |s|
s.name = 'fuzzydates'
s.version = '0.0.1'
s.date = '2013-02-10'
s.summary = "a summary of your gem"
s.description = "describe your gem"
s.authors = ["your name"]
s.email = 'your email address'
s.files = ["lib/fuzzydates.rb"]
s.homepage = 'your website'
end
Paste the above text into the file and update the fields as required. The version number is up to you but will have a bearing on the version that gem sees or your rails application requires. The s.files section needs to contain the names of the .rb files you add to the lib directory. The s.name will be the name as your gem. Once update, save the file and then change to the lib directory that you created.
Once there create a file with the same name as you used in the s.files section above. In my case this was fuzzydates.rb
Now create a basic class and have it do something as a test. Mine just returns some dates.
class Fuzzydates
def self.end_of_this_month
return Date.current+1.month-Date.current.day
end
def self.first_of_next_month
Fuzzydates.end_of_this_month+1.day
end
end
Once you have saved this file return to the base directory where the .gemspec file is and run
gem build fuzzydates.gemspec
If all goes well it will build a .gem file and report the following (or similar)
Successfully built RubyGem
Name: fuzzydates
Version: 0.0.1
File: fuzzydates-0.0.1.gem
You can now install the gem using the normal gem install command from inside the directory where the .gem file is located.
There are other ways of using rvm and bundle to create the basic gem template but this works for me.
To make the XFCE application menu pop up when you hit the Windows key add the following application via the keyboard shortcuts and press the Windows key when prompted.
xfce4-popup-applicationsmenu
It doesn’t work exactly the same as windows since hitting the key twice does not make the menu disappear.
I have just needed to install a dev package on my Xubuntu system and wanted to see what and where the package would install the files to. It seems that there is an apt-file command which is not installed by default. So I installed it…
apt-get install apt-file
and then followed by
apt-file update
In my case it wanted to update about 23.6M of information from the web. Once this was done I could run the command
apt-file list libusb-dev
and get a nice long list of what files would be installed and where they would be located.