all posts linux tech

[Solved] sshd Does Not Run At System Startup (Ubuntu)


  • sshd does not appear to start on system boot, but runs fine when started from a terminal with /etc/init.d/ssh start

Update Dec 2010: Thanks to Jeremie here. Change the following in /etc/init.d./ssh to stop sshd starting before the network is ready:


# Required-Start:       $remote_fs $syslog 


# Required-Start:       $remote_fs $syslog $network

Merci Jeremie!

Cause and Solution:

  • A ListenServer directive in /etc/ssh/sshd_config is making sshd attempt to listen on a not-yet extant address. Change the directive to ListenServer

(NB: if you don’t have an /etc/init.d/ssh, you can get one from here)

I had a problem with a machine I am using as a samba fileserver. It would seem that the sshd process was not running at startup, so I would have to log into Gnome and run /etc/init.d/ssh start manually, which was a pain in the arse.

A quick search turned nothing up, except “make sure openssh-server is installed”, which in my case it was. I was about to post to the Ubuntu forums, but first I had a quick look at the syslog (which sshd prints to), where I saw entries like the following:

Jun 27 13:18:56 hermes init: ssh main process (802) terminated with status 255
Jun 27 13:18:56 hermes init: ssh main process ended, respawning
Jun 27 13:18:56 hermes init: ssh main process (806) terminated with status 255
Jun 27 13:18:56 hermes init: ssh main process ended, respawning
Jun 27 13:18:56 hermes init: ssh main process (810) terminated with status 255
Jun 27 13:18:56 hermes init: ssh main process ended, respawning
Jun 27 13:18:56 hermes init: ssh main process (814) terminated with status 255
Jun 27 13:18:56 hermes init: ssh main process ended, respawning
Jun 27 13:18:56 hermes init: ssh main process (818) terminated with status 255
Jun 27 13:18:56 hermes init: ssh main process ended, respawning
Jun 27 13:18:56 hermes init: ssh main process (822) terminated with status 255
Jun 27 13:18:56 hermes init: ssh main process ended, respawning
Jun 27 13:18:56 hermes init: ssh main process (826) terminated with status 255
Jun 27 13:18:56 hermes init: ssh respawning too fast, stopped

My thinking is that sshd was trying to start up before the network interfaces were configured, which was causing it to fail as it had a ListenAddress directive in /etc/ssh/sshd_config.

Commenting out the specific ListenAddress directive and adding ListenAddress to let sshd listen on any address solved the problem. The fileserver has only 1 IP address anyway.

all posts pc games reviews

My Short APB Review

(Note: I also posted this over on Slashdot on the story about the fact that APB is to use in-game advertisements)

Having played the beta, my short review of APB is: “drive here, shoot stuff, repeat”. Oops! Seems like I broke the embargo on reviews which was initially set at 10 freakin’ days after release! To their credit (I guess), they rolled that back to merely release day.

A more nuanced look at the game shows they have in fact done some things quite nicely. The “All Points Bulletin” mechanic works very nicely. You’ll be doing a mission when up pops up a notification that a comparable group from the opposing faction has been sent to stop you. It changes the dynamic of the mission and gives you a jolt of adrenaline as you listen out for the roar of the car engine signifying your would-be assassins drawing close. However, these adversarial matchups aren’t without their problems. Say 50% of the time they work and you get a comparable strength team sent against you, resulting in a pitched battle that culminates in either narrow victory or defeat. Perfect! Well, the other 50% of the time you get a team that is woefully underpowered, say one wee neophyte against our group of four. Or massively overpowered, so you “call for backup”, which works maybe 10% of the time. Perhaps the opposition are a full map away and have no way of intercepting you in time. Or they are already at the objective and virtually impossible to budge. The latter gets irritating as there are a few excellent camping spots should you get a VIP ‘escort’ mission. Oh, and I lied about the proportions. Things go right about 25% of the time rather than 50%.

Despite these problems, the gameplay is fun if you have a good group that you are in touch with through some kind of voice comms. The problem is that there is very little variety. Perhaps I’ve been spoiled by Saints Row 2 in this regard, but there seem to be about 3 basic types of mission which leads to the game getting boring quickly – pitched battles or not.

There is also a HUGE amount of customisation, if you’re into that sort of thing. I won’t say more about this as I’m not buying a game to play dress up…

