Yubikey & PAM

之前没看懂 PAM 怎么用,今天重新看了一下pam(8),打算搞好之前想弄的 yubikey 解锁桌面。


看了一篇讲 PAM 的博客:噢,我明白了(没有懂),甚至应该修改 /etc/pam.d下的哪一个文件都不清楚。


先在 Arch Linux 上安装yubico-pam包。

然后修改/etc/pam.d/system-auth,将下面一行添加到 auth required pam_unix.so ... 那一行的前面。如果添加到后面的话,还会先调用 pam_unix.so 来索取密码,而且失败了就失败了,并不能 fallback 到 Yubikey 登陆,然而将 sufficientpam_yubico 放在最前,当 yubikey 验证成功了就一定成功。

如果写的是 required 而不是 sufficient ,结果就是不仅要 yubikey 验证成功,而且还要接着再输一遍密码,相当于倒过来的二步验证。

auth sufficient pam_yubico.so id=<yubikey API id> authfile=/etc/yubikeys

这样就大功告成了!现在 sudo,解锁屏,登陆都可以用 Yubikey 一摁完成了!

当然,如果 KDE 的用户

  • 只想用它解锁屏,就把这一行放到 /etc/pam.d/kde 里的对应位置,注意当前用户需要有 authfile 的读权限,否则无法使用
  • 只想用它登陆,就把这一行放到 /etc/pam.d/sddm 里的对应位置

如果只想用 yubikey 登陆 console (估计没有这样的人),就把这一行放到 /etc/pam.d/login 里就行了,ssh类似,大概。

而如果想离线也能验证,或者嫌在线验证时间过长的话,就换用 challenge-response 模式就可以了。具体见 Yubico 官网的相关页面,就懒得再翻译一遍了。设置好之后甚至连一摁都不需要了。

Arch Wiki 关于 Yubikey 的条目可以说比较混乱,而 Fedora Wiki 的页面则较为简洁直白,可以作为参考。

顺便一提,也是 Fedora Wiki 告诉我有 modhex 这种东西。 Yubikey 作为键盘输入,它只会向机器发送键盘扫描码,机器再将其转换为按键。因此 Yubikey 不能控制键盘的 layout ,也就导致如果随意输入,在不同的键盘 layout 上可能会输出不同的字符。比如QWERTY的Y,在德语键盘上就成了Z(它交换了Y和Z),而在日语键盘上差不多就是假名 N (说差不多的意思是在假名输入下才是 N)。因此 Yubikey 选择了那些在任何键盘 layout 下都不会变的16个字符,用以表示16进制数,这就是 modhex 。



今天读了一篇关于硬件中断,以及如何用 PIC 处理的博文,因为没怎么看懂,就不翻译了。


Arcaea 潜力值终于上 9 了,或者说,才上 9 。啊……


Comment and share

The title comes from Sunless Sea, an adventure game where the player explore the dark sea of unknown. However, it has nothing to do with that game.

The translation of Japaneses words are done with best effort, in another word, there is no any kind of guarantee that the translation is official or consistent with the official one.

This article contains spoilers, which may harm or even completely ruin your experiences, here’s a non-exhaustive list:
Hikari no Umi no Apeiria(Apeiria of the Sea of Landscape)
Eiyuu Densetsu Sen no Kiseki(Legend of Heroes: Trails of Cold Steel)
Planetarian ~ Chiisana Hoshi no Yume
Newton to Ringo no Ki(Newton and the Apple Tree)
Eden *(spoiler: it is not spoiled)

Progress with heed.


This post does not contain what you’d expect from a typical game review – the overall plot, the execution, the voice casts and so on, because it is kinda lame to write something that is already on the Internet, especially for a year-old game like Apeiria(although I myself is the reason why this post is delayed for half a year).

So instead, the post focuses on elements and ideas, either central or peripheral to the game, and expands these concepts further. This strategy makes the post a little out of focus, and here’s another reason for it: the game is in a sense mediocre, because it does not exceeds one’s expectation.

