Skip to content

Instantly share code, notes, and snippets.

@ozgurgulsuna
Last active March 22, 2024 10:51
Show Gist options
  • Save ozgurgulsuna/ad1f7bda4faeededf77afa6914844f31 to your computer and use it in GitHub Desktop.
Save ozgurgulsuna/ad1f7bda4faeededf77afa6914844f31 to your computer and use it in GitHub Desktop.

USB drive that boots up to a Linux environment to read papers, comment on them and think freely.

bspwm-ok-a-lil-bit-of-what-might-be-my-main-colorscheme-and-v0-wgkt4yor2asb1

features

  • light, nice looking environment
  • [[Pomodoro]] timer
  • Wi-Fi, Ethernet support
  • Web browser, Spotify
  • Black and White perhaps ?
  • 128 GB flash drive
  • Obsidian integration
  • insync synchronization with a folder
  • [[PDF]] reader
  • Battery indicator, time, etc
  • Dual screen support

either, SanDisk Ultra Luxe or SanDisk Ultra® Dual Drive Luxe

do we need type-c would be better if it is future proof ?

name suggestions

  • LIT3 (+)
  • PaperLite
  • PALIT3
  • P-LIT3
  • E-LIT3
  • ELIT3

hostname suggestions: node, soar, chip, memory, voyager, roamer.

ozgur@voyager:~/$                           

extended

  • [[future proof]] slide, environment.
  • 20+ years
  • Note taking environment for lectures

environment

Linux distros ([[distributions]]) that are [[USB]] bootable.

  • Slax
  • Peppermint OS
  • MX Linux (+)
  • Kali Linux
  • Puppy Linux
  • Porteus
  • Linux Lite
  • Parrot OS
  • Tails
  • elementary OS
  • KANOTIX

whatever, will use [[arch]].



installation

download the ISO and Flash

https://wiki.archlinux.org/title/installation_guide This time we will use single USB device to install system also into the USB device.

  1. start with archlinux.org/download/, find a near mirror view then download the latest iso, perhaps check the checksum to verify.
  2. download rufus, ofcourse portable version, most definitely rufus.ie/en/
  3. rufus the iso with all the default settings, rufus got you covered all the way.

make sure you have shut down the windows properly, not just hibernate, or else you will have to restart the computer to boot from the usb device.

