Follow Slashdot stories on Twitter


Forgot your password?
DEAL: For $25 - Add A Second Phone Number To Your Smartphone for life! Use promo code SLASHDOT25. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. Check out the new SourceForge HTML5 internet speed test! ×
User Journal

Journal Journal: Linux QL-500 Label Printer Update

While the Brother P-Touch QL-500 is recognized out of the box by Ubuntu, it doesn't really work. Do the following to fix:

1. Go to the Brother driver site and download both the LPR and CUPSWRAPPER driver.
2. Install both with "sudo apt install ./ql500cupswrapper-1.0.1-0.i386.deb ./ql500lpr-1.0.1-0.i386.deb"

That works.

Ideally, download and use the font "OCR-B", which is freely available from here:

User Journal

Journal Journal: Intel Wifi Crashing 3

Note to future self.

I was fiddling around with my laptop and broke something. My WiFi kept disconnecting every couple of minutes. A quick look in dmesg showed the iwlwifi kernel module was segfaulting every couple of minutes.

This was new. WTF had I changed? Reminder to self -- don't fiddle with things that matter when really tired.

As it turns out, I had enabled up the amd64-microcode in my system, which is under Additional Drivers in Ubuntu. This played absolute havoc with the Intel WiFi and provided no discernible benefits.

Uncheck box, reboot machine, problem resolved.

User Journal

Journal Journal: Passwords 2

When attempting to change your password on the genealogy website, you get this not-so-helpful message:

New Password -- Your new password should be between 5 to 24 characters long and can be any combination of letters, numbers, and some symbols.

Really. Some symbols. Not that they're going to tell you which ones. Oh no, that would be too easy. You have to guess!

The best I can figure out is some dev is just fucking with people for fun. Either that, or they had to spend way too much time writing escape code for special characters and this is payback.

For the record, so far I've determined that a period, hyphen, and underscore are all acceptable and a space is not. . - _


User Journal

Journal Journal: systemd 13 - on the impossibility of automated monitoring 2

One of the design goals of systemd is to check if services are running, and restart them automatically if they aren't. One of the criticisms is that this should be done in the daemon, not in systemd (for various reasons, one of which is addressed here).

In some cases it's easy to detect if a daemon has failed: when the daemon no longer has any processes running, you know it has failed. That's a fairly trivial case of course, and you'd hope the daemon is well written so it doesn't crash.

But that's not really what you want, what you want is to make sure the service is still up and responding correctly. There is no automated way to do that. In other words, you need to have deeper knowledge of the daemon in order to make sure it is still running.

One idea: you could have the service send a message to systemd every few seconds, letting systemd know it is alive. This is a heartbeat, but it is again relying on the writer of the daemon to make sure he does it correctly. If you've seen a lot of code, then you know that someone will set the heartbeat message to send in a separate thread, and you'll end up with a situation where the entire program has deadlocked, and nothing is running except the heartbeat thread.

These are the limitations systemd lives with: the limitations any monitoring system would live with; that automatic monitoring of processes is not really possible. If processes are crashing often, the answer isn't to improve monitoring, it's to fix the process.

I've written other entries (some positive some negative) about systemd here. The big problem I see with systemd is outlined here.

User Journal

Journal Journal: systemd 12 - how large is pid 1? 15

Systemd pid 1 takes up 1.5 megabytes on my Fedora system hard drive. For comparison, sysvinit compiles down to 40k. For security purposes, smaller is better, but getting the interfaces right is far more important.

So what is systemd doing with that 1.5 megabytes of compiled code? To answer that question, we find a good place to start, src/core/main.c, which is 2085 lines long. That is not necessarily too long, but if you are a fan of short functions, you will be horrified to learn that the main function is 825 lines long.

Typically a long function starts out well organized, but as people add to it over time, it becomes more and more chaotic, and that is starting to happen here. It is not always clear the order of why things happen, for example. If I were going to refactor this, it would look something like this:

