# Ever had FreeBSD brick a device?



## ProphetOfDoom (Jan 4, 2019)

I plugged my e-cigarette into a Thinkpad running FreeBSD. When I unplugged it the screen no longer worked, it wouldn’t create any vapour and also it was ticking (yes, ticking like a bomb).
I tried cleaning it thoroughly, changing the batteries and reflashing the firmware, but the thing is now basically a brick.
I wouldn’t normally blame an OS for such a thing but FreeBSD has been acting oddly on two of my computers for a while now - random reboots and stuff. And I remember Ubuntu once had a bug that bricked some machines’ BIOS.
I’m annoyed as the e-cigarette cost £70. I know they’re generally not hugely reliable but I really do wonder if FreeBSD played a part in this.


----------



## Spartrekus (Jan 4, 2019)

I won't easily believe that FreeBSD would brick.


----------



## olli@ (Jan 4, 2019)

Why would you plug an e-cigarette into a FreeBSD PC? I mean, does it attach as a HID device or similar? Is it even recognized by FreeBSD? 

Anyway, I think it is very unlikely that FreeBSD is the culprit.


----------



## ProphetOfDoom (Jan 4, 2019)

Why is it on Unix/Linux forums people always answer a question with another question? 
The e-cigarette is intended to charge via USB, I didn’t just plug it in for a laugh to see what would happen.
Spartrekus if you’ve nothing constructive to say, go away. LOL.


----------



## aragats (Jan 4, 2019)

I would rather suspect an ESD...


----------



## k.jacker (Jan 4, 2019)

AlexanderProphet said:


> Why is it on Unix/Linux forums people always answer a question with another question?


Why do you at first complain and then say the following...


AlexanderProphet said:


> Spartrekus if you’ve nothing constructive to say, go away. LOL.


No offense, but you shouldn't talk to others like that on any forum. It's against the forum rules and you risk to get banned.

Anyway, if you get really annoyed by someone, just put this member on your ignore list and every content from this user will be hidden while you are logged in. That would be right approach.


----------



## Spartrekus (Jan 4, 2019)

Thank you. I left it, as others:

I won't easily believe that FreeBSD would brick.

@Sorry for the post.


----------



## ProphetOfDoom (Jan 4, 2019)

I’m sorry for being rude - I just felt the response rather hostile although on a forum it’s hard to tell if it really is or not.


----------



## ProphetOfDoom (Jan 4, 2019)

Thanks aragats that would explain it. Guess im off out shopping tomorrow.


----------



## Spartrekus (Jan 4, 2019)

AlexanderProphet said:


> Thanks aragats that would explain it. Guess im off out shopping tomorrow.


thank you again.

Concerning brick, more information or details would be helpful, for better interpretation. 
If FreeBSD would have some influence on the "brick", a software fix would be needed.


----------



## jstn (Jan 4, 2019)

I can't bring myself to believe the OS had anything at all to do with this - all you did was plug in a device that generally speaking wouldn't even be recognized as anything by any OS, especially not *BSD.

What ecigarette was it? The vast majority of them are Chinesium junk notorious for crapping out early in their lifespans for no real good reason at all.  Also just as a bit of advice even though this is probably way off-topic for the board:

1. If it has removable batteries, remove them and charge them in an external charger. You can get cheap dual bay chargers for 18650s and any other high drain cell out there. Ecigarettes often have usb ports for charging and firmware updating, but keep in mind that these are super high volume devices made in China by the lowest bidder imaginable. It's pretty common wisdom in the vape community that you should really avoid USB charging entirely unless you have a higher end device that's been tested to charge safely and evenly. USB charging on cheap devices is notorious for damaging batteries, frying chips, etc.

2. Don't go to a brick and mortar store to buy that stuff - the markups are absurd and all of that stuff can be had online for waaay cheaper. $70 online will buy you a really, really nice vape that will last you for years. $70 in most physical vape shops will buy some $20 Smok piece of junk at a 350% markup and you'll be lucky if it survives past three months.


----------



## ProphetOfDoom (Jan 4, 2019)

Hmm. I’m not sure I can give much more useful information. I can program, but certainly not at kernel level. I was more curious to know what was going on, rather than demanding a fix. Electrostatic Discharge sounds much more plausible than a bug, now it’s been pointed out to me.


----------



## chrbr (Jan 4, 2019)

I also guess that the issue is hardware related. I assume that the e-cigarette does not register at the USB hub to drain more than the current the USB spec allows for "normal" devices. This would cost a dedicated chip. I would try if the HDD of the Thinkpad works elsewhere or if the Thinkpad can boot from a different medium. But it can be that the removal of the e-cigarette caused a glitch on the USB 5V rail, may be to more than 5V because the load has been removed.

