KDE Wayland: My Second Impressions

Good Morning from my Robotics Lab! This is Shadow_8472 with a side project for the week. Let’s get started!

Riding the bleeding edge with EndeavourOS, my upgrade from KDE 5 to 6 when the default implementation was moved from Xorg to Wayland. The deal breaker for me was Discord not displaying messages properly as I type. I retreated to KDE 6 Xorg.

That was almost a couple months ago. Xorg has worked since then, but it was a little love starved having to share developer time with KDE Wayland. But I understand; there are only so many developers, and their main focus is getting Wayland working. On an update/reboot cycle, I decided to check out their progress. I have to say it’s not bad. The bug from earlier is resolved, at least.

Not all my settings transferred over. In particular, my mouse pointer got stuck when crossing a boundary on my multi-screen display. This setting was found in System Settings/Mouse & Touchpad/Screen Edges/Edge barrier. I set it to 0 pixels, disabling the feature.


OBS (Open Broadcast Software) had trouble seeing the screen due to windows in Wayland not being able to see outside themselves. It now needs some kind of screen caster that shows up in my system tray.

The obvious difference I can’t help is spotty performance from my taskbar window previews. Oftentimes, they don’t even load when I mouseover them. Other than that, there are new interface sounds I’ve already been living with, but haven’t found the way to turn them off.

Takeaway

Technology marches on. Legacy software becomes obsolete. There are bumps along the way, but the KDE Wayland’s are smoothed enough that I can jump over now. In another couple months, I expect the experience will be virtually unnoticeable.

Final Question

Have you ever rode the bleeding edge and had to come back later? I look forward to hearing from you in the comments below or on my Socials!

Can Linux See a GameCube Controller?

Good Morning from my Robotics Lab! This is Shadow_8472 with a side project for the week. Let’s get started!

I’ve had a Nintendo GameCube controller on my desk ever since I got a USB adapter some months ago. I poke at it every so often, trying to confirm it working in Linux, but in late June of this year, things came together.

Computer: Derpy Chips
Distribution: PopOS 22.04
Desktop Environment: KDE Plasma 5.24.7 (Qt 5.15.3)
Product: DragonRise Inc. Controller Adapter

In my research, I read about this product working with Dolphin Emulator on Linux, if not elsewhere. Dolphin sounded like a good first stop, and one day I sat down with enough patience to compile it. It needed a few tries before I read a guide on Dolphin’s GitHub explaining how the project has dropped qt5 support [1]. However, my qt version can use backports.

I installed my compiled Dolphin package. Now for a ROM. Commercial games are illegal to download, but I can either dump my own games (not in my skill set yet) or find a homebrew game. GameCube only has one such title I found worth mentioning: Toy Wars. It’s not even an exclusive – probably because it’s basically a baby Wii/Wii U on the inside.

Long story short: Toy Wars gave me a black screen. I happen to know the Wii has tons of Homebrew, so I found another guide [2] that walked me through performing a system update, netting me the Wii menu, the Homebrew channel, and then a content browser layered on top of that. While significantly hampered navigating this browser using the emulated Wii remote, I found and downloaded a free homebrew game about dogging space junk.

And still nothing from the GameCube controller. It showed up with the command “lsusb,” but Dolphin’s configuration options said it didn’t have permission. There was the missing link. By default, Linux is a lot more locked down to strange USB peripherals than Windows. I had to make a file under “/etc/udev/rules.d” describing my controller adapter and granting these missing permissions.

$ cat /etc/udev/rules.d/51-gcadapter.rules
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="0337", MODE="0666"

The 51 in the name has to do with what order this and similar rules overwrite each other. There are a ton of possible parameters for the file contents, but idVender and idProduct can be found with the “lsusb” command where it says ID vvvv:pppp. Mode is the same as file permissions ([user, group, everybody]x[read*4+write*2+execute*1]).

Takeaway

From further observation, I concluded these changes let Dolphin reach out to find the state of my controller[s]; no events are triggered in Xorg, as happen for the mouse and keyboard. Long term, I have a gag goal of writing a custom driver so I can use my GameCube controller however I like, but I didn’t get that this go-around. Oh well.