…Which brings me to my next point: pricing. Pinning down the pricing details wasn’t easy, although I did eventually find it on Kotaku or similar. I’ll quote from RPS again:

You can purchase a retail version of APB either in-store or via digital download at standard retail price (SRP $49.99/£34.99/€49.99). The game includes 50 hours of action game play out of the box plus unlimited time in APB’s social districts customising, socialising and trading on the marketplace.

Once your game time is up, you have flexibility to top up your action game time from as little as $6.99 (£5.59, €6.29) for an additional 20 hours, while more frequent players can switch to a 30-day unlimited package for only $9.99 (£7.99, €8.99) with discounts available for 90 and 180 days.

The retail package also contains a bonus 100 RTW points towards your next purchases.

An additional benefit to this evolutionary model is the ability for you to convert your own customisations and rewards to tradable products to give to friends or clan-mates or to place on the Marketplace to earn more RTW points (convertible to game time) or in-game cash. Check back later for more details

The problem is, you are paying full retail price plus a decent fraction of 10 of your local denomination (£/$/€) monthly, for what? Progression seems limited – you can gain prestige with local NPC types to do more missions, but your character doesn’t seem to get much stronger as with more traditional MMOs. It’s not even like EVE where you can claim a small section of the virtual world for your particular gang. Frankly, I’m not sure it is worth paying for a glorified matchmaking service, but that is a judgment call each individual gamer needs to make.

Lastly, technical issues. I left them till last as I don’t like bringing them up for a pre-release version of code, but they need to be mentioned. I experienced frequent crashes, something which seemed to affect a small percentage of users, mostly running 64-bit Windows 7. A redownload of the full 7 GB and reinstall *seemed* to fix it, although I did not have enough time to check this fully. I did experience some graphical slowdowns as well, even on minimal settings running on a PC well above recommended spec. Perhaps this was because optimisations had not yet been applied, again due to it being pre-release.

Lag was also an issue, which I mention in a separate paragraph as APB is a shooter after all. However, there were only 2 european servers up during the beta (EU1 and EU2, natch) and so this may not be a problem if they deploy servers widely. Except if you’re in Australia, it would seem. Sorry, mates!

In short, the game is quite fun in the short term, but I question its longevity and value. I won’t be getting it, but you might.

all posts cool linux software wisdom

Extract A Single Image From A Video Using FFMPEG

Update: Still using this 8 years later, but in the form of a quick script, which is useful if you are doing it more than once

Dead handy, this:

ffmpeg -ss 0.5 -i inputfile.mp4 -t 1 -s 480x300 -f image2 imagefile.jpg

The various options:

  • -vframes 1: limit to 1 frame extracted
  • -ss 0.5: point of movie to extract from (ie seek to 0.5 seconds; you can also use HH:MM:SS.ZZZZ sexagesimal format)
  • -s 480x300: frame size of image to output (image resized to fit dimensions)
  • -f image2: forces format

I use this to generate preview stills for jwplayer to use. Dead handy!

Edit: Thanks to DieBagger who pointed out it is much faster to place the seek argument before the input file, and Matthias his point about the seek time.

all posts tech

Black Screen (KSOD) Vista Solutions

Before I get started, some resources:

I’m looking at a friend’s laptop for him. It boots, gets past the progress bar, but before login or a desktop, the screen goes black with a cursor present which can be moved. There are multitudes of threads and posts about this issue over the internet, ranging as far back as 2006 and as recently as last month (May 1010). Although the symptoms are similar, from what I can see there are several causes each with different fixes.

For example, if the login screen comes up and there is a black screen after, it may be possible to hit Ctrl+Shit+Esc together to bring up Task Manager, from there do File->New Task (Run…), explorer.exe. This will bring up the desktop etcaetera, from where you can run other tools to repair the issue.

Advanced Startup Options Menu

Hit F8 while the computer is booting to bring up this menu. It has a number of potentially useful options, and is probably the easiest and lowest-impact to try first. The following options from that menu have been reported to work for some:

  • Safe Mode (with Networking / Command Prompt)
  • Enable low-resolution video (seems to help with nVidia driver update issues)
  • Last Known Good Configuration
  • Disable Driver Signature Enforcement (helps with some other driver errors in HP laptops, if I remember correctly)

