Posts tagged: linux
All posts with the tag "linux"
AUR.">paru is an aur helper that allows you to use a package manager to install packages from the aur.
What’s the Aur #
The Aur is a set of community managed packages that can be installed on arch based distros.
Why a helper? #
paru just makes it easy, no clone and run makepkg. You can do everything paru can do using the built in pacman installer.
Manual Install from the Aur #
You will need to manually instal pacman from the aur in order to get started.
sudo pacman -S --needed base-devel
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -si
Installing packages with paru #
Once setup you are ready to install packages from the AUR just like the core repos.
# you can update your system using paru
paru -Syu
# you can install packages from the AUR
paru -S tailscale
paru -S prismlauncher
# even core repo packages can be installed
paru -S docker
Paru in Docker #
Here is a snippet from my devtainer dockerfile. Where I use paru to install packages from the AUR inside of a dockerfile.
FROM archlinux
RUN echo '[multilib]' >> /etc/pacman.conf && \
echo 'Include = /etc/pacman.d/mirrorlist' >> /etc/pacman.conf && \
pacman --noconfirm -Syyu && \
pacman --noconfirm -S base-devel git && \
groupadd --gid 1000 devtainer && \
useradd --uid 1000 --gid 1000 -m -r -s /bin/bash devtainer && \
passwd -d devtainer && \
echo 'devtainer ALL=(ALL) ALL' > /etc/sudoers.d/devtainer && \
mkdir -p /home/devtainer/.gnupg && \
echo 'standard-resolver' > /home/devtainer/.gnupg/dirmngr.conf && \
chown -R devtainer:devtainer /home/devtainer && \
mkdir /build && \
chown -R devtainer:devtainer /build && \
cd /build && \
sudo -u devtainer git clone --depth 1 https://aur.archlinux.org/paru.git && \
cd paru && \
sudo -u devtainer makepkg --noconfirm -si && \
sed -i 's/#RemoveMake/RemoveMake/g' /etc/paru.conf && \
pacman -Qtdq | xargs -r pacman --noconfirm -Rcns && \
rm -rf /home/devtainer/.cache && \
rm -rf /build
USER devtainer
RUN sudo -u devtainer paru --noconfirm --skipreview --useask -S \
bat \
cargo \
direnv \
dua-cli \
dust \
fd
Final Thoughts #
There are other options out there, paru seemed to be the most supported at the time I started using arch and there has been no other reason for me to change it. It’s treated me well for nearly a year now.
useful btrfs tools
Fix Arch Linux randomly rejecting passwords with one command. Try ‘faillock –user $USER’ to reset login counter and regain access. Quick solution for a smooth computing"
If you’re an Arch Linux user, you may have experienced a frustrating issue where your password is randomly not being accepted by the system. This can be a major inconvenience and can cause a lot of frustration, especially if it happens frequently.
The good news is that there is a simple fix for this issue. The following bash code can be used to fix the problem:
bash faillock --user $USER
This command is used to reset the failed login count for the current user. By running this command, you will be able to reset the system’s login counter and regain access to your account.
It’s important to note that this command should only be used as a temporary solution. If you find yourself frequently having to run this command, it’s likely that there is a deeper issue with your system that needs to be addressed.
In any case, if you’re experiencing problems with your Arch Linux system not accepting your password, give the above command a try and see if it resolves the issue for you.
I recently setup some vm’s on my main machine and got sick of signing in with passwords.
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub virt
I just shared some ssh keys with myself and ran into this error telling me that I did not set the correct permissions on my key.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0750 for '/home/waylon/.ssh/id_*******' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/home/waylon/.ssh/id_*******": bad Permissions
repo: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I changed them with the following commands.
chmod 644 ~/.ssh/id_*******.pub
chmod 600 ~/.ssh/id_*******
For far too long I have had to fidget with v4l2oloopback after reboot. I’ve had this happen on ubuntu 18.04, 22.04, and arch.
After a reboot the start virtual camera button won’t work, It appears and is clickable, but never turns on. Until I run this command.
sudo modprobe v4l2loopback video_nr=10 card_label="OBS Video Source" exclusive_caps=1
Today I learned that you can turn on kernel modules through some files in /etc/modules...
This is what I did to my arch system to get it to work right after boot.
echo "v4l2loopback" | sudo tee /etc/modules-load.d/v4l2loopback.conf
echo "options v4l2loopback video_nr=10 card_label=\"OBS Video Source\" exclusive_caps=1" | sudo tee /etc/modprobe.d/v4l2loopback.conf
Setting up snapper on Arch
The one reason I switched to arch
xrandr is a great cli to manage your windows in a linux distro using x11, which is most of them. The issue is that I can never remember all the flags to the command, and if you are using it with something like a laptop using a dock the names of all the displays tend to change every time you redock. This makes it really hard to make scripts that work right every time.
Homepage #
Check out the deresmos/xrandr-manager for more details on it.
installation #
xrander-manager is a python cli application that is simply a nice interface into xrandr. So you must have xrandr already installed, which is generally just there on any x11 window manager, I’ve never had to install it.
As with any python cli that is indended to be used as a global/system level cli application I always install them with pipx. This automates the process of creating a virtual environment for xrandr-manager for me, and does not clutter up my system packages with its dependencies that may eventually clash with another that I want to use.
# prereqs (xrandr, pipx)
pipx install xrandr-manager
set main monitor #
First if your main display is not set to the correct monitor set your main display first.
xrandr-manager -m HDMI-0
xrandr-manager -m DP-0
prompt mode #
If you dont know the name of your monitors and and don’t want to dig through
xrandr, you can just run --prompt and tab complete to fill set your main
display.
xrandr-manager --prompt
direction #
This is what I most often use xrandr-manager for. Once you have the main display set you can tell it where to put the other monitor. I’ve only tried this with two monitors, I have no idea what happens with more monitors.
xrandr-manager -d right
xrandr-manager -d left
xrandr-manager -d above
xrandr-manager -d below
mirror #
One thing that I always need to jump through hoops to do is mirror. Occasionally I want to mirror so that more people can see the screen while we are split screen gaming. This has seemed like a pain in any other xrandr utility, but trivial in xrandr-manager.
xrandr-manager --mirror
It logs out the xrandr command #
One nice thing about xrandr-manager is that it echos out the xrandr command that it’s running. This is nice because you can toss this behind a hotkey or an init script.
Guis #
Ya there are guis that do this. I’ve had good luck with arandr. It’s more intuitive to drag windows around like what you would do in windows. Every once in awhile it messes up and my polybar overlaps my windows, or my windows end up only on half the screen.
There are also graphics card specific utilities, Ive used nvidia x server settings and it mostly works similar to arandr.
I really like the super clean look of no status menus, no url bar, no bookmarks
bar, nothing. Don’t get me wrong these things are useful, but honestly they
take up screen real estate and I RARELY look at them. What I really want is a
toggle hotkey. I found this one from one of DT’s youtube video’s. I can now
tap xx and both the status bar at the botton and the address bar at the top
disappear.
# ~/.config/qutebrowser/config.py
config.bind("xb", "config-cycle statusbar.show always never")
config.bind("xt", "config-cycle tabs.show always never")
config.bind(
"xx",
"config-cycle statusbar.show always never;; config-cycle tabs.show always never",
)
I recently was unable to boot into my home Linux Desktop, it got stuck at
diskcheck fsck. I found that I was able to get in to a tty through a hotkey.
https://twitter.com/_WaylonWalker/status/1512281106120384519
What’s a TTY? #
There’s probably more to it, but to me its a full screen terminal with zero gui, not even your gui fonts. It does log into your default shell so if you have a comfy command line setup it will be here for you even though it looks much different without fonts and full colorspace.
Normal setup #
Normally you have 6 TTY’s running, the first is dedicated to your desktop manager, which is your login screen it might be something like gdm or lightdm.
- ctrl+alt+F1: login screen
- ctrl+alt+F2: Desktop
- ctrl+alt+F3: TTY 3
- ctrl+alt+F4: TTY 4
- ctrl+alt+F5: TTY 5
- ctrl+alt+F6: TTY 6
In my case the desktop manager neverstarted, so ctrl+alt+F1 brought me into a tty.
What happened?? #
Well after getting back in and having some time to reflect, I think my Desktop manager was installed or just broken, possibly during a update I ran a few days prior.
I tried a bunch of things like switching to lightdm, and manually running startx.
Getting back in #
The final commands that ended up getting me back in were installing and starting gdm3.
sudo apt install gdm3
sudo systemctl start gdm3
Dunk is a beautiful git diff tool built on top of rich.
Browsing through twitter the other day I discovered it through this tweet by _darrenburns.
https://twitter.com/_darrenburns/status/1510350016623394817
Dunk is beta #
Before I dive in deep, I do want to mention that Dunk is super new and beta at this point. I am making it my default pager, because I know what I am doing and can quickly shift back if I need to, no sweat. If you are a little less comfortable with the command line, terminal, or reading any issues that might come up, it might be best if you just pipe into Dunk when you want to use it.
The author really cautions the use of it as your default pager this early, I’m just showing that it’s possible, and I’m trying it.
He notes that it might have some issues especially with partially staged files.
try it #
You can try it with pipx.
git diff | pipx run dunk
install it #
If you like it, you can install it with pip or pipx, I prefer pipx for cli applications like this.
pipx install dunk
set it as your default pager #
You can configure dunk as your default pager with the command line, or
by editing your .gitconfig file.
git config --global pager.diff "dunk | less -R`
[pager]
diff = dunk | less -R
As pointed out by _darrenburns dunk is not a pager and you can gain back all of the benefits of using a pager by piping into less with the
-Rflag.
reset it if you don’t like it #
You can --unset your pager configuration from the command line or edit
your .gitconfig file by hand to remove the lines shown above.
git config --global --unset pager.diff
Comparison #
I have some edits to a game my son and I are working on unstaged so I
ran git diff on that project with and without dunk to compare the
differences.
Dunk just looks so good.
Always install #
If you follow along here often you know that I am a big fan of installing all my tools in an ansible playbook so that I don’t suffer configuring a new machine for months after getting it and wondering why its not exactly like the last.
# Dunk - prettier git diffs
# https://github.com/darrenburns/dunk
- name: check is dunk installed
shell: command -v black
register: dunk_exists
ignore_errors: yes
- name: install dunk
when: dunk_exists is failed
shell: pipx install dunk
[[ ansible-install-if-not-callable ]]
More on conditionally installing tools with ansible in this post.