Final Question

I couldn’t find out what the leading 0 is supposed to represent. If you know, I look forward to hearing from you in the comments below or on my Socials!

Works Cited

[1] Dolphin Emulator, “Building for Linux,” github.com, May 31, 2024. [Online]. Available: https://github.com/dolphin-emu/dolphin/wiki/Building-for-Linux. [Accessed: June 25, 2024].

[2] Nintendo Homebrew, “Installing Homebrew Channel on Dolphin Emulator,” 2024. [Online] Available: https://wii.hacks.guide/homebrew-dolphin.html. [Accessed: June 25, 2024].

How I would Relearn Linux #5: Basic Scripting

Good Morning from my Robotics Lab! This is Shadow_8472 with another tip for how I would relearn Linux. Let’s get started.

Scripts

No serious system administrator has time to memorize long chains of commands taking minutes to type and might need fixing after the first try. When faced with a periodic task involving a long, involved [set of] command[s], it’s preferable to write them in a script to be run sequentially from file. While I did get by for a few years by using Bash’s (terminal shell, see section on shells) history functionality, a script is a much more sustainable way to “remember” commands.

To write a script, put your command[s] into a text document – one per line. The pound sign # at the start of a line turns it into a comment to clue future you or others into your thought process. Using a backslash \ character and additional whitespace for alignment, lines may be broken up at any point to increase readability. This becomes especially useful when dealing with half a dozen flags.

#this line is a comment
podman run \
    --name testpilot \
    --network podman \
    --ip 10.88.2.88 \
    -v ~/sandbox/testVolume:/root/vol1 \
    --rm \
    busybox:latest
#No interrupting commands – even with commented flags.
#    -v ~/sandbox/wrongTestVolume:/root/vol2 \

A script will then need permission to execute.

chmod +x <filename>

Lacking a proper explanation of the Linux permissions system, just know this is a fast way to ensure YOU have permission to EXECUTE your script.

Even understanding up to this point unlocks a powerhouse of possibility. These tools –sequential commands, comments, line breaks, and white space– are all I need to make scripts to stitch together more complicated programs I work with to build my home server. Most importantly: scripting commands allows me to clearly visualize the command I’m working on.

Shells

One slightly mind bending concept is the shell. In simplified terms, a computer shell is an operating environment. Open a terminal on a Linux workstation, and you probably have a Bash shell. Some part of desktop environment you opened that shell from is a graphical shell. From Bash, you can open another instance of Bash inside the last one like a Russian matrushka doll (nesting dolls). Connect to another computer with SSH, and there’s another shell (one one each machine working together, I think?). Other programs –such as a Python interpreter– may have a shell of their own.

Not all shells are intended for human interaction. Somewhere below the graphical environment is logically a shell either running directly atop the kernel (I don’t actually know if the kernel itself counts as a shell) optimized for running quickly.

Most important to this conversation: running a script will open a shell for its own use and close it afterwords. Fancier shell scripts can leverage many powers characteristic of typical programming languages. Flow control allows logic to branch and loop depending on the state of a whole assortment of variable types. And thanks to shell manipulation, variables can be isolated from one another in ways I’m totally unfamiliar with. And all this exposed power comes packaged directly into the operating system itself.

Takeaway

Shell scripting is a powerful tool. This single lesson is enough to unlock a wealth of potential, yet only a fraction of its total capabilities. Variables –for example– turned out more involved than I thought, so I scrapped a section them after writing about shells to support it. While it’s OK to run with only a partial knowledge, it’s also good to be aware of additional capacities when reading scripts written, polished, and published for use by other people.

Final Question

What projects have you designed with scripts?

How I would Relearn Linux #3: Terminal Navigation

Good Morning from my Robotics Lab! This is Shadow_8472 with my third installment of How I would Relearn Linux, a series where I pick an entry-level skill I would want to re-learn first if I were to begin my Linus journey over again. The terminal is the heart of the Linux admin experience. Let’s get started!

Command Line Interface (CLI)