I don’t mean the game is bad. On the contrary, Apeiria is a good combination of popular concepts and has a capturing story. After all, if the game is really not good enough, I wouldn’t even bother to post an article about it, let alone go through iterations in this six months. The point is, however great the game is, Apeiria is just a galgame, nothing more, nothing less.

It is hard to define what makes an art piece unique, but for a game, drawing moustache on character’s face and claiming the originality would be unique for the blatant copyright infringement. For a game, it could have great arts and music, humanly characters, a catching plot, or a thought-provoking theme. Kikiyama’s free game Yume Nikki(Dream Diary), for example, features exploring exotic scenes with an unrealistic art style, whereas The Last of Us, an action game by Naughty Dogs, portrays humanity in a postapocalyptic world. And that’s one of the reasons why they receive acclaims from the fans.

That being said, people’s mileages can greatly vary, and there’s no universal standard for good or bad games. So this post is not about judging whether a game is good or not, but just a peek into the core of the game.

No Sense Online

Note: it comes from Only Sense Online, an online lightnovel by Aroha Zachou(literally Chairman Aloha) later published in print. AFAIK this lightnovel does not feature OreTueee.

The story of Apeiria happens in 2035, and people profit from the highly developed VR technology and AI research. Reiichi Kirishima, works together with his friends to build the VRMMORPG Second. The second is a fantasy world of sword and magic. One may suspect fantasy makes up most of the game, just as Reki Kawahara’s lightnovel Sword Art Online, and most online novels do. However, the story puts emphasis on both the real world and the virtual one. But the best part is, the two seemingly contradicting themes are tactfully merged in the end of the game.

Back to the fantasy world. Usually to make a party, we need members of these sorts:

  1. Short- and/or mid-range attackers. They are usually deployed to defend the party members behind. Examples are thieves, swordsmans, lancers, and fighters. There should better be a tank to take the damage.
  2. Long-range attackers or scouts. They can discover enemies early, leaving enough time for preparation. Their attacks won’t be countered by short-range enemies. Archers, for example, belong to this category.
  3. Mages. If physical attack and magical attack are largely different in ways of effects and costs, then mages are needed to ensure a more comprehensive scope of attack.
  4. Healers or supporters. Their importance is never overemphasized.

Take Falcom’s Legend of Heroes: Trails of the Cold Steel I as a motivating example, we have:

  1. Short-/mid-range: Rean(tachi), Laura(double-handed sword), Fie(dagger/gun), Jusis(knight sword), Gaius(spear)
  2. Long-range: Alisa(bow), Machias(shotgun), Eliot(staff), Emma(staff)
  3. Mages: Emma, Eliot
  4. Healer: Eliot, Emma

In this game everyone is able to use arts(what magic is called in this game), therefore the main difference between mages and others is that mages have higher magic attack/defence stats. So Eliot and Emma are not required as mages(though they are required as healers).

Trails of the Cold Steel allows only four characters in the battle, with two substitute members, there are at most 6 members in the party most of the time. Let’s see how Falcom arranges the party in each chapter to make sure it is balanced:

  1. Rean(S), Alisa(L), Eliot(H), Laura(S)
  2. Rean(S), Emma(H), Fie(S), Machias(L), Jusis(S)
  3. Rean(S), Gaius(S), Jusis(S), Alisa(L), Emma(H)
  4. Rean(S), Laura(S), Fie(S), Machias(L), Eliot(H)
  5. Rean(S), Laura(S), Jusis(S), Emma(H), Millium(S)
  6. Rean(S), Alisa(L), Eliot(S), Machias(L), Fie(S), Crow(S)

Though there’s another system restricting the selection of members: there are four types of normal attack damage: slash, pierce, thrust, strike. Normal attacks from different characters have varied affinities to these types. For instance, Rean’s tachi attack has a high slash affinity, while Laura’s affinity to both slash and strike is high. And different enemies can be easily unbalanced by different types of attack damages. So the damage throughput could be increased by using the right person to attack the enemies, leading to more unbalancing and link attacks. Though the system is marginal since the bosses can hardly be unbalanced(they don’t have this kind of weak point), the affinities of the characters are carefully arranged to make sure all four types are covered in the above party setups.

