Skip to content

u/LiteracyFanatic

In this archive from Jun 2019 to Sep 2023

7
posts
137
comments
0
media
1.1k
score

The icon issue is probably because Nerd Fonts moved the material design icons to different code points. See the release notes for more details: https://github.com/ryanoasis/nerd-fonts/releases/tag/v3.0.0.

You should not need to name the script package-updates.sh. It's fine to do so as long as you use the same name in the config file, but unnecessary. The shebang at the top of the script itself determines what shell it will be executed with.

I've also included updated versions of two of the files below. I believe the original versions will still work but the polybar-msg syntax is technically deprecated.

~/.config/polybar/config

enable-ipc = true

modules-right = package-updates-trigger package-updates ...

[module/package-updates]
type = custom/ipc
hook-0 = ~/.config/polybar/package-updates

[module/package-updates-trigger]
type = custom/script
exec = polybar-msg action "#package-updates.hook.0" &>/dev/null
interval = 600

/etc/pacman.d/hooks/polybar.hook

[Trigger]
Operation = Upgrade
Operation = Remove
Type = Package
Target = *

[Action]
Description = Updating Polybar package count...
Depends = polybar
When = PostTransaction
Exec = /usr/bin/bash -c 'XDG_RUNTIME_DIR="/run/user/$(id -u jordan)" sudo -u jordan --preserve-env=XDG_RUNTIME_DIR -- polybar-msg action "#package-updates.hook.0" &>/dev/null || true'
1 points

For a Systemd user service to interact correctly with the notification daemon, you will need to either source /etc/X11/xinit/xinitrc.d/50-systemd-user.sh or just add the following lines to your .xinitrc:

systemctl --user import-environment DISPLAY XAUTHORITY
dbus-update-activation-environment --all

Checkout xpub if you need to do the same thing from a system service or udev rule instead. I mention udev because that would be preferable to a polling based approach if your battery supports the correct events.

2 points

It's smaller and simpler. sudo actually has a ton of features that most people don't make use of. In theory, this means the potential attack surface is a lot bigger. For what it's worth though, I think doas takes its minimalism a bit too far. Some of sudo's supposed 'bloat' is actually pretty useful. Specifically, I miss the timestamp_timeout and pwfeedback options.

6 points

I think the difference is in the defaults. In Windows, programs will autostart themselves by default. You either have to add a program to you init script, enable a service, or install something implementing the XDG Autostart specification on Arch. There's arguments to be made in favor of both approaches, but I personally prefer the control that comes with Arch's more manual approach.

2 points

I know about the settings you mentioned, but they don't actually apply to all updates. Unless they've changed it in the last couple of years you can only pause updates for 35 days and even then Windows might still automatically reboot for certain security updates. You can use group policy to actually stop automatic updates but that only works if you have a pro version of Windows.

1 points

Back when I was a regular Windows user I also tried to do my updates in a timely manner by manually checking for them...then I found out that Microsoft actually tracks whether users push the check for updates button or not. Those who do will have certain updates rolled out sooner than general users, essentially making you part of a beta program you didn't knowingly sign up for.

1 points

I don't actually make backups as often as I probably should. Every week or two I'd say. I'd set the script up to run on a timer, but this is a laptop, so I don't actually have the external hard drive connected most of the time. rsync makes it quite easy to transfer files over the network though, so I've considered connecting the hard drive to a Raspberry Pi and running my backups over the network. I'd have to see how long they took though. At any rate, I don't worry about it too much because 90% of what I do on my laptop is surfing the web or programming, so most of the stuff I care about is synced with my GitHub anyway.