The most familiar paradigm of using a computer is the GUI, or Graphical User Interface. Before the GUI, computers more closely resembled increasingly fancy typewriters writing from left to right, top to bottom. Just as GUI’s are still here after VR has been on the market for years, so too has the Command Line Interface (CLI) endured. Modern terminal emulator programs are wildly customizable, but that is beyond the scope of this post as well as my capabilities.

Basic Navigation

I’ll assume you have experience with a GUI file manager. The Linux terminal can do everything those do, but instead of hitting buttons or double clicking folders, you use commands to jump around to directories. My experience is with a popular default shell known as bash.

The Command Prompt

Most beginner-level Linux distributions’ terminals display a prompt like this:

<username>@<hostname>:<directory>$ 

There may be variations like different colors or square brackets present. These are heavily customizable and often are by distribution authors. The point of the prompt is to display who is logged in to what machine and where it is working. For example:

[shadow8472@ButtonMash ~]$ ▯

In this case, username shadow8472 is logged in to ButtonMash. The ~ is a shortcut for the current user’s home directory. The hollowed out cursor means I clicked out of my terminal emulator to another window.

File Paths

Similar to other operating systems, Linux has a file system resembling the trunk, limbs, branches, etc. of a tree. Starting at the root directory, /, (often simply called “root”) absolute file paths list directories separated by additional /’s.

/home/shadow8472/Downloads/Games/TicTakToeStrat.sh

Relative paths the present working directory and work from there. So, if I were in my Downloads directory, the following path would point to the same:

Games/TicTakToeStrat.sh

A leading . (period) in a file name means a file is hidden. A lone . points to the present working directory, and a pair of periods .. points to a parent directory. These are mostly used when working with a file in the present working directory or moving the present working directory up one level, respectively, though if so inclined, a user can use them as part of a larger path:

/home/././shadow8472/Downloads/./Games/../Games/../../Downloads/Games/./TicTakToeStrat.sh

Spaces cannot be used in file names because the space character dictates the flow of control when working with commands. To get around this, the \ (backslash) may be used as in “\ ”, or the entire file path may be placed in quotation marks. I find it much simpler to use capital letters for new words.

Commands

Linux commands are special system programs accessible from anywhere. As a general rule, they follow the syntax (pattern):

$ <name> -<flags> <additional parameters>

If everything before the $ is who and where you are, everything after is what you do. I like to imagine myself as walking around on the file system as though it were a maze of rooms. More practically, pressing tab will complete a command or file name (or list the possibilities based on syntax if user presses tab multiple times).

Flag and parameter syntax will be specific to an individual command/program. In general, flags control the mode a program operates in; -h or –help is a common flag to quickly access a brief program description, acceptable syntax, other flags, and whatever the programmer thinks it is most important for users to know at a glance. Parameters are more about data – especially file paths. And if you weren’t confused enough, flags can have parameters of their own.

Point of clarification: 
With the exception of Java, multi-letter flags use two hyphens. WordPress's automatic conversion is wrong.
--help
ls (LiSt the contents of a directory)
cd <file path> (Change Directory)

When using the terminal, I will imagine myself walking around the file system as though it were a maze of rooms. I use ls to “Look Surroundings.” The command cd takes steps from one room to another – either by providing a name or using .. to take one step backwards, toward the root. While not a command per se, I envision using tab to complete directory names as of feeling around with my hands; three characters before using tab is usually enough to identify a name or otherwise save a lot of time and mental energy typing and spell checking an exact name.

cd -

I properly learned this trick specifically for this week’s post. It returns you to the previous present working directory. I’ve known about something like this for a while and I intend to use it more when “teleporting.”

pwd (Displays absolute path of Present Working Directory)
whoami (Who Am I? outputs who you are working as)

These commands may seem redundant with the prompt, but some Bash shells reduce clutter and omit the path leading up to the present working directory, which can get confusing when working around multiple instances of a program. whoami exists because some prompts only start at the dollar sign, $.

man <program name> (MANual)

The man command brings up the “man page[s]” for a program detailing exactly how to use it when -h or –help aren’t enough. If a program still eludes you, Internet search and hope your results aren’t just the man page all over again.

