Helpful Debian 9 Hacks and Fixes
This post will serve as an ongoing personal notes section as I migrate my daily driver desktop to Debian 9. As I have issues with the OS, I will post fixes here. I hope that if you found this, it helps you out.
Add the sudo Command (If it Doesn’t Exist)
Upon completing the install, I opened a terminal and attempted to run some commands with ‘sudo.’ I got an error that the sudo command wasn’t found. After some searching I found that since I had created a root user password during install, sudo hadn’t been installed. If you choose to leave the root password blank during install, the root user account will be disabled and sudo will be installed properly. If you choose to keep the root user though, it’s easy to add the command.
First you’ll need to su to the root user, so in your Terminal:
su root
Enter the root password, and then install sudo with apt.
apt -y install sudo
From here, you’ll want to add your user account the users who are able to use the sudo command.
visudo
Scroll down to the section that’s marked “User privilege specification.” It should have a line that looks like this:
root ALL=(ALL:ALL) ALL
You’ll want to create a line directly under that line, but replace ‘root‘ with your username. Save the file with CTRL + O and then exit with CTRL + X. Log out and back in as your user account and you should be able to sudo to your heart’s content.
Returning to “Normal” Network Interface Names (eth0, wlan0, etc.)
I noticed that by default my network interface names weren’t what I was used to. For example, my wired Ethernet adapter was called “ens0p3,” my internal 802.11 adapter was called “wlpls0,” and my Alfa USB adapter was called “wlp139482afslek34” or something like that. No good. It’s nice when your wired Ethernet adapters start with eth0, and your 802.11 adapters start with wlan0 and increment as you add adapters. These crazy names make running utils like airmon-ng no fun at all.
Let’s fix this. Start by editing the following file:
sudo nano /etc/default/grub
Scroll down to GRUB_CMDLINE_LINUX=”” and change the lines so it reads like this:
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
Re-make the grub config file with the new settings.
sudo grub-mkconfig -o /boot/grub/grub.cfg
Reboot. Your network interface names should now be “normal.”
What Happened to ifconfig?
I found that in Debian 9 I was able to run the iwconfig command, but ifconfig was nowhere to be found. I found this odd since in Mint, Manjaro and Kali I’ve always had ifconfig. It turns out that the ifconfig command has been deprecated in favor of the ip address command, which is typically shortened to ip a. I’ll probably just force myself to learn the replacement command, but if you are die-hard and want to keep ifconfig, you can reinstall it by installing net-tools.
sudo apt-get install net-tools
Changing / Adding a Password for Full-Drive Encryption
When I installed Debian I opted to encrypt my root partition with LUKS. Later, I decided that I wanted to create a longer password to protect the drive. First, we’ll use fdisk to see which devices are encrypted with LUKS.
sudo fdisk -l
One of the devices listed should have “_crypt” appended to it. In my case, it’s /dev/sda5.
To add a new password that we can use to unlock the drive upon boot, use the following command.
sudo cryptsetup luksAddKey /dev/sda5
The command will walk you through adding a new password after you verify your knowledge of at least one existing password. You must have at least one existing password to add new passwords, so adding a new password must be done before you delete an existing password if you only have one password. If you don’t specify the -S flag, the new password will be stored in the next available password slot. You can populate up to 8 slots.
Once you’ve added a new password, you can remove an existing password by using:
sudo cryptsetup luksRemoveKey /dev/sda5
Without specifying the slot to erase, you’ll need to type the password that you want to remove and it will be removed from its respective slot automatically. Again, you need to have at least one active password. You can have up to 8 passwords, each one occupying one of 8 slots. You can list active slots and see which slots contain a password with the following command:
sudo cryptsetup luksDump /dev/sda5 | grep Slot
For more information about how to insert and remove keys from individual slots, this is a great resource for showing how to use LUKS to do that, as well as apply encryption to other drives / external drives as well.
Tweaking Gnome 3
Editing the UI
Gnome 3 is a bit of an odd duck. A lot of people don’t like it, and at first I didn’t either, but I thought I’d give it a try for a while and see how I like it once I’m used to it. (I’m not yet.) At first, it didn’t seem very customizable. Luckily I found a couple of resources that explained a couple tools to make it much more manageable. The first is included with Debian 9 and it’s called “Tweak Tool.” You can access it from the UI by pressing the “Super” (Windows) key and typing tweak.
A few settings that I personally turned on in here:
- Appearance > Global Dark Theme – You’ll have to restart any windows you have open for this to take effect, but the result is nice.
- Appearance > GTK+ > Awaita-dark. Even with Global Dark enabled, GTK apps won’t be dark unless this setting is explicitly enabled. (Also requires log out / log back in to change some apps, I’ve noticed).
- Desktop > Mounted Volumes – I like getting a desktop icon when I plug in a flash drive for easy access. This is personal preference. I turned the other desktop icons off.
- Extensions > Applications Menu – If you’re used to Kali, you’ll find this to be very nice vs going to the weird tablet-like dashboard to launch apps.
- Extensions > Places status indicator – This puts a nice little menu next to the Applications menu that gives you quick access to different parts of the file system.
- Extensions > Workspace Indicator – I don’t use workspaces a lot, and when I do I switch between them with shortcut keys, but it’s always nice to see where you are and it doesn’t take up much room.
- Top Bar > Show Date – It doesn’t take up much room and it’s nice to see at a glance.
Those are the settings I changed, but there are a ton of customizations in here that you can poke around and look at. This is a great tool that can really make your desktop your own.
Editing the Applications Menu
I found it odd that, by default, the system doesn’t come with a way to edit what’s seen in the applications menu. I did find a cool little utility called alacarte that gets the job done though. Installation is easy.
sudo apt-get alacarte
This will let you hide items that appear in the Applications menu submenus so you can really trim down that menu and make it efficient. It will also let you add commands to the menu, and edit existing commands.
Installing Firefox Quantum
Debian 9 comes with Firefox ESR, but I wanted to install Quantum. Turns out it can be done with a little repository modification.
sudo nano /etc/apt/sources.list
Add to the bottom
deb http://ftp.us.debian.org/debian/ sid main
deb-src http://ftp.us.debian.org/debian/ sid main
Save and exit the file. Next:
sudo nano /etc/apt/preferences
This file will likely be blank. We’ll have to add the following information to it in order to add preference for the stable repository packages for every package except the ones that are used by Firefox Quantum.
Package: * Pin: release a=stable Pin-Priority: 1000 Package: * Pin: release a=unstable Pin-Priority: 2 Package: libdrm-* Pin: release a=unstable Pin-Priority: 1001 Package: firefox Pin: release a=unstable Pin-Priority: 1001 Package: libfontconfig1 Pin: release a=unstable Pin-Priority: 1001 Package: fontconfig-config Pin: release a=unstable Pin-Priority: 1001 Package: libnss3 Pin: release a=unstable Pin-Priority: 1001
Finally, you’ll need to install Quantum. Before you install, make sure that Firefox ESR is closed. I also uninstalled ESR with the package manager GUI just to avoid headache.
sudo apt update sudo apt install -t sid firefox
That’s it. Quantum should now be available in your Application menu.