‹ go back

More Linux Tweaks.

Published 03 October 2021 at Yours, Kewbish. 2,604 words. Subscribe via RSS.


Introduction

It’s been a while since I had the time to write anything for YK - I’ve been getting settled into the quintessential university freshman experience at UBC, and loving it so far. Every upper-year I meet keeps telling me about the rose-coloured glasses apparently all freshmen have, with something along the lines of ‘well, I hope you can keep that mindset up!’. It’s not particularly encouraging, but to be fair, I’ve only been here a month, and haven’t had any major quizzes or midterms yet, so maybe I do still have my pink spectacles quite firmly on. More on this some other time: this isn’t some university reflection, after all, it’s a tech blog!

So, in other news, I got a new laptop, and have been juggling close readings and annotations with setting it up. I’ve finally got everything installed and configured to my liking, however, so I thought I’d write a bit about the process of getting everything together, similar to my previous one about my monitor and Bluetooth setup. While I was able to follow my past notes for display and Bluetooth configuration, I encountered my fair share of struggles along the way. It’s just mostly stuff I’d set up on my old laptop but without writing notes about how I got myself through the messes in the first place, I had no idea where to go this time round. However, I managed to work things out, very slowly and steadily, and I’m now writing this very post with my new setup.

Some specs:

  • It’s the Lenovo Yoga 7 14ITL5 - got it off Best Buy for a half decent deal.
  • It’s got a 11th Gen Intel i7-1165G7, with 8 cores, Intel Iris Xe graphics, a very nice 16GB of RAM that I didn’t even have to dismantle the chassis for, and 1TB of NVMe SSD. It’s currently running 5.13.19-2MANJARO, and everything (minus fingerprint reader and sound) works really well.
  • One of the immediate improvements over my old laptop (well, besides weight) is how quickly it boots and runs things. My old laptop had to go for at least half a minute to boot up, which was certainly an annoyance when it’d suddenly crash in the middle of Zoom class. Granted, it had to go through Grub and a shabbily patched together Windows dual boot configuration, but this laptop is so much quicker. It boots from completely shut down in what I can perceive to be a second or two, which is crazy fast compared to my past habits of staring blankly at a HP loading circle for ages.
  • Speaking of weight, the laptop’s quite thin and light, something I appreciate when I have other binders and things to shove in my bag. It’s about half a kg lighter than my old laptop, which isn’t entirely much, but it makes a nice difference that I value.
  • The battery life’s also pretty amazing - the first time I took this laptop to school, I hadn’t yet ordered a second charger cable, and my packaged one was still at home. It managed to churn through three hours of Zoom meetings, and three hours of a physics lab, all while still having a good 30% left. It’s amazing what this 71Wh battery can do - it can definitely hold tonnes more than my old 38Wh.
  • Something else I really like about the laptop so far is that I have one (1!) cable to plug in when I get home. I have my power, monitor, printer, webcam and various other little cables all hooked into a singular USB-C hub, which then plugs right into my laptop. I used to have to plug each individual cable in, and because each port was on different sides of my old HP, it was a bit of a mess, visually. This does present the problem of always having to be charging the laptop if I want to use my monitor, but it’s somehow configured itself to only charge when not full, and then run off what I assume is AC after that.
  • And it looks amazingly cute - I’m not usually one to fuss over the colour of laptops, but it’s just such a nice slate grey.

Overall, definitely a big improvement over my old HP, and very grateful I’m able to have a better machine.

Similarly to my other Linux-setup-tweaks post, this article will cover a bunch of my troubleshooting, thought processes, and eventual solutions to my various issues: getting my printer drivers working, fixing screen tearing, duplicating Chrome history and passwords, tweaking fonts, and more. This is mostly to keep a record for myself of all the little problems that I’ve had, just in case I have to reinstall or do this all over again for some other machine. I don’t think this post’ll be of much use if you don’t have the exact same model of laptop, but maybe some of the more general tweaks, like for fonts and such, will help someone out there. Throughout this guide, I assume you’ll be running Manjaro or some Arch relative, and have a basic knowledge of how to run commands and install packages - I’ll only be going into what I did to fix my issues, so you’ll have to look at more general advice elsewhere.

CUPS and Printing

I’m going go start with CUPS troubleshooting first, because I went through a whole struggle to set up my printer. I specifically have the Brother-MFC7340 laser printer, which is a rather old black and white model that comes without any of the fancy modern QoL features like double sided printing or wireless connections. It even has a fax - that’s how old it is. But Brother does a pretty decent job of keeping their drivers backward compatible and up to date, even for older models like mine, so I thought I’d have a pretty easy time at it here. I installed cups, and trawled the internet a bit for the Brother driver I thought would work, which ended up being this one (brother-mfc7340) on the AUR. Spoiler alert: it doesn’t work.