However, in Apeiria, we see an unprecedented bias of party member roles. The constitution of the party is like this:

  1. Reiichi: short/mid-range attacker, main damage output, can revive himself and buff teammates
  2. Miu: sniper and healer. So roughly speaking, she’s Ana from Overwatch, while being a tsundere younger sister.
  3. Kuon: swordswoman, tank(she have a spell to call out an inpenetrable shield)
  4. Mashiro: thief, able to exchange money for rare items
  5. Apeiria: mage, persumably a DPS(second to Reiichi), unavailable most of the times.

As we can see Reiichi is ridiculously overpowered – he himself is a whole team. I guess it is probably due to the story. If my memory serves me right, the party is like the following in different times:

  1. Reiichi, Miu, Kuon, Mashiro, Apeiria
  2. Reiichi, Miu
  3. Reiichi, Kuon
  4. Reiichi, Mashiro
  5. Reiichi, Miu, Kuon, Mashiro

Nanami and whatever are taking up much less a role, so they aren’t counted. Discussion about them can be left to the post about the game’s spinoff Casablanca no Kishi(Knights of Casablanca), if there is one.

Given this plot requirement, the usual party makeup does not make any sense, because Reiichi will have no chance of survival, turning the Second into souls-like games, and Apeiria into Re:zero. Powering up the heroines could be a good idea, but that will render the last fight, a one-on-one fight with the last boss unimpressive.

This kind of unbalanced protagonist is mushrooming in lightnovels these years. With the uprise of coarse grained net novels, the use of such template is hitting new high. Let’s yell out some of the catch phrases:

Shuujinkou saikyou(protagonist the mightiest)!

Ore tueeee(I’m so stroooong)!

Such settings bring about some benefits. One of them is that the story can always be kept under control. There’s no need for ex machina, because the overpowered protagonist themself is the ex machina. Another is that a group of readers are usually happy about it. Admittedly I was one of them.

Apeiria of Love and Desire

Note: it comes from Aiyoku no Eustia. Ai means tarnish rather than love, while yoku means wings instead of desire.

In August’s visual novel Aiyoku no Eustia, we have multiple routes, from Ellis the pharmacist to Eustia, the main heroine in the story. Unlike other galgames, in Eustia, the common route does not branch to personal routes at the same time. It first has a branch off to Ellis’ route, then Fione’s, on and on, and in the end Eustia’s. Such a structure allows huge savings, since one thing in one route needn’t be reintroduced in another. Moreover, it makes all routes sequentially related, so the player can regard the story as a well-structured whole, rather than 5 separate ones.

Another visual novel created by Laplacian, Newton and the Apple Tree, has the same flow of story. However, the game forces the player to go into Ravi’s route once before progressing to the Japanese, the maid, and Alice.

However, it is not as simple as spreading out to personal routes sequentially. There should be key events to set the backgrounds of the personal routes apart. In Nitroplus’ adventure (text) game Steins;Gate, the D-mail is the key. If Rintarou sends the D-mail to Firis, the whole landscape of Akihabara will not be the heaven of otakus, but still a street of electronics. Therefore, the common route before and after this branch into Ferris’ route differs significantly.

Apeiria is also a galgame that has such a structure. However, it integrates all routes into one. As a side-effect, choices are eliminated, and we have a truly linear storyline. But here comes the problem: how can we avoid conflicts of different routes? Even we can manipulate the protagonist’s feelings for the heroines, we cannot simply take things in the previous route as unhappened.

To resolve the conflict, Silky’s Plus Dolce resorts to the good old time leap: if we can revert to the time before the personal route begins, then everything works perfectly. Therefore, in the end of routes the protag leaps to one year before the current time, losing almost all his memories, including the ones with the heroine.

However, there is no elixir, and the seemingly powerful time traveling has its side-effects, that is the time paradox. In Steins;Gate, to avoid the time paradox being happening, Rintarou has to stab Kurisu while avoiding bumping into his past self, when he goes back in time to save Kurisu. Sorry, but my poor wording makes it sounds a little silly.

Apeiria goes further than that: rather than not touching the paradox, it provides a new theory to get over it. The theory states it is not the case what one does now has no impact on the past. When we travel to the past, the future is not undone: it affects now so that everythin will converge to what has happened in the future.

