Friday, August 9, 2024

In defense of online console subscriptions

 Widely disliked to the point of being considered predatory, difficult to measure in terms of real cost, and one of the most common points of attack against consoles from PC gamers, paid online multiplayer services in consoles are what I will try to analyze and defend in this article.

Analyzing Nintendo Switch Online Subscription

First, to simplify our analysis, let's focus on the most basic of these subscriptions: The Nintendo Switch Online individual membership, costing $19.99 per year. It doesn't offer much in "extra" content, except for some old Game Boy games that you could easily play on an emulator and which likely cost Nintendo very little to provide. From those $19.99, we need to subtract the actual cost Nintendo incurs to maintain online game servers for you (one extra player). For a very rough estimate, you can rent a Counter-Strike 2 game server (at retail prices) for about $1 per player slot. Of course, you won't be playing just one game, but over time and across 38 million subscribers, the cost is averaged out, and the actual cost per player should be fairly close to that. That still leaves $18.99 from your subscription going directly to their pockets. "Outrageous!" you might say, "To pay $18.99 just for the privilege of playing online." Well, it's not that simple. Let's continue with the analysis.

The Present Value of Subscription Payments

There's a formula in finance that allows us to convert any future payment to a present payment, or even a series of future payments to a single present payment and vice versa.

If C is your future payment (say a single subscription payment), i is the yearly interest rate that Nintendo gets for their savings, and n is the number of years until you make that future payment, then that future payment has a present value (PV), (i.e., it is currently worth to Nintendo):


So, for example, if the yearly interest is 2%, when you start a subscription, the first payment (happening the same day) is worth, obviously, $19.99 to Nintendo at that moment in time. But your next-year payment is worth $19.60. In other words, Nintendo would not care if you want to pay another $19.99 next year, or just pay $39.59 the very first day and be done for two years. Similarly, your third year payment of $20 is worth an equivalent payment of $19.21 if you made it the first day of the first year. So you could pay $58.80 up-front and be done for three years; Nintendo would be unaffected either way.

The Real Cost of an Online-Capable Switch

Assuming a lifetime of 7 years for a Switch console, that would be 7 payments of $20, spaced out over that period. That's equivalent to an up-front payment of $131.96. With an introductory price of $299.99, that means that in effect, Nintendo is selling an offline-only Switch for $299.99 and an online-capable Switch for $431.95. They are just "forcing" those wanting the online version of the Switch to get a loan with 7 installments of $19.99 at 2% interest from Nintendo to pay those extra $131.96 for that version. This is probably done because it's easier to convince your parents to pay another $19.99 per year instead of getting you a $431.95 Switch, even though it's effectively the same cost, just structured differently.

Why Charge More for Online Play?

Where does that leave us? Why does Nintendo charge those who want to play online multiplayer $131.96 more? There are three answers that I can think of:

  1. They are simply copying Sony and Microsoft. I will not consider this as a real answer because it simply changes the question to "Why is Sony charging those who want the online version of PlayStation more?" which cannot be answered by pointing the finger at Nintendo again. We only picked Nintendo for the analysis because it was simpler, but my conclusions should more or less apply to all three consoles.
  2. They charge online players more because they are more "hardcore gamers" and are willing to spend more on their console than those who only play single-player games. That means Nintendo is earning pure profit from these players. We'll analyze this case further down.
  3. Online players are more focused on their favorite online games. A player without a subscription will play one single-player game after another, spending all their time exclusively on finishing games. A player interested enough to buy a subscription for online play is more likely to focus on one of the fewer online games, say Splatoon, and spend most of their time on it, leaving less room for finishing single-player games. I find this answer very likely to be true. Anecdotally, I've been mostly an online player for many years, and I definitely bought fewer games back then, while now I play mostly offline and buy more games, finishing (or dropping) one after another. If this is true in general and not just in my case, then Nintendo is likely charging more up-front to make up for that loss of future income. Often, console hardware itself is sold at a loss, so the way to make up for that loss is by selling games. But if your intention is to buy two games over 7 years (say Splatoon 2 and Splatoon 3), then obviously Nintendo can't have that.
  4. A combination of #2 and #3 could also be the real answer. Analyzing that is the same as analyzing #2, which we'll now do.

Potential Consequences of Banning Subscriptions

