Wednesday, August 9, 2023

Ripping streams

I ripped a bunch of stuff from SomaFM.com years back and couldn't remember the process I used and couldn't find anything on here. It worked great and I believe I have remembered that I used a combination of streamtuner and streamripper for Linux. It looks like Ubuntu now has streamtuner2, not sure the difference. Anyway it has preset URLs it works with but you can add other URLs but I'm not sure if it works generically with any sort of stream or not.

Tuesday, August 16, 2022

Convert VirtualBox .vdi image to .raw then to KVM .qcow2

I installed Windows 10 into VirtualBox to replace my old 32 bit Windows 7 which can no longer accommodate modern Visual Studio. However the Visual Studio Installer just hard locks my VirtualBox image. So I installed KVM and converted the image and it works fine.

I got the instructions for converting the image from https://www.tecmint.com/migrate-virtualbox-vms-into-kvm-vms/

Very simple straightforward instructions for converting from VirtualBox .vdi to KVM .qcow2 image.

You have to first convert the .vdi to a raw image, then convert the raw image to a .qcow image

$ vboxmanage clonehd --format RAW /home/james/VirtualBox\ VMs/debian/debian.vdi debian_10_Server.img
$ qemu-img convert -f raw debian_10_Server.img -O qcow2 debian_10_Server.qcow2

Thursday, July 28, 2022

Restore missing "Share Entire Screen" functionality in Zoom under Gnome

Hey, I know its been a long time since I rapped at ya.

(That was a reference to Jim Anchower from The Onion)

