Skip to content

Instantly share code, notes, and snippets.

@toastal
Last active October 18, 2021 08:05
Show Gist options
  • Save toastal/ffeecc92fa0ef33e7d35 to your computer and use it in GitHub Desktop.
Save toastal/ffeecc92fa0ef33e7d35 to your computer and use it in GitHub Desktop.

Debian Laptop Setup

What are we aiming for?

Debian unstable/sid, two SSDs in Btrfs RAID0, GRUB, Nvidia+Bumblebee, Openbox+Other DE stuff, HiDPI, some basic dev needs

Why is this special?

Mostly the 2 SSDs in Btrfs RAID0 that needs made by breaking out into the shell during setup which is easy to goof troop if you don't do the steps in the right order. Not only that, but GRUB fails to install. Woo :(.


Acquire Debian Testing ISO

Look around here... get the right architecture and everything and you probably want the net install.

Flashing to USB

Linux
fdisk -l
umount /dev/SDX
dd if=/path/to/debian-netinst.iso of=/dev/SDX status=progress bs=4M && sync
Mac
diskutil list
diskutil unmountDisk /dev/DISKX
dd if=/path/to/debian-netinst.iso of=/dev/RDISKX bs=1m
diskutil eject /dev/disk2

Installing

Boot into UEFI instead of BIOS for this guy. Since the mouse doesn't work, might as well use the regular installer, not grahpical. Do the normal flow of things until you get to the formatting disks...

Formatting Disks

Since I'm probably looking at this guide again, it's because something got fubar. First choose Manual. Erase data from the root and home partitions on both drives (this would be the time to get a snack or coffee). Resize drives now if needed. If it's the first time, create two equal-sized partitions across the two SSDs in the manual partition mode because it's easiest.

Breaking Into the Shell For

Press ctrl-alt-f2 to get to the prompt and enter to enter the shell.

Look for our partitions with fdisk -l. Currently what I'm seeing is the two SSDs at /dev/sda and /dev/sdc.

Raiding
mkfs.btrfs -L debian -m raid0 -d raid0 /dev/sda1 /dev/sdc1
mkfs.btrfs -L home -m raid0 -d raid0 /dev/sda2 /dev/sdc2
btrfs device scan

Back to Setting Mount Points

Press crtl+alt+f1, go back and rescan the devices. Select the debian drive and use as btrfs journaling file system, do not format partition, mount point /, mount options noatime,nodiratime. Do the same with home mounting to /home. I put the boot EFI partion on the 3rd 5400rpm HDD since it's used a lot less and less likely to fail from the RAID setup.

Why Not Encrypt

Don't get me wrong, dm-crypt+LUKS is awesome. Doing at this step makes it easiest since the Debian installer lets you do it from the partition menu. So why not? Well, it's a tradeoff. Outside the obvious I-have-to-unlock-it-all-the-time scenario: 1) it's prevents your data from being accessed in the case of stolen equipment and the unit is powered off—which is kind of rare and my data being kept to myself is important, but not imperative and the likelihood of it being stolen is probably pretty low (and I say that after having my car broken into and things stolen), but more importantly 2) it's another point of failure—obvoiously you can have some issues with RAID0 and something getting corrupted, but now compounding that with either the encryption or the RAID failing is not a risk I want to take. So I'd have to take my pick: speed of RAID0 or security of dm-crypt+LUKS—and I chose speed this time around as the speed is always relevant (even if I'll barely perceive it) and the security is only really relevant in the case of catastrophe.

Finish Partitioning

Yeah, hit that button.

Installing the system

Proceed as normal. Select yes to the popularity contest because you care about Debian. Software selection of ssh server and standard system utilities. Probably won't be printing much, so I can install CUPS later. ...

GRUB Fails

Proceed to install without. And reboot.


Super Grub 2 to the Rescue

Well this sucks. Something about the installer never did like this setup. Seems some people had issues with GRUB trying to install back onto the USB disk instead of the drive specified... Well, download the hybrid ISO from here. And dd it to a USB like we did with the Debian netinst. Boot to Linux manually from the disks menu so we can install GRUB. Once there, pop out the USB, login and go to town:

sudo apt-get update
sudo apt-get install aptitude
sudo aptitude install grub-efi
Install the GRUBs
# look for the disk
fdisk -l
sudo grub-install /dev/sdb1
sudo update-grub
# reboot
sudo shutdown -r now

Reboot.


Setting Up the Basics

Changing the Sources

Find the fastest mirror
sudo aptitude install netselect-apt
sudo netselect-apt
sudo mv ./sources.list /etc/apt/sources.list

Next sudo vi that file adding experimental, unstable, testing, and stable based on the url netselect-apt's file provided—including the deb-src and non-free. Build a prefences file something like this:

Package: iceweasel midori chromium gimp darktable inkscape nodejs npm
Pin: release a=experimental
Pin-Priority: 1001

Package: *
Pin: release a=unstable
Pin-Priority: 500

Package: *
Pin: release a=testing
Pin-Priority: 400

Package: *
Pin: release a=stable
Pin-Priority: 300

Package: *
Pin: release a=experimental
Pin-Priority: 100

Upgrading and Getting the Most Imperative Pieces

sudo aptitude update
sudo aptitude dist-upgrade
sudo aptitude install firmware-realtek firmware-iwlwifi nvidia-kernel-dkms bumblebee-nvidia openbox xserver-xorg xinit pulseaudio alsa-base alsa-utils network-manager selinux-policy-default

Test OpenBox

startx

Is it good? Cool. Exit.

Reboot and Install 'Important' Things

sudo aptitude update
sudo aptitude install git build-essential fish axel htop ranger w3m w3m-img tmux pwgen disk-manager sakura thunar leafpad synaptic dtrx

Install Neovim from source

sudo aptitude install libtool libtool-bin autoconf automake cmake g++ pkg-config unzip libmsgpack-dev libuv-dev libluajit-5.1-dev ninja-build
git clone https://github.com/neovim/neovim.git /opt/neovim
cd neovim
make CMAKE_BUILD_TYPE=Release
sudo make install

Install Dev Things

sudo aptitude install nodejs npm elixir ghc cabal-install
sudo ln -s $(which nodejs) /usr/local/bin/node

Install Lesser Things

sudo aptitude install nitrogen mpv unclutter lxappearance trimage gvfs-bin apt-transport-https pavucontrol xfce4-panel rofi compton
sudo aptitude install gimp inkscape darktable hugin
sudo aptitude install fonts-fantasque-sans fonts-mplus fonts-roboto fonts-roboto-hinted fonts-symbola

gmrun

Add this to the ~/.config/openbox/rc.xml

    <keybind key="A-F2">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Terminal-popup</name>
        </startupnotify>
        <command>gmrun</command>
      </action>
    </keybind>

HiDPI

echo "Xft.dpi: 164" >> ~/.Xresources

Reboot again and it should be pretty good

# ~/.config/openbox/autostart
xset -b
(sleep 1.25s && compton -b --config ~/.config/compton.conf --backend glx) &
(sleep 1.5s && nitrogen --restore) &
(sleep 1.5s && xfce4-panel) &
# ~/.config/compton.conf
# Shadow
shadow = true;
no-dnd-shadow = true;
no-dock-shadow = true;
clear-shadow = true;
shadow-radius = 13;
shadow-offset-x = -1;
shadow-offset-y = -10;
shadow-opacity = 0.3;
shadow-red = 0.02;
shadow-green = 0.0;
shadow-blue = 0.06;
shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g ?= 'Notify-osd'",
"class_g = 'Cairo-clock'",
"_GTK_FRAME_EXTENTS@:c"
];
# shadow-exclude = "n:e:Notification";
# shadow-exclude-reg = "x10+0+0";
# xinerama-shadow-crop = true;
# Opacity
#menu-opacity = 0.8;
#inactive-opacity = 0.8;
# active-opacity = 0.8;
#frame-opacity = 0.7;
#inactive-opacity-override = false;
#alpha-step = 0.06;
# inactive-dim = 0.2;
# inactive-dim-fixed = true;
# blur-background = true;
# blur-background-frame = true;
blur-kern = "3x3box"
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
# blur-background-fixed = true;
blur-background-exclude = [
"window_type = 'dock'",
"window_type = 'desktop'",
"_GTK_FRAME_EXTENTS@:c"
];
# opacity-rule = [ "80:class_g = 'URxvt'" ];
# Fading
#fading = true;
# fade-delta = 30;
#fade-in-step = 0.03;
#fade-out-step = 0.03;
# no-fading-openclose = true;
# no-fading-destroyed-argb = true;
#fade-exclude = [ ];
# Other
backend = "xrender"
mark-wmwin-focused = true;
mark-ovredir-focused = true;
# use-ewmh-active-win = true;
detect-rounded-corners = true;
detect-client-opacity = true;
refresh-rate = 0;
vsync = "none";
dbe = false;
paint-on-overlay = true;
# sw-opti = true;
# unredir-if-possible = true;
# unredir-if-possible-delay = 5000;
# unredir-if-possible-exclude = [ ];
focus-exclude = [ "class_g = 'Cairo-clock'" ];
detect-transient = true;
detect-client-leader = true;
invert-color-include = [ ];
# resize-damage = 1;
# GLX backend
# glx-no-stencil = true;
glx-copy-from-front = false;
# glx-use-copysubbuffermesa = true;
# glx-no-rebind-pixmap = true;
glx-swap-method = "undefined";
# glx-use-gpushader4 = true;
# xrender-sync = true;
# xrender-sync-fence = true;
# Window type settings
wintypes:
{
tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment