Pages

Sunday, April 16, 2017

Running a service in own network namespace in Ubuntu

Running a service inside network namespace in pre Ubuntu 16.04 versions was as easy as running a command such as:  
ip netns exec [NAMESPACE_NAME] service [SERVICE_NAME] start

However things got slightly more complicated in Ubuntu 16.04 and newer versions.

In this example we will run transmission-daemon service inside a namespace. You have to remember that the namespace MUST exist and be configured before starting the transmission-daemon. Otherwise the command will fail. For this purpose we have to modify the /lib/systemd/system/transmission-daemon.service file as follows:

[Unit]
Description=Transmission BitTorrent Daemon
After=network.target

[Service]
User=root
Type=simple
ExecStart=/bin/sh -c 'exec /sbin/ip netns exec YOURNAMESPACE /usr/bin/sudo -u debian-transmission /usr/bin/transmission-daemon -f --log-error --config-dir /var/lib/transmission-daemon/info'
ExecReload=/bin/kill -s HUP $MAINPID

[Install]
WantedBy=multi-user.target

Here we need to start service as root because we will need to access the namespace to be able to start the transmission-daemon. It is important to change the Type as simple otherwise you may have problems returning back to command line after giving the service start command. The rest is simply a matter of changing ExecREload to run transmission-daemon manually inside the network namespace while changing user to debian-transmission user

Remember to change YOURNAMESPACE with the namespace you want to use. Now you can start transmission daemon easily by running service transmission-daemon start

Friday, April 14, 2017

How to access files with colon (:) in filename using Samba

I had a long standing problem. Samba would convert filenames with colon (:) to unrecognizable names. For example name Filename Date:Time.mkv could be converted into C7MXR~1.mkv

Some people seem to have success by using:
        mangled names = no
However this setting allowed me to see the files but I got access errors when trying to access them from computers which use Windows. This seems to be a bug in Samba causing the problem when accessing files with colon (:) in their names.

I solved the issue partially by converting the colon (:) into tilde (~). You can convert it to anything you want. This way, there is also no reason to disable `mangled names` option in `smb.conf` because Samba does not try to mangle names if there are no restricted characters.
        vfs objects = catia
        catia:mappings = 0x3a:0x7e
After this setting, the file Filename Date:Time.mkv appears as Filename Date~Time.mkv and it is possible to access the file from Windows based workstations without any problems.

For this to work, you need the catia module installed. For example in Ubuntu this requires samba-vfs-modules package to be installed on your system.

Thursday, April 13, 2017

Why You Must Avoid AliExpress When Buying Batteries

I have recently had many bad experiences with AliExpress. It feels like AliExpress' dispute process was favoring the customer so much more when they were much smaller. Since they have recently reached 100 million customers, they are now making up fake excuses to fool customers to keep their money.

I had this problem twice with one of my battery purchases recently. I let the first one slide, but I was ready to provide all information on the second time and still failed.

1st Problem Battery:

When I received the battery for a Google Nexus 4. I realized immediately that something was wrong because it did not hold any more charge than my old battery.

The battery sticker said minimum 2100mAh. I tried to rip it off and see what it says on the battery itself. I got shocked to see that the seller used a smaller cell and padded the space with "paper" to make it look bigger. Litereally I paid money for paper! You can see it in the photo below. There were no markings or any text on the cell itself.

I have immediately opened a dispute for this battery. However the response from AliExpress was that there was not enough evidence to show the actual capacity of the battery and I should provide evidence with a battery tester. (then they had an irrelevant link to a USB port power tester). I didn't have a tester that time and I was about to accept defeat.

As you probably know, usually li-ion batteries have the similar power density. So you can not have same capacity battery with smaller volume. That was why I thought my case was a slam dunk. But I also accepted that AliExpress had a point, they need to see proof which is understandable.

Next day I managed to borrow a battery tester from my friend and tried to test the battery. My first problem was the protection circuit embedded in the battery. Because it cut off power when the charger was discharging the battery. Apparently charger was set to discharge until 2.6v and protection circuit cut off the power if voltage went under 2.8v. So I had to connect the charger directly to battery terminals.

Below is the result of the test. The so called 2100mAh battery tested 1245mAh only.


However there was a problem. I was 1 day late and AliExpress closed my dispute. I tried to get it opened again by sending an appeal request. I told in my appeal request that I now have the battery tester and I tested the battery and it is lower capacity than advertised. I needed AliExpress to open the dispute so I can add the evidence since I can not do it when the dispute is closed. However AliExpress sent a blunt response saying:
I am sincerely sorry for your unsuccessful purchase experience. Regarding this dispute, we found there's no detailed evidence for the problem you mentioned when our Case Management Specialist  handled this case. Besides, there is no video from you can prove the quality problems as well. As you know, it is hard for dispute team to help our buyers if the evidence is not supported. That's why we  reminded you to provide the detailed video to verify your claim in the mail.
This made no sense to me but I could not respond to it so I had to leave it as a defeat and lost money. At that point I did not think that AliExpress was trying to "unfairly" protect sellers selling bad batteries. Then I remembered what a friend of mine said "none of those batteries are correct capacity", it made me think for a second, perhaps AliExpress is trying to make sure that products are sold and they get their commission. AliExpress may have given explicit orders to their dispute teams to crash all buyers with nonsense responses.

2nd Problem Battery: 

I was sure that I will need more batteries in future. So I wanted to be ready and I bought a battery charger / capacity tester from a brand called LiitoKala (funny enough, this means FlyingFish in Finnish). It was an average quality charger but did its job.

I received another battery from AliExpress and it had no paper padding but it still performed badly. I have immediately connected it to my brand new charger/tester. 

As you can see from the image above, it had only 2/3 capacity of what a new battery should at least have (in worst case). Usually a genuine battery  would easily top 2100mAh, making the situation more dire.

So I opened a dispute. But I could not believe what I received as response from AliExpress. It was unbelievable.

According to AliExpress it is normal that you get 40% less from what is advertised capacity value and it is the "industry standard" (maybe in China?!)

I think the reason is because the quality is so bad that they would have to return money for all the battery products sold at AliExpress. This is why I do not recommend purchasing batteries from AliExpress.

I had to provide a test result from a normal battery to prove that AliExpress must be making a joke. I used a trusty Sanyo Eneloop battery for the test and what do you know, the tester shows higher capacity than the text on the battery. As a matter of fact, I have tested 100s of batteries in the past and they always perform to their capacity. There is no magical "industry standard" which says the capacity is overrated. (unless the industry is AliExpress Magical Chinese Battery Industry)

I have eventually managed to get refund for the 2nd battery, but I am very disappointed in how they are handling these disputes. Dispute process is not very trustworthy when AliExpress is trying to take your money away. It required way too much effort. I will simply stay away from batteries at AliExpress from now on.

Under normal circumstances, if seller did NOT respond to dispute, I got refund automatically. As seen below:

 

However the seller of this battery actually does NOT exist anymroe on AliExpress and therefore can NOT respond. What do you think AliExpress does? They automatically step in and "invalidate" your dispute. You can see below taht the dispute date and AliExpress step in date are exactly the same day.

What AliExpress did was to immediately try to grab the money by setting dispute reasons invalid. Of course it does not help much to receive a response like "there is light in the end of the tunnel" meaning I am dead from AliExpress helpdesk chat.