boot from USB device

  1. boot from the USB device, then select Arch Linux Install Medium.

  2. connect to the internet via Wi-Fi

    root@archiso ~ # iwctl
    NetworkConfigurationEnabled: disabled
    StateDirectory: /var/lib/iwd
    Version: 2.8
    [iwd]# device list
                                    Devices                                   *
    --------------------------------------------------------------------------------
      Name                  Address               Powered     Adapter     Mode      
    --------------------------------------------------------------------------------
      wlan0                 54:6c:eb:38:3f:ba     on          phy0        station     
    
    [iwd]# station wlan0 scan
    [iwd]# station wlan0 get-networks 
                               Available networks                             *
    --------------------------------------------------------------------------------
          Network name                      Security            Signal
    --------------------------------------------------------------------------------
        > Rulokat                           psk                 ****    
          meturoam                          8021x               ****    
          metuconnect                       open                ****    
          eduroam                           8021x               ****    
          DIRECT-1f-Pantum P2500 Series     psk                 ****    
         
    [iwd]# station wlan0 connect Rulokat
    Type the network passphrase for <SSID> psk.
    Passphrase: ***********
  3. set a password for the root user, this is needed for the [[SSH]] connection if needed.

     root@archiso ~# : passwd
     New password: 123
     Retype new password: 123
     passwd: password updated successfully
  4. get the keys

    root@archiso ~ # killall gpg-agent 
    root@archiso ~ # pacman -Syy archlinux-keyring
    root@archiso ~ # pacman-key --init  
    root@archiso ~ # pacman-key --populate archlinux
  5. disable ipv6 (sometimes it causes problems)

    nano /etc/sysctl.d/40-disable-ipv6.conf
    
    net.ipv6.conf.all.disable_ipv6 = 1 # ALL 

    check with

    root@archiso ~ # sysctl net.ipv6.conf | grep disable_ipv6
    net.ipv6.conf.all.disable_ipv6 = 0
    net.ipv6.conf.default.disable_ipv6 = 0
    net.ipv6.conf.lo.disable_ipv6 = 0
    net.ipv6.conf.wlan0.disable_ipv6 = 0
  6. update servers and install archinstall

    root@archiso ~ # pacman -Syy
    :: Synchronizing package databases...
     core 128.4 KiB   201 KiB/s 00:01             [################################] 100%
     extra
    root@archiso ~ # pacman -S archinstall
    resolving dependencies...
    looking for conflicting packages...
    
    Packages (1) archinstall-2.6.3-1
    
    Total Download Size:   0.55 MiB
    Total Installed Size:  3.74 MiB
    Net Upgrade Size:      0.21 MiB
  7. start the install

    root@archiso ~ # archinstall
  8. time to set the settings here are the configurations

    Set/Modify the below options
    	Archinstall language               English (100%)
    	Mirrors                            Defined
    		┌── Info ───────────────────────────────────────────┐
    		│ Mirror regions: Germany, Türkiye, Worldwide       │ 
    		└───────────────────────────────────────────────────┘
        Locales                            Defined
    		┌── Info──────────────────────────────┐
    		│ Keyboard layout: us                 │
    		│ Locale language: en_US              │
    		│ Locale encoding: UTF-8              │
    		└─────────────────────────────────────┘
    	Disk configuration                 Use a best-effort default partition layout
    		┌── Info ───────────────────────────────────────────────────────────────────────┐
    		│ Configuration: Use a best-effort default partition layout                     │
    		│ /dev/sda: USB  SanDisk 3.2Gen1                                                │
    		│ Status|Device|Type|Start|End|Size|FS type|Mountpoint|Mount options|Flags│     │
    		│ ------------------------------------------------------------------------------│
    		│ create | | primary |    2048 |  1050624 | 536 MB | fat32   | /boot| Boot, ESP │
    		│ create | | primary | 1050624 | 30031872 | 14 GB  | ext4    | /    |           |
    		│                                                                               │
    		└───────────────────────────────────────────────────────────────────────────────┘
    	Bootloader                         Systemd-boot
    	Unified kernel images              False
    	Swap                               False
    	Hostname                           host
    	Root password                      ***
    	User account                       1 User(s)
    	Profile                            Minimal
    		┌── Info ──────────────────────────────┐
    		│ Profiles: bspwm                      │
    		│ Graphics driver: All open-source     │
    		│ Greeter: ly                          │
    		└──────────────────────────────────────┘
    	Audio                              Pulseaudio
    	Kernels                            linux
    	Additional packages
    	Network configuration              Use NetworkManager
    	Timezone                           UTC
    	Automatic time sync (NTP)          True
    	Optional repositories              multilib
    	 
    	 Save configuration
    	 Install
    	 Abort
    (Press "/" to search)                                                             

Once the installation is complete, green text should appear saying that it is safe to reboot, which is also the command you use to reboot.



[[functionality]]

first we need to install some crucial packages, like git, nano, etc.

[user@host ~]$ sudo pacman -S git nano 

if the internet connection is not working, try this

[user@host ~]$ nmtui
┌────────────────────────────┤ Edit Connection ├─────────────────────────────┐
│                                                                           ↑│
│            Profile name metu____________________________________          ▒│
│                  Device ________________________________________          ▒│
│                                                                           ▒│
│ ╤ WI-FI                                                          <Hide>   ▒│
│ │                  SSID meturoam________________________________          ▒│
│ │                  Mode <Client>                                          ▒│
│ │                                                                         ▒│
│ │              Security <WPA & WPA2 Enterprise>                           ▒│
│ │        Authentication <PEAP>                                            ▒│
│ │    Anonymous identity anonymous@metu.edu.tr___________________          ▒│
│ │                Domain ________________________________________          ▒│
│ │               CA cert ________________________________________          ▒│
│ │      CA cert password ________________________________________          ▒│
│ │                       [ ] Show password                                 ▒│
│ │          PEAP version <Automatic>                                       ▒│
│ │  Inner authentication <MSCHAPv2>                                        ▒│
│ │              Username e2xxxxx_________________________________          ▒│
│ │              Password ***********_____________________________          ▒│
│ │                       [ ] Show password                                 ▒│
│ │                       <Store password for all users>                    ▒│
│ │                                                                         ▒│
│ │                 BSSID ________________________________________          ▒│
│ │    Cloned MAC address ________________________________________          ▒│
│ │                   MTU __________ (default)                              ▒│
│                                                                           ↓│
└────────────────────────────────────────────────────────────────────────────┘

install and activate SSH

[user@host ~]$ sudo pacman -S openssh
[user@host ~]$ sudo systemctl start sshd
[user@host ~]$ sudo systemctl status sshd

add user to the sudoers file, if necessary.

[user@host ~]$ pacman -S sudo
[user@host ~]$ EDITOR=nano visudo
	## Uncomment to allow members of group wheel to execute any command
	%wheel ALL=(ALL) ALL

[[bspwm]]

here we have the wiki and a nice tutorial

[user@host ~]$ sudo pacman -Syu xorg xorg-xinit alacritty bspwm sxhkd xf86-video-intel lxsession
[user@host ~]$ mkdir .config/sxhkd/
[user@host ~]$ mkdir .config/bspwm/

[user@host ~]$ cp /usr/share/doc/bspwm/examples/bspwmrc  ~/.config/bspwm/
[user@host ~]$ cp /usr/share/doc/bspwm/examples/sxhkdrc  ~/.config/sxhkd/

[user@host ~]$ cp /etc/X11/xinit/xinitrc ~/.xinitrc
[user@host ~]$ sudo vim .xinitrc
## delete these lines
	twm &
	xclock -geometry 50x50-1+1 &
	xterm -geometry 80x50+494+51 &
	xterm -geometry 80x20+494-0 &
	exec xterm -geometry 80x66+0+0 -name login

## add these instead
	setxkbmap tr &
	exec bspwm

## make sure it is executable
[user@host ~]$ chmod +x .xinitrc

[user@host ~]$ sudo vim .config/sxhkd/sxhkdrc
## change urxvt with picked terminal emulator
	super + Return
#		urxvt
#		alacritty
		kitty

to install [[kitty]], see [[terminal emulator]]

[user@host ~]$ reboot

to start the bspwm, we need to start the x server, and then start the bspwm.

[user@host ~]$ startx

[[terminal emulator]]

Kitty is a nice emulator, it stands out with using GPU acceleration.

[user@host ~]$ sudo pacman -S kitty

it did not came working out of the box, for a specific pc with intel iris xe graphics, we need to remove the xf86-video-intel package.

[user@host ~]$ sudo pacman -R xf86-video-intel

then we need to change to the modesetting driver, which is already installed.

[user@host ~]$ sudo vim /etc/X11/xorg.conf.d/05-modesetting-options.conf
Section "OutputClass"
	Identifier "modesetting"
	MatchDriver "i915"
	Driver "modesetting"
	Option "AsyncFlipSecondaries" "on"
EndSection

more resources on this issue, try 3.2 from here sometime in the future.

also, same issue with alacritty, and one more

[[backlight]]

here is the wiki page for backlight. for some laptops we need to install a backlight controller, like light.
do not forget to add the user to the video group.

[user@host ~]$ sudo pacman -S light
[user@host ~]$ sudo usermod -aG video $user

to check the brightness

[user@host ~]$ light -G

to set the brightness

[user@host ~]$ light -S 50

sets the brightness to 50%.

or we can use the xbacklight

[user@host ~]$ xbacklight -get
[user@host ~]$ xbacklight -set 100
[user@host ~]$ xbacklight -perceived 80

Insync

Syncs a folder with the cloud, in our case it is also the obsidian vault.

[user@host ~]$ cd Downloads/
[user@host ~]$ git clone https://aur.archlinux.org/insync.git
[user@host ~]$ cd insync
[user@host ~]$ makepkg -si
[user@host ~]$ sudo pacman -U package_name.pkg.tar.zst
[user@host ~]$ insync start 
[user@host ~]$ insync show

add this line in ~/.xinitrc to start insync automatically.

insync start

get speaker working

[user@host ~]$ sudo pacman -S alsa-utils
[user@host ~]$ sudo pacman -S pulseaudio
[user@host ~]$ sudo pacman -S pavucontrol

enable as user-level service

[user@host ~]$ systemctl --user enable pulseaudio

start the pulseaudio server

[user@host ~]$ pulseaudio --start

check for the sound card

[user@host ~]$ pacmd list-cards

set the default sound card

[user@host ~]$ pacmd set-card-profile 0 output:analog-stereo

check the sound

[user@host ~]$ speaker-test -c 2

unicode character support

couple of japanese websites not working. the characters are displayed with unicode symbols.

[user@host ~]$ sudo pacman -Syy
[user@host ~]$ sudo pacman -S noto-fonts-cjk noto-fonts-emoji 

fixes it but changes the japanese chinese fonts altogerher, find new typefaces in the future.



ricing

ly greeter

works as a greeter for the window manager.

in our case we have two "possible" options, the first is xinitrc and the second is bspwm. both execute different initialization scripts hence we need to be careful.

or simply execute one from other

[user@host ~]$ cd .config/bspwm/
[user@host ~]$ vim bspwmrc
#!/bin/sh
## other stuff
## ...
## ...
exec ~/.xinitrc

dark mode

Switching between light and dark mode requires support from applications or application toolkits like GTK and Qt.

If you don't need live theme switching, to quickly set a dark theme system-wide Install gnome-themes-extra, adwaita-qt5-gitAUR and adwaita-qt6-gitAUR and Export GTK_THEME=Adwaita:dark, GTK2_RC_FILES=/usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc and QT_STYLE_OVERRIDE=adwaita-dark.

[user@host ~]$ sudo pacman -S gnome-themes-extra
# [user@host ~]$ sudo pacman -S adwaita-qt5-git
# [user@host ~]$ sudo pacman -S adwaita-qt6-git
[user@host ~]$ vim ~/.xinitrc
## add these lines
export GTK_THEME=Adwaita:dark
export GTK2_RC_FILES=/usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc
export QT_STYLE_OVERRIDE=adwaita-dark

nemo

[user@host ~]$ sudo pacman -S nemo

picom

picom is a compositor, it is used to add some effects to the windows, like transparency, shadows, etc.

[user@host ~]$ sudo pacman -S picom
[user@host ~]$ sudo vim ~/.xinitrc
## add this line
picom &
[user@host ~]$ vim .config/picom/picom.conf

cursor themes

first lets very briefly change the "x" cursor. to do this add these lines to the ~/.xinitrc

xsetroot -cursor_name left_ptr

wallpaper

install feh, it is a lightweight image viewer, we will use it to set the wallpaper.

[user@host ~]$ sudo pacman -S feh

then we need to create a folder for the wallpapers, and put the wallpapers in it.

[user@host ~]$ mkdir .wallpapers

then we need to add this line to the ~/.xinitrc

feh --bg-fill ~/.wallpapers/highres.png

zathura

minimalistic pdf reader with vim keybindings.

[user@host ~]$ sudo pacman -S zathura zathura-pdf-poppler

bar on the left (polybar)

greeter (ly) sudo pacman -S ly sudo systemctl enable ly

scripts


here lies the scripts that are used in the system. first lets create a folder for the scripts.

[user@host ~]$ mkdir ~/.scripts

invert colors of a window

[user@host ~]$ sudo pacman -S xdotool

make a custom keybinding for it, in sxhkdrc, ctl+alt+u

[user@host ~]$ sudo vim ~/.config/sxhkd/sxhkdrc
# invert window colors
alt + ctrl + u
	window="$(xdotool getwindowfocus)"; \
	status="$(xprop -id "$window" 8c INV | cut -d " " -f 3)"; \
	[ "$status" != 1 ] && status=1 || status=0; \
	xprop -id "$window" -f INV 8c -set INV "$status"

this was the first and easy method, an alternative that is more indirect is to use invert-colors script.


bash script method

[user@host ~]$ sudo vim ~/.scripts/invert.sh

we will first describe the bash script,

#!/bin/bash

# invert colors of a window

# hold the current state of the window
invert=0

# invert the colors of the window
function invert_colors {
	xdotool key ctrl+alt+i
	invert=1
}

# revert the colors of the window
function revert_colors {
	xdotool key ctrl+alt+i
	invert=0
}

# check if the window is inverted or not
if [ $invert -eq 0 ]
then
	invert_colors
else
	revert_colors
fi
#!/bin/bash
if [ "$(pidof picom)" ];
	then
		killall picom
		picom &
	else
		ID=$(xdotool getactivewindow)
		CLASS=$(xprop -id "$ID" | grep "WM_CLASS" | awk '{print $4}')
		COND="class_g=${CLASS}"
		picom --invert-color-include "$COND" &
fi

make it executable

[user@host ~]$ sudo chmod +x ~/.scripts/invert.sh

make a custom keybinding for it, in sxhkdrc, ctl+alt+u

[user@host ~]$ sudo vim ~/.config/sxhkd/sxhkdrc
# invert colors of a window
	alt + ctrl + u
		~/.scripts/invert.sh

cheat sheet

ctrl + alt + enter enter or exit from fullscreen (also works in xfreerdp)
super + f fullscreen window
super + {1,2,3,4} move desktops
super + shift + space pop-out / pop-in

extras


can we copy the whole system to another usb device, as it is, with all the settings and everything ?

remember last windows open, and open them again when the system starts.

logs


15-12-2023

  • fresh install with archlinux-2023.12.01-x86_64.iso, and a 128 GB flash drive resulted in a relatively slow installation.

     installing archlinux-keyring.  100%
     ==> Appending keys from archlinux.gpg

    part took too much time. the install was from a single usb device with the target device is the same flash drive.

     ==> image generation successful

    took a lot of time as well. killall gpg-agent and pacman -Syy archlinux-keyring added with no clear effect. the installation took part in the office with a fast ethernet connection.

     Failed to set keymap: Connection timed out

    archinstall 409.24s user 543.70s system 20% cpu 56:33.50 total

    time to go home...

16-12-2023

  • tried on a desktop pc with previous iso (archlinux-2023.11.01-x86_64.iso), same problems.
  • tried powering off the other OS, no effect.
  • select only the US mirrors, no effect.
  • do not update the archinstall, and pacman, no effect.
  • after just waiting for a long time, 60 mins for the installation and 25 mins for the poweroff sequence, the system booted up. install does not result in system with required packages, like xorg, xinit and even networkmanager.
  • tested on different thumb drives, with different iso files.
  • finally the iso archlinux-2023.10.01-x86_64.iso hanged on the same spots but the installation took 20mins and the poweroff took 20 mins as well. the system is installed with no desktop environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment