How do I Ubuntu ? - GNU/Linux

Users browsing this thread: 1 Guest(s)
Grey Hair Nixers
So I finally managed to do everything I wanted, and get my very own configuration working. There are multiple key points, so I'll list them here: session startup

Ubuntu 21.04 ships with GDM3 as its default session manager. On the login screen, you can spot a small gear icon that lets you select the type of session you want. There are 2 choices by default: "Ubuntu" and "Ubuntu on Xorg". I decided to add a 3rd entry: "xsession".

Doing that was fairly easy. I created the following file as "/usr/share/xsession/xsession.desktop":
[Desktop Entry]
Comment=Custom Xsession launcher

Upon doing that, and selecting the entry on the login screen, GDM will run the "/etc/X11/Xsession" script, which (among other things) runs the "$HOME/.xsession" script, which you can use to start your session, just like you would do with ".xinitrc". session

This part was pretty easy. Now that I narrowed my whole session down to a single script, writing that script was easy:

# $HOME/.xsession

xrdb -merge $HOME/.config/xrdb/ssh-askpass
xidle -timeout 300 -program $HOME/.local/bin/lock &
xsetroot -cursor_name left_ptr
bgs -z $HOME/.bg.jpg

sxhkd -m1 -r /dev/null & # keybinds
glazier & # window management
ewmh & # EWMH support
picom & # compositing
x-widgets & # status bars
rootmenu & # right-click menu (launcher)
safe -rkp '' & # password manager

x-wait # X session holder (basically an infinite loop)

# cleanup session on exit (kill password manager)
rm -f $SAFE_SOCK

Something worth mentioning about /etc/X11/Xsession: by default it tries to source "$HOME/.xsessionrc" before running your script, so it acts like $HOME/.profile. I use it to set my environment variables that are specific to the X session (mostly related to password manager).


This was the most complex part for me. It's probably because networking is a big part of my job, but I want my networking setup exactly the way I want it. My laptop (like most!) has 2 interfaces: wired and wireless. And I want to be able to seamlessly transition between both, and without disconnection. By default a different IP is assigned for each interface, and when you "switch" connection, you switch IP as well, thus killing all active connections.

I used to run an active/passive bonded connection on my previous debian install: it's a virtual interface that aggregates both the wired and wifi connection, and activate them "on-demand". The mac address of the bonding is that of the primary interface (in my case, the wired one).
This means that when I unplug the cable, the wifi becomes the primary interface, but keeps my current DHCP lease as the MAC address of the bonding interface remains the same. This worked great, and I wanted to replicate it under ubuntu.

Unfortunately, Ubuntu dropped usage on /etc/network/interfaces with release 18.04 I think, so I couldn't just copy my debian config there. The "official" way of configuring the network under Ubuntu seems to be using NetworkManager, and its "nmcli" tool. I have yet to test if I can just drop a file in /etc/NetworkManager to make it work, but for now, I had to do it on the cli (note: bonding a wifi interface is unsupported by NetworkManager, so you need to create a bond with multiple connections: wired, wifi1, wifi2, wifi3, … and add wifi to the bonding as you encounter them. This is ugly, but it works !

# create bonding interface
nmcli con add type bond con-name bond0 ifname bond0 bond.options "mode=active-backup,miimon=100,primary=$WIRED"

# add wired interface to the bond
nmcli con add type bond-slave ifname $WIRED master bond0

# add new wifi connection to the bond (this command is wrapped in a "wifi-add" script, to add more wifi connections as time goes)
nmcli cond add type wifi con-name "bond-wifi-$SSID" ifname $WIFI master bond0 ssid "$SSID" wifi-sec.key-mgmt wpa-psk wifi-sec.psk "$WPA_KEY"

And that's it ! I hope this would help someone someday. If not, I learnt something new at least, which is nice.

Messages In This Thread
How do I Ubuntu ? - by z3bra - 06-08-2021, 12:36 PM
RE: How do I Ubuntu ? - by jkl - 06-08-2021, 02:40 PM
RE: How do I Ubuntu ? - by z3bra - 06-08-2021, 04:48 PM
RE: How do I Ubuntu ? - by venam - 08-08-2021, 02:41 AM
RE: How do I Ubuntu ? - by z3bra - 08-08-2021, 07:27 AM
RE: How do I Ubuntu ? - by pyratebeard - 09-08-2021, 05:20 PM
RE: How do I Ubuntu ? - by pkal - 19-08-2021, 07:13 PM
RE: How do I Ubuntu ? - by z3bra - 22-08-2021, 01:05 PM
RE: How do I Ubuntu ? - by pkal - 22-08-2021, 01:27 PM
RE: How do I Ubuntu ? - by z3bra - 22-08-2021, 01:34 PM
RE: How do I Ubuntu ? - by freem - 26-08-2021, 07:42 PM
RE: How do I Ubuntu ? - by z3bra - 30-08-2021, 06:51 AM
RE: How do I Ubuntu ? - by z3bra - 30-08-2021, 01:15 PM
RE: How do I Ubuntu ? - by pyratebeard - 02-09-2021, 10:27 AM