Shallow Thoughts : : linux

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Sun, 19 Mar 2023

Rsync: Combining Includes and Excludes

I back up my computer to a local disk (well, several redundant local disks) using rsync. (I don't particularly trust cloud providers, and in any case our internet connection is very slow, especially for upload, so waiting hours while the entire contents of my disk uploads isn't appealing.)

To save space and time, I have script that includes a list of files and directories I don't need to back up: browser cache directories, object files, build directories, generated files like thumbnails, large video files, downloaded source, and so on.

I also have a list of files I do want to back up even though they'd otherwise be excluded. For instance, I sometimes have local changes in my GIMP source directory, outsrc/gimp-master/gimp/, even though most of outsrc doesn't need to be backed up. Or /blog/tags/build in my local mirror of the shallowsky website, even though I have a rule that says directories named build shouldn't usually be backed up.

I've been using rsync's --include and --exclude to handle this. But I discovered yesterday that I'd been using them wrong, and some things I thought were getting backed up, weren't. It took some reading and experimenting before I figured out how these rsync flags actually work — which doesn't seem to be well explained anywhere.

Read more ...

Tags: , , ,
[ 16:11 Mar 19, 2023    More linux/cmdline | permalink to this entry | ]

Wed, 23 Nov 2022

Shared Folder in QEMU Between Linux Host and Windows Guest

Unexpectedly, one of the hardest parts of Migrating a VirtualBox Windows Virtual Machine to qemu/kvm/virt-manager was finding a way to exchange files between Linux and Windows. In virtualbox, setting up a shared folder is trivial. In QEMU, not so much.

Read more ...

Tags: , ,
[ 17:37 Nov 23, 2022    More linux | permalink to this entry | ]

Sat, 12 Nov 2022

Limiting Battery Charge on a Lenovo Carbon X1

Ever since I got my Lenovo Carbon X1, I've wished there was some way to limit the battery charge. I keep it plugged in to a USB hub and external monitor most of the time, which means that the battery is at 100% for weeks on end. That isn't particularly good for lithium ion batteries: it's better for battery life to stop charging at around 80%.

Lots of laptops, including Dells and Apples, have a charge limit feature in their BIOS, but I searched through the CX1's BIOS several times and never found anything, so I'd resigned myself.. But just this week I accidentally stumbled on a way to set this at runtime!

Read more ...

Tags: , ,
[ 16:17 Nov 12, 2022    More linux/laptop | permalink to this entry | ]

Mon, 10 Oct 2022

dpkg-divert: override a file in a Debian package

I boot Linux in text mode, with all the boot-time messages showing. There are several reasons for this, but one is that I want to be able to see any errors that might arise — boot-time errors aren't otherwise shown to the user.

However, many Linux distros, including Debian and Ubuntu, clear the screen before showing a login prompt, making it impossible to read the last few messages or find any errors.

Some years back, I looked into why this was happening, and found the answer in Stop Clearing My God Damned Console. It comes down to a line in getty@tty1.service: TTYVTDisallocate=yes. Change that to TTYVTDisallocate=no and the terminal will stop clearing before you log in.

Read more ...

Tags: ,
[ 19:08 Oct 10, 2022    More linux | permalink to this entry | ]

Mon, 25 Apr 2022

Virt-Manager Beginner Tips

A couple of small tips on QEMU/KVM/VirtManager that I picked up while migrating my Windows 10 virtual machine from VirtualBox, for use once you get virt-manager running and migrate your VirtualBox VMs to virt-manager/QEMU:

Read more ...

Tags: , ,
[ 14:33 Apr 25, 2022    More linux | permalink to this entry | ]

Sat, 16 Apr 2022

Migrating a VirtualBox Windows Virtual Machine to QEMU/KVM/virt-manager

A month ago I wrote about Getting virt-manager Running on Debian. The ultimate goal of this was to migrate my Windows 10 install from VirtualBox to QEMU, because VirtualBox is becoming increasingly difficult to install on Linux, especially on Debian, which has removed VirtualBox from Bookworm (testing) and there are indications that it might be removed from Sid (unstable) as well. I gather there's something unsavory about the license now that Oracle owns it, but I haven't been following the details.

Anyway, after getting virt-manager running, I'd been putting off the rest of the migration out of a suspicion that there lay dragons. I was right: it took several days of struggling, but I now have Windows 10 working under virt-manager and qemu/kvm. Here's how.

Read more ...

Tags: , ,
[ 18:20 Apr 16, 2022    More linux | permalink to this entry | ]

Sun, 20 Mar 2022

Activate the Microphone on a Lenovo Carbon X1 Running Debian

When I bought my Carbon X1 laptop a few years ago, the sound card was new and not yet well supported by Linux. (I knew that before I bought, and decided it was a good gamble that support would improve soon.)

Early on, there was a long thread on Lenovo's forum discussing, in particular, how to get the microphone working. The key, apparently, was the SOF (Sound Open Firmware) support, which was standard in the 5.3 Linux kernel that came with Ubuntu 10.10, but needed an elaborate script to get working in earlier kernels.

It worked fine on Ubuntu. But under Debian, the built-in mic didn't work.

Read more ...

Tags: ,
[ 11:15 Mar 20, 2022    More linux/laptop | permalink to this entry | ]

Thu, 17 Feb 2022

Getting virt-manager Running on Debian

A conversation that happens every so often on a Linux chat channel:
newbie: Which is easier for virtualization, KVM/qemu or virtualbox?
enthusiast: KVM/qemu is really easy if you use virt-manager.
me: If you're running a full Gnome desktop, maybe. I've tried to use virt-manager several times, with virt-manager enthusiasts on this channel helping, and never got it going.

That happened again a few weeks ago, and one of the virt-manager enthusiasts on the channel wanted to help me track down the problems. Since I didn't have anything much going on, I agreed, and kept at it instead of giving up after the first few iterations.

It took about 45 minutes of fiddling, installing more packages, web searching on the error messages and discussing them on IRC, then fiddling some more, getting a little further with each package I installed. In the end, I did get virt-manager running.

Here's the list of packages I had to install, as well as adding myself to the groups kvm, libvirt and libvirt-qemu:

apt install virt-manager libvirt-daemon qemu qemu-kvm libvirt0 libvirt-bin virt-manager bridge-utils libvirt-daemon-system qemu-system-x86 qemu-utils dnsmasq gir1.2-spiceclientgtk-3.0

Part of the problem, apparently, is that Debian's virt-manager package isn't set up to require on all the other packages it needs to run. They might be there in the "recommends" and "suggests", but I don't install those by default, since they tend to pull in all sorts of silly bloatware I'll never want. With most packages, the "depends" are all that's needed to use a package in its basic form, and "recommends" and "suggests" are for optional extra features. But if you install just virt-manager without at least some of the suggested and/or recommended packages, it won't run at all.

I haven't run any real virtual machines yet under virt-manager, but I think it's working now. At least I'm to the point where I can boot from a Debian installer ISO and see the initial screen.

Tags: ,
[ 00:00 Feb 17, 2022    More linux | permalink to this entry | ]