Kategoriarkiv: English

After cloning a Ubuntu 22.04 server

Many things have changed from the oh so abundant 18.04 server and there are a few surprises that one needs to be aware of. One thing that has changed is that changing the MAC address no longer changes the ID when the server requests a new IP from a DHCP server.

This means that cloning a server into a new server they will start competing for the same IP address if they are on the same network so there are a few things you need to do before you deploy the new close.

Fix the IP address of the clone

  1. First release the DHCP address the machine has by issuing the command ”dhcpd -r” which should take care of this.
  2. Change the mac address, if you are using bridged network in particular there should not be two network interfaces on the same segment with the same MAC address. This is done in the virtual machine software.
  3. Change the machine-id of the clone. This is done by deleting the file /etc/machine-id and then running the script systemd-machine-id-setup which will create a new one.
  4. Optional: If you would like the system to change the network ID when you change mac address on the NIC then you need to change the following file(s) /etc/netplan/*.yaml and edit this to insert under each of the network interfaces you want to use MAC address as their ID ”dhcp-identifier: mac” then run sudo netplan apply.

Now shutdown the host, change the networking to whatever is needed (bridged most usually) and then restart the system and it should now be assigned a new IP address.

Fix the SSH keys of the clone

Next step is of course to change the cloes SSH keys which is done by deleting the keys in /etc/ssh by issuing the command ”rm /etc/ssh/ssh_host_*” which would delete all of them.

Then regenerate new keys from using the command ”dpkg-reconfigure openssh-server” which will generate all needed keys as if it was fresly installed.

Bevingade ord

Sleep resume in Ubuntu screws up mouse pad

I found that my Lenovo laptops did not always get the mousepad right when coming out of sleep or hibernate. After a bit of research I found that a modprobe remove and insert of the psmouse kernel module did the trick.

To automatize this you can insert a file in the systemd control structure to fix the problem yourself (if you are experiencing it). Below is a block of code. Save this to a file in /lib/systemd/system-sleep/touchpad


#!/bin/bash
# 2019 Täpp-Anders Sikvall
# Reinsert kernel module for mouse pad on lenovo after waking up
# from a sleep or a suspend so that things like gestures work 
# properly
# bugs to anders@sikvall.se
 
case "$1" in
   pre)
     exit 0                  # Do nothing just return
     ;;
   post)
     sleep 3                 # Wait for system to stabilize
     modprobe -r psmouse     # Remove psmouse from kernel
     modprobe psmouse        # Reinsert psmouse to kernel
     exit 0                  # Return no error
     ;;
   *)
     exit 1                  # Normally we should not be here
     ;;                      # but if we are, return error
 esac

Ubuntu Linux kernel 4.0.15-29 diasbles keyboard on Lenovo T420s

Recent update to one of my laptops made the keyboard completely stop working. While rebooting to the previous kernels made it work again.

The kernel that’s the culprit is the generic kernel 4.0.15-29 which does not even work in recovery mode. I have disabled this kernel on my system but could not find information out there about others with similar symptoms so I am writing this here in order to quickly get something out.

Getting Teamviewer to work on Ubuntu 16.10

Teamviwer relies on a bunch of 32 bit dependencies you need to enable for it to install. This procedure should work:

sudo dpkg --add-architecture i386
sudo apt-get update
wget http://download.teamviewer.com/download/teamviewer_i386.deb
sudo dpkg -i --force-depends teamviewer_i386.deb
sudo apt-get install -f
sudo teamviewer --daemon start

I always suggest you take a snapshot before if your file system supports this just in case.