ellipsix informatics

Adventures in China: The Christmas

Guess where this is?

pile of presents in restaurant lobby

This is the restaurant where I went to dinner last night. A fancy, yet very definitely Chinese restaurant. In China.

News flash: Americans aren't the only ones obsessed with Christmas.

Okay, to be fair, nobody turns Christmas into an obsession quite like the United States. I think the frantic rush to start making preparations in September is a uniquely American tradition. But the celebration is catching on among the Chinese, especially young people, in a big way. From what I hear, a lot of Chinese are taking Christmas as an occasion to spend more time with their families. And businesses are capitalizing on the spirit by putting up holiday-themed decorations — lights, presents, and even decorated trees are everywhere.

ornamented stairs at Best Western

tree at Best Western

As I write this, I've been sitting in the Beijing airport for five hours listening to a loop of "Santa Baby," "There's No Place Like Home For The Holidays," "Silver Bells," "Jingle Bells," and a rather Hawaiian-sounding rendition of "Let It Snow" (notable for the contrast with the complete lack of snow outside).

I guess the lesson is, if you're tired of the Christmas frenzy, you might be able to hide, but you can't run. It's everywhere.


Adventures in China: the toys of the trade

My boss got me a new toy today.

it's a Mac!

This is one of the perks of working for a well-funded research group, I guess. And a new research group. It's not often that you get your foot in the door right when they're buying equipment.