Let's assume then that Nintendo is overcharging online players. Is that outrageous? What happens with these profits? What would happen if they were somehow forced to reduce those profits? Imagine that a law gets passed that bans subscriptions for consoles. What now? How does Nintendo react to that? Any of the following, or a combination of them could happen:

  1. The price of the console itself could be increased. 38 million subscribers out of 143 million units sold very naively means that about 26.57% of the sold units were those hypothetical "online" units that effectively cost $431.95, and 73.43% are those offline-only units that cost $299.99. Now these two models are equalized, so the end result would be an online-capable unit for an introductory price of $335.06. The bad thing here is that we may have gone from a situation where the "hardcore online players" were subsidizing cheap consoles for the offline-only players, to a situation where the offline-only players are now subsidizing the costs of the online players.
  2. The price of all games could go up by whatever amount is needed to keep the profits the same as before. Again, the offline-only players would end up paying more in the long run, and the online players would end up paying less. If your subscription effectively costs $131.96 like we showed, paid by 38 out of every 143 users, and the average player purchases 6 games per year over 7 years, then that would be a $0.83 game price increase.
  3. The price of just the online games would go up by whatever amount is needed to keep the profits the same as before. If you are an average online player, then you'd see no difference in your wallet in the long run. If, as I suspect, the online players buy fewer games, say 3 games per year over 7 years, then that would be a $6.28 game price increase, only on the online games.
  4. Nintendo could invest less in research or game development in order to keep their profit the same as before. What this means for the next console or the next game is impossible to predict. It is safe to say that without the current level of R&D, the next console will be less capable and/or more expensive to manufacture.
  5. Nintendo could accept the loss of profit and make smaller dividend payments to their stockholders and/or have their stock decrease in value. The end result of that would be some amount of investment leaving the company and going elsewhere. Needless to say, this will not make their next console better or cheaper; quite the opposite.

Market Dynamics and Subscription Models

Of course, all of the above assume no player movement to or from other platforms. It is possible that the PC gaming market is starving for a new gaming machine with the payment structure that PC gamers are used to, i.e., a big up-front payment for the real cost of the hardware and the OS software, no subscriptions, and low game prices with little to no platform markups. In which case, the moment Nintendo decides to stop their subscription model, they get flooded with new players and don't need to do anything at all to make up for the loss of income.

But it's also possible that it's exactly the other way around: that the up-front cost is already too much for console players, that PC players will never buy a console just because the subscription model was abolished, and the market is actually starving for an even more subscription-based service. For example, remember that hypothetical $431.95 subscription-free online-capable Switch? Well, it's exactly equivalent to $65.43 yearly payments for 7 years with no up-front cost. Or even $5.51 monthly payments for 7 years, no up-front cost. And you can kind of do these things by buying the device with a credit card, though those have much higher interest rates than what we assumed so far.

Hell, you can get a PC effectively on exactly the same subscription model as a Switch. For example, buy this laptop:



and pay up-front $303.28 (about the same as the introductory price of a Switch), pay the other $65.21 with a credit card (23.76% effective yearly interest rate), and then make 7 yearly payments of $19.99 on that credit card.

My guess is that if there was space for gaining meaningful market share by dropping the subscription price or even getting rid of it completely, one of Sony, Nintendo, or Microsoft would have already done it. You'd expect that the first one to do it would immediately steal a good chunk from the other two, especially if they waited for one of the other two to announce a pricing change, like when Sony added two more higher tiers to their subscription service. It's also possible that while their market research may show an average improvement in profit margins if they abolish subscriptions, the standard deviation is too high, meaning there's a good chance of reducing their profits below some threshold that would force them to re-implement subscriptions, with unpredictable effects on their users' nerves and reputation. They would certainly look desperate if they were the only company that had to bring back subscriptions. My guess is that their market research shows the opposite: that moving even more of the cost of the console away from the games and hardware and into subscriptions makes more sense in the current market. At least Sony seems to think so, as they showed by recently adding higher tiers, and both Sony and Microsoft now provide games "for free" as long as you pay the subscription. It looks like this model is working for many people. And with Steam Deck and other PC handhelds on the market, Nintendo has even less reason now to try and capture gamers interested in paying up-front for hardware as long as later costs are low.

Comparing to the Commodore 64