I tried uninstalling sane, disabling usblp, and manually editing PPD files, all things listed in the Arch Wiki troubleshooting page. Long story short - the driver doesn’t work, wasn’t the one I thought I had installed on my old laptop, and you shouldn’t bother trying any of the above. Instead, install brlaser from the AUR, and set up your printers to use that driver instead. I’m not going to go into the specifics of how to set printers up, but know that you’ll have to select something like ‘Brother MFC7360N’ instead of MFC7340. It’s not an exact model match, but it works perfectly fine for me, so I’m not going to ask questions.

An aside: to configure scanning properly, you’ll have to install brscan3, or install brother-mfc7340 as above. Then, install simple-scan or another scanning tool, which should automatically register your printer / scanner combo.

Screen Tearing

When madly scrolling through tonnes of forum pages in an attempt to resolve the above CUPS issue, I also encountered a bunch of screen tearing issues. I’m running Chrome1, and found that without hardware acceleration on (which for some reason, didn’t work properly in Chromium) and another fix I’ll detail below, I had pretty significant screen tearing while scrolling. It wasn’t anything too severe, but annoying to notice when trying to read pages and scroll nicely.

What got my screen to stop tearing was, for one, enabling hardware acceleration in Chrome settings (see chrome://settings), and messing around with Intel graphics files. I created /usr/share/X11/xorg.conf.d/20-intel.conf, and put the following in it:

Section "Device"
  Identifier  "Intel Graphics"
  Driver      "intel"
  Option      "AccelMethod"  "sna"
  Option      "TearFree"     "true"
EndSection

When I rebooted, the boot was getting stuck at ‘/dev/[something] clean, … files, … blocks’, so I thought I’d have to start over and reinstall my system again. But don’t panic - hit CTRL-ALT-F2 to get into a recovery terminal. From here, you can either pacman -Syu and see if that fixes it; or, as that didn’t work in my case, run sudo mhwd -f -i pci video-linux, which did some scary things for a while and then popped me back into my login screen. The above command is the equivalent of sudo mhwd -r pci video-linux followed by sudo mhwd -i pci video-linux, if that helps.

Retracing History

It turns out Chrome conveniently stores all of its data in ~/.config/google-chrome/. Most of what you’ll want will be in the ~/.config/google-chrome/Default/ directory, which is home to the History, Cookies, Extension Cookies, and Shortcuts databases. I’m going to be honest - I don’t entirely know which have carryover effects and which don’t, but I essentially copy-pasted all the databases I could find to my new laptop. This let me retain my history, but I still had to log into each website and refresh cookies where necessary on my own. Note that the Extensions directories don’t appear to do anything - I thought that this would copy over all of my extensions, but alas, I had to do that manually as well, which is surprising, since the directory contains what appears to be the raw extension files.

Speaking of logins, I’ve saved most of my passwords into the Chrome password manager (not very secure, I know), and wanted to transfer those over as well2. On my origin / old laptop, I went into chrome://settings/passwords, and clicked the hamburger menu near Saved Passwords. This let me export all my passwords into a very dangerous, unencrypted CSV. Try not to let anyone get access to that. On my new installation, I went to chrome://flags, and searched for and enabled Password Import. Navigate back to the chrome://settings/passwords page, and it’ll let you import a whole bunch of passwords in the same menu.

Also, a cute tip if you, like me, enable login to Gmail without login to Chrome but still want a custom profile pic in Chrome: click on your profile, click edit, and select some other profile pic. This’ll spit out the photo in ~/.config/google-chrome/Avatars/. Take whatever photo you want to use as a profile pic, rename it to whatever’s in the Avatars directory, and replace the Chrome avatar with your custom pic.

Font Tweaking

I had two major font tweaks to do - one with my preferred emoji font, and one with my type hinting in LibreOffice.

First, the emojis. I prefer to use Twemoji, which is Twitter’s custom emoji font - also the same one used in Discord. I like how round and flat and cohesive it is, but maybe that’s just an acquired taste from spending much too long on Discord. Regardless, to make Twemoji work at a baseline level, you’ll have to install ttf-twemoji. There’s another package, ttf-twemoji-color, that provides the colour version of the font, as well as the B&W files. However, Chrome apparently doesn’t have full support for SVG colour by default, and the colour version wasn’t appearing in other apps like my terminal. So, I had to do some finagling, and install ttf-bitstream-vera, then ttf-twemoji-color. Finally, I had to create ~/.config/fontconfig/fonts.conf, and put the following inside:

<fontconfig>
  <alias>
    <family>serif</family>
    <prefer>
      <family>Twemoji Color</family>
    </prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Twemoji Color</family>
    </prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Twemoji Color</family>
    </prefer>
  </alias>
  <alias>
    <family>Apple Color Emoji</family>
    <prefer>
      <family>Twemoji Color</family>
    </prefer>
  </alias>
</fontconfig>

Run fc-cache -f -v to clear the font cache, log out and back in for good measure, and you should be graced with some very quirky, iconic emojis.

I also had a small problem with ttf-ms-fonts, which is a package that includes all the default Windows fonts, like Times New Roman. I’m required to use it for school, so I’d have to be staring at it quite regularly. A pity then, that LibreOffice wasn’t displaying it properly - it was a bit too short and compressed, and there were some spacing issues that came up occasionally. So, I had to further edit my fonts.conf, and add some bitmap edits:

<match target="font">
	<edit name="embeddedbitmap" mode="assign">
		<bool>false</bool>
	</edit>
</match>

Put this inside the <fontconfig> tag, and run fc-cache -f -v again.

The final ~/.config/fontconfig/fonts.conf:

<fontconfig>
  <alias>
    <family>serif</family>
    <prefer>
      <family>Twemoji Color</family>
    </prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Twemoji Color</family>
    </prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Twemoji Color</family>
    </prefer>
  </alias>
  <alias>
    <family>Apple Color Emoji</family>
    <prefer>
      <family>Twemoji Color</family>
    </prefer>
  </alias>
    <match target="font">
        <edit name="embeddedbitmap" mode="assign">
            <bool>false</bool>
        </edit>
    </match>
</fontconfig>

And, Finally, Sync

No actual problems here - I’d just like to keep a note of the rsync command I use to back things up for further reference:

rsync -r --info=progress2 --exclude=.git --exclude=node_modules --exclude=archive --exclude="*.mp4" /home/kewbish/Downloads/dev/* /media/kewbish/Seagate\ Basic/dev/

Conclusion

Every time I set up a laptop, or break something and need to fix it, I’ve realized that even though there’ll inevitably be trials and tribulations, I end up learning a lot - not just about how to fix said bugs, but in general how computers work. The first time I installed Linux, I had to learn about dual booting, what partitions even were, and how to make partition schemes, and port all my hacky Windows experience over into a whole new world of Unix. When I was trying to troubleshoot my monitor last time, I learned a whole lot about displays and profiles, and likewise when I sorted out my Bluetooth connections. These processes of constantly breaking, then fixing and learning, are what’s kind of fun about Linux. Sure, you won’t ever have to run into major issues on Windows (as long as you don’t do anything too crazy), but it ends up abstracting all the interesting system files and configurations away from the user. Sometimes diving into the /etc/ or /usr/ directories can lead to a whole lot of research and fun findings - that’s why I still bodge my way through Linux, even though I’ve been ‘haha linux kid’ed so many times.

There’s still some things that refuse to work - the fingerprint scanner, and the speakers, for some reason, are either not supported on Linux, or require some complicated kernel patches that for the sake of my sanity I don’t think I’ll attempt. As well, now comes the process of wiping my old HP and figuring out how to reinstall Windows, and then handing it off to a family member. I also need to sort out some small little config problems here and there, but I don’t run into them enough to bother. For the most part, what I need to work works fine: I wasn’t planning on using the scanner, I have headphones or earbuds for when I need audio, and my programming environment works pretty much identically to my HP anyways. It’s good that I managed to set everything up so quickly - I don’t have to tote around such a bulky laptop anymore, and the extra battery life’s definitely a boon for uni.


  1. The Googled one, as I found Chromium was a bit buggy in some respects, such as not letting me sign into my Gmail because the ‘browser was insecure’, and also not letting me save my passwords properly. I haven’t found any performance differences, and to be honest, I’m okay with not crusading the whole privacy narrative if I’ll be able to check my bloody email. ↩︎

  2. I never got around to enabling and really using Google Account sync, which apparently takes all your locally saved passwords and associates them with your Google Account instead. This has the added benefit of syncing extensions as well - something that would have been nice to maintain my preferences from. Having sync enabled makes switching installations and machines a lot easier, but I don’t know if I want to bother. ↩︎


‹ go back