Setting up Debian

About setting up debian on a laptop computer.

I had been using Ubuntu as the primary Linux distro on my computer for a long time.

A lot of my friends are Debian users and I figured I would make debian the primary distro on my new laptop.

This blog post is a description of some of the stuff that I did while installing and configuring debian.

Used the latest stable release: Debian 11 (Bullseye).


Initially tried using the installer that doesn't come with a desktop environment (to use hlwm as window manager). But got stuck after installing the base system when using the installer without a desktop environment (DE), as we need internet to download other packages and the only internet connection that I could access has a captive portal where I got to enter my username and password. And the DE-less installer comes without any web browser; including those usable from the terminal like lynx, elinks, links and w3m.

Tried to do some acrobatics with wget and curl to get around that, but couldn't make that work (if anyone knows how we can make it work, please tell me 😃) as my internet access point's captive portal had some kind of an access token that kept changing.

So finally gave up and used the installer (non-free as I needed the drivers) with xfce instead.

Partitioning

Had used fdisk to partition the harddisk beforehand using a live ISO.

The computer had 8GB of RAM.

Mount point Size File system Comment
/boot/efi 300MB efi EFI
/boot 1.5GB ext4 GRUB and Kernel
/swap 8GB swap Swap
/ 47% ext4 Root
/home 53% ext4 Home

See here about a discussion as to a good size for /boot/efi.

Red Hat's recommended partitioning scheme may also be worth checking out. (As for me, I didn't use LVM.)

Configuring

Adjust apt sources list

apt, the package manager that debian uses, has a list of repos from where it will fetch packages at /etc/apt/sources.list.

I didn't have internet connection while installing the OS, so needed to edit this file manually to make it:

deb http://deb.debian.org/debian/ bullseye main
deb-src http://deb.debian.org/debian/ bullseye main

deb http://deb.debian.org/debian/ bullseye-updates main
deb-src http://deb.debian.org/debian/ bullseye-updates main

deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main

Bascally, just got rid of the cd-image lines that were inserted there at the time of installation.

Do an sudo apt update afterwards.

Adjust $PATH

By default, $PATH won't include directories like /usr/sbin/ where many useful executables (like useradd, visudo, etc) are located.

So, modify $PATH at ~/.profile to add:

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

Add a user to sudo group

By default, debian will set up two users: root and a non-root user.

The non-root user won't be able to use sudo. We got to add it to the sudo group.

We can view the list of groups to which a user belongs to using the groups command.

groups <user-name>

To add a user to the sudo group, we can do (as super user) ¹²

sudo useradd <user-name> sudo

adduser <user-name> sudo

Verify that it worked by using the groups command.

Stop beeping

For my computer, the internal speaker would make a loud beeping noise whenever triggering the auto-completion in the shell (bash) doesn't result in a match.. A rather loud (and somewhat annoying) beeping sound.

Found that a lot of people just disable the pcspkr kernel module to prevent the speaker being active. I too did that using ¹:

rmmod pcspkr

We can blacklist this kernel module so that we don't have to keep running the above command each time we turn on the computer. This can be done by making a file /etc/modprobe.d/nobeep.conf with the following in it:

blacklist pcspkr

Remove custom theme in grub

There is a good-looking background image in the grub menu by default in an installation of debian with xfce (any installer other than the standard one without a DE, I guess).

But I preferred a minimalistic setup without custom backgrounds and wished to remove it.

To remove the custom theme we can use ²:

sudo chmod -x /etc/grub.d/05_debian_theme
sudo update-initramfs -u
sudo update-grub

lightdm

I had got lightdm as display manager. I made a couple of changes to how it looks like.

Prefill user name

lightdm doesn't pre-fill the username field by default (for better security and privacy, I guess), but I preferred to have it.

We can change the default setting by uncommenting the following line in /etc/lightdm/lightdm.conf ³:

greeter-hide-users=false

Change background

Background was a nice artwork with the debian logo. But I preferred a solid colour.

For this we can edit the file at /etc/lightdm/lightdm-gtk-greeter.conf and add the hex-value of the desired colour for background value under the [greeter] section.

[greeter]
background=#444444

Not exactly sure why there's 'gtk' in the file name. Maybe this link can help to figure that out. lightdm uses the gtk-greeter by default.

Set date

Date was wrong since the debian installer couldn't connect to internet during the installation. Fixed that with something like

date -s "2021-12-05 15:30:10"

But that doesn't change the hardware clock that can be obtained with hwclock command. We can change the hardware clock to be same as the system clock with :

# 'Copy' system clock to hardware clock
hwclock --systohc

(Fun fact: Set system clock to be same as hardware clock, ie 'copy' hardware clock to system clock, with hwclock --hctosys).

If needed, we can set the time zone like ¹³:

sudo timedatectl set-timezone <Continent>/<City>

Setting the font size right

The font size was very small. Not just the font size, the entire display. Even the command line in BIOS!

This may be a problem with HiDPI displays.

I could increase the size of the text in the terminal by placing the following in the /.Xresources file :

xterm*faceName: Monospace
xterm*faceSize: 14

That's it!

With these changes, I got my debian to look the way I wanted it to be. It's been a few months and I am happy with the configuration.😊

(Almost all of this blog post was originally written in December 2021.)

(Also, thanks to my friend Kevin for his advice regarding the partition scheme to use.)


Edits (2022 Feb 23):