About FreeBSD, one of my family members ancient laptop has a very lousy power supply jack. Under FreeBSD it might crash and reboot from time to time. But after reboot it runs again. This recover did not occure under other operating systems. This laptop is almost dead but refuses to die ;-). May be if it dies I will remove the jack and connect directly to its power supply and it wakes up again to live forever.


----------



## Ogis (Jan 4, 2019)

AlexanderProphet said:


> but I really do wonder if FreeBSD played a part in this.


Or is it just a simple coincidence here? Obviously, without knowing more details, it is not possible to deal with it, but in my opinion, it is not FreeBSD's fault here.


----------



## drhowarddrfine (Jan 4, 2019)

AlexanderProphet said:


> I wouldn’t normally blame an OS for such a thing


And you shouldn't. I started life as an electronic engineer and I've designed computers from the TTL chip level, resistors and transistors. *FreeBSD did not smoke your device.*


----------



## Spartrekus (Jan 4, 2019)

eventually pictures of the hardware could help ? pictures are usually good speaking and informative.


----------



## recluce (Jan 4, 2019)

drhowarddrfine said:


> And you shouldn't. I started life as an electronic engineer and I've designed computers from the TTL chip level, resistors and transistors. *FreeBSD did not smoke your device.*



^ This, I doubt that there is enough circuitry in an e-cigarette for it to even register with any OS. Sh***y design of the e-cigarette appears most likely, didn't devices like this literally blow up in their users faces?

If FreeBSD was to blame: cudos to Beastie, destroying e-cigarrettes is a great service to public health  ;-)


----------



## tingo (Jan 5, 2019)

Ah, this thread made me remember that once in the old days, when IBM still made laptops named ThinkPad I managed to get one of these laptops into a non-booting state simply by installing FreeBSD on a partition on the harddrive. The laptop would not boot unless I removed the hard drive from it. Turned out that the then current version of the BIOS on that laptop reacted badly to a FreeBSD partition type, which locked up the machine (before any output on the screen). Later after a BIOS upgrade I installed FReeBSD again, and it worked as it should. Fun times.


----------



## Spartrekus (Jan 5, 2019)

tingo said:


> Ah, this thread made me remember that once in the old days, when IBM still made laptops named ThinkPad I managed to get one of these laptops into a non-booting state simply by installing FreeBSD on a partition on the harddrive. The laptop would not boot unless I removed the hard drive from it. Turned out that the then current version of the BIOS on that laptop reacted badly to a FreeBSD partition type, which locked up the machine (before any output on the screen). Later after a BIOS upgrade I installed FReeBSD again, and it worked as it should. Fun times.


 
interesting that it could happen.


----------



## olli@ (Jan 5, 2019)

AlexanderProphet said:


> Why is it on Unix/Linux forums people always answer a question with another question?


Because the information I asked for might be useful to determine the cause of what happened.


> The e-cigarette is intended to charge via USB, I didn’t just plug it in for a laugh to see what would happen.


If the USB connector is _only_ for charging, then FreeBSD is definitely not the culprit. Because, in this case, FreeBSD doesn't even see the device at all, let alone attach a driver to it.


----------



## Beastie (Jan 6, 2019)

Spartrekus said:


> tingo said:
> 
> 
> > Ah, this thread made me remember that once in the old days, when IBM still made laptops named ThinkPad I managed to get one of these laptops into a non-booting state simply by installing FreeBSD on a partition on the harddrive. The laptop would not boot unless I removed the hard drive from it. Turned out that the then current version of the BIOS on that laptop reacted badly to a FreeBSD partition type, which locked up the machine (before any output on the screen). Later after a BIOS upgrade I installed FReeBSD again, and it worked as it should. Fun times.
> ...


Some have "hidden" partitions that store disaster recovery tools, monitoring tools and what not. Removing or modifying such partition may prevent booting, essentially bricking the machine.


----------



## abishai (Jan 6, 2019)

I have a working example - UPS Powercom MACAN-1000 hangs and reboots (in endless cycle) ASAP I plug USB cord (without any drivers) to FreeBSD 11.1 box. So, I am sure that FreeBSD USB stack or HID has difference than Linux or Windows one.


----------



## Crivens (Jan 6, 2019)

abishai maybe put a bug report to the manufacturer? Also there is a usbdump util (not sure about the name) which might tell you what the device tries to do.


----------



## olli@ (Jan 6, 2019)

abishai said:


> I have a working example - UPS Powercom MACAN-1000 hangs and reboots (in endless cycle) ASAP I plug USB cord (without any drivers) to FreeBSD 11.1 box. So, I am sure that FreeBSD USB stack or HID has difference than Linux or Windows one.


But that USB connection is _not_ just for charging. It certainly tries to establish a data connection, even if FreeBSD doesn't have a driver to attach.

By the way, what exactly do you mean with “without any drivers”? I assume your kernel _does_ include the basic drivers for USB controllers and USB hubs, doesn't it? (uhci, ohci, ehci, xhci)