main() {

So what is it doing with all those 825 lines of code? I went through and made a rough outline, which I wrote in code form. It could be further simplified, of course, but this will give you a basic understanding of what is in the main function, and it's better than 825 lines of chaotic code:

int main(void) {

I tried pasting the original function here so you could compare, but Slashdot apparently doesn't allow posts that long and chopped it off. If you want to see it, you'll have to put some extra effort in and click on this link.

When code gets too long, you need to break it into smaller pieces, so the human brain can see how the code is organized. When you refactor like this, it's important to make sure that the refactored code shows the overall structure, rather than obscuring it.

As always, please comment or correct me below, I am interested in hearing what you think!
(I've written other reviews, too, check them out).

User Journal

Journal Journal: Systemd 11 - Open Source Makes Things Better 9

In some ways, I think of Lennart Poettering as a product manager. He figures out what people want, then builds it. The architecture is not always the best, but 'customers' don't tend to care. The point here is that some people do want some of the features of systemd, and Lennart figured that out.

Lennart's system is sometimes laughably bad (for example, he'd prefer to get rid of BSD because he doesn't know how to write portable software), but he has done the community a service by bringing up the topic of system init. More and more, we are seeing thought provoking commentary, ideas on what a good init should be like. This wouldn't have happened if Lennart hadn't built systemd.

This is how the community should be. One person sees the problem, and tries to solve it. Other people come and say, "I can think of a way to improve that." Eventually we arrive at a solution that is elegant, and effective. Init systems have been controversial for decades, which is why BSD and SysVinit are different. Every major Unix vendor has tried to come up with a solution to that problem, and in each case come up with something rather mediocre. Until recently, the Linux and BSD communities have kept what they had, preferring not to change until something comes that is clearly better. When the better answer comes along, it will be obvious.

Systemd won't be here for the long term, but it's effects will be felt through spurring the community to solve this problem that has plagued the community for decades, again, analyzing the problem with things like this (I'd also like to think my own analysis is worth something).

I think a good start would be to add functions to POSIX like "daemonize()" and "start_dameonize()" "complete_daemonize()" but maybe I'm wrong.

User Journal

Journal Journal: Thoughts on 007 - Spectre 2

No spoilers, just some quick comments.

It isn't bad, but it isn't great, either. Good enough is where I'd put it. Of the Daniel Craig Bond moves, I'd rank this one as #4 (of 4).

A couple of things that stick out at me were the early car chase scene. WTF people? Who wrote this? It wasn't so much a car chase as "lets watch expensive cars tool around Rome". No shooting, nothing exciting. Just what looked like an orange Lamborghini chasing whatever custom car Bond was driving. (Okay, it was a custom Jaguar C-X75 chasing a custom Aston-Martin DB10.)

See, Bond was driving a bullet-proof, armored car. WTF was he fleeing from? The bad guy couldn't get to him. He could've come to a complete stop, let the guy roll up, wave, and ask him to do his window and it wouldn't have mattered.

The second scene that bothered me was the train fight scene. Holy fuck! Are there no other people on the train? The bash their way through like 4 or 5 cars on a 7 car train and there aren't people scrambling to get out of the way. No staff, no passengers, nothing. It was like a ghost train. Then they get off at the next stop looking freshly showered and pressed, not like both protagonists just got their asses kicked and should be covered in bruises and welts and walking with severe limps.

The final scene that irked me was where Bond was chasing the cars in Austria with the plane. The plane loses its wings and a strut, then slides down the mountain only to bash through a barn and smash into one of the bad guys cars. And NO ONE IS OUTSIDE TO SEE IT! It is like they found the only Austrian ski resort village that IS TOTALLY DEVOID OF PEOPLE.

I guess they smashed up so many cars they had to save money somewhere, and skimped on the extras (except for the opening scene in Mexico City).

A little long, and a little disjoint. It really helped that I was at an Alamo Draft House and ordered a couple of beers while watching it.

All in all it really reminded me of a Roger Moore Bond as opposed to a Daniel Craig Bond. Not Moonraker bad, but still...

User Journal

Journal Journal: Ubuntu 15.10 Miscellaneous

A couple of other notes on Ubuntu 15.10 on my hacked-up HP ProBoox 6475b.

1. The fingerprint sensor is a Validity VFS491, 138a:003d. Validity Sensors was bought by Synaptec back in 2013, but regardless those sensors have never been well supported under Linux. I did get this one working by digging out the old driver patch that HP supplied for SuSE Linux 11 back in 2012. I applied that to libfprint-0.0.6 and compiled everything from source. Ugly, but it works. I forwarded the patch over to the fingerprint-gui guys to see if they are interested in adding it in. Every little bit helps.

2. Playing with my Yubikey Neo I found that the pam-u2f package in the PPA (v1.0.2) segfaults on the pamu2fcfg command. I filed a bug report, provided debug and core data, and the developers patched the git HEAD source in a few hours. I rebuilt the utility and supporting libraries from scratch to test and all is working! Score one for open source software! Expect it to be released on the PPA next week.

That was really the last little nit. Everything went much smoother than I expected, and I'm quite happy with the setup. Every last feature on the machine works without a hiccup -- except the WiFI scanner, but that isn't part of the machine.

I'm actually fairly impressed with the open source AMD video drivers (Radeon 7660G, which comes with the A-10 processor), but don't play games on the machine other than WarZone 2100 so I don't really stress it.

User Journal

Journal Journal: Ubuntu 15.10 and Epson / Seiko Scanner Driver

I've tried everything, but can't connect to the scanner over WiFi. I can connect over USB, but the scanner is on the other side of the room and that defeats the purpose of the WiFi.

I have installed Epson's iscan, iscan-data and iscan-network-nt packages -- the latter being the one supposed to allow Epkowa devices connect over the network. Yes, I modified the epkowa.conf file in /etc/sane.d/ using both IP address and DNS name, but to no avail.

The printer works, the scanning port (1865) is active, but no joy on using simplescan, xsane, or iscan. Drat!

User Journal

Journal Journal: Ubuntu 15.10 and Epson / Seiko Printer Driver

Ubuntu 15.10 automatically found my Epson XP-610 wireless printer / scanner and tried to install the proper printer driver, but failed miserably.

By "miserably" I mean it got stuck halfway through installing the package file and gummed up their software installation utility. I had to "kill -9" the appropriate, defunct dpkg instance. A reboot will do it as well.

The problem seems to be the proprietary Epson driver relies on LSB (Linux Standard Base), which is no longer installed by default in Ubuntu. The fix is to download the appropriate .deb package from the Epson site. Install the driver with sudo dpkg -i epson-inkjet-printer-201308w_1.0.0-1lsb3.2_amd64.deb, which will install but not configure because of missing LSB as a dependency. Finally, do a sudo apt-get install -f to handle the missing dependencies and you can go into the Printers app and add the printer, as the drivers will now be available.

User Journal

Journal Journal: Brother P-Touch QL-500 on Linux 1

Just a quick entry because I couldn't find a fix for this issue anywhere online.

Under Linux, using Ubuntu 15.04 and 15.10, my USB-connected Brother QL-500 label printer is detected automatically and available out-of-the-box, no driver install necessary. Very nice.

I tried printing under Glabels and all I got was a flashing LED on the printer. The Brother website has a similar error under Windows, claiming this is caused by a mismatch between the label actually loaded in the printer and the setting in the driver. This was not the issue. I have DK-1201 address labels loaded, and the driver is set to 29 x 90 mm, which is also the template I'm using in Glabels.

In the driver (Printers app, Properties, Printer Options), there is a button labeled "Label Preamble". This is on by default and is the culprit. Un-check that box and the printer should now print properly.

User Journal

Journal Journal: systemd 10 - code structure (a random-seed example) 18

As an intermezzo while investigating the stability of APIs (since that's not a fun thing to do), here is an analysis of some code: examining random-seed.c, pulled September 1st, 2015 ( link here, for as long as github is around).

When you come across a piece of code, the first thing you ask is, "what does this do?" In this piece of code, you can see the main() on line 34, so we know it's a stand-alone utility. That is the only function in a 165 line file, so come on Poettering, break your code into easy to read functions. It's not 1985 anymore.

Since it's not clear what the utility does from the comments, a web search might be helpful, which finds the man page, which doesn't tell you much. For example, on line 44 of random-seed.c, we can see that a command-line argument is required. However, the man page doesn't tell you what options are available, it's biggest use is telling you where the seed is stored on the filesystem (if you're wondering where that file location is defined, it's in the The documentation is bad.

The program itself isn't helpful either, it doesn't respond to the --help option. If you give it any option that is not correct, it responds "Unknown verb '%s'." So keep guessing random verbs until you get the correct option.

Moving along to my main complaint, you have to read many lines of this file before you understand what it does. A program like this can be mostly self-documenting, if you structure main correctly. Here is an example of how it could be.

int main(int argc, char **argv) {

    if(shouldLoad) {
    else if(shouldSave) {
      return 0;

This can still be improved. There can be comments explaining why things happen. It is much easier to see what the program does when it's broken up like this. The main algorithm should be clear.

One more serious criticism about this file, hard-coding the output file in is double bad: first because it shouldn't be hardcoded, it should be a command-line option. Second because build files should store as little information as possible.

That's a lot of criticism, but they're relatively minor. With a few fixes, the code is cleaned up. The big problems in systemd, the things that really worry me, were mentioned in journal 9. Those are the things that will cause serious degradation over time, and problems for all of us.

User Journal

Journal Journal: CuBox Wifi Streaming Solved

I believe I have mentioned before that every bit of media I purchase I digitize and store the files on a central server. That includes over 300 movies and over 100 television episodes, plush a few hundred audio tracks. Everything is available anywhere in my home via wireless streaming, however I had been having problems with reliably streaming 1080p HD video over WiFi to my main television units.

My back end device is simply a Buffalo AirStation AC 1750 running DD-WRT build 27456. It is configured for WiFi AC-only in the 5.8 GHz band, and G/N/AC in the 2.4 GHz band to accommodate some older devices.

A Western Digital My Passport Ultra 2 Tb USB 3.0 drive is plugged into the back of the wireless router, which acts as a NAS and makes media available via SAMBA shares.

Over all I like this set-up, though after several months of use I can't really recommend the Buffalo AirStation for the simple reason that it doesn't have any external antennas. It really suffers in coverage area because of this. DD-WRT is great, as is the little 2 Tb WD drive, but I'll never again get a wireless gizmo that doesn't use an external antenna.

The front end to my televisions scattered throughout the house is a CuBox i4-Pro running OpenELEC. This is a fantastic combination that has been almost -- but not quite -- perfect for me. It is also easy to use for my non-technical wife and future geek 7-year old child.

The one issue has been reliably streaming 1080p HD videos to a CuBox. Even with the unit less than 10 meters away from the access point, with no obstructions, it would routinely have such a poor connection as to not be able to keep up with the playback. Watching the dashboard of DD-WRT showed me it had less than 30% signal strength and constantly would drop to 5.5 Mbps connection rates.

To eliminate interference I got up in the middle of the night and shut off everything that used wifi except the CuBox and it still performed poorly.

The short answer is the built-in wireless on the CuBox is abysmal. Again, no external antenna and 2.4 GHz only. Further investigation showed it would not work with channel bonding, thus not use 40 MHz channels in 802.11n. I don't know if it is a chipset limitation or a driver issue. Either way, it sucks.

My answer was to buy a USB wifi adapter with an external antenna. This one is tiny, totally plug-and-play, and absolutely does the trick. And for $12.99, including Prime shipping, a bargain. It is marketed towards the Raspberry Pi, which is what I bought it for. It uses the Realtek RT5370 chipset and is supported at the kernel level (no extra drivers needed) in Android, OpenELEC, Raspbian and lots of other Linux flavors.

It support 802.11n and bonded, 40 MHz channels and, more importantly, handles HD streams without breaking a sweat. I just ordered 2 more to outfit my 2 other CuBox devices so I can stream everything to the TVs in bedrooms without running wires.

(Note: I'm in a fairly low-population subdivision and not a lot of 2.4 GHz wireless around. I'm not stepping on any of my neighbors with my signal.)

User Journal

Journal Journal: 9 - systemD: Interfaces last longer than code 2

This entry discusses the benefits of good interfaces, then gives a (overly simple) metric for how to recognize them. Then it ties it back to systemd.

The 'unix way' is built around solid interfaces. The actual code to Unix is mostly gone (unless you use SCO or something), but the interface lives on with multiple (mostly compatible) implementations. The interface long outlasted the code. (NB: Unix hasn't always had good interfaces in every place, Unix isn't perfect.)

Another example of a good interface is the Berkeley networking API. It's not user-friendly, but as a low-level 'plumbing' API, it is extremely flexible and effective. It spread and now every OS has an implementation. (That is, every OS more complex than some stuff at ). The original code is gone, but the interface will be around for a long, long time.

There are plenty of examples of interfaces in Unix. It doesn't have to be an API.

If you consider a programming language to be an interface between a computer and a human, then think of the C compiler. The original C compiler is no longer in use, but the interface was designed clearly enough that even intentionally bad IOCC code from 30 years ago still compiles.

Cron is another interface, as are the basic CLI commands like ls, mv, ps, grep, etc (which have now taken over almost everywhere....the interfaces, not the original code). The pipe is a powerful interface that seems obvious now, but wasn't at the time......the pipe makes it possible to take the output from any program and send it as input to any other program. That is impressive.

"Robert Metcalf [the inventor of Ethernet] says that if something comes along to replace Ethernet, it will be called Ethernet', so therefore Ethernet will never die. Unix has already undergone several such transformations." -- Ken Thompson

How do you recognize a good API? It's tough, but one thing is sure, a good interface allows easy swapping of components. If it doesn't allow easy swapping of components, it's not a good interface.

"Linux has always been multiple components that you can chose which one suits you best - whether its vi or emacs, gnome or kde, sendmail or postfix, apache or nginx, etc. This is a good thing, where you can swap out component A for B for any reason, and keeps the project competing with each other to get better and better." -- gbjbaanb.

When your component can be easily replaced, because the interfaces are good, it can only compete on its technical merits. That is how you will recognize the best interfaces, because when they are evaluated and put into use by skilled programmers, the best ones will come to the fore.

Time to wrap this back to systemd.

Systemd has gained traction as a init engine because the "unit file" interface provides benefits that a lot of people like. If the "unit file" interface proves durable, then it will last longer than the code. Interfaces can be immortal, code can not.

Throughout systemd there is a lack of understanding of proper interfaces. Making the GUI depend on a particular init system is a particularly obvious example of poor design, but the code was written from a 'code first' perspective rather than an 'interface first' perspective.

Lennart Poettering is a fine programmer. (His code is readable, and let's be honest, anyone who can hack on the Linux kernel has skill. Furthermore he is passionate about it). I don't think he really understands interfaces, though. When he does, his code will move up to next level.

Slashdot Top Deals

Coding is easy; All you do is sit staring at a terminal until the drops of blood form on your forehead.