Click here for archives 2005-2019

How to stop VS Code from autocompleting plain text to god knows what

Published: Sun Mar 26 2023 00:00:00 GMT+0000 (Coordinated Universal Time)

Make a language-specific setting like this (in your settings.json):

"[plaintext]": { "editor.quickSuggestions": { "other": false, "comments": false, "strings": false } }

This goes inside the bracket already in that file. Also to get to JSON mode you have to first click a little icon at the top right.


How to get rid of lots of fonts on Ubuntu in scripts you don't read or write

Published: Fri Mar 24 2023 00:00:00 GMT+0000 (Coordinated Universal Time)

I used info from this guy's page: https://www.riksoft.it/wikiriks/linux/remove-foreign-fonts-from-debian-ubuntu

This command came in handy to spot any straddlers:

sudo dpkg -l fonts\*|grep ^ii|awk '{print $2}'

xxhashsum a fast hashing algo in standard ubuntu repos

Published: Thu Mar 23 2023 00:00:00 GMT+0000 (Coordinated Universal Time)

It was 3x faster than sha256sum in my tests, but that includes a lot of just file I/O. So it must be comparatively a lot faster than that.


Getting a separate Chromium to translate to English

Published: Mon Feb 20 2023 00:00:00 GMT+0000 (Coordinated Universal Time)

I decided to use a different Chromium profile for running some extensions, including translation extensions. Problem is I'm running under a Swedish locale, and me changing settings to translate into English in the extensions did not work; they were just ignored.

Finally in the custom desktop file I've made in order to launch a separate profile for Chromium, I put in a language environment variable on the execution line:

Exec=env LANGUAGE=en chromium --user-data-dir=/path/to/my/custom/profile/directory


Trying to fix resume problems on Ubuntu 22.04 with Nvidia

Published: Thu Feb 09 2023 00:00:00 GMT+0000 (Coordinated Universal Time)

A certain error message: "Freezing of tasks failed after 20.009 seconds", led me to this discussion on Nvidia.

https://forums.developer.nvidia.com/t/trouble-suspending-with-510-39-01-linux-5-16-0-freezing-of-tasks-failed-after-20-009-seconds/200933/12

Now installed it, will have to wait and see if it works.

As described in the comment, more or less:

sudo nano -w /usr/local/bin/suspend-gnome-shell.sh

And put in:

#!/bin/bash

case "$1" in
    suspend)
        killall -STOP gnome-shell
        ;;
    resume)
        killall -CONT gnome-shell
        ;;
esac

sudo nano -w /etc/systemd/system/gnome-shell-suspend.service

and put in:

[Unit]
Description=Suspend gnome-shell
Before=systemd-suspend.service
Before=systemd-hibernate.service
Before=nvidia-suspend.service
Before=nvidia-hibernate.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/suspend-gnome-shell.sh suspend

[Install]
WantedBy=systemd-suspend.service
WantedBy=systemd-hibernate.service

sudo nano -w /etc/systemd/system/gnome-shell-resume.service

and put in:

[Unit]
Description=Resume gnome-shell
After=systemd-suspend.service
After=systemd-hibernate.service
After=nvidia-resume.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/suspend-gnome-shell.sh resume

[Install]
WantedBy=systemd-suspend.service
WantedBy=systemd-hibernate.service

Enable the two new systemd units:

sudo systemctl daemon-reload
sudo systemctl enable gnome-shell-suspend
sudo systemctl enable gnome-shell-resume

Gnome-shell consumed CPU, disabling Ubuntu AppIndicators solved it

Published: Wed Feb 08 2023 00:00:00 GMT+0000 (Coordinated Universal Time)

Ubuntu 22.04 LTS

  1. sudo apt install gnome-shell-extension-prefs
  2. Open the Extensions app
  3. Disable Ubuntu AppIndicators

That was enough for me. Enabling them again also worked.

See: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1974054/comments/8


Decompress files β€” unp seems to do what dtrx did

Published: Wed Feb 01 2023 00:00:00 GMT+0000 (Coordinated Universal Time)

Had some files that needed unpacking and was reaching for dtrx, but wasn't installed and also not in the Ubuntu repos. Found unp which seems to do more or less the same thing. Haven't tried it on zip files to unzip, tarballs, 7zip or other stuff yet though. Just .xz .