----------



## Crivens (Jan 6, 2019)

Maybe that thing curls up when it sees no ways to inject malware... </tinfoil>
Seriously, connecting such a piece of HW is simply asking for trouble. There were even flattering irons with a wlan inside which tried to do do evil while you were doing your shirts.  (In german: https://www.engadget.com/de/2013/11/03/bugeleisen-mit-spam-und-malware-chips-befallen-offene-wifis/)


----------



## Deleted member 30996 (Jan 6, 2019)

I've got 2 different off-brand e-cig batteries that I've charged on a few different FreeBSD Thinkpads and my Gateway without any problems. The battery on one was shot and you could only get a couple uses out of a charge so I charged it probably 50 times in short succession before getting another. I never get random reboots on any of my machines and have had 12.0 and 11.2 boxen running constantly the past couple weeks. That USB exploit does worry me though.

I did have a dock brick a Thinkpad T61 when I pulled the USB mouse out of the dock while it was compiling ports from the login terminal. It died right before my eyes and went to laptop heaven. It looked like it had come right out of the box, too.


----------



## abishai (Jan 6, 2019)

Crivens said:


> abishai maybe put a bug report to the manufacturer? Also there is a usbdump util (not sure about the name) which might tell you what the device tries to do.


I've got reply that FreeBSD is not supported. =/ This was rather disappointing to hear for a server grade device.
The trick is that device tried to establish normal operation, I even got vendor information and battery status if I was fast enough to read it.



olli@ said:


> By the way, what exactly do you mean with “without any drivers”?


Well, probably I've misused the word. Certainly. something attaches, probably ehci and hid. But I'm in serious doubt that this is enough reason for device reboot


----------



## Crivens (Jan 6, 2019)

abishai that is a typical tier1 support "leave us alone" reply. I'd ask them if their device just curling up it's toes ad going for a trip was due to their dev team not knowing  what the device does or not knowing what the expected thing was.

That they don't support an OS does not mean they are allowed to give shoddy work for all others. Because that is what they do.


----------



## ProphetOfDoom (Jan 7, 2019)

Sorry for being kinda unfriendly olli. Just was dreading the inevitable “Why”, lol.
Well the device’s firmware can be upgraded via USB, so it’s not just for charging. What that means for low level OS behaviour I don’t know. The e-cigarette was an Eleaf Lexicon, that’s all I know about it.
Of course I’m sure whoever made the e-cigarette wouldn’t have even dreamed someone would plug it into a FreeBSD machine. And likewise the FreeBSD developers wouldn’t have dreamed... etc. But I would imagine most OSs are written to just do nothing if an unrecognised device is plugged in.
So anyway, it seems that FreeBSD, like Linux, only bricks things occasionally. That is kinda unnerving about the malicious internet-of-things stuff though. Ive heard of this before. I even saw a video on YouTube with Richard Stallman talking about malicious dildos.


----------



## Phishfry (Jan 7, 2019)

I feel like ESD or straight-up uncompliant USB device drawing too much. I messed alot with USB power draws with the Beaglebone.
I have seen devices pulling 700ma., well over 500ma. max USB amperage allowed.

Have you tried looking at the dead laptops HDD system logs with another PC?
Most likely this is an electrical anomaly not software..

We have a large belt sander at work that keeps shocking the crap out of me.
I have never experienced such a high static electricity charge. The arcing gap getting to the switch is worse than touching it.
A couple days later it warmed up and I get no shock. Weird stuff ESD.
I have built lots of computers and never wear any ESD gear. So I really don't understand it at all. Never lost any gear to ESD.
Shoved an ISA card in a live system and saw white smoke. That was my first computer brick.
It was my first real PC and I learned my lesson. That was an expensive mistake.
I still cringe yanking a USB stick out of the computer after writing an image. It just seems dirty to me. The LED is still on too.
Part of my Windows brainwashing I guess.


----------



## aragats (Jan 7, 2019)

Phishfry said:


> I still cringe yanking a USB stick out of the computer after writing an image. It just seems dirty to me. The LED is still on too.


You already presented a solution in your own thread 2 years ago (-;


----------



## aragats (Jan 7, 2019)

Phishfry said:


> I still cringe yanking a USB stick out of the computer after writing an image. It just seems dirty to me. The LED is still on too.





aragats said:


> You already presented a solution in your own thread 2 years ago (-;


A simple (not perfect) script can "automate" ejecting a USB mass storage device (assuming you want to eject the last inserted):
	
	



```
DEV=`dmesg | sed -n '/ugen/,/umass/ s/\(ugen.*\)/Turning off \1/p' | tail -1 `
`echo $DEV | sed 's/.*ugen\([0-9]\)\.\([0-9]\).*/usbconfig -u \1 -a \2 power_off/'`
dmesg | tail -2
```


----------