To put things into perspective let's compare to one of the best selling computers ever, that was also widely used for gaming: A Commodore 64 would cost $395 to months after release. A floppy drive would about a year after release cost $300. That's a total of $2275.96 in today's money. A 21" CRT uses about 100W, the Commodore 64 uses 21W, for a total of 121W. At $0.076/KWh in 1982 and with 2 hours of gameplay per day, that's $6.71 per year or $22.36 in today's money, more than your yearly Nintendo subscription. Commodore 64 games typically cost $30 around 1984 (really hard to find original pricing information) which is $92.50 in today's money. A Switch uses 8W and a modern monitor of similar size uses 25W for a total of 33W. At 2 hours of gameplay and at $0.1643/KWh, that's $3.96 per year on top of your $19.99 subscription. Or if you play handheld, $0.96 per year on top of the subscription. So a Commodore 64 was 488% more expensive than a Switch, its games cost 54% more than those of the Switch, and the costs for playing it 2 hours per day were about 7% less than those of a Switch on a 21" monitor, or around 6% more expensive compared to a Switch played handheld. And it was not online.

 Commodore 64
(adj. for infl.)
Switch
(some adj. for infl.)
Hardware cost$2275.96$386.58
Game cost$92.50$60
730 hours of electricity cost$22.36$3.96 (on a monitor)
$0.96 (handheld)
Online multiplayer costN/A$19.99

Conclusion - Fix It Yourself

If you're still certain that Nintendo would actually increase their profit by offering the option to pay the full price up front, I recommend you put your money where your mouth is and offer that service yourself on the market, and become rich. Sell Switches with an add-on service: Your clients pay an extra $131.96 up-front, and you cover their Nintendo subscription costs for 7 years. You should be able to sell more consoles than anyone offering just the console.

Otherwise, don't fuss. As we saw, any up-front cost is equivalent to some recurring cost and vice versa, whether it's paid per game you buy, or per month, or per year. And there are more options than there ever were. But "don't fuss" doesn't mean don't ask console manufacturers to improve their offers. Just don't accuse them of not choosing the price structure of your choice. Convert everything to a present value and compare the different offers. Then use a credit card to move up-front payments to the future, or deposit money up-front in an account to bring future payments to the present.

Wednesday, April 24, 2024

Voyager Manager v0.1

I've written around seven programs for my HP 12c. I've manually combined them into a big "multiprogram" which starts with a jump table: a bunch of GTO commands, each one jumping to the entry point of one of the actual programs. The reason for that is that the HP 12c has only one contiguous program area. Fortunately, the calculator allows you to manually execute a GTO command before pressing R/S to start the execution. But instead of having to remember the starting address of each program, I just put them on the GTO instructions on the jump table so I just need to manually do GTO 003 and press R/S to start the third program, because address 003 has the GTO to the starting point of the third program. 

But managing this multiprogram is very tedious. When a program is placed in a different starting address in memory, all the GTO targets of that program need to be updated and offset correctly to continue working. So I made a program called Voyager Manager that lets me compile any number of programs into one such multiprogram, taking care of the GTOs and the jump table automatically. It works for my programs but it's still a very early version. It comes with GNU/GPLv3 source code, Lua binaries for Windows included, and a library that includes my programs for the HP 12c to get you started.

You can download Voyager Manager from here.

Saturday, January 13, 2024

A Dissonant Chord - Part 9

In part 8, Ikram, Arasen, Kendi and Indirra fled to Ikram's old campsite to recover from their injuries after escaping from jail. The next day, Indirra explained to Ikram that he must deal with the "sodden" that was pursuing him, either through combat or by offering a gift. Ikram and Indirra then went to a river, where Ikram ate wetwart to commune with the spirit and had a vision of its past life. He threatened the sodden to leave him alone and the sodden agreed to it in exchange for a pair of iron boots. Then they started preparing a trap in a area where they would attempt to fight warriors of the Cove.


2nd day of Summer, year 132