https://unix.stackexchange.com/questions/436984/decompressing-archive-to-a-single-folder


Getting gratis DaVinci Resolve 18.0 to work on Ubuntu 22.04

Published: Sun Jan 29 2023 00:00:00 GMT+0000 (Coordinated Universal Time)

Video formats

The final thing that made it work was realising that not all video formats are accepted by the free version. It will happily import them, but they can not be dragged on to the time line. Or if you succeed in creating a new timeline with them on, nothing is played as the play head traverses through them. This ffmpeg script seems to work to convert files:

ffmpeg -i infile.mp4 -vcodec mjpeg -q:v 2 -acodec pcm_s16be -q:a 0 -f mov outfile.mov

Described here: https://www.reddit.com/r/davinciresolve/comments/pxicvk/comment/ho2inmz/ , In fact there is listed a batch command:

mkdir transcoded; for i in *.mp4; do ffmpeg -i "$i" -vcodec mjpeg -q:v 2 -acodec pcm_s16be -q:a 0 -f mov "transcoded/${i%.*}.mov"; done

Video card always on

It seems you need an external video card to run Resolve too, and the card must be active when running the installation script. Or you will get missing license key once you run the application with the graphics card.

Not that there comes any license key with the free version.

In order to switch to the card being always on I used the nvidia-settings app. I tried to do it also with some CLI command but it did not seem to stick.


Disable middle click actions from the mouse in Ubuntu 22.10

Published: Sun Dec 25 2022 00:00:00 GMT+0000 (Coordinated Universal Time)

Summary: No system wide setting has worked for me so far. You can open about:config in Firefox, search for "middle" and set to false as much as you can find there. In VS code you can search for "editor.selectionClipboard" and set it to false.

A dodgy mouse keeps middle clicking when the scroll wheel is used. This lead to a flurry of new tabs in Firefox and text all over the place in VS Code.

See: https://askubuntu.com/questions/1419274/middle-click-paste-disable for the VS Code setting.


How to install Chromium with apt-get on Ubuntu so you can use extensions that need to reach out

Published: Sun Dec 25 2022 00:00:00 GMT+0000 (Coordinated Universal Time)

Summary: Use a repository from the Linux Mint distribution. Promote chromium there and demote everything else from that Mint repository.Mint is like Ubuntu, but have decided to not go down the snap path.

Instructions

The instructions are copied from here with very light editing such as a newer Mint (una β†’ vera) https://askubuntu.com/questions/1386738/how-to-install-chromium-from-the-linux-mint-repositories-in-ubuntu :

Make a backup of the stuff from the snap chromium you want to keep, such as bookmarks

Uninstall snap's Chromium, and if you installed it via apt, remember to also uninstall chromium-browser there or you will get a conflict that prevents Mint's Chromium from being installed

Create an apt source file for the Mint repository:

echo "deb http://packages.linuxmint.com vera upstream" | sudo tee /etc/apt/sources.list.d/mint-vera.list

To prevent NO_PUBKEY you have to add the GPG key by this:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com A1715D88E1DF1F24 40976EAF437D05B5 3B4FE6ACC0B21F32 A6616109451BBBF2

Then update package lists by apt: sudo apt update

Prevent installation of other packages by pin-file:

cat <<EOF | sudo tee /etc/apt/preferences.d/pin-chromium
Package: *
Pin: release o=linuxmint
Pin-Priority: -1
Package: chromium
Pin: release o=linuxmint
Pin-Priority: 1000
EOF

Install chromium:

sudo apt install chromium

Snap will be able to do it in the future

Some browser extensions cannot work with snap versions of Firefox and Chromium and snap is what Ubuntu offers nowadays. The snap people are working on making extensions that need to communicate outside the sandbox to work in both in Firefox and Chromium, and it seems they have a solution you can use for Firefox, if you snap install firefox-beta. Untested by me. Once they get the irons wrinkled out as one says, they will make this work for Firefox normal and for Chromium.

See: https://www.omgubuntu.co.uk/2022/07/ubuntu-devs-fix-another-frustrating-firefox-snap-flaw

A proxy server inside of the Chromium snap