You never need to do a full backup after the first time. The script is using hard links, so files that haven't changed show up in each backup folder but don't take up any additional space. The only real files in each backup are the ones that have changed. The previous versions of those files are still available as well unless you go out of your way to delete them. The same is true for deleted files; they are still accessible unless you delete all the backups that referenced them. I also want to clarify that the backup is incremental, but not the files themselves. What I mean is that each backup only copies files that have changed. However, the whole file is copied each time. So the entirety of SOME_FILE (version A) and SOME_FILE (version B) are both stored on the external hard drive, not the diff between the versions. That's why there's no real point in creating a new full backup unless you're pressed on space and want to remove files that no longer exist on your computer from the backup as well. Hopefully that makes sense, the semantics of hard links can be a bit difficult to grasp at first.

I keep separate branches of my dot files for each machine I use. That way I can track the differences in configuration depending on what I'm using that device for. I can also make changes on one machine and easily propagate them to others by pulling and merging. Sometimes I come across something that looks silly and I can't figure out why I did things that way. I can look through my commit messages to see what the context was (perhaps I was working around a bug in some program). Also, there are times when I make a change which I end up not liking. Git makes it easy to revert my config files to a previous state.

1 points

Subscribe to arch-announce to get a heads up on updates that require manual intervention. Install mlocate and then run locate pacnew after an update to find any config files you need to tend to. rsync is a very flexible tool you can use to transfer files or create backups. I use this script to create incremental backups of my home directory to an external hard drive.

#!/bin/bash
dir="/mnt/seagate/snapshots/"
date="$(date --iso-8601=seconds)"
lastBackup="$dir/last"
newBackup="$dir/$date/"

mkdir -p "$XDG_DATA_HOME/rsync"

# Errors can be found by grepping for 'rsync:' in log file

t0="$(date +'%s')"
rsync \
    --archive \
    --partial \
    --info progress2 \
    --human-readable \
    --link-dest="$lastBackup" \
    --log-file="$XDG_DATA_HOME/rsync/log" \
    --filter "-/ $XDG_CACHE_HOME/" \
    --filter "- .local/bin/" \
    --filter "- .local/lib/" \
    --filter "-/ $XDG_DATA_HOME/Trash/" \
    --filter "-/ $XDG_DATA_HOME/manga/*/*/" \
    --filter "-/ $HOME/videos/" \
    --filter "-/ $XDG_DATA_HOME/gallery-dl/" \
    "$HOME/" \
    "$newBackup"

rm -f "$lastBackup"
# Use a relative link
ln -s "$date" "$lastBackup"
t1="$(date +'%s')"
dt="$(bc <<< "($t1 - $t0) / 60")"
notify-send --expire-time 0 "Backup completed in $dt minutes."

You could also use a file system with built in snapshotting like Btrfs. I keep all my configuration files under source control with git. I additionally keep a list of all explicitly installed packages on my system as well as customizations to system configuration files here. It contains a script which is more or less capable of rebuilding my system from the ground up. It doesn't handle the installation, just the post-install configuration. etckeeper and aconfmgr are two tools which try to automate system level configuration tracking. Neither of them fit my needs exactly, but they might work well for you. Another useful tool is downgrade which can be used to restore a previous version of a broken package.

A few more tips. Consider keeping an LTS version of the kernel installed as kernel updates do sometimes cause problems with certain hardware. Also keep a flash drive with the Arch Linux ISO or a system rescue distro on hand so that you can fix things in situations where your computer won't boot. I've also found systemd-boot to be much simpler and less error prone than GRUB for boot loading, but that's just my two cents. When you think an update broke your system, look through /var/log/pacman.log to find what has changed recently. Start at the end and work backwards. Also make good use of systemctl status and journalctl to diagnose failing services.

Although it's definitely possible to screw things up, there should very rarely if ever be a situation that requires you to wipe your hard drive and reinstall Arch. Assuming you follow the manual interventions mentioned on the mailing list, most broken things will be the result of a change you made somewhere that doesn't take effect until you restart. I've shot myself in the foot plenty of times. But tracking down the source of the problem and figuring out how to fix it will help you learn more about how your system actually works, so I thinks it's worth it in the end.

23 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.