Takeaway

The Linux command line cannot be done justice in a single blog post. Manipulating it effectively can be considered a form of art at higher skill levels or on a VM/spare machine you can afford to break. Shell scripts effectively put the computer at its own terminal, and there exist command programs written specifically for this situation. I’m planning on a followup where I go over file manipulation. In the meantime, feel free to look up a cheat sheet and keep it somewhere safe.

Final Question

Are you familiar with the terminal? What assumptions would you say are safe make about people who have only ever used a GUI file manager?

I look forward hearing about them in the comments below or on my Socials.

I Put Space Engineers on Linux (Again)

Good Morning from my Robotics Lab! This is Shadow_8472, and today I am offloading Space Engineers from Manjaro to EndeavourOS. Let’s get started!

Short Answer

I used Glorious Eggroll’s community version of Proton [1], but the AI update this past week and now requires a blank registry key or two added to its prefix. See the section titled “GAME UPDATE!!!” down below.

EDIT 4-18-2023: The development team just released a Hotfix in update 1.202.067 fixing the issue. 2/3 of my post is out of date only 14 hours after publication.

Background

This is a follow up/update to both last week –where I finish moving into a new EndeavourOS installation– and a post I wrote on January 18, 2021 [2], where I installed Space Engineers on Manjaro Linux and go into some detail about WINE, Proton, and the lengthy struggle I went through to install it there without fully understanding what I was doing. In case the specifics help anyone, I am running Space Engineers 1.201.014 default (Most Wanted update) on Glorious Eggroll GE-Proton7-54 on EndeavourOS with an Nvidia Geforce 970 graphics card.

I know what I’m doing a little better this time around. I even got it working first try. But that doesn’t mean I understand how everything works inside. There was an update to Space Engineers some time after my 2021 post that introduced a bug related to the audio system that would crash the game after anywhere between 5 minutes to 2 hours (ballpark average of half an hour). I was never able to diagnose it beyond a since-forgotten Discord post noting that the crash is an audio-related bug, and that it can be fixed by ripping open the .exe to kill the sound system. I happen to like sounds, so I accepted it until I gradually stopped playing.

The Dotnet Tradeoff

In more recent days, a member of the community going by G3ckobot on the developers’ Discord (Keen Software House) identified this crash as related to dotnet48, which I was quite possibly using as it showed up in a guide I linked to on GitHub I tried to follow. In my new installation, I went straight for Glorious Eggroll, and while the trade-off, as G3ckobot put it, is worse performance, the improved stability using the default wine-mono is worth it. He also suggested disabling progression in world settings to fix some lag related to the “G menu” for selecting blocks for your hotbar.

Crashes aren’t the only change I’ve noticed improvements with. The main menu plays videos like it’s supposed to. “Inventory Full” doesn’t self-overlap or cut off. Even “Exit to Windows” doesn’t throw a crash anymore. On the topic of miscellaneous bugs, there’s a new hint of static sometimes when I finish welding something.

A Note About Ship Blueprints

I’ve had one long-term goal while playing Space Engineers, and that is to perform a grand tour of the Solar System map before doing much else. I want to visit every planetary body once – even if just for a touch and go. My first attempt had a worker ship I was quite fond of designing, so I went to fetch it from my old save.

Like with any long-file path file transfer, my first move was to explore the destination directory.

/home/shadow/.steam/steam/steamapps/compatdata/244850/pfx/drive_c/users/steamuser/AppData/Roaming/SpaceEngineers/Blueprints/local/

When I navigated to the counterpart on Manjaro, I found myself in the exact, same place. I even made a file using the touch command in one place and it showed up in the other! A closer inspection of my file path showed that ~/.steam/steam is actually a symbolic link. Symbolic links have no concept of being mounted into another file system, so when I followed it, I landed right back in EndeavourOS’s copy of Space Engineers. It pointed to /home/shadow/.local/share/Steam, which I had to manually follow. I had to look around to find ../steamuser/Application\ Data/SpaceEngineers/, but in the end, it imported just fine.

GAME UPDATE!!!

The AI update arrived this week, and my installation broke after I was all but done writing.