You could conceivable get some glue to work inside the snap for e.g. Chromium, similar to this guide for Firefox and Flatpak:

https://discourse.flathub.org/t/how-to-run-firefox-and-keepassxc-in-a-flatpak-and-get-the-keepassxc-browser-add-on-to-work/437

In that case you'd put a proxy binary inside the snap and some JSON for the browser.


If Ubuntu Linux on the desktop was a car

Published: Sun Dec 25 2022 00:00:00 GMT+0000 (Coordinated Universal Time)

If Ubuntu Linux on the desktop was a car

Today when I went out to the garage, two wheels were missing from the car. After some searching it turned out to be a conflict between the mechanic and the guy who changes the wheels to winter tyres. I pinned the mechanic to the ground and praised the tyre guy a 1000 times, and the wheels snapped on again.

A security update (UPS update) had disabled old unsafe driving modes such as driving in reverse. It was just a question of going under the engine hood to file off two serial numbers and I could after a restart, back out of the garage.

The car keeps middle-honking when I turn the steering wheel but there is no workaround as of right now.


How to know if your Linux machine is on 5GHz WiFi and what channel

Published: Fri Dec 09 2022 00:00:00 GMT+0000 (Coordinated Universal Time)

In a terminal, just issue:

iwconfig

And for one network interface you will get something like this, where "5.18GHz" indicates you're on the higher band:

wlp1s0    IEEE 802.11  ESSID:"My dual band WiFi"  
      Mode:Managed  Frequency:5.18 GHz  Access Point: FF:FF:FF:FF:FF:FF   
      Bit Rate=6 Mb/s   Tx-Power=20 dBm   
      Retry short limit:7   RTS thr:off   Fragment thr:off
      Power Management:on
      Link Quality=51/70  Signal level=-59 dBm  
      Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
      Tx excessive retries:0  Invalid misc:0   Missed beacon:0

If you want to know what channel you're on you can install the iw command e.g. with apt on Ubuntu and get something like this:

Interface wlp1s0
    ifindex 3
    wdev 0x1
    addr ff:ff:ff:ff:ff:ff
    type managed
    wiphy 0
    channel 36 (5180 MHz), width: 80 MHz, center1: 5210 MHz
    txpower 20.00 dBm
    multicast TXQ:
        qsz-byt    qsz-pkt    flows    drops    marks    overlmt    hashcol    tx-bytes    tx-packets
        0    0    0    0    0    0    0    0        0

which indicates channel 36 in this case. But I guess that was probably obvious from the frequency anyway in the previous query?

Source: https://superuser.com/questions/485588/determine-channel-of-wireless-interface


Pipewire got the sound back for YouTube videos on Ubuntu 22.04

Published: Mon Nov 14 2022 00:00:00 GMT+0000 (Coordinated Universal Time)

Sound disappeared in Firefox sometimes and did not come back, while playing YouTube videos. Only recourse seemed to be to restart the computer! I got it back by installing a new sound system called pipewire, see instructions here: https://ubuntuhandbook.org/index.php/2022/04/pipewire-replace-pulseaudio-ubuntu-2204/

Seems to be a problem for a certain Intel chipset?

Discussion here: https://askubuntu.com/questions/1406874/youtube-freezing-videos-in-fresh-22-04-installation


encfs needs some tweaks to work on Ubuntu 22.04, better to replace it

Published: Mon Nov 14 2022 00:00:00 GMT+0000 (Coordinated Universal Time)

encfs is an old deprecated way of encrypting a volume. It may have problems working on newer Linuxes, unless you allow OpenSSL to use old stuff. More info here: https://askubuntu.com/questions/1405656/encfs-segfault-in-version-22-04

It's better to replace encfs with something better, such as the pretty much standard luks/luks2.


Can you trust sites that furnish apks for Android?

Published: Mon Nov 14 2022 00:00:00 GMT+0000 (Coordinated Universal Time)

Well, the answer from me is that I don't know but some seem more trustworthy than others. apkmirror has a known team behind while e.g. apkpure does not. According to this comparison, apkpure has had malware included, and no one knows who's behind the site: https://www.slant.co/versus/7899/22173/~apkmirror_vs_apkpure

So if choosing between these two, https://apkmirror.com seems the better option. If it's good enough, no idea.


