tag:blogger.com,1999:blog-302384612024-02-03T01:40:11.889+01:00Entropy increases... while I write this ... :-)icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.comBlogger97125tag:blogger.com,1999:blog-30238461.post-1200870265891325692021-07-11T11:20:00.000+02:002021-07-11T11:20:12.989+02:00Amazon Box sizes in mm<span style="font-family: inherit;">My own rough measurements:</span><div><span style="font-family: inherit;"><br /></span></div><div>LengthxWidthxHeight (LxBxH):</div><div><span style="font-family: inherit;"><br /></span></div><div>E0<span> mm</span></div><div><span>E1<span> mm</span></span></div><div><span><span>E3<span> mm</span></span></span></div><div>E36<span> mm</span></div><div><span>E4<span> 410x310x110 mm</span></span></div><div><span><span>E6<span> 410x310x210 mm</span></span></span></div><div><span><span><span>E7<span> 455x345x270 mm</span></span></span></span></div>icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-45207235257137269502021-05-28T00:53:00.001+02:002021-05-28T00:59:01.553+02:00<p> Control system volume and play/stop from an external keyboard on a MacBook Pro on macOS Catalina</p><p>Install Karabiner-Elements and map the following keys:</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_Ux1prqUBhODKlAl_-n6D8HxJV5pDDp2PW754SSMEez4V5ZKEJ1Hxo7O-y94pJ5tifXk3tjFj4ZpAne2R_vfS8tfRGJJo5fBfLtkXqkK4Ca_BedXLbY6S95h9Mte2EA6W-Vw8lQ/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="684" data-original-width="1112" height="394" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_Ux1prqUBhODKlAl_-n6D8HxJV5pDDp2PW754SSMEez4V5ZKEJ1Hxo7O-y94pJ5tifXk3tjFj4ZpAne2R_vfS8tfRGJJo5fBfLtkXqkK4Ca_BedXLbY6S95h9Mte2EA6W-Vw8lQ/w640-h394/settings.jpg" width="640" /></a></div><br />No other tools (no MacMediaKeyForwarder etc) required.<p></p><p><br /></p>icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-36622855689247704152020-04-13T23:48:00.001+02:002020-04-13T23:48:22.528+02:00Convert UTF-8 NFD to UTF-8 NFC on Linuxconvmv -f utf-8 -t utf-8 --nfc -r . --notest
<br />
<br />
This will for example convert the german ü from 75 cc 88 to 73 bc (which both describe an ü).<br />
<br />
Doing this on a Samba server will avoid problems when accessing NFD filenames from a Mac.icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-31849106910000474092020-02-08T23:14:00.000+01:002020-02-08T23:14:02.015+01:00Convert Latin1 text to UTF8One can use Python as a universal converter on the command line like this:<br />
<pre>
cat latin1.txt | python3 -c "import sys; t=sys.stdin.buffer.read(); sys.stdout.buffer.write(t.decode('iso-8859-1').encode('utf8'))" > utf8.txt<br />
</pre>
icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-42116617481399773312019-04-22T00:08:00.002+02:002019-04-22T00:08:19.963+02:00Limits of 1&1 virtual server LI recently tried to find out the limits of my 1&1 virtual server L. The official resourse was not very conclusive about the problems I was experiencing (out of memory errors):<br />
<br />
<a href="https://www.ionos.de/hilfe/server-cloud-infrastructure/virtual-server-linux/administration/ressourcen-limits-der-virtual-server-user-beancounters/">https://www.ionos.de/hilfe/server-cloud-infrastructure/virtual-server-linux/administration/ressourcen-limits-der-virtual-server-user-beancounters/</a><br />
<br />
The root cause was out of processes, and later I apparently ran out of iptable entries.<br />
<br />
I finally found that "cat /proc/user_beancounters" shows all the available resources and imposed limits of the Virtuozzo virtualisation. For my quite old Ubuntu 14.04 these limits were significantly lower than what is advertised on the Link above. This may be because the virtual machine was set-up before new limits have taken effect.<br />
<br />
The limits which are most relevant to me are:<br />
- numproc: Max. 100 processes (each thread counts, not just processes in the UNIX sense).<br />
- numiptent: Max. 400 iptables entries. This is usually sufficient for eveb complex firewalls but becomes a problem when using fail2ban.<br />
<br />
In the end it was sufficient to move the ssh port away from port 2222, which was attacked a lot. The attacks on the mail ports come from a smaller set of IPs. I am currently (2019-04) using 88 of 400 iptable entries.<br />
<br />
<br />
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-82014788050373010872019-04-14T22:08:00.000+02:002019-04-14T22:08:00.176+02:00Find brute-forced destination ports<span style="font-family: inherit;">Find all destination ports used by TCP brute-force attacks on a server:</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">zgrep firewall /var/log/syslog*|python -c "import sys;[sys.stdout.write(word + '\n') for line in sys.stdin for word in line.split() if word.startswith('DPT=')]"|sort -n -t= -k 2|uniq -c </span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: inherit;">The above assumes that you log all stray TCP packets to /var/log/syslog with the prefix 'firewall', which can be done with this iptables rule:</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">iptables -A INPUT -m limit --limit 200/hour --limit-burst 50 -j LOG --log-level warning --log-prefix firewall:</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;"><br /></span>
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-29825244608520915882018-11-14T14:52:00.003+01:002018-11-14T14:52:49.923+01:00Cut-copy-paste suddenly stops working with Microsoft Remote DesktopUse this to fix:<br />
<br />
Kill rdpclip.exe using the TaskManager.<br />
Start rdpclip.exe using Run.<br />
<br />
The clipboard should work now again.<br />
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-15439861735139960012018-04-27T11:35:00.001+02:002018-04-27T11:35:10.426+02:00Show Intel TurboBoost usage under Linux: tubostat<div>
This monitors the current clock rate (in MHz) for each core and it also lists the TurboBoost settings depending on how many cores are used:</div>
<div>
<br /></div>
<span style="font-family: Courier New, Courier, monospace;">sudo turbostat -v</span><div>
<br /></div>
<div>
You may first need to install turbostat (for Ubuntu):</div>
<div>
<br /></div>
<div>
<span style="font-family: "Courier New", Courier, monospace;">sudo apt-get install linux-tools-common</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span><br /></div>
icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-6794876602537883072018-03-20T09:14:00.002+01:002018-07-29T23:15:07.562+02:00Ctrl-Q and Ctrl-S do not work in GNU screenIf you find that pressing Ctrl-Q and Ctrl-S has no effect at all in a specific GNU screen terminal than you most likely have accidentally switched on XON/XOFF flow control by hitting Ctrl-A F. The symptom is that you cannot save using Ctrl-X Ctrl-S in Emacs, and you cannot use Ctrl-Q for quoted-insert in Emacs. The Ctrl-S and Ctrl-Q keys are silently ignored.<br />
<br />
To make the Ctrl-S and Ctrl-Q keys work again you must disable flow control in screen: Press Ctrl-A F until "-flow" is displayed. Now the behavior should be back to normal: GNU screen no longer handles Ctrl-Q and Ctrl-S specially and passes these to the application.<br />
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-41040392696682400632018-02-22T14:57:00.003+01:002018-02-22T14:57:58.209+01:00Set terminal title (reset terminal title after it was scrambled by accidentally printing a binary file)<span style="font-family: Courier New, Courier, monospace;">echo -ne "\033]0;SOME TITLE HERE\007"</span><br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-19596765925298592202018-02-03T23:56:00.000+01:002018-05-16T21:52:16.313+02:00Encrypted backup disk on LinuxProblem: I would like to store a backup disk in a different physical place every now and then, just to be sure in case of severe incident like a fire etc. Different physical place means to give up the control where the disk goes: It might be stolen, or it might simply be lost, or it might be sold on ebay by accident. Ok, I totally made the ebay thing up. :-)<br />
<br />
Solution: Keep the backup disk encrypted.<br />
<br />
Whole disk encryption is not as secure as it sounds, due to the limitations of sector-wise access, but it is _way_ better than not encrypting the disk at all, and it usually provides solid confidentiality (meaning an attacker cannot read any information from the disk).<br />
<br />
(There are nasty attacks on whole disk encryption, but they are all around an attacker writing stuff to the disk, modifying it contents in various ways. But if the encryption is done properly all of these attacks leave random garbage in the decrypted view of the disk.)<br />
<br />
I am using 'plain dm-crypt' instead of LUKS since I do not need any of the LUKS features and it is very easy to set up and very easy to understand what happens.<br />
<br />
I am also using the entire disk as one big partition, without a partition table. Encrypted partition tables do not make much sense in my opinion, and I only want one partition anyway.<br />
<br />
If there was already (plain) data on the disk (e.g. an unencrypted backup) it is wise to erase that by overwriting the disk with random garbage:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">shred -n 1 /dev/sdX</span><br />
<br />
Create encrypted layer of the disk:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">cryptsetup --cipher=aes-cbc-essiv:sha256 --key-size 128 --key-file=key.bin open --type plain /dev/sdX enc</span><br />
<br />
(I am using aes-cbc-essiv:sha256 with just a 128 bit key since it seems sufficient for my purpose. If you are concerned that somebody might modify the contents of the disk you are better off with using aes-xts-essiv:sha256 with a 512 bit key, but I was not happy with the performance penalty for very little benefit (if any).)<br />
<br />
The file <span style="font-family: "courier new" , "courier" , monospace;">key.bin</span> contains the 16 byte (128 bit) binary AES key. I created it using:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">head -c 16 /dev/random > key.bin</span><br />
<br />
I keep the <span style="font-family: "courier new" , "courier" , monospace;">key.bin</span> file in plain on my server since I am not nervous of it getting lost. People with access to the server are unlikely to want to decrypt the backup disk of the server since they have full access to the data (even full access to the data on the encrypted disk!) anyway. Of course it is necessary to keep a backup of this key in another physical place, e.g. printed on paper etc. Otherwise the backup disk is useless.<br />
<br />
The plain view of the encrypted disk image is now available under <span style="font-family: "courier new" , "courier" , monospace;">/dev/mapper/enc</span>.<br />
<br />
<br />
Creating an ext4 filesystem on the encrypted disk:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">mke2fs -m 0 -t ext4 /dev/mapper/enc</span><br />
<br />
Mount encrypted disk:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">mount /dev/mapper/enc /backup_disk</span><br />
<br />
Now you can create a backup on /backup_disk.<br />
<br />
When done, umount the disk and stop the encryption (which might flush a few sectors to the disk):<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">umount /backup_disk</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">cryptsetup close enc</span><br />
<br />
Useful links:<br />
<a href="https://wiki.archlinux.org/index.php/Dm-crypt/Device_encryption">https://wiki.archlinux.org/index.php/Dm-crypt/Device_encryption</a><br />
<a href="https://sockpuppet.org/blog/2014/04/30/you-dont-want-xts/">https://sockpuppet.org/blog/2014/04/30/you-dont-want-xts/</a><br />
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-91100459688159447062018-02-03T23:19:00.000+01:002018-02-03T23:19:49.822+01:00Monitor dd progress on Linux with old binutilsI recent was on an Ubuntu 14.04 machine, started a long running dd to clear a disk, and then wanted to monitor progress of this command to get an indication how long it would take.<br />
<br />
In found that my binutils (dd) were too old for the dd status=progress feature.<br />
<br />
Sending signal USR1 to dd prints its progress:<br />
<br />
<tt>killall -USR1 dd</tt><br />
<br />
Alternatively you can just look at the write file descriptor of the dd process, e.g.:
<p>
<tt>grep pos /proc/4609/fdinfo/1</tt>
<p>
icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-4473162916202813822018-01-21T21:40:00.001+01:002018-01-21T21:40:33.109+01:00David P. Reed talks about the invention (or better conception) of UDP<a href="http://www.reed.com/blog-dpr/?page_id=6">http://www.reed.com/blog-dpr/?page_id=6</a><br />
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-62533778081507911492017-11-14T19:41:00.002+01:002018-01-11T23:12:28.394+01:00Save GNU screen buffer to fileTo save the content of a screen in the "GNU screen" tool to a file, including the scrollback buffer, do the following:<br />
<br />
- Press Ctrl-A and then :<br />
- Enter "hardcopy -h myfile.txt"<br />
<br />
myfile.txt will be created in the current working directory of the screen instance you are connected to.<br />
<br />
This is useful in situations where you think "I should have really redirected that into a log file". Of course this only works well if you have a big scrollback buffer. I have:<br />
<br />
defscrollback 100000<br />
<br />
in my .screenrc.<br />
<br />
<br />
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-39066584662251480802017-10-27T15:41:00.003+02:002018-01-11T11:17:13.716+01:00Reset screen terminal after printing garbageWhen accidentally printing binary data in a terminal the state of the terminal gets messed up and one needs to reset it. When using GNU screen, this is maintaining part of the terminal state as well.<br />
<br />
To reset it:<br />
- press Ctrl-A<br />
- enter ":reset" and press enter<br />
<br />
Done. You many need to enter "reset" in the terminal itself as well.<br />
<br />
<br />
<br />
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-36038258041422289162016-07-09T00:13:00.000+02:002017-01-03T23:56:39.948+01:00rsyslogd does not log kernel messages to kern.log on Ubuntu 14.04.1 and OpenVZProblem: Logging dropped packets using iptables LOG policy did not work. Well, the precise problem was, that the messages did not end up in /var/log/kern.log (nor in any other log file), but they did show in 'dmesg' and /proc/kmsg.<br />
<br />
This one was tough. Googling showed that this problem could be solved by uncommenting the line '<b style="font-family: 'Courier New'; font-size: 13px;">$ModLoad imklog'</b> in /etc/rsyslog.conf. This in turn caused kern.log to be filled with messages like '<b style="font-family: 'Courier New'; font-size: 13px;">imklog: error reading kernel log - shutting down: Bad file descriptor'</b>. This in turn is probably caused by some strange interaction between Ubuntu and OpenVZ/virtualization combination, but initially I did not find the precise cause of the problem, nor a solution.<br />
<br />
This link finally gives a clue what the problem is and also presents a working workaround:<br />
<br />
<a href="http://www.nostate.com/4228/fixing-the-100-cpu-and-no-useful-output-imklogrsyslog-kernel-logging-problem-on-ubuntu-guests-under-xen-pv/">http://www.nostate.com/4228/fixing-the-100-cpu-and-no-useful-output-imklogrsyslog-kernel-logging-problem-on-ubuntu-guests-under-xen-pv/</a><br />
<br />
Following the solution worked for me. In more detail:<br />
<br />
Create file /etc/init/kmsg-pipe.conf with the following content:<br />
<br />
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;"># </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;"># Ye Olde /proc/kmsg hack by Mike Gogulski </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;"># from http://www.nostate.com/4228/fixing-the-100-cpu-and-no-useful-output-imklogrsyslog-kernel-logging-problem-on-ubuntu-guests-under-xen-pv </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;"># </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;"># This is free and unencumbered software released into the public domain under # the terms of the Unlicense [http://unlicense.org/]. </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;"># </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;">description "/proc/kmsg pipe hack for rsyslogd" </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;">start on started rsyslog </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;">stop on stopped rsyslog </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;">respawn </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;">script </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;"> mkdir -p /var/run/rsyslogd || true </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;"> mkfifo /var/run/rsyslogd/kmsg || true </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;"> chown -R syslog /var/run/rsyslogd || true </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;"> chmod -R 700 /var/run/rsyslogd || true </span></b></div>
<div style="font-size: 13px; line-height: normal;">
<b><span style="font-family: "courier new" , "courier" , monospace;"> exec dd bs=1 if=/proc/kmsg of=/var/run/rsyslogd/kmsg </span></b></div>
<br />
<div style="font-family: 'Courier New'; font-size: 13px; line-height: normal;">
<b>end script</b></div>
<div>
<b><br /></b></div>
<div>
This effectively creates a shadow copy of /proc/kmsg (using dd and a named pipe) which is accessible by the syslog user.</div>
<div>
<br /></div>
<div>
Then adapt /etc/rsyslog.conf to use this:</div>
<div>
<br /></div>
<div>
<div style="font-family: 'Courier New'; font-size: 13px; line-height: normal;">
<b>echo '$KLogPath /var/run/rsyslogd/kmsg' >> /etc/rsyslog.conf</b></div>
</div>
<br />
Then execute the script and restart rsyslogd:<br />
<br />
<div style="font-family: 'Courier New'; font-size: 13px; line-height: normal;">
<b>initctl start kmsg-pipe</b></div>
<div style="font-family: 'Courier New'; font-size: 13px; line-height: normal;">
<b>service rsyslog restart</b></div>
<div>
<br /></div>
<div>
Now /var/log/kern.log should show kernel messages, for example iptables LOG output.</div>
<div>
<br /></div>
icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-20810068650875615362015-11-08T21:13:00.001+01:002015-11-08T21:14:25.460+01:00Reset Toner on Brother MFC-9340CDWThe original Brother toner cartridges for the Brother MFC-9340CDW printer runs out of toner after a programmed amount of toner usage which is of course useless. This is how to reset the toners so you can continue to print for quite some time:<br />
<div>
<br /></div>
<div>
- Close all warning and error message windows and return to the main menu.</div>
<div>
- Open the Fax menu</div>
<div>
- Mark the '*' Button with a pencil, or just remember where it is. Do not press it. It will disappear in the next step.</div>
<div>
- Return to the main menu.</div>
<div>
- Open the printer so you can see the toners. </div>
<div>
- Press and hold the hidden '*' button for 7 seconds.</div>
<div>
- A toner reset menu appears. Reset the toner in question.</div>
<div>
- Choose K=black, C=cyan, M=magenta, Y=yellow, STR=starter (small), STD=standard, HC=high capacity.</div>
<div>
- Close the printer and return to the main menu.<br />
<br />
See also <a href="https://www.timoschindler.de/brother-mfc-9140cdn-toner-resetten/">https://www.timoschindler.de/brother-mfc-9140cdn-toner-resetten/</a><br />
<br /></div>
<div>
<br /></div>
icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-1957189826430163842015-09-30T18:41:00.000+02:002015-10-29T11:36:27.067+01:00Copy multiple lines from Windows Command Prompt (cmd.exe)Holding down shift while pressing the right mouse button in the selected area copies the text and removes all linefeeds. This is not proper cut/copy/paste of multiple lines, but works for a single long line spanning multiple terminal lines. It is better than nothing.<br />
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-79580705167389860452015-09-28T13:27:00.002+02:002016-01-13T14:54:15.298+01:00Visual Studio Intellisense: No focus on suggestions.<div>
For some reason sometime my Intellisense changes behavior every now and then (probably a Linux Keyboard shortcut entered in VS). To fix this:</div>
<div>
<br /></div>
1. Type something so the Intellisense Popup opens.<br />
<div>
2. Press Ctrl+Alt+Space to toggle whether the suggestion should have the focus or not.</div>
<div>
<br /></div>
<div>
<br />
<div>
<br /></div>
</div>
icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-66969121648950889032015-09-17T23:27:00.001+02:002018-07-29T23:39:40.108+02:00Volumio autoplay with NAS (hack)<br /><br />Goal: Let Volumio 1.55 automatically start playing music automatically after the Raspberry Pi is powered on. The RPi is used completely headless and without any buttons, and while it is fine that I can control it through my phone or a computer, I sometimes just want to start the music on random play by flicking a plain old power switch and nothing more. <br /><br /><br /> After a lot of fiddling with /etc/rc.local I realized that the NAS is mounted only after my commands in rc.local were executed. A sleep may help, but rc.local is killed if you sleep to long ... argh, nasty!<br /><br /><br /><br /><br />Instead I decided to hardcode the autoplay into the PHP scripts directly. I don't know any PHP, but how hard can it be? <img src="" /><br /><br /><br /><br /><br />Edit file /var/www/command/player_wrk.php and search for 'WORKER MAIN LOOP'.<br /><br />Add the following lines before the '// --- WORKER MAIN LOOP --- //' line:<br /><br /><br /><br /><br />// Autoplay<br /><br />sleep(5);<br /><br />$cmd = 'amixer cset numid=3 1';<br /><br />sysCmd($cmd);<br /><br />$cmd = 'mpc repeat on';<br /><br />sysCmd($cmd);<br /><br />$cmd = 'mpc random on';<br /><br />sysCmd($cmd);<br /><br />$cmd = 'mpc consume off';<br /><br />sysCmd($cmd);<br /><br />$cmd = 'mpc single off';<br /><br />sysCmd($cmd);<br /><br />$cmd = 'mpc play';<br /><br />sysCmd($cmd);<br /><br /><br /><br /><br />The amixer line tries to force 3.5mm jack audio output. Not sure this works. Omit it if you use your own DAC or HDMI.<br /><br />Not sure the sleep(5) is necessary. This is actually not specific for NAS and should work with any source. It should play the playlist which was last active. <br /><br /><br /><br /><br />I would love to have this in the GUI, but I do not know how to hack that in.<br /><br /><br /><br /><br />Ah yes. Completely unrelated and just so I do not forget it: To get my TL-WN725N WLAN Dongle working with volumio 1.55 I had to download the firmware for it:<br /><br />sudo wget <a class="postlink" href="https://github.com/lwfinger/rtl8188eu/raw/c83976d1dfb4793893158461430261562b3a5bf0/rtl8188eufw.bin" style="border-bottom-color: rgb(67, 166, 223); border-bottom-style: solid; border-bottom-width: 1px; color: #43a6df; direction: ltr; font-family: "helvetica neue", helvetica, arial, sans-serif; font-size: 13px; line-height: 19.512001037597656px; margin: 0px; padding: 0px; text-decoration: none; transition: 0.2s; unicode-bidi: embed;">https://github.com/lwfinger/rtl8188eu/raw/c83976d1dfb4793893158461430261562b3a5bf0/rtl8188eufw.bin</a><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 13px; line-height: 19.512001037597656px;"> -O /lib/firmware/rtlwifi/rtl8188eufw.bin</span>icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-89444575023614436072015-05-07T13:40:00.003+02:002015-05-07T13:41:28.614+02:00Mac OS X telnet escape character on a german keyboard is Ctrl+ÜThe title says it all. To get the telnet escape char (^]) in a Mac OS X Terminal, for example to quit telnet, you have to type Ctrl+Ü on a german keyboard.<br />
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-9186872144264717682015-01-12T10:53:00.000+01:002015-01-12T10:53:04.253+01:00Update Samsung SSD 840 EVO firmware on Zotac Linux server (poor read performance of old files).My Samsung SSD 840 EVO was suffering from the apparently well known problem that 'old' files (files which have been written a long while ago and not touched since) had slow read transfer rates (as low as 5 MBytes/s in places, 29 MBytes/s for some big files I had).<br />
<br />
I have a Zotac server without a CD drive, so I needed to run the Samsung Performance Restauration tool. I used the DOS / Mac variant which is a DOS bootable disk which contains the update tool. The easiest way to prepare the USB stick is NOT to use the USB zip provided by Samsung but to use the *.iso file (Samsung_Performance_Restoration.iso) instead:<br />
<br />
- Mount the ISO file and get the file ISOLINUX/BTDSK.IMG from it.<br />
- dd the BTDSK.IMG directly onto a USB stick<br />
- boot from the USB stick and follow the instructions<br />
<br />
On my Zotac machine when booting from this USB stick I got a couple of broken error messages about not being able to boot from device XYZ, but it booted OK from the stick after a couple of seconds.<br />
<br />
The performance restauration procedure took 4.5h for a 1TB SSD (60% full) and about 15h for another 1TB SSD (95% full), so expect this to take some time.<br />
<br />
Both SSDs were not erased by the procedure.<br />
<br />
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-72524822658807065582015-01-12T10:40:00.000+01:002015-03-20T23:58:58.578+01:00Avoid hang of headless Zotac server on Ubuntu Linux reboot. (How to disable the graphical console for grub and the Linux kernel.)My Zotac server did not reboot without a monitor attached. Booting from power-up did work ok. The graphical console of grub seemed to be the problem. Since I do not use the monitor output at all not setting any graphics mode at all and using the 80x25 default console is fine for me. This is how to disable the graphical grub console:<br />
<br />
Edit <b style="background-color: #000224; color: #bbbbbb; font-family: 'Courier New'; font-size: 13px;">/etc/default/grub</b><br />
<br />
Uncomment this line:<br />
<b style="background-color: #000224; color: #bbbbbb; font-family: 'Courier New'; font-size: 13px;">GRUB_TERMINAL=console</b><br />
<br />
In addition I disabled setting any graphics mode on the Linux kernel and setting the timeout to 1 second.<br />
<br />
My <b style="background-color: #000224; color: #bbbbbb; font-family: 'Courier New'; font-size: 13px;">/etc/default/grub </b> file now looks like this:<br />
<div style="background-color: #000224; font-family: 'Courier New'; font-size: 13px;">
<span style="color: #cccccc;"><b>G</b><b>RUB_DEFAULT=0</b></span></div>
<div style="background-color: #000224; font-family: 'Courier New'; font-size: 13px;">
<span style="color: #cccccc;"><b>G</b><b>RUB_HIDDEN_TIMEOUT_QUIET=true</b></span></div>
<div style="background-color: #000224; font-family: 'Courier New'; font-size: 13px;">
<span style="color: #cccccc;"><b>G</b><b>RUB_TIMEOUT=1</b></span></div>
<div style="background-color: #000224; font-family: 'Courier New'; font-size: 13px;">
<span style="color: #cccccc;"><b>G</b><b>RUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`</b></span></div>
<div style="background-color: #000224; font-family: 'Courier New'; font-size: 13px;">
<span style="color: #cccccc;"><b>G</b><b>RUB_CMDLINE_LINUX_DEFAULT="text nomodeset"</b></span></div>
<div style="background-color: #000224; font-family: 'Courier New'; font-size: 13px;">
<span style="color: #cccccc;"><b>G</b><b>RUB_CMDLINE_LINUX=""</b></span></div>
<br />
<div style="background-color: #000224; font-family: 'Courier New'; font-size: 13px;">
<span style="color: #cccccc;"><b>G</b><b>RUB_TERMINAL=console</b></span></div>
<div>
<b><br /></b></div>
Reboot time: The time between pressing enter after 'reboot' and being logged in again with ssh is 25s.<br />
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-67474533818311245092014-10-03T23:31:00.001+02:002014-10-03T23:33:03.964+02:00Copy files using rsync as root when the remote host does not allow root access and ssh is on a different port<br />
<ul>
<li>Step 1: Make sure you can execute commands as root on the remote host after logging in, without entering your password. For this there are two alternative options:</li>
<ul>
<li>You can allow the user to execute sudo without entring the users password. You can do this by adding the following line to the end of /etc/sudoers:</li>
<ul>
<li><user> ALL=NOPASSWD: ALL</user></li>
</ul>
<li>You can enter the sudo password in advance once and make sure it is cached between sessions. To make sure it is cached between sessions you must add the '!tty_tickets' option to the Defaults line in /etc/sudoers, and then you must run a dummy command as root:</li>
<ul>
<li>Defaults env_reset,!tty_tickets</li>
<li>ssh -p PORT <port>-t USER<user>@REMOTE_HOST<remote_host> sudo id</remote_host></user></port></li>
</ul>
</ul>
<li>Step 2: Do the rsync. Override the ssh port. Specify "sudo rsync" as remote rsync command. Target the rsync at the non-root user which can now sudo:</li>
<ul>
<li> sudo rsync -avRe "ssh -p PORT<port>" --rsync-path "sudo rsync" LOCAL_DIR USER<local_dir><user>@REMOTE_HOST<remote_host>:</remote_host></user></local_dir></port></li>
</ul>
</ul>
icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0tag:blogger.com,1999:blog-30238461.post-83263189894759826442014-09-29T00:41:00.003+02:002014-09-29T00:42:12.943+02:00Ubuntu Linux: Show network throughput of network device eth0 etc in bytes: iftop -BBy default iftop shows the bandwidth in Bit/s<br />
iftop<br />
<br />
To show the bandwidth in Bytes/s<br />
iftop -B<br />
<br />icodehttp://www.blogger.com/profile/12337909803151176293noreply@blogger.com0