After perfecting our trap over several days and keeping watch on the road, Kendi spotted a group of warriors approaching from the direction of the city. As planned, he pulled aside the bushes we had cut from the ground, creating an opening. Seeing this, Arasen, Indirra and I ran to meet him. They then pretended to be walking away from the city but turned as if in panic when one of the warriors pointed at Kendi's group. The warriors immediately broke into a run to follow them. It was now my turn to act, making the spikes invisible just after the three had safely passed them. Visualizing something invisible took concentration, but I managed it just as the warriors passed the concealed roadside bushes. There were five in total, and three seemed familiar. As planned, Arasen, Kendi and Indirra fled toward the trees where I hid, feigning panic. The emboldened five warriors sprinted after them directly into the trap. The front three were skewered on invisible spikes as two behind, shocked and confused, tried to stop. I then jumped from cover, now certain these were the remaining men from Graycliff, and shouted, "You filthy trogs will die today for what you did!" Their mouths agape, I aimed and shot an arrow at the one that I did not recognize, striking his chest. He fell to his knees as the sole other standing rushed at me, fast as could be. He likely would have reached me before I could nock another arrow, but the area was full of spikes, and his speed caused him to fall upon one, piercing him deep. As he screamed, my arrow found its mark in his skull, silencing him instantly. The one who had taken an arrow to the chest lay unmoving just nine steps away. All that remained were the other three - two crawling away in agony while skewered on spikes, and one Kendi now approached, recognizing him as a former captor. I went after the two crawling men. I kicked one onto his back, and as he shouted expletives, quickly loosed an arrow into his face before moving to the last. I turned him over. "You and your dead buddies killed ten people in Graycliff and burned the village," I said. "So what? You attacked us!" I shot an arrow through his knee. "I attacked you? After you tried to take all I had? Was it worth it, you stupid fuck? I'm going to destroy your little band - you're the last of the boys that attacked my village. I'm coming for your leader next." "I hope they catch you and give you to the elves, you bastard!" he spat. I tied his hands and feet. "What, you won't kill me? I'll die anyway, you can't use me as leverage." "The river is near, and I see you're wearing some fine iron boots," I replied. Five minutes later, I unloaded him from Valeri beside the flowing water. "What the hell, you psycho, why aren't you finishing me off with an arrow like everyone else? Will you drown me? Hey! Were are you going?" he mumbled as I stepped away from the river. "I ain't drowning you myself," I said. "Your boots are here, plus anything else of worth you find to aid you in your revenge against your brother!" I shouted toward the river. The warrior's confusion was quickly replaced by terror as two wrinkled hands emerged from the water and pulled him under. Arasen, Indirra and Kendi had followed me and were watching from a distance but now approached. "Are you ready? Feeling alright?" Arasen asked. "Yes, much better. He was the last of..." I started to say, but my sentence was cut short by a pink light exploding from the river in a mist that weaved through the air toward me. I tried to run but it was too fast, shooting straight for my sternum. However, it wasn't aiming for me - it absorbed into my lodestone within seconds. "What's happening?" shouted Kendi. "Why did you freak out?" "There was some weird mist coming from the river that went into Ikram!" Indirra replied. "Not into me, into my lodestone," I corrected. "Didn't you see it?" I asked Kendi and Arasen, who both shook their heads. "But what was that energy? It was pink, so not the kind you usually absorb, right Ikram?" Indirra asked. "Yes, it looked and felt somewhat different. Let's move our camp elsewhere for tonight," I said. So we traveled for about an hour and found a clearing in the forest to set up camp, where I spent most of the night examining the lodestone with Indirra. We found out that it responded to my invocation attempts but not to Indirra's. It also seemed to be filled with energy after absorbing the mist but I decided not to absorb it that yet since I felt quite full.

3rd day of Summer, year 132

I slept very well and felt completely rejuvenated upon waking. We ate together and discussed our next steps. I still wished to move on, but as I told that warrior, I intended to go after the Cove's leader next. I swore upon my knife that I would see Namura captured or dead. Knowing the Cove was now weakened, we decided to strike swiftly. We would target the head - Namura. We would wait until nightfall and infiltrate their headquarters under cover of darkness. Indirra used invocations to dim or extinguish any lights along our path. She also allowed me to absorb some of her energy, which was quite intense. When we reached the headquarters, I spent some time searching for alternative entry points. We found an unguarded window on the side that appeared to open into some sleeping quarters. Assuming it would be empty at this late hour with so few members remaining, we entered. However, we were mistaken - someone was sleeping inside. Only once within did we realize. We tried to sneak past quietly, but the old wooden floors creaked underfoot, rousing the warrior from sleep. I quickly invoked transparency around us and felt my lodestone warming against my skin, a sign that the illusion had taken hold with its help. Moments later, the warrior returned to slumber and we exited the room, moving into another empty barracks room. Within, we heard footsteps above, likely a single person. Finding a staircase, we ascended and emerged in a workshop hall strewn with arrows, weapons and used armor. I mentally noted a few wooden armor stands that could serve as makeshift barriers if we were chased through the space. We moved away from the sound around a corner. The hallway continued a bit more narrowly ahead, ending at a door bearing both the insignia of the Cove and Greatrock. This had to be Namura's private quarters. And indeed, we could hear snoring emanating from within! I timed opening the door to coincide with Namura's snores, and after a few more, we had all entered the room standing before him. We all looked to Kendi, who gladly moved over Namura and stabbed his heart while muffling his mouth with a hand. I searched his office and found letters exchanged between Namura and someone named Kabeera. Namura had detailed plans to launch an attack on the elves and was requesting backup, stating it was time to stop serving "those monsters." The letter was dated a week past, and I wondered why it had not yet been sent. Then I discovered two additional letters apologizing for an inability to assist Namura and advising against moving against the elves, warning this would result in destruction of the entire region. It had become clear that while we had succeeded in destroying the Cove, the true heads of this operation were the elves pulling the strings from afar. We escaped the way we entered and made for Valeri, camping in the forest outside the city for the night.