It's also a perk of being a phenomenologist (which is like being a theorist but sometimes we measure things we can't calculate). Unlike experimental physicists, who have to spend their budgets on all sorts of exotic lab equipment (which I'm given to understand means obscene amounts of duct tape and aluminum foil), all you need for phenomenology is a computer, pencil and paper, and a place to sit. So there's really no reason not to blow as much money as possible on nice equipment. And this is nice equipment. It's literally the best Apple computer you can buy over here, featuring a 27 inch display (oooooh) and OS X Yosemite, the newest update to the operating system.

Not that I don't have reason to complain. The system stalled twice before I even managed to finish the setup procedure.

Eternal Flame

I guess I have to start making offerings to the Apple Gods now? Or the spirit of Steve Jobs?


How one line in one file made me reinstall Gentoo

Hey, internet. Long time no see.

(It's often claimed "long time no see" is a literal translation from Chinese "好久不见", "hǎo jiǔ bú jiàn", but actually nobody knows for sure.)

On Thursday, my computer crashed. Not just that it crashed, but it somehow corrupted itself so that I couldn't even boot it. It survived for two seconds after being turned on, before bailing out with this error:

Linux crashes after two seconds

init[1]: segfault at 0 ip 00007ff10ea3fe05 sp 0007ffff7cb49148 error 4 in libc-2.19.so[7ff10e919000+19e000]
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

This is so early in the startup process that nothing is running. It's pretty much just the kernel and init (which, if you don't know, is the very first program to run when a Linux system starts, the one that runs all other programs).

So of course I recompiled (it's Gentoo) and reinstalled both the kernel and init, as well as libc, several times, as well as several other programs that I'm pretty sure didn't even get a chance to start, so how could they have anything to do with this crash? Still, better safe than sorry I guess.

None of it made any difference. After replacing every program that could possibly be running at the time of the error, init still crashed. This is probably the most frustrating error I've seen in 15 years as a Linux user.

So I spent my weekend reinstalling everything on my computer.

Verifying downloads before GPG

One of the easy ways a nefarious group could hack into my computer is by intercepting the source code I download when I'm installing a program and modifying it to do, well, whatever they want. China's government tries to maintain pretty strict control over the internet in their country, so I wouldn't put it past them to do this. (To be fair, I wouldn't put it past the US government either.) One way I could get around that is to download everything from a trusted server in the US or some other country, but the internet access here is kind of slow, especially going in or out of the country. It'd be a lot quicker to download all my source code within China, and I need all the time I can get.

The alternative is to use cryptography. Gentoo already does this, to some extent: whenever I install a program, the installer first checks the SHA256 hash of the source code against an internal database to make sure the source code hasn't been tampered with. But that internal database is also something I need to download, and how do I know that hasn't been tampered with?

Of course, the Gentoo Release Engineering Team (the people who maintain this internal database) have thought about this, and they cryptographically sign the database files. I'll skip the details, but through the "magic" of public-key cryptography, I can check that the SHA256 hashes I download are the same ones they upload by checking one single 40-letter key fingerprint, just once.

Here's the catch: to verify the hashes, I need to have GPG installed, and to install GPG, I need to verify the hashes of its source code and all the other code it depends on. My bright idea to get around this was to define this little function, a fake version of GPG:

echo "gpg invoked: gpg $*"
echo "please do this manually and press ok if successful"
read -n 2
if [[ "$REPLY"=="ok" ]]; then
    return 0
    return 1

That goes into /usr/local/bin/gpg in the system I'm trying to install. This way, when I run emerge-webrsync to download the hashes, and it gets to the point where it's going to check the file's signature, it will pause so I can manually check the signature.

I spent way too much time coming up with that.

About that crash

I did eventually figure out the problem. It turned out to be a line in /etc/ld.so.preload, which is a file specifying libraries of code that the system should preload for every new program it starts up. Essentially you're patching extra computer code into the program when it runs. Extra code that it probably wasn't written to deal with. That makes an environment ripe for conflicts between the preloaded code and the original code. (The fact that this feature exists is shocking, most of the time, but it does have a few legitimate uses.)

I had tried to install the Astrill VPN client, which as part of its installation adds this line to /etc/ld.so.preload:


I'm guessing liblsp.so is Astrill's way of intercepting everything that a program tries to send or receive over the internet. It might work for most programs (might; I'm not going to keep it around to find out), but clearly, it has a major conflict with init (which doesn't even need to access the internet anyway).

It wasn't easy to find the culprit, actually; I had to boot my computer using the System Rescue CD (on a USB drive, despite the name) and find all files that were modified at the exact time I installed Astrill:

find /mnt/gentoo -mmin 537 -mmax 539

This finds all files which were last modified 538±1 minutes ago. There were about 50 of them, and it wasn't hard to pick out the one that could affect how the very first program on the computer starts up.

Still, I can't believe I reinstalled my entire operating system because of one line in one file... life of a Gentoo user, I guess. :-P


Adventures in China: the bank account

Part of moving to a new country is setting up all the "personal infrastructure" you need in order to live. And when you're starting a new job at the same time, getting paid is pretty close to the top of that list. Which explains how, a couple days ago, I found myself walking into the Bank of China on the CCNU campus to set up a bank account.

No, wait, let me back up.


I found myself walking into the Bank of China on the CCNU campus to set up a bank account. Since it is the Bank of China, after all, everything is written in Chinese. Everyone there speaks Chinese. I would have been totally lost without my host (actually my boss, but he's been so much help getting me settled that I think of him as my host) having come along to translate.

Apparently the idea of being busy with a customer doesn't really exist in China. A bank employee at one of the reception desks, where a Chinese woman was filling out a form, immediately beckoned us over. She and my host talked for a while, and she led us over to the counter where stacks of all the bank's key forms were. Then my host started filling out the form (again: everything written in Chinese), when another guy working at the bank came over to talk to us. Again, he and talked, I stood there and tried not to look bored, they talked... you get the gist.

I'll skip to the point. It turns out that there are about three things for which you need a social security card. Not the number, the actual card. Getting a driver's license, setting up payroll at a new job, and opening a bank account in a foreign country. Due to international banking regulations the US government throwing its weight around, any US citizen opening a foreign bank acount needs to provide a copy of their social security card. Which I didn't have, because, again, there are about three things you ever need a social security card for. Needless to say, I did not expect any of them to be in China.

(TV-style) PRESENT DAY (actually Friday, but who's counting)

It took a couple days, but I was able to get a scan of my social security card emailed from home. So my boss and I headed back to the bank to take another run at opening the account. Again, an employee at the reception desk directed us to the forms and my boss filled out the account opening form, or the little bit of it we needed, anyway. Name, birthday, passport number, phone number, and a couple other things; that still leaves 90% of the form blank.

Then we wait.

Here's one handy fact I learned about Chinese banks: they operate really slowly. There were maybe two or three people ahead of us in the queue, and it still took around 40 minutes until we got our turn at the service counters. Now, my part was easy: I just had to hand over my documents, sign a couple papers, and pose for a picture or two (to make sure I was physically present in the bank). I feel kind of bad for the poor bank employee who had to enter all this information into the computer, and who apparently had never created a bank account for a foreign citizen before. The first time through, (my host told me) she accidentally entered my passport number into the SSN field. Who had the bright idea of making passport numbers and social security numbers both nine digits? And that's not easy to fix either. We had to wait while she called up a central office or something to void the first account request (I was excited to understand when she read some of the digits of my SSN in Chinese), then go through basically the whole process again, from scratch.

So I guess whoever has the social security number that's the same as my passport number probably will not get a fun surprise when they check their credit report....

To top it all off, we spent so long sitting at the counter waiting for the account to be created that the bank actually closed — literally shut and locked the security gates — with us inside. Then we had to step out of the building for about two minutes while they transferred money to an armored truck. Another handy fact: they take armored truck security really seriously here. Two policemen in full body armor with assault rifles stood guard next to the truck while a third carried briefcases of cash out from the bank. And this in a country where gun ownership is forbidden to private citizens, and even the police don't normally carry them.

Eventually I did wind up getting my bank account. Hooray, I'm not on any money laundering watchlists! (Fun story: my roommate shares a name with someone on a watchlist, which caused him no end of trouble when he tried to go through this same process a month ago.) However, I have to do all this again at another bank this week, because thanks to some shady corporate deals with CCNU, part of my salary has to be paid through Bank of China while another part has to be paid through Industrial and Commercial Bank of China (ICBC). I hope it gets easier with practice!


Lessons from my first half-week

Things that don't exist in China:

  • Ubiquitous wireless internet. Not so surprising, really, because Americans do have a rather unhealthy obsession with their wireless, but one would think I'd get wifi in the hotel room. Surprise, nope! Naturally this makes it rather less convenient to put up blog posts.
  • Washcloths. Seriously, China, what's up with that?
  • Dryers. Or, they do exist, but for some reason dryers are considered a luxury item and are pretty rare. The Chinese prefer to stick to the traditional method of line-drying. (Hey, it's environmentally conscious)
  • Smog. The weather has been pretty fantastic since I got here. From what I hear, outside of Beijing and maybe Shanghai, that's actually pretty typical.

    View from on the CCNU campus

  • English speakers. Which, again, is not that surprising; China has its own language, so why would they speak English? Nevertheless, you'll hear in a lot of places that lots of people in China speak English, even to the point that foreigners don't actually need to learn Chinese! Nope, not in Wuhan.

Things that do exist in China:

  • Toilets, by which I mean something that Americans would recognize as a toilet. In hotels and international dorms, at least. Public restrooms still tend to have the Asian-style squat toilets.
  • Toilet paper. The piece of advice I got probably more than any other was to bring my own toilet paper. Well, not to worry; they have toilet paper here. (Which is good because I actually forgot to bring any.)
  • Really good noodles. I include this not because it's characteristic of China in general, there's just this one restaurant off campus that makes really good noodles.
  • Cooked whole animals. Nothing enhances the experience of eating fish like staring down its lifeless eyes as you munch on its flesh...

    A mostly-eaten fish

  • Good coffee. Or at least decent coffee. The particle physics group has their own $1500 coffee machine in the lounge. Let's see how long I can hold out before becoming addicted.


New Adventures in China

The blog has been pretty quiet the last few months, because I've been getting ready to move to Wuhan, China, where I'll be starting work as a postdoc at Central China Normal University.

It turns out that moving to another country - in fact another continent - takes a lot of preparation. Shocker, huh. Airlines put pretty restrictive limits on both the amount and type of things you can take, so I had to pack light. I'll basically be living out of a couple of suitcases for the next six weeks. But at the same time, shipping things to China is unreliable, expensive, and impossible until I find out where I'll be living, so I had to make sure to take everything I needed. It took some planning to figure out how to fit the essentials into those two suitcases. My old habit of making a checklist of what to pack really came in handy!

Then there's the whole issue of getting permission to enter the country in the first place. Officially, to work in China, I need a work visa. For that I need a work permit from the university. For them to give me the work permit, they need to see a copy of my PhD diploma. (No, that doesn't make sense to me either. Copies are not hard to fake.) To get the diploma I had to submit my dissertation and all the accompanying paperwork. One of those papers was a signature form that had to be signed by all members of my dissertation committee. To get them to sign the paper, I had to revise my dissertation according to their directions, which I only got after my defense at the beginning of August.


Wait, there's more! Since I defended my thesis in August, I don't officially get to graduate until December. But Penn State doesn't actually mail out diplomas for people who aren't there until a month later (mid-January). So, based on that schedule, once I get to send a copy to the people at CCNU, they probably wouldn't finish the paperwork until after the Chinese New Year in February, which is a pretty major holiday from what I hear. So I might not be officially employed until nearly a full year after getting the offer!

Anyway, for now I'm going as a visitor, on a temporary business visa. This plan works around the visa rules, and reportedly they can still pay me, which is the important thing.

Coincidentally, this trip comes just as National Novel Writing Month starts, or in my case, National Blog Writing Month. I'm going to try again to go for my goal of 30 non-trivial blog posts in 30 days. And I'm probably going to fall short again, but at least I do have a bunch of good science ideas saved up, and there will be a lot of updates about life in China. Maybe this will be the year, who knows?

Just to be safe, I'm counting this as one.


Hooray, I have a postdoc!

I figured a quick update is in order to announce that starting this fall, I'll be a postdoc at Central China Normal University!

If you've been following this blog for a while, you may remember that visited CCNU back in 2012 for a conference and a week of research collaboration. It's definitely different — you know, because China is not the US — but there's a lot to like about the place. CCNU is rapidly developing a strong international reputation for their theoretical physics research. They're well placed to take advantage of the Chinese drive to promote basic science; in particular, unlike the US and even Europe, to some extent, basic research in China still gets substantial amounts of financial support. The living costs are low, so even a small salary goes a long way, and I'll definitely be looking forward to all the delicious food of Hubei province.

There's a lot to do between now and the fall, when I move, so I'm sure I'll have more to say about this as it happens. It'll be nice to be a scientist for a little while longer.


Check-in from China

WELCOME READERS OF THE FUTURE!! (with ominous echo) In all seriousness, I wrote most of this from the Beijing airport yesterday, but without internet access I couldn't post it until I got to the conference.

View from Beijing airport First impression of China: it doesn't seem that different from the US. Classical music plays over the speakers in the airport. Signs are pretty much bilingual everywhere, or even English-only (although to be fair, a lot of those are actually made-up Western name brands that don't mean anything anyway). And seeing a bunch of Chinese people walking around speaking Chinese doesn't feel even a little bit strange. This is a testament to just how many Chinese students have swarmed into American higher education. It's only when I look around for the corresponding groups of white people and Indians — and don't find them — that it really starts to become evident that I'm in a foreign country.

Oh, and another thing: unlike what you might hear (in the US) about China being a "police state," the police and security officers in the airport really don't seem to be taking their jobs more seriously than they have to. It's a stark contrast to all those sullen TSA officers and constant reminders of "If you see something, say something" and "Our safety is your priority" that I got before leaving the US. Who's Big Brother now, huh?

Anyway, I'm already looking at some interesting new results from the LHC's pPb pilot run, so stay tuned for another blog post on that soon.

Also, KFC needs to start making shrimp burgers in America, because they are super-delicious.