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.

The World Sized Robot

I felt this needed to be shared with a broader audience. It may not be news to everybody but far from enough people understands we are just on the verge of something large happening.

We are building a world sized robot

Bruce Schneier writes in his latest CRYPTO-GRAM about something that has been bothering some people for a while as the implications are yet an undiscovered country. But his words are better than mine, so here goes:

We no longer have things with computers embedded in them. We have computers with things attached to them.

Your modern refrigerator is a computer that keeps things cold. Your oven, similarly, is a computer that makes things hot. An ATM is a computer with money inside. Your car is no longer a mechanical device with some computers inside; it’s a computer with four wheels and an engine. Actually, it’s a distributed system of over 100 computers with four wheels and an engine. And, of course, your phones became full-power general-purpose computers in 2007, when the iPhone was introduced.

We wear computers: fitness trackers and computer-enabled medical devices — and, of course, we carry our smartphones everywhere. Our homes have smart thermostats, smart appliances, smart door locks, even smart light bulbs. At work, many of those same smart devices are networked together with CCTV cameras, sensors that detect customer movements, and everything else. Cities are starting to embed smart sensors in roads, streetlights, and sidewalk squares, also smart energy grids and smart transportation networks. A nuclear power plant is really just a computer that produces electricity, and — like everything else we’ve just listed — it’s on the Internet.

The Internet is no longer a web that we connect to. Instead, it’s a computerized, networked, and interconnected world that we live in. This is the future, and what we’re calling the Internet of Things.

Broadly speaking, the Internet of Things has three parts. There are the sensors that collect data about us and our environment: smart thermostats, street and highway sensors, and those ubiquitous smartphones with their motion sensors and GPS location receivers. Then there are the ”smarts” that figure out what the data means and what to do about it. This includes all the computer processors on these devices and — increasingly — in the cloud, as well as the memory that stores all of this information. And finally, there are the actuators that affect our environment. The point of a smart thermostat isn’t to record the temperature; it’s to control the furnace and the air conditioner. Driverless cars collect data about the road and the environment to steer themselves safely to their destinations.

You can think of the sensors as the eyes and ears of the Internet. You can think of the actuators as the hands and feet of the Internet. And you can think of the stuff in the middle as the brain. We are building an Internet that senses, thinks, and acts.

This is the classic definition of a robot. We’re building a world-size robot, and we don’t even realize it.

To be sure, it’s not a robot in the classical sense. We think of robots as discrete autonomous entities, with sensors, brain, and actuators all together in a metal shell. The world-size robot is distributed. It doesn’t have a singular body, and parts of it are controlled in different ways by different people. It doesn’t have a central brain, and it has nothing even remotely resembling a consciousness. It doesn’t have a single goal or focus. It’s not even something we deliberately designed. It’s something we have inadvertently built out of the everyday objects we live with and take for granted. It is the extension of our computers and networks into the real world.

This world-size robot is actually more than the Internet of Things. It’s a combination of several decades-old computing trends: mobile computing, cloud computing, always-on computing, huge databases of personal information, the Internet of Things — or, more precisely, cyber-physical systems — autonomy, and artificial intelligence. And while it’s still not very smart, it’ll get smarter. It’ll get more powerful and more capable through all the interconnections we’re building.

It’ll also get much more dangerous.

— Bruce Schneier, cryptographer and computer security expert and educator, from his news letter CRYPTO-GRAM of february 15, 2017.