Anyway, Zoom does not work right on Ubuntu (I'm back on Ubuntu) in that sharing the screen is not an option. This is apparently a bug with Wayland and you could do a horrible fix of moving off of Wayland and back to Xorg, but screw that.

You can make it work, though this should probably be a temporary fix that you turn on and off when you are done sharing.

From: https://community.zoom.com/t5/Meetings/Linux-screen-sharing-broken-in-new-client/m-p/30975/highlight/true#M15362

The short version of the workaround is: do alt-F2, type "lg" and hit return; then enter

  global.context.unsafe_mode = true

and hit return; then escape to go back to things. You might want to reverse this (change "true" to "false") afterwards.

Friday, April 12, 2019

My first Linux Virus! (exciting!)

I've actually suspected something was up for a while now because the fan on my laptop starts spinning real hard, I start htop to see what's using my CPU and I see 4 processes called something like gvfsd or init or something that immediately disappear and then my fan goes back to normal.

So I had little luck searching around but finally stumbled across something here https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/1766503 because one of the processes was naming itself ibus something or other. And someone in this bug list pointed to a couple of pages describing trojans
https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/1766503 and
https://www.reddit.com/r/Addons4Kodi/comments/8eto78/people_using_unofficial_kodi_addon_on_linux/ which put me onto the bad files.

I found that the bad executables were in /tmp/ and when I tried to upload one of them to virustotal.com the file disappeared. So I looked and saw that it had simply recreated itself with a new name and made a copy of the executable and uploaded THAT to virustotal. Somewhere in this process I had installed ClamAV from the repo and ran it with no luck, I also scanned this executable that I copied and ClamAV said it was fine.
VirusTotal game me the following:


ClamAV didn't recognize this at VirusTotal either but several engines did. Since the virus runs out of /tmp and is apparently installed in my user directory I didn't think reinstalling the OS would do anything so I dug a little deeper and found a link to this github that listed the files/folders that contained the scripts that started virus program up https://github.com/Saren-Arterius/dbus-daemon-trojan-sample I found and deleted the files shown and edited that .bash* files that had scripts appended to the end of them that would execute the virus. 
All seems to be well now.
Oh I also did a file search in my home folder for any files matching the same size as the virus and found none remaining.

find ~/ -type f -size 3321680c -exec ls {} \;

So if you have a coin mining virus in Linux, this *might* help you.

Thursday, March 28, 2019

.local/share/sddm/xorg-session.log is about 700GB in size!!!

Holy cow, my desktop running Manjaro FireFox suddenly crashed and wouldn't restart. I figured I'd reboot and I might as well do an update first. Well, "yay" said my home partition was out of space!?! I should have had hundreds of GB free. But df -h showed my home was 100% full.
A bit of investigation using du and I located the issue. In ~/.local/share/sddm was a single file named xorg-session.log which was around 700GB in size. I deleted the file but things were loathe to return to normal so I rebooted and all is fine and I have 758GB available again.

So what the heck? SDDM is the login manager, I don't understand why it has an xorg session log in the first place. But I began monitoring it with tail -f and saw nothing going into it.
After a few hours I looked again and WHOAH It's over a GB in size again!
The content looked normal but I realized with this much data there is bound to be some lines repeated many times so I ran

sort xorg-session.log | uniq -c | sort -nr | hea

To count the number of times each line in the file appears and output the top 10 lines in order.

1982576 print-layout-end
1982576 print-layout-begin
1954874 Deal0:
1922847 Deal1:
1660218 Deal2:
1565822 Deal4: |KH |8H |QS |4H |6H |7S |JS |5S |4H |6H
1261551 Deal3: |5H |KS |KH |2H |4H |TH |AH |JH |3H |AH
 775214 Off:
 721025 Deal3:
 416754 Deal4:

I don't know what's happening but it appears that when I print a document it floods a bunch of garbage into this log file. I'll have to reboot to investigate further as I deleted the 1GB file again and now there is no logging taking place.

Friday, August 24, 2018

Configuring Canon IR-ADV printer in Manjaro

Staring a new job I needed a new OS and decided to go with Manjaro so as not to have to try to remember how to install Arch again.
Everything is mostly great, but I installed the Canon CQUE driver software and it seemed to see the printer next door but when I tried to use it I would get error codes or nothing at all.
I figured out I needed to use the UFR II drivers instead (whatever that is) which I discovered by looking for a driver in Windows (which worked). So in Manjaro I removed the cque driver and used
yay -S cndrvcups-lb
to install the different drivers (which don't use PCL/PS/whatever) I then reinstalled the printer using the new driver and everything is good!

Tuesday, February 14, 2017

Linux terminal commands that will rock your world!

I was surprised at how not so overly hyperbolic this title turned out to be.

http://www.improgrammer.net/11-linux-terminal-commands-that-will-rock-your-world/

Right up front we get:

The following keyboard shortcuts are incredibly useful and will save you loads of time:
  • CTRL + U – Cuts text up until the cursor.
  • CTRL + K – Cuts text from the cursor until the end of the line
  • CTRL + Y – Pastes text
  • CTRL + E – Move cursor to end of line
  • CTRL + A – Move cursor to the beginning of the line
  • ALT + F – Jump forward to next space
  • ALT + B – Skip back to previous space
  • ALT + Backspace – Delete previous word
  • CTRL + W – Cut word behind cursor
  • Shift + Insert – Pastes text into terminal
Followed by a bunch more really useful tips.

Tuesday, January 17, 2017

Configuring TexStudio commands and fixing highlight for dark backgrounds

I recently re-installed TeXstudio in Arch Linux after not needing it for a few years and had to remember how to get things working again.
There were 2 issues, one it said I had no Latex distribution, which I did so I had to (ugh) manually configure all the commands (actually I only had to locate each command, the configuration was automatic for each one). I used this as a guide: http://tex.stackexchange.com/questions/246316/error-make-sure-that-you-have-installed-a-latex-distribution.

Then the background color of the current selected line was the same as the foreground color making the text invisible. There are a LOT of color options under settings, but the setting needed is "current line" background, which I figured out from  http://tex.stackexchange.com/questions/85038/current-line-highlighting-in-texstudio even though the option screen is not the same.

Wednesday, January 4, 2017

Fix flickering KDE Plasma display

My Plasma display flickers wildly between black and non-black whenever switching focus or other random interactions with the GUI, it has done this from time to time, but has recently gotten worse.

From https://bbs.archlinux.org/viewtopic.php?pid=1595276#p1595276

Create a file named 20-intel.conf on /etc/X11/xorg.conf.d with the following contents:

Section "Device"
   Identifier  "Intel Graphics"
   Driver      "intel"
   #Option      "AccelMethod"  "sna"
   Option      "TearFree"    "true" 
   Option      "DRI"    "3"  

Tuesday, November 1, 2016

Shortcut view of installing Arch

I haven't tried it, but this looks like a quick reminder of the options needed to install Arch without having to read a virtual book and delve into various links assuming you have done this a few times before:
https://hackaday.io/page/1755-my-parabola-gnulinux-laptop

Tuesday, October 25, 2016

Using extended regular expressions in sed

I've never quite figured out Posix regular expressions, and was trying to replace the first n characters for every line in a file the other day using sed. This is easy if all the lines have at least n characters in them.
sed s/^....//

But sed doesn't suppor the "optional" question mark modifier so lines with less than n characters would not be matched.

It turns out you can turn on extended regex support with "-r" or "--regexp-extended" allowing the following.
sed s/^.?.?.?.?//

Tuesday, September 13, 2016

Enumerate USB devices with udevadm

There's a lot of ways to find USB information, but they seem to give too much or too little information. This script from http://unix.stackexchange.com/questions/144029/command-to-determine-ports-of-a-device-like-dev-ttyusb0 is perfect for me:

for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
    (
        syspath="${sysdevpath%/dev}"
        devname="$(udevadm info -q name -p $syspath)"
        [[ "$devname" == "bus/"* ]] && continue
        eval "$(udevadm info -q property --export -p $syspath)"
        [[ -z "$ID_SERIAL" ]] && continue
        echo "/dev/$devname - $ID_SERIAL"
    )
done

Running it on my system gives:
~ $ usbdiscover.sh 
/dev/input/event9 - Chicony_USB2.0_HD_UVC_WebCam
/dev/video0 - Chicony_USB2.0_HD_UVC_WebCam
/dev/ttyUSB0 - Parallax_Inc_DEF_CON_22_Badge_DAXU3JTE
/dev/input/event1 - Logitech_USB_Receiver
/dev/input/mouse0 - Logitech_USB_Receiver

Monday, August 29, 2016

Make plasma panel visible again after disconnecting external display

I've been having this weird issue which is apparently known, but the workaround I got from https://bugs.kde.org/show_bug.cgi?id=356225 is below:

In $HOME/.config/plasma-org.kde.plasma.desktop-appletsrc there's a section "[Containments][1]". There within the option "lastScreen" often refers to the wrong screen, i.e. "1" instead of "0". When I change that option to "lastScreen=0" before starting the KDE session the panel is visible again on my laptop screen if it is the one and only available screen.

This is an important workaround because this panel not showing up on my laptop prevented my wifi from connecting and caused other odd behaviors.