Missing prerequisites
There is missing required C++ package.
You have to accept elevation dialogs from the
Steam to install prerequisites.

Within 20 minutes, I was the first one reporting it on Discord. The server went into a flurry of activity as community members pooled skills over the next four hours. A few facts were soon apparent: there are a lot of C++ packages, no logs were of help narrowing down the missing one, beta builds were working fine with Proton right up until the update dropped. I was busy with more important matters for most of it, but by the time I came back, user opekope2 posted [3]:

HERE'S THE WORKAROUND
1. Install and run protontricks
2. Navigate to SE > default prefix > regedit
3. Under HKLM\SOFTWARE\Classes\Installer\Dependencies, create Microsoft.VS.VC_RuntimeAdditionalVSU_amd64,v14

Community consensus was that an unused dependency was listed last-minute –perhaps accidentally– that wasn’t commonly included in Proton. Since the dependency isn’t actually called, it’s OK to add a fake entry in the prefix’s registry. How to get that fake entry in there can get tricky.

How to use Winetricks instead of Protrontricks

Protontricks is a version of Winetricks geared for managing Proton prefixes instead of Wine prefixes. Protontricks is in AUR but didn’t feel like installing anything from there properly. Instead, I made a symbolic link from ~/.wine to my Proton prefix and told Winetricks to load the “default” prefix. Note: I heard good things about Proton Experimental, so I switched to it from Glorious Eggroll.

AUR: Arch User Repository

cd ~
mv .wine .wineDISABLED
ln -s .steam/steam/steamapps/compatdata/244850/pfx .wine
cd .wine

Errors about .wine and “No such file or directory” can be ignored. It just means you don’t already have a default Wine prefix. If you get an error when trying to cd into .wine, that means you will have to find where Steam puts games on your distribution and change your file path accordingly.

If everything is good so far, It is a very good idea to back up your prefix if you aren’t working with a clean one or wish not to redownload it.

cp ~/Full/Proton/Path ~/.SEbackup

Ensure both Space Engineers and Steam are closed. Start Winetricks. Select “Select the default wineprefix.” The link you created and tested earlier will fool Winetricks into looking at Space Engineers’ prefix. Click OK.

Next, select “Run regedit” and hit OK.

Navigate in the registry editor to HKEY_LOCAL_MACHINE\Software\Classes\Installer\Dependencies.

You the Classes folder is long. Once you scroll down to Installer and find Dependencies, you should see two keys with the folder icon (my screenshot already has the extra key). Bring up your context menu and make a New Key and name it Microsoft.VS.VC_RuntimeAdditionalVSU_amd64,v14. Do not worry about adding a value.

Space Engineers should start up now, but you may have to try a few times before you start/load a game. My record is 4. After you confirm Space Engineers is working, be sure to remove ~/.wine link and replace your original default wine prefix if you had one before!

rm .wine
mv .wineDISABLED .wine


Takeaway

I’m no stranger to easy projects expanding on me, but this was dramatic! I tried to keep up with developments in this story until the night before publication. Opekope2’s original workaround post is pinned and has been edited to include instructions for importing two keys* that will do the same job as editing the registry manually as demonstrated. As a personal experiment starting around the time this goes live, I’m adding the other key manually. I don’t expect anything to change, but as opekope2 pointed out to me, “Because that’s how it is on Windows,” [3].

* Microsoft.VS.VC_RuntimeAdditionalVSU_amd64,v14 and Microsoft.VS.VC_RuntimeMinimumVSU_amd64,v14

Final Question

Have you gotten whatever latest update of Space Engineers running on Linux? If not, I highly recommend you engage with the community on Discord [3].

As always, I look forward to hearing about your experience.

Works Cited

[1]. GloriousEggroll, “proton-ge-custom,” github.com, [Online]. Available: https://github.com/GloriousEggroll/proton-ge-custom [Accessed Apr. 17, 2023].

[2]. Shadow_8472, “Space Engineers: WINE Is Not an Emulator” letsbuildroboticswithshadow8472 Jan. 18, 2021. [Online]. Available: https://letsbuildroboticswithshadow8472.com/index.php/2021/01/18/space-engineers-wine-is-not-an-emulator/ [Accessed Apr. 17, 2023].