Like this one, there are many theories presented in Apeiria about time, causality and so on. Just like the Koujin Nanase part of manga Kyokou Suiri(In/Spectre), although every theory, in itself, is unsound, it has its reasonable parts. And in the showdown, all rational parts are combined to make the final, sound theory.

Mechanic Princess in the Dying World

Note: it comes from the light novel Kakeyuku Toshi no Kikai Tsukihime, wherein a robot girl meets her end.

Everyone knows an awful lot about the greatness of AI, but much less about its correct use. Fortunately, we have Silky’s Plus Dolce to point out the right way: to make one’s own girlfriends.

It is a reiterated theme - there are already works about having android girls or something like that as protagonists or heroines. In manga Mahoromatic, the main heroine Mahoro is a female android, previously soldier, who comes to Misato’s house after knowing she has only a year left. Visual Arts Key’s visual novel Planetarian: The Reverie of a Little Planet features Yumemi Hoshino, a female robot narrator in a discarded planetarium. In the anime series Plastic Memories, we have android Isla(Aira) working with Tsukasa, the protagonist, to retrieve androids that are near the end of their life.

It seems not really good – they nurtured a stereotype about androids and robots – they are powerful but vunerable, they have short lifespan, they have difficulties understand human emotions, so on and so forth.

And the real bad thing is that Apeiria, one of the main heroine, and the center of the whole story, does not at all fall out of these stereotypes.

  • Power: she hacks tens of billions of computers around the world to make her Apeiria Network.
  • Vulnerability: she has not once successfully repelled Thinker’s virus attack. And when the Apeiria Network is hacked, she cannot disconnect herself from the network to avoid being disabled.
  • Short lifespan: near her own route, she has only one year to live(it’s Mahoro!)


Note: it comes from the movie Inception, maybe.

Tired and bored after a day’s work, we may want to escape the real world, and embrace a virtual one. So one may imagine a switch mechanism for it: switch on, and we’re in the realm of imagination, and off, back to the real world.

But such a kind of mechanism overlooks the interplay of this two worlds. Usually one playing a game is aware of its virtual nature, and is not separated from the outside. Take Ready Player One for example, control of the character in game is also affected by the lost of balance in the real world. So the virtual world can be greatly influenced by the real world, but it is often not the same the way around.

With this asymmetry taken into consideration, a layered structure seems better to express this kind of relationship. Here we adopt the idea of a stack. The virtual domain is on the top, while the reality is in the bottom. The virtual world dominates our feelings when present, but we fall back to earth upon exiting the imaginary.

So the reality-virtuality dichotomy can be expressed by a stack of size 2, let’s call it world stack from now. The real world is the first element of the world stack, and also the only element if we’re in reality. But if we dive into the virtual world, like OASIS, then we push the game onto the stack, and there’s two elements: the virtual world on top of the real world.

And it is easy to extend the world stack to allow more than 2 elements.

In a chapter of Douglas Hofstadter’s book Gödel, Escher, Bach: an Eternal Golden Braid, Achilles and the tortoise travels in and out Escher’s works by drinking blue and red phials. The travelling is done in a similar manner: going deeper into prints is like the push an item onto the stack, while going out out of the piece of artwork is like popping elements of the stack. And the world we are directly feeling is the top element of the stack.

Though it bears resemblance to the stack data structure, the world stack has a definitive difference: we do not know how many elements are in the stack at any time. So here’s the problem: how can we know if the top element of the world stack is the real world? In other words, how can we tell if the world we’re right in real or not?

We can check this by popping out elements, if there’s nothing to pop, then the world stack is empty, and the last world we popped is the real one. But note that popping out real world usually means one’s death. One never knows if the red pill is authentic before he washes it down. So we do not know if the current world we’re living is real, the only thing we know is since the real world is at the bottom, if we find out the current world is virtual, we can always pop out of it without getting ourselves killed.

But the safety to pop out does not mean it is doable. For example, it is claimed that people in heaven never dies. So people are not able to access the world beyond heaven, just like the girls cannot come out of the screen.

