Got my Cr-48 today. Immediately set about poking some of the things I’d been poking at in the Chromium source repository.
First things first, you need to root the device and make its filesystem readable.
- Flip the dev switch, poweron, hit C-d at the frowny face prompt, and let it reinstall itself. Then reboot and C-d again to get to the OS.
- Open a terminal via C-M-t. Type ‘shell’ at the crosh prompt to login as the ‘chronos’ user.
- Optionally, but good if you’re paranoid, do ‘sudo su’ to become root, followed by
'echo "chronos:$(openssl passwd -1)" > /mnt/stateful_partition/etc/devmode.passwd’ to set a password for that user (makes sudo require a password, everytime) - Do
'sudo /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification'to make the fs writable - Reboot again.
At this point, the machine is modifiable, but there is no editor installed. Not even ed. To get one, you’re going to need another machine.
First, grab a simple editor with no deps other than, perhaps, ncurses. I prefer mg; the guy I cribbed this process from prefers nano. The Arch linux packages are very basic and good choices.
Download one of those to your other machine, then
- Use the xz utility to decompress it (‘
xz -d FILE’) - scp from the Cr-48 to copy the resulting tarball onto the chromebook
- Untar the tarball
- Using sudo, copy the editor binary from the unpacked tarball into /usr/bin
Now you can actualy go about modifying the system. All I’ve done so far is set up a hosts file, an ssh config, and (most interestingly), modified the settings of the terminal.
When you do C-M-t in ChromeOS, an executable named cros-term is run. This isn’t a binary, but is just a one-line shell script that fires off a urxvt with a lot of command-line options. I changed mine to this:
exec urxvt \ -fn 'xft:DejaVu Sans Mono:pixelsize=10:antialias=false' \ -fb 'xft:DejaVu Sans Mono:pixelsize=10:antialias=false' \ -tn xterm-256color -bg black -fg lightgrey -cr green +sb \ -e /bin/bash
The changes from the original are as follows:
- I drop the 4 lines of custom color definitions. Their choices looked washed-out to me; I prefer the defaults for my 16 “system” colors.
- The font size is changed from 12 to 10 point. This lets me have split screen with 88 characters 2-up
- Antialiasing is turned off. At 10 point, antialiasing starts to lose on sub-pixel rendering and you end up with broken-looking text with random pixels 100% red, blue, or green.
- I changed the terminal name from “xterm” to “xterm-256color”. At first I wondered why they were telling urxvt to announce itself as xterm at all, but then I realized that a lot of systems don’t have terminfo entries for urxvt. You probably want to leave yours set to plain old “xterm”.
- I told the foreground to be “lightgray” instead of “grey”, and set the cursor to be green
- Most importantly, no more crosh. Just run bash, thanks!
Now when I invoke a terminal, I drop straight into a regular login session as chronos.
Confusingly, I don’t end up in chronos’s homedir. I end up sitting in /, though typing ‘cd’ will take me to my homedir. Said homedir, by the way, is not /home/chronos, but /home/chronos/user. There is an issue with ssh, which I suspect have something to do with this nonstandard state of affairs.
ssh on ChromeOS keeps the keys of known hosts exactly where you expect (~/.ssh/known_hosts), but it ignores ~/.ssh/config if you create it. According to the ssh_config manpage, ~/.ssh/config should be parsed before the system configuration, and it also says that ~/.ssh/known_hosts is, as we all know, the default host key file. But in ChromeOS’s system ssh config, the location of known_hosts is set explicitly. And due to user config being parsed before system config (in an unusual twist), it’s not possible to edit the system config to point at chronos’s ssh config file.
Why /home/chronos/user/.ssh/config isn’t being resolved by ssh as ~/.ssh/config is a question I can’t yet answer.
I’m very sleepy. More later.