It may also help to choose the Enable Boot Logging option, which should create a file called ntbtlog.txt containing info that might point to the driver or component that is causing issues.

Using the Windows System Recovery tool

The first option on the advanced startup menu listed above is “Repair your computer”. This starts a graphical interface with a number of options which may help.

System Restore

You should try to do a system restore first, if it is enabled. If it isn’t enabled, make sure to enable it when you fix the problem! Click the “System Restore” option on the menu (second item) and choose a restore point from when you believe your computer was previously functional.

Registry Fix

It may be a registry issue. In some cases, it would appear the Shell entry is corrupted. You can sort it by doing the following:

  1. Turn on the computer
  2. As it boots, press F8 to bring up the advanced boot options menu
  3. Select “Repair Your Computer”
  4. From there, login to an admin account (eg Administrator)
  5. Select the bottom option to launch a command prompt
  6. type regedit and hit enter
  7. Navigate through the following keys: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\Current\Winlogon
  8. One you are at Winlogon, there should be an item on the right panel that says “Shell“. Right click this, and select edit.
  9. Change the value to explorer.exe. If this is already present, this is not your issue!

NOTE: If you try this from the “Repair Windows” option on a Windows Vista install DVD or recovery DVD it won’t work, as that seems to edit the registry on the disc (you will see cmd.exe /k start cmd.exe or similar for the Shell key). For me the “load hive” option was greyed out, if isn’t for you, you can open C:\Windows\system32\config and edit the local registry).

Startup Repair

It might be a long shot, but the startup repair option might help. It is the first option on the System Recovery menu.


It is unlikely that your RAM is causing this problem, but it is useful to know that Vista does have a tool to check memory, and it can be accessed through the System Recovery tool. I didn’t know this until today, having previously used memtest+ x86 included on Ubuntu LiveCDs.

Chkdsk / SFC (Updated 2011-07-16)

From the command prompt provided by the System Recovery tool, you can also try running chkdsk /r C: to run a disk check. Running sfc /scannow /offbootdir=c:\ /offwindir=C:\windows should do a verification of ‘critical windows files and components’, but I could not get this to run as it complained about needing to reboot with an active recovery ongoing – I guess it can’t be run via the system recovery tool.

Renaming Event Viewer Log Folder / Prefetch Folder

(See the good post by ubman on technet here)

There are reports that a problem with the event viewer service can cause this black screen on login. To work around this, start up a command prompt through the recovery tool as above. Then execute:

cd \windows\system32\winevt
ren Logs LogsBad
mkdir Logs

Another report claims PreFetch can cause the issue. Now, the folder for PreFetch can be deleted as Windows will recreate its contents as needed. However, should you wish to keep a backup, start p a command prompt as above and run:

cd \windows\
ren Prefetch PrefetchBad
mkdir Prefetch

Other Options

Apologies for the brevity here, these items I quickly jotted down but I am not able to try some of them myself.

Also on technet, zorglub1789 claims broken file permissions were the cause of his woes. Using icacls to fix these apparently worked. He booted to the recovery console and ran:

icacls C:\* /grant builtin\users:(RX) /T

to grant read and execute permissions to all users.

If you can start safe mode, it may be worthwhile temporarily disabling UAC. If the security centre won’t run in safe mode from the control panel, I think it is accessible via the management console. Hold the windows key + R, then type in mmc. I think you may need to add the Group Policy plugin / manager to MMC.

Another file to check on is C:\wialog.txt. This may contain useful information for troubleshooting what is causing the problem.

Again, if safe mode works, msconfig may prove useful. Hold windows key + R, and type msconfig. Then try disabling services, startup options and so forth until you get a working startup. From there you can work back to the cause of the problem. Apparently one to try is “Low Graphics Boot” (or similar), although I don’t know if there is a difference between this and the advanced startup (F8) option.


Basic Command-line Backup

If you have an external hard drive, and want to back up the C:\ drive, the following command will do that from a command prompt (see above for how to get a command prompt).
xcopy /h /i /c /k /e /r /y C: E:\backup

Where E: is the drive letter for your external hard drive.

Reset Administrator or other Windows Passwords

There is a tool at which is very handy for resetting Windows passwords should you not know them. I had to do it in this case as there was no documentation on the default password for this laptop (an Acer), and I can vouch for its utility. Note that you don’t need to know the password for this tool to work.