To solve this problem, Apeiria introduces a world structure similar to the stack model, but is different in its essence. In the game, the top and the bottom of the stack are connected, therefore the way in becomes the way out.


Apeiria is a interesting combination of popular topics – AI, virtual reality – on the good old basis of Sci-Fi and fantasy. Unlike in Sword Art Online, where one is constant aware the world’s nature, Apeiria weaves a story across the borderline of reality and fantasy, which makes it capturing and different.

Comment and share

Last Day

in writing

It was unreal, but it felt real.

We are facing a giant dragon – given that all dragons are large – to fight our ways up the tower.

The tower of Yggdrasil is still looking down upon the world from the center today. Modeled after the boundary tower in Amakusa, Tokyo, which is the birthplace of a phenomenal VRMMO game, Yggdrasil is a lofty tower, too.

Like a needle piercing into the space.

A crystal one, though, to fit in the overall fantasy art style of the Second. And like the boundary tower, Yggdrasil boasts a whole lot of floors – 1000 of them, to be exact – crammed with all kinds of monsters and challenges.

And we are the first one to set our feet on the tenth floor. It is almost cliche to put some strong monster in the floors of ten’s multiples, and the AI is clearly sticking to this common practice when creating the Second.

One dragon was already beat when we first enter this tower, that is, the mother dragon. It was quite a tough one: it even nearly managed to suffocate us by burning out all the oxygen with its breath. But now, after countless battles, our team is invincible, and the dragon doesn’t stand a chance.

Whoosh! its sweeps the ground with its left claw, but in vain. It took too much damage to maintain its swift actions. Time to deliver the last strike. I called out to my little sister.

“Miu! Covering fire!” “Gotcha!”

The dragon roared in pain as the bullet penetrates the dragon’s eyes. The monster raises its head, it want to cast a breath.

“Kuon!” “Needless to say!”

Kuon cast the spell, which forms a shield protected all of us from the devastating breath. I looked to Apeiria, and she knows what I’m gonna do in an glimpse.

“You are powered up, owner, get in there!”

I run forward towards to dragon, to deliver the final blow.

“Mashiro, come back!” “Roger!” The little silouette who’s attacking with combos jumps back, agile like a humming bird.

A few steps forth, I get face to face with the hideous monster. Time for my ultimate sword.


Eight beams spreads out in an instant, all of them punching the dragon, lighting the last moment of this floor master.

With a death agony, the large figure collapsed to the ground and dispersed.

After I confirmed the death of the dragon, other party members come to me.

“Miu, good shot.”

“Of course. Who you think I am?”

And I turned to my childhood friend.

“Kuon, your spells are of great help, too.” “Reiichi, it is okay to depend more on your older sister, you get it?”

“Well done, Mashiro.” “Eeh?! Th-th-thank you!” The introverted junior is still shy about compliments today.

“Apeiria.” I hugged the girl with silver hair. “You are the best.”

“Owner, plus, hug, equals, happiness.” The girl in my embrace replied with her monotonic voice, but with a tinge of delight.

“Hentai…” Complaints comes from the little sister with a cold-eyed gaze.




It feels real, but it is unreal.

My eyes are open now. It’s not inside the magnificent crystal tower. Not but my monochromatic bedroom.

The window is wide open. A gust of December’s chilly wind breaks in, across my face and between my fingers.

“It’s … cold.” The wind must receive a summons for trespassing.

Today Apeiria will set off to Second, which has been already a hell. No one could return from that world of death. But there are no other options: she should have gone there a year ago, and this probation is as much as I could get.

The digital clock says it’s 7. I step into my slippers and out of my bedroom.

There is already one up.

“Good morning, owner.” The silver-haired girl notices me.

“Morning, Apeiria.” I try to make myself sound more energetic.

The dried-up response echoes in the empty house. There is nobody besides the two of us.

Miu isn’t here. She isn’t in this world any more.

She was disposed by her mother. Miu was created as a clone of that woman, who has been haunted by the shadows of her aborted child.

I walk to the kitchen, Apeiria is preparing the breakfast.

“A few minutes and it will be done, owner.”