[3]. Keen Software House, “Linux” [Discord]. Available: https://discord.gg/keenswh [Accessed Apr. 17, 2023].

Space Engineers: WINE Is Not an Emulator

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am forcing a Windows game to run on Linux. Let’s get started!

WINE Is Not an Emulator

Gaming on Linux hasn’t always had the best reputation. Software written with one operating system in mind may require the presence of libraries only found in that system, and for the past few decades, that’s meant Microsoft Windows has become the standard for PC gaming.

WINE is a compatibility layer. Their mission is to replace the proprietary Windows libraries with their own open source ones that anyone can freely use. Using WINE, Windows exclusive titles run in “Wine bottles” (or Wine prefixes) that make the correct system calls to either Linux or Mac.

Due to copyright reasons, WINE isn’t allowed to copy-paste any code they look at. Imperfections in execution are an inevitability. Some programs work no questions asked, while others refuse to work all together rated from platinum to garbage.

Steam Proton

I remember seeing someone play Portal 1 on Linux about ten years ago. It one of the earliest titles Steam had running on Linux, but all the walls were blackened like some sort of dark mode. It’s been fixed by now, and Steam will now happily run thousands of titles through Proton, their custom version of WINE. For tech savvy users, they have an option to let any game try to run with no promises provided.

Space Engineers: A Pain to Run

The first time I successfully beat a game into running on Linux with no promises given was Among Us. That game only needed an environment variable or something Proton couldn’t find on its own. Space Engineers, though… it’s something else. ProtonDB lists the game as Silver meaning “[A program] works excellently for normal use, but has some problems for which there are no workarounds” according to WINE’s online database, WINEHQ.

I don’t fully understand what I did in my success. No, Space Engineers will not run easily. My journey started in this community thread on Steam, though the GitHub page they link to is referenced several times over. Just follow the instructions there, and you have a portable black box solution.

But it wasn’t so easy for me. I believe I kept having trouble in creating my WINE prefix. I tried the usual black box rites like rebooting, reinstalling the program, and trying multiple solutions. It wasn’t until I slowed down to find some process hanging in the log that Engineer Man user jeffz instructed me in how to kill the process. Prior to this, I was just using Ctrl+C to kill the process directly in the WINE setup terminal and it would appear to work without the actual game going. I think I managed to rack up a total of 8 to 10 minutes of “play time” in Steam while debugging because not every attempt closed itself.

Followup Work Potential

I pretty much called it good as soon as the game started. Linux discussions kept mentioning “flying grass,” so I was prepared when I saw that, though I have it from a fellow player that there are many bugs even when running it in its native Windows. The only bug I keep running into is an early audio cutoff, usually between the words “Inventory Full.”

My computer is barely fast enough to run Space Engineers smoothly. One of my usual optimizations is ditching the Steam client and running whatever game directly. For a WINE game, though, I’m guessing I’d need to go through the whole process again with another setup, avoiding Proton (I’m using a custom Proton fork by Glorious Eggroll, a recommendation from the ProtonDB page). Unless there’s a DRM requirement where I must use Steam, I’m fine not getting the achievements or other end-user visible hooks. I expect I’ll first try getting Among Us to run from Lutris before tackling Space Engineers.

Takeaway

It is my belief that nothing is impossible to get running on Linux given enough time, talent, and compatible hardware are involved. It is also not unheard of for some games to run better on Linux/WINE than on their native Windows due to the lower overhead from the operating system.

I’ve also noticed a discrepancy where WINEHQ has Space Engineers as low as Bronze or Garbage. Looking at both the age and source of available reports, one needs to not draw conclusions about the runability of a particular piece of software in WINE. ProtonDB had reports near both extremes; most reports are summed up as, “It doesn’t work!” but there are more than a few people who gave detailed specifications on how they got it running. I have a working assembly through a lot of hammering until I found the right spot.

Final Question

If you could run any game on a platform it has no buisness running on, what game would you get running on what system?