4th day of summer, year 132

I awoke refreshed. Once more, we discussed what was next. Kendi cared deeply about Greatrock, so he wanted to stay there underground for a while and hopefully expunge any remaining Cove members before organizing a militia against the elves. Indirra agreed that they should stay and help. Arasen was the only one who suggested they move away before things with the elves became worse, but eventually gave in. I told them that I'd move on with my trip around the world. I promised them that I'd visit again as soon as possible. I gave them instructions on how to find the library of old-world books in the frozen cavern under the shack and suggested they go see Padma in Mournwood if they need to sell more of these books. Then I showed Indirra the tablets I copied from the abandoned house in the Deep Wilds. Before I even explained anything, she ran and brought her magic mirror. She partially uncovered the edge and showed me an inscription on it. It was definitely the same script, but, alas, she knew what neither meant. Neither did her mother. But since the mirror was probably made by the same people as the ones in the abandoned house, we discussed its origin. Her mother told her that she was once led to a ruin by a glimmer. A child-like glimmer. We speculated that maybe that glimmer was once one of these humans. Maybe all glimmers were once such humans. We kept talking till midday. Then we exchanged hugs with each other and I left towards the Havens to the east. I reached an opening and camped for the night.


This marks the end of the first act of A Dissonant Chord. I have played enough to post another three parts from the second act, which follows Ikram on a trip to another plane of reality and back. But I will post the next three slowly over the next half a year or so. Without providing any more spoilers, I have had to pause playing that campaign because I am currently playing a prequel campaign with some people. This prequel campaign will determine exactly what Ikram is going to discover when I continue playing his campaign. Till then, if you feel like playing in a campaign within this universe, leave a comment.

A Dissonant Chord - Part 8

In part 7, Ikram, Arasen, Indirra, and their rescued friend Kendi successfully break Kendi out of jail using Indirra's enchanted mirror. However, as they flee, a drunk warrior spots Ikram and alerts others. A fight ensues and Ikram is able to kill one, but they are injured in the process. They escape to Ikram's old campsite to recover from their injuries.


36th day of spring, year 132

We woke feeling somewhat more energized this morning. Arasen treated me like a brother and was very upbeat in his outlook about everything. Indirra and Kendi, however, were not so optimistic. They were worried about an infected wound on Kendi's foot, which seemed to be getting worse, and asked if I had any knowledge of how to treat it now that we could no longer return to Greatrock. I gave Kendi some alcohol to numb the pain and took a close examination of his wound. I discovered a piece of wood buried deep inside and removed it. I then applied some healing herbs before rebandaging his foot. Once Kendi had calmed down, I noticed that Indirra had begun drinking the remaining alcohol. So we lent a helping hand as she finished it off. The rest of the day was spent swapping stories about our pasts to take our minds off our troubles.

37th day of spring, year 132

