So my ThinkPad just borked itself. It was running Ubuntu LTS. I got tired of Ubuntu’s faffing about with ads in the terminal, pushing private data to Amazon, and general asshattery. From a previous install I knew that installing Debian wasn’t as difficult as I recalled from the before times, so I went with that.

Unless otherwise stated, everything here happens in the terminal. Don’t be afraid, it’ll be ok. Just open a terminal.

The default on Debian 11 would be gnome-terminal.

Moving your data onto your freshly installed machine

You had backups, right? Before we do anything else, take that hard drive (or whatever) with your old data on it, connect it to your computer, and start moving the files over.

The fiddly stuff below will take a while, so let’s make good use of the time.

Getting up to date

While your data is being copied over, let’s get the OS up-to-date. Who knows how long that install ISO has been lying around there.

In your terminal, become root:

	(Enter root password)

And run the update commands:

	apt-get update
	apt-get upgrade

Enable sudo

UPDATE: You can skip this step if you’re smart during the installer stage.

It works like this:

When the installer prompts you to set a password for the root user, leave the field blank. In the next screen, the installer will then let you create your own user. Sudo will be enabled, and your user will have sudo privileges.

Thanks @neil!

Or just keep doing it the hard way

So far, so good. On to more interesting things. We want to install the sudo command, because… I’m used to it, and I hate having to change my habits. That’s a perfectly cromulent reason.

Install the sudo package:

	apt-get install sudo

Now we have to amend the PATH variable in our bash settings, because otherwise we won’t find the command we need. (No idea why this is necessary. Whoever set things up this way: I have words to say to you.)

	export PATH="$/usr/sbin:$PATH"

Now close your terminal, and open it again - just to make sure the new path is loaded. Become root again:

	(Enter root password)

Then add the user account in which you need to use the sudo privileges:

	adduser yourusername sudo

If the damn box still says “adduser: command not found”, just do

	/usr/sbin/adduser yourusername sudo

I swear, it’s there. Debian just doesn’t want you to know. Whatever.

Doing the evil thing: Add contrib and non-free repos

While I don’t want to recommend running non-free software, it can be rather practical for some things. Like getting your wifi working, if you’ve ended up with one of the many machines where that requires proprietary drivers.

So let’s add some package repositories! In your terminal, do

	nano /etc/apt/sources.list

and after each “main” that you see, add

	contrib non-free

Save and exit with Ctrl-O Ctrl-X, and run

	apt-get update

Getting wifi to work

Now with the repos for the dark side enabled, we can install the wifi drivers that at least my ThinkPad needs. You’ll have to figure out which ones are needed for your machine. I do:

	apt-get install firmware-iwlwifi

Good, that should do it. We’ll see after a reboot.

More evil proprietary stuff: multimedia codecs, playing DVDs

The steps in this section come from this page, which was recommended to me by the most excellent Neil Brown. Thanks!

You’ve done the update / upgrade dance described at the start of this post, right? If not, do it now.

Then let’s install the libraries that let us play DVDs:

	apt-get install libdvd-pkg

This will give you one of Debian’s lovely blue config screens that always pop up for the more serious stuff. Not to worry, just select the defaults and run with those.

At this point, in order for stuff to work I had to close my terminals, start them again, and become root as

	su -

Maybe this is about loading the path variable that we modified above. Who knows. Who cares.

Now download, compile and install libdvdcss. (This sounds way worse than it is. The reason you need to do this at all is the absolute state of global copyright law.)

	dpkg-reconfigure libdvd-pkg

Another blue config screen, another click on the default, off you go.

Next, we install the regionset command:

	sudo apt-get install regionset

and finally, all those juicy codecs:

	apt-get install libavcodec-extra

If your DVD player refuses to play your discs, use the regionset command to set your machine’s DVD region code to whatever the DVD demands. The region codes are listed on the regionset man page. (1 is for North America, 2 is for EMEA / South Africa / Japan, etc. I don’t make the rules.)

You’ll also want some software to, well, actually play those DVDs:

	apt-get install vlc

Now it works for me! I tested it with one of those top TERF wizard kid movies that I happened to have lying around.

Making CapsLock an additional Ctrl

The Ctrl key is in the wrong place on modern standard keyboards. (No, I’m not interested in your views on this point.) Let’s fix that.

While this has to be one of the most popular modifications to the keyboard layout, it has apparently been less than straightforward historically.

Fortunately, things are better now. Open the gnome-tweaks tool, and you’ll find everything you need under “Keyboard & Mouse” > “Additional layout options”.

This will require a restart, which by this point is probably advisable anyway, what with all the stuff we’ve been installing and configuring.

(Optional) Restoring passwordless ssh login

This use case is a lot more specific than the rest, so feel free to ignore this section.

I have a managed server that I can ssh into. That’s nice! I’ve set it up so that I can just type “ssh (server shortname) on the console, and I’ll be logged in. This is also very handy for running scripts. Unfortunately, it didn’t work after the Debian install, even though I had restored my old ssh keys from backup.

The error message read:

	sign_and_send_pubkey: signing failed: agent refused operation

This turned out to be a permissions problem. I fixed it in the following way (all this happens on my laptop, not on the server):

  1. Go to your home directory:

     cd ~
  2. Set the correct permissions for the .ssh directory:

     chown 700 .ssh
  3. Go into the .ssh directory:

     cd .ssh
  4. Make sure the permissions for your ssh key files are set as they should be, like so:

     chown 600 id_rsa
     chown 644
  5. Add your private key to the OpenSSH authentication agent:


That’s it. Now everything should work as before.

Done. I think.

With this, we should have most of the boxes ticked. Of course you’ll want to install more stuff as needed.

Enjoy your new Debian system!