The breakfast time in Kirishima’s is filled with silence. The clashing sounds of utensils reverbrate in the room.

After I’m done with the meal, I speak to Apeiria.

“It’s the last day, isn’t it?”

“Affirmative, owner.”

“Then let’s hang out.”

We first arrives at the AI circle in the school. Full name “Lovable AI Circle”, the circle has had two members – I, the founder, and Mashiro, who I forcibly dragged in. After I created Apeiria here, the five of us have had a lot memories here – making the VR MMORPG Second, and playing it together as a team. But Mashiro is not here.

She is dead from radiation in Boundary’s beta test, when the machine suddenly malfunctioned.

A double-slit box sits on the table. When I turn it on, it’s still showing interference pattern.

The DNA computer is turned off now. Apeiria is accidentally created from it when a lightning cut off its power about a year ago. And I managed to get her a body by hacking the genetic research facility.

There is nothing to do here. After the door is shutted with a huge noise, and silence dominates the school again.

Next stop is the boundary tower. Usually it was once full of people, especially when Boundary was in tests. After that accident, people are showing concerns about safety issues of the VR games, and the development of Boundary is put to a halt.

“Owner, will we be seeing Kuon?”

“Forget about it.”

Kuon’s father is the creator of the Boundary, so the family lives on the top floor of the boundary tower. One year ago, She had a quarrel with her mother, who fell unconscious soon afterwards and died days later. And Kuon never had a chance to apologize. Since then, I haven’t got in contact with her as much.

After having lunch in Asakusa, we decide to return.

Bang, and the door closed. It’s the familiar living room today.

The digit clock in the phone says it’s already 2pm. So the separation is only a few hours away.

In this year, we’ve been to everywhere we are able to go, done everything we are able to do. I promised to teach her what is love, but things are not going as expected.

Sometimes I doubt if I’ve made the right choice: is it fine to hold her back here, who is not supposed to be born and hated by the world, for a year? Is it right to spend so much time together, only to make the parting more heartbreaking?

And who is Thinker after all? Is he the observer who’s been peeking into this world? Why does the observer want to do with Apeiria?

I take out my phone from the pocket. In it there are the mails sent by my future self.

“There are two Thinkers.”

“The observer is human.”

And things like that. I pondered about these things again and again, but to no avail. This time I try again to find out what it means.

The observer … is human …


The viruses, the time loop, the disappearing interference pattern.

The observer is human.

The appearing viruses in the house just confirm my thought.

It feels real, but it is unreal.

“Apeiria! Run!” I grab her hand and run for the door.

“Affirmative. What’s the heading, owner, by the way, why are viruses here?” She replies with a mite of bewilderment.

The answer to the first is clear. The way out is the way in.

Since we cannot rely on Apeiria network and the nanobots now, there is only one way into the Second.

“The boundary tower!”

Comment and share

Memories, Off

in writing

The title of this post refers to the galgame series produced by the once existing KID, though there is no obvious relevance between the game and this article(though the protagonist in Yubikiri no Kioku does have a memory loss and mistakes himself for someone else). By the way, an eighth installment of it is near its publication by MAGES, the franchise’s now owner, along with GloriaWorks. It was once decided to be a homage to one of the songs of Jin’s Kagerou Project, but you are not seeing it here because I forgot that and went for this one.

This article contains spoilers, which may harm or even completely ruin your playing or reading experience of the works, including but not limited to:

Game Shichinen go de Matteiru (waiting for you seven years later), fumi_md
Lightnovel Tosho Meikyuu (the labyrinth of book), Juuji Shizuka, Shirabi
Lightnovel Boku no Shiranai Rabukome (the love comedies I don’t know), Kashimoto Tsubame, Pyon-Kti
Lightnovel Owari no Album (album of the end), Sugii Hikari

Note the pen names are kept as is: their surnames – if those could be called surnames – sits before their names.
Make sure before reading on.

Continue reading

Let's start from DDLC

in writing

This article contains spoilers, which may harm or even completely ruin your playing experience of the games, including but not limited to:
Doki Doki Literature Club!

Proceed at your own risk.

Continue reading
Author's picture


A progamer.