We awoke feeling rested, miraculously without hangovers. Kendi's wound seemed somewhat better. I asked what our next steps would be, but Indirra reminded me of the sodden that was pursuing me. "Soddens are said to grow stronger over time, so you must act swiftly. Defeating them in combat usually prevents further attacks, though such fights are never fair. You can't evade them forever either - as spirits, they haunt you whether emerging from the water or not. The other option is to offer a gift, but for that you must discover what they cherished in life," she explained. "But how will I know?" I began to ask, when she interrupted, "You commune with them. Go to water with friends during daylight and eat some wetwart - two or three should suffice. Then you may see their past." I replied, "Very well, will you help me with this? Today even, the river is near." Indirra agreed and we set off. Along the way, she advised that avoiding soddens in future meant not approaching water alone or ensuring attacks would be ineffective. We left Kendi resting back at camp and Arasen to care for him and guard our supplies and Valeri. A half hour later, we reached the riverbank. Indirra tied a rope around us both, making it virtually impossible for either of us to be dragged into the water. After finding some wetwart sprouts, she asked, "Ready?" "Yes," I answered, and lay down by the flowing water. I munched three wetwart sprouts and swallowed them, though the taste was horrible. We chatted for less than an hour before the effects of the warts began to take hold. At first, I started seeing movement in the water and among the trees. Indirra told me it was merely a hallucination and advised me to close my eyes. I did so, and after a minute I opened them again to see the trees as before. I felt myself starting to move towards them, unsure if I was actually walking or merely observing myself from a distance. Then I saw Valeri with no saddle. She looked at me briefly before turning and moving into the trees. I followed her silently, feeling no need to call out for her to wait. We walked through the forest as the trees began to glow with a dim blue light and that familiar smell surrounded me once more. I closed my eyes, took a deep breath and allowed it to envelop me. When I opened my eyes again, I felt sated but Valeri was no longer in front of me. The trees had stopped flowing and I found myself standing at the entrance of a cave, carrying the carcass of a deer which I knew I must bring it inside before something attacked. As I headed into the cave, a family was waiting - my brother, wife, uncle and infant daughter, whom I recognized at that moment. Everyone seemed glad to see the deer, except my brother - he was jealous as always. "That's why he drowned me," I thought. "That's why I need this power." But some small part of myself knew, "This isn't real." I tried to remind myself. "I need control. I saw this cave the same day you decided to attack me. You won't get my power. Let me go or I'll go straight to your family, and it won't be just your brother I kill." I thought to myself. Now I was breathing deeply and rapidly. "At least bring me iron boots so that I can walk the land myself," a voice rang in my head. I thought I would do so and tried to stand up and walk back to Indirra. It took some time "walking" and slowly coming back to myself. When I finally did, it was almost evening. On the way back to camp, I recounted the whole experience and the sodden's request to Indirra. She agreed we needed to fulfill it but warned me about returning to Greatrock. I spent the rest of the day hunting, though I still felt somewhat slowed by the lingering effects of the wetwart.

38th day of Spring, year 132

I awoke feeling a bit less tired. I headed out to collect resources and found we were missing only the iron boots. I had the idea to steal the boots from the Cove, as it would be very risky to show up in the market and buy them. While stealing them carried its own dangers, at least it would also cause a small amount of damage to the Cove, and perhaps I could find other useful items. I suggested going alone and asked where their headquarters were located. Arasen confirmed what I partly already knew - their main building with a tall watchtower atop was on the east side of town, where they kept all their supplies, though it was guarded. "Could I hire mercenaries to help us?" I asked the others, explaining I had at least 900 arrowheads to spend on destroying the Cove. They were surprised by this revelation, and we began discussing our options. All thought finding enough trustworthy mercenaries would be risky, as a single betrayal could lead us into a trap. Hiring a mercenary group would be ideal, but the Cove had ensured none were available locally. I then suggested we set a trap along the road, using sharpened stakes concealed in a thicket, to ambush the next large Cove party we saw entering or leaving the city. We worked on this through the night.

39th day of Spring, year 132

After a restful sleep, we spent another day further preparing our trap. Kendi, who was still somewhat tired, mostly kept watch over the road.


In the next and last part of the first act of A Dissonant Chord, a climactic confrontation awaits as plans come to fruition. Danger and revelation loom as our heroes spring their trap and even enter enemy territory. But will all go as expected, and what new factors may yet emerge from shadows unseen?

To be continued...

Wednesday, January 3, 2024

Cryptsetup basic cheatsheet

To format a partition (e.g. sda1) as LUKS with an HMAC integrity layer:

cryptsetup luksFormat --type=luks2 --integrity hmac-sha256 /dev/sda1

Or without an integrity layer: (you probably want this for most usecases)

cryptsetup luksFormat --type=luks2 /dev/sda1

To open the encrypted partition:

cryptsetup open /dev/sda1 sda1_crypt

Alternative was to open it while permanently marking the LUKS device to accept discard (TRIM) operations:

cryptsetup open /dev/sda1 sda1_crypt --allow-discards --persistent 

This will create a decrypted device for the same partition which you can format like so: (-i 4M for storing files around 4MiB each, -m 0 to avoid reserving space for the root user, change the Label to whatever you like)

mkfs.ext4 -i 4M -m 0 -L Label /dev/mapper/sda1_crypt

Then close it:

cryptsetup close /dev/mapper/sda1_crypt

Disconnect the device and reconnect it (or mount it however you normally do) to see if everything works.

Popular Posts