Got access to a luks2 encrypted USB boot drive that borked

Published: Sat Aug 20 2022 00:00:00 GMT+0000 (Coordinated Universal Time)

Preliminary notes. I wasn't exactly sure what I was doing here. Maybe it was already mounted and that was the problem. Anyway, files saved.

A USB boot disk with luks2 and LVM refused to boot. Needed to save the files from it.

I connected it to another computer.

Used this to figure out its /dev/sd(letter)(number):

sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

It was /dev/sdc6. Opened it into a logical volume name that I made up, "my_encrypted_volume":

sudo cryptsetup luksOpen /dev/sdc6 my_encrypted_volume

Made a local mount point in the home directory

mkdir -p mnt/rescue

Mounted it there:

sudo mount /dev/mapper/my_encrypted_volume mnt/rescue

And that did not work for me, it may work for you. I got an error message about:

mount: unknown filesystem type 'LVM2_member'

I figured out its LVM(?) name by issuing:

sudo pvscan

Then took that name, e.g.: "root-vg" and issued:

sudo vgchange -a n root-vg
sudo vgchange -a y root-vg

…to make Linux mark it as inactive, then active again. Got this info from this page:

https://svennd.be/mount-unknown-filesystem-type-lvm2_member/

And then it could be mounted and then accessed under $HOME/mnt/rescue. Copied files off of it with:

rsync -rh --progress mnt/rescue/path/to/files /media/username/mybackudisk/backups/

The lsblk dance I got from https://askubuntu.com/questions/182446/how-do-i-view-all-available-hdds-partitions .


Simple 3 point lighting rules for a talking head

Published: Thu Jun 09 2022 00:00:00 GMT+0000 (Coordinated Universal Time)

Simple 3 point lighting rules for a talking head. I took these from a video, published here as notes for myself only. Don't take lighting advice from me without double checking!

First light, right or left (maybe camera's left best?). 45 degree angle, a bit above the subject if you want Rembrandt's triangle. No sharp light, since it casts sharp shadows

Second light, same setup but opposite side. Less light.

Third light, directly opposite first light but higher up, out of shot.

Background should be darker on the more lit side of the face. Background overall in between the brightness of the left and right side of the face of the subject.

Background can have complement colours, each side.

Source: https://www.youtube.com/watch?v=AUmu1e78Bhk


How to make a systemd Linux check its boot disk on startup

Published: Wed Jun 01 2022 00:00:00 GMT+0000 (Coordinated Universal Time)

To make a systemd Linux check its boot disk on startup, you provide a special boot parameter, fsck.mode=force. So in /etc/grub something like:

GRUB_CMDLINE_LINUX_DEFAULT="quiet fsck.mode=force"

And then remember to update grub.

Source: https://www.cyberciti.biz/faq/linux-force-fsck-on-the-next-reboot-or-boot-sequence/


How to get one icon per window in the Ubuntu 22.04 dock

Published: Sat May 28 2022 00:00:00 GMT+0000 (Coordinated Universal Time)

Updated 2022-11-26: What seems to work for me now on Ubuntu 22.10 is to install a Firefox extension which then smoothly and a bit worryingly integrates with gnome on my desktop.

The extension can then be installed from here: https://extensions.gnome.org/extension/1160/dash-to-panel/

Old text:

You have to download dash-to-panel. This can be done by installing gnome extensions manager from the standard repos. Then choose "Browse" and type a search string to find dash-to-panel. Nota bene that gnome extensions manager only presents the first twelve or so search results, so you've got to do a reasonably precise search.

Once installed, you can configure dash-to-panel either from gnome extensions manager or from gnome extensions app.

gnome extensions manager:

gnome extensions app (in Swedish)

In either one go to dash-to-panel's settings and under "Behavior" select "Ungroup programs" (sorry about the Swedish):

And your dock, if it's vertical will start to look like this:


Bash β€” How to give a file to a command without making a file

Published: Thu Apr 14 2022 00:00:00 GMT+0000 (Coordinated Universal Time)

You can use heretext. The syntax seems to be:

commmand <<< $"file contents"

Tested by me. Or use single quotes. See: https://stackoverflow.com/questions/5852643/piping-in-on-the-command-line-simulating-a-file