Joey Hess: badUSB
This actually happened.
Jan 19 00:05:10 darkstar kernel: usb 2-2: Product: ChaosKey-hw-1.0-sw-1.6.
In real life, my hat is uglier, and Keithp is more kindly looking.
gimp source
This actually happened.
Jan 19 00:05:10 darkstar kernel: usb 2-2: Product: ChaosKey-hw-1.0-sw-1.6.
In real life, my hat is uglier, and Keithp is more kindly looking.
gimp source
Because I wanted my home router to use at least decently supported software that provides complete out-of-the-box support for native IPv6, I recently got around upgrading my WRT54GL's firmware from White Russian to Backfire, which is the most recent OpenWRT release that fits the hardware's limited amount of flash memory.
These are the last hours when we can update packages and they migrate to testing after 10 days right before the full freeze on 5 February.
The latest Wireshark upstream version, 2.2.4 has been released on Monday and it is waiting patiently to be part of next Debian stable.
I have just tested the fix for Kodi s bug preventing playing DVD-s and today it will be fixed in unstable as well.
If you have packages which could be updated to make Stretch even better you can still do it today, but don t wait too long!
Thanks to everyone working on Debian! Stretch will be awesome!
Working with Preferences, AudioManager, RingtoneManager in Android.
Sometimes the noise can get too much. Imagine all the people around you at work or in a classroom. All of them have at least one cell phones. Even if they were all to make a tiny blip, the noise would be irritating and disruptive.
To avoid devices from interrupting the non-digital life, applications often provide settings that allow users to modify app volumes. My task this week was to enable/disable silent mode in Lumicall.
To provide settings for your application, instead of using multiple Views, Preference APIs should be used.
Each preference appears as an item in a list and provides the appropriate UI for users to modify the setting.
In Lumicall, when settings menu from the menubar is selected, a preference screen is displayed showing various setting options, where I appended a Configure Silent Mode option.
The UI for the preference screen is expected to be in Src->xml folder under the name preferences.xml
Snippet from Lumicall s preference.xml for Configure Silent Mode preference screen.
Every preference has a key and the result associated with it.
To fetch the result from the SharedPreferences file-
boolean silentflag=PreferenceManager.getDefaultSharedPreferences(ctx).getBoolean(org.sipdroid.sipua.ui.Settings.PREF_SILENT_MODE, org.sipdroid.sipua.ui.Settings.DEFAULT_SILENT_MODE);
Note, the arguments in getBoolean function is (Key, DefaultValue).
Don t forget to pass the Context object, ctx in the statement. I wasted a lot of time figuring that one out and created a non-optimal-working way which I eventually had to remove cos I figured out how to retrieve the result value.

To add a second method of setting silent mode, i.e where the user can enter his work days/time, I wanted to display an activity with required widgets .
To display an activity on a when a preference is selected, intent tags are used. (See the above snippet)
Note that the target package in the intent tags is not the package name of where the java file of the activity is to be found.It s the package name which is your applicationID.
Now this activity, like any other activity in android is a combination of an xml and java file.
1. My xml file contains the widgets for user to enter two set of time value in HH:MM format. i.e.the start and end time during which user requires application notifications to be silent it also contains checkboxes for user to select multiple days of the week.
2. The java file associated with this does the following:
2.1 Comparing the Real Time with User s Specified Start and End time
2.2 Checking the current day of the week with the days marked by the user in the checkboxes
I have used inbuilt Calendar class and Date class to accomplish this.
All done I felt quite proud but this.. this was something that tested my patience and endurance!
As I continue my work, I will keep sharing!
Please keep reading!
U
As previously mentioned, at the end of last year I got involved with a project involving the use of 1-Wire. In particular a DS28E15 device, intended to be used as a royalty tracker for a licensed piece of hardware IP. I d no previous experience with 1-Wire (other than knowing it s commonly used for driving temperature sensors), so I took it as an opportunity to learn a bit more about it.
The primary goal was to program a suitable shared key into the DS28E15 device that would also be present in the corresponding hardware device. A Maxim programmer had been ordered, but wasn t available in stock so had to be back ordered. Of course I turned to my trusty Bus Pirate, which claimed 1-Wire support. However it failed to recognise the presence of the device at all. After much head scratching I finally listened to a co-worker who had suggested it was a clock speed issue - the absence of any option to select the 1-Wire speed in the Bus Pirate or any mention of different speeds in the documentation I had read had made me doubt it was an issue. Turns out that the Bus Pirate was talking standard 1-Wire and the DS28E15 only talks overdrive 1-Wire, to the extent that it won t even announce its presence if the reset pulse conforms to the standard, rather than overdrive, reset time period. Lesson learned: listen to your co-workers sooner.
A brief period of yak shaving led to adding support to the Bus Pirate for the overdrive mode (since landed in upstream), and resulted in a search request via the BP interface correctly finding the device and displaying its ROM ID. This allowed exploration of the various commands the authenticator supports, to verify that the programming sequence operated as expected. These allow for setting the shared secret, performing a SHA256 MAC against this secret and a suitable nonce, and retrieving the result.
Next problem: the retrieved SHA256 MAC did not match the locally computed value. Initially endianness issues were suspected, but trying the relevant permutations did not help. Some searching found an implementation of SHA256 for the DS28E15 that showed differences between a standard SHA256 computation and what the authenticator performs. In particular SHA256 normally adds the current working state (a-g) to the current hash value (h0-h7) at the end of every block. The authenticator does this for all but the final block, where instead the hash value is set to the working state. I haven t been able to find any documentation from Maxim that this is how things are calculated, nor have I seen any generic implementation of SHA256 which supports this mode. However rolling my own C implementation based on the code I found and using it to compare the results retrieved from the device confirms that this is what s happening.
So at this point we re done, right? Wait for the proper programming hardware to turn up, write the key to the devices, profit? Well, no. There was a bit of a saga involving the programmer (actually programmers, one with at least some documentation that allowed the creation of a Python tool to allow setting the key and reading + recording the ROM ID for tracking, and one with no programming documentation that came with a fancy GUI for manually doing the programming), but more importantly it was necessary to confirm that the programmed device interacted with the hardware correctly.
Initial testing with the hardware was unsuccessful. Again endianness issues were considered and permutations tried, but without success. A simple key constructed to avoid such issues was tried, and things worked fine. There was a hardware simulation of both components available, so it was decided to run that and obtain a capture of the traffic between them. As the secret key was known this would then allow the random nonce to be captured, and the corresponding (correct) hash value. Tests could then be performed in software to determine what the issue was & how to generate the same hash for verification.
Two sets of analyzer software were tried, OpenBench LogicSniffer (OLS) and sigrok. As it happened both failed to correctly decode the bitstream detected as 1-Wire, but were able to show the captured data graphically, allowing for decoding by eye. A slight patch to OLS to relax the timing constraints allowed it to successfully decode the full capture and provided the appropriate data for software reproduction. The end issue? A 256 bit number (as defined in VHDL) is not the same as 32 element byte array Obvious when you know what the issue is!
So? What did I learn, other than a lot about 1-Wire? Firstly, don t offhandedly discount suggestions that you don t think make sense. Secondly, having a tool (in this case the Bus Pirate) that lets you easily play with a protocol via a simple interface is invaluable in understanding it. Thirdly, don t trust manufacturers to be doing something in a normal fashion when they claim to be using a well defined technology. Fourthly, be conscious about all of the different ways bitstreams can be actually processed in memory. It s not just endianness. Finally, spending the time to actually understand what s going on up front can really help when things don t work as you d expect later on - without the yak shaving to support Overdrive on the BP I wouldn t have been able to so quickly use the simulation capture to help diagnose the issue.
The Budget
The story which I wanted to share is there are few friends (from Debian as well as elsewhere) who shared that they didn t get the whole demonetisation play or what the Government is/was trying to do. As budget is just round the corner (India will be presenting its yearly budget on 1st of February), thought it is prudent to share at least some basics, ideas and theories of what goals the Finance Minister would be looking at when presenting his budget. I would NOT talk of Inflation targeting or some such exotica as those topics would require their own blog-posts altogether. I would mainly be talking a bit about Taxation and in that Personal Income Tax. I would also not use words like Receivables and like which thought bit more accurate are not used in everyday language.
Just like Private Companies and increasingly public utilities, The Government of the day has two-three different aims when it is presenting a budget
a. The first is to give an update about how things went last year. Did all the incomes that were projected, did it happen or was there a short-fall ? If there was a short-fall what were the reasons for the shortfall.
Similarly, did all the budgeted expenditure earmarked for the year was spent and were it spent under the heads they were supposed to ? If not what went wrong there ? There is usually a tussle between Planned and Unplanned expenditure and one of the hallmarks of good governance is that unplanned expenditure is kept at minimum, while planned expenditure and projects completion or/and assets coming on-line were within the estimated time-frames.
So these updates are given to the Parliament and hence public at large.
The second and the more interesting part are the plans for the immediate future, 1 year down-the-line. Based on the performance last year, a bit of crystal-ball gazing of external and internal conditions of the country, the Finance Minister along with her/his colleagues of Finance Ministry.
Trivia There hasn t been a female finance minister till date in India.
The Finance Ministry as a whole also holds consultations with most sections of the society before sharing/putting his Fiscal Policy (Planned Expenditure) for debate and passage in form of the Budget. While the budget itself is a technical exercise, it is also a Political exercise as both the budget and the finance bill (which contains the taxation proposals) need to be passed in Lok Sabha (Lower house).
After passing scrutiny of Lok Sabha (Lower House having people s representatives directly elected) and Rajya Sabha (Upper House, indirectly elected), the taxation proposals becomes the law. It isn t that simple but for our understanding, keeping it simple. This Political model of governance with two houses is modeled under the British (Westminister) model since 1947.
The Government, just like any other Organization gives a similar Profit and Loss Account and a Balance Sheet.

How A country s budget is made. A representational and simplified version of how things flow was made using Graphviz. Click on it to see image in detail.
graph Budget
subgraph tier1
node [color="limegreen",style="filled",group="tier1"]
Country_Budget
......
Country_Budget -- Profit_and_Loss_Account [type=s];
It might be possible to make the graph much better than it is currently .
The Profit and Loss Account of the Government tells what Incomes it is projected to earn in the upcoming year and whatever Expenditures it hopes to do this year.
The Income and Expenditure independently can be bifurcated into two, Revenue Income and Capital Income and Revenue Expenditure and Capital Expenditure.
Indian Railways EMU local train

INR 2000 Rupees
I wrote a piece a few days ago about how the Meitu app asked for a bunch of permissions in ways that might concern people, but which were not actually any worse than many other apps. The fact that Android makes it so easy for apps to obtain data that's personally identifiable is of concern, but in the absence of another stable device identifier this is the sort of thing that capitalism is inherently going to end up making use of. Fundamentally, this is Google's problem to fix.
Beware, this would be slightly longish.
Debian Contributions
In the last couple of weeks, was lucky to put up a patch against debian-policy which had been bothering me for a long-long time.
The problem statement is simple, man-pages historically were made by software engineers for software-engineers. The idea, probably then was you give the user some idea of what the software does and the rest the software engineer would garner from reading the source-code. But over period of time, the audience has changed. While there are still software engineers who use GNU/Linux for the technical excellence, the man-pages have not kept up with this new audience who perhaps are either not technically so sound that or they do not want to take the trouble to reading the source-code to understand how things flow. An example or examples in a man-page gives us (the lesser mortals) some insight as how the command works, how the logic flows.
A good example of a man-page is the ufw man-page
EXAMPLESNow if we had man-pages like the above which give examples, then the user at least can try to accomplish whatever s/he is trying to do. I truly believe not having examples in a man-page kills 50% of your audience and people who could potentially use your tool. Personal wishlist The only thing (and this might be my failure) is we need a good way to search through a man-page. The only way I know is using / and try to give a pattern. Lots of times it fails because I, the user doesn t know the exact keyword which the documenter was using. What would be nice, great if we do have some sort of parser where I tell it, $this is what I m looking for and the parser tries the pattern + all its synonyms and whatever seems to be most relevant passage from the content, in this case a manpage it tells me. It would make my life a lot easier while at the same time force people to document more and more. I dunno if there has been any research or study of the relationship between good documentation and popularity of a program. I know there are lots of different tiny bits which make or break a program, one of which would definitely be documentation and in that a man-page IF it s a command-line tool. A query on Quora gives some indication https://www.quora.com/How-comprehensible-do-you-find-Unix-Linux-Man-pages although the low response rate tells its own story. there have been projects like man2html and man2pdf and others which try to make the content more accessible to people who are not used to the man-page interface but till you don t have Examples the other things can work only so far. Also if anybody talks about X project which claims to solve this problem they will have to fight manpages who have been around like forever. As can be seen in the patch, did some rookie mistakes as can be seen. I also filed a lintian bug at the same time. Hope the patch does get merged at some point in debian-policy and then a check introduced in lintian in some future release. I do agree with anarcat s assertion that it should be at the level of the manpage missing level. I am no coder but finding 14,000 binary packages without a manpage left me both shocked and surprised. I came to know about manpage-alert from the devscripts package to know which all binary packages that have been installed but not have man-pages. I hope to contribute a manpage or two if I across a package I m somewhat comfortable with. I have made a beginning of sorts by running manpage alert and putting the output in a .txt file which I would grep through manually and see if something interesting jumps at me. The learning garnered from putting the patch to the debian package resulted in another patch but this time for an upstream project altogether. As can be seen all are just baby-steps that even a non-coder can take. Another couple of bugs I filed which were fixed were of a sim called unknown-horizons . A 2D realtime strategy simulation. I had filed three bugs, two of which were fixed in 2 days, the 3rd I hope is also fixed soonish. Lastly, I spent most of the week-end poring over packages who have left files in /etc/bash_completion.d/ . I spent almost 4-5 odd hours as each package in question as well as entries found in /etc/bash-completion.d/$filename I had to find which package it belonged to first
Deny all access to port 53: ufw deny 53 Allow all access to tcp port 80: ufw allow 80/tcp Allow all access from RFC1918 networks to this host: ufw allow from 10.0.0.0/8
ufw allow from 172.16.0.0/12
ufw allow from 192.168.0.0/16 Deny access to udp port 514 from host 1.2.3.4: ufw deny proto udp from 1.2.3.4 to any port 514 Allow access to udp 1.2.3.4 port 5469 from 1.2.3.5 port 5469: ufw allow proto udp from 1.2.3.5 port 5469 to 1.2.3.4 port 5469
[$] dpkg -S /etc/bash_completion.d/git-prompt
git: /etc/bash_completion.d/git-prompt
I know that dpkg-query also does the same
[$] dpkg-query -S /etc/bash_completion.d/git-prompt
git: /etc/bash_completion.d/git-prompt
But I am used to plain dpkg although do know that dpkg-query can do lot more intimate searching in various ways than dpkg can.
Once the package name was established, first simulate the purge
[$] sudo aptitude -s purge git
[sudo] password for shirish:
The following packages will be REMOVED:
git p
0 packages upgraded, 0 newly installed, 1 to remove and 14 not upgraded.
Need to get 0 B of archives. After unpacking 29.5 MB will be freed.
The following packages have unmet dependencies:
libgit-wrapper-perl : Depends: git but it is not going to be installed
git-extras : Depends: git (>= 1.7.0) but it is not going to be installed
bup : Depends: git but it is not going to be installed
git-remote-gcrypt : Depends: git but it is not going to be installed
git-svn : Depends: git (> 1:2.11.0) but it is not going to be installed
Depends: git ( 1:2.11.0) but it is not going to be installed
Depends: git (= 1:1.8.1) but it is not going to be installed
git-core : Depends: git (> 1:1.7.0.2) but it is not going to be installed
The following actions will resolve these dependencies:
Remove the following packages:
1) bup [0.29-2 (now, testing, unstable)]
2) fdroidserver [0.7.0-1 (now, testing, unstable)]
3) git-annex [6.20161012-1 (now, testing)]
4) git-core [1:2.11.0-2 (now, testing, unstable)]
5) git-extras [4.2.0-1 (now, testing, unstable)]
6) git-remote-gcrypt [1.0.1-1 (now, testing, unstable)]
7) git-repair [1.20151215-1 (now, unstable)]
8) git-svn [1:2.11.0-2 (now, testing, unstable)]
9) gitk [1:2.11.0-2 (now, testing, unstable)]
10) libgit-wrapper-perl [0.047-1 (now, testing, unstable)]
11) python3-git [2.1.0-1 (now, testing, unstable)]
12) svn2git [2.4.0-1 (now, testing, unstable)]
Leave the following dependencies unresolved:
13) devscripts recommends libgit-wrapper-perl
14) dh-make-perl recommends git
15) fdroidserver recommends git
16) git-annex recommends git-remote-gcrypt (>= 0.20130908-6)
17) gplaycli recommends fdroidserver
18) python-rope recommends git-core
Accept this solution? [Y/n/q/?] q
Abandoning all efforts to resolve these dependencies.
Abort.
Then I made a note of all the packages being affected, saw purging all of them wouldn t call others (the Package dependency Hell), made the purge and then reinstalled anew.
The reason I did this is that many a times during upgrade, either during update/upgrade sometimes the correct action doesn t happen. To take the git s example itself, there were two files git-extras and git-prompt which were in /etc/bash_completion.d/ both of which were showing their source as git. Purging git and installing git afresh removed git-extras file and git-prompt is the only one remaining.
While blogging about the package, did try to grep through changelog.Debian.gz and changelog.gz in git
[shirish@debian] - [/usr/share/doc/git] - [10046]
[$] zless changelog.gz
and similarly
[shirish@debian] - [/usr/share/doc/git] - [10046]
[$] zless changelog.Debian.gz
But failed to find any mention of the now gone git-extras. Doing this with all the packages took considerable time as didn t want to deal with any potential fallout later on. For instance, ufw (uncomplicated firewall) also had an entry in /etc/bash_completion.d/, hence before purging ufw, took backup of all the rules I have made, did a successful simulation
[$] sudo aptitude -s purge ufw gufw
The following packages will be REMOVED:
gufw p ufw p
0 packages upgraded, 0 newly installed, 2 to remove and 14 not upgraded.
Need to get 0 B of archives. After unpacking 4,224 kB will be freed.
Note: Using 'Simulate' mode.
Do you want to continue? [Y/n/?] y
Would download/install/remove packages.
purged the packages, reinstalled it and then re-added all the rules. Doing it all for various sundry packages, had to do it manually as there is no one size fits all solution.
A sensitive one was grub which still has an entry in /etc/bash_completion.d/grub. Doing it wrong could have resulted in a non-bootable situation. There are workarounds for that, but it would have taken quite a bit of time, energy, notes and bit of recall factor what I did the last time something like that happened. Doing it manually, being present meant I could do it rightly the first time.
So, was it worth it It would be if the package maintainers do the needful and the remaining entries are moved out of /etc/bash_completion.d/ to /usr/share/bash-completions and some to my favourite /usr/share/zsh/vendor-completions/ for instance
[shirish@debian] - [/usr/share/zsh/vendor-completions] - [10064]
[$] ll -h _youtube-dl
-rw-r--r-- 1 root root 3.2K 2016-12-01 08:48 _youtube-dl
But trying to get all or even major packages to use zsh-completions would be hard work and would take oodles of time and this concerns upstream stuff, also very much outside what I was sharing.
World History
Before, during and even after South-African experience, I was left wondering why India and South Africa, two countries who had similar histories at least the last couple of hundred years or more, the final result of Independence was so different for both the countries. It took me quite sometime to articulate that in a form of question , while the answers were interesting, from what little I know of India itself, if I were an Englishman I would never leave Hindustan . What the people answering failed to take into account was that in that era it was Hindustan or un-divided India.
Pre-partition map of India
The second most difficult mountain in the world K2, Pakistan
Nageru, my live video mixer, is in the process of gaining HDMI/SDI
output for bigscreen use, and in that process, I ran some loopback tests
(connecting the output of one card into the input of another) to verify
that I had all the colorspace parameters right. (This is of course trivial
if you are only sending one input on bit-by-bit, but Nageru is much more
flexible, so it really needs to understand what each pixel means.)
It turns out that if you mess up any of these parameters ever so slightly,
you end up with something like this, this or this.
But thankfully, I got this instead on the very first try, so it really
seems it's been right all along. :-)
(There's a minor first-generation loss in that the SDI chain is 8-bit Y'CbCr
instead of 10-bit, but I really can't spot it with the naked eye, and it
doesn't compound through generations. I plan to fix that for those with spare
GPU power at some point, possibly before 1.5.0 release.)
During useR! 2016, Nick Tierney had asked on Twitter about rmarkdown and metropolis and whether folks had used RMarkdown-driven LaTeX Beamer presentations. My firm hell yeah answer, based on having used mtheme outright or in local mods for quite some time (see my talks page), lead to this blog post of mine describing this GitHub repo I had quickly set up during breaks at useR! 2016. The corresponding blog post and the repo have some more details on how I do this, in particular about local packages (also with sources on GitHub) for the non-standard fonts I use.
This week I got around to updating the repo / example a little by making the default colours (in my example) a little less awful, and a page on blocks and, most importantly, turning the example into the animated gif below:
More than five years ago I blogged about the configuration problem and a proposed solution for Haskell, which turned into some Template Haskell hacks in the seal-module package.
With the new GHC proposal process in plase, I am suddenly much more inclined to write up my weird wishes for the Haskell language in proposal form, to make them more coherent, get feedback, and maybe (maybe) actually get them implemented. But even if the proposal is rejected it is still a nice forum to discuss these ideas.
So I turned my Template Haskell hack into a proposed new syntactic feature. The idea is shamelessly stolen from Isabelle, including some of the keywords, and would allow you to write
context fixes progName in
foo :: Maybe Int -> Either String Int
foo Nothing = Left $ progName ++ ": no number given"
foo (Just i) = bar i
bar :: Int -> Either String Int
bar 0 = Left $ progName ++ ": zero no good"
bar n = Right $ n + 1
instead of
foo :: String -> Maybe Int -> Either String Int
foo progName Nothing = Left $ progName ++ ": no number given"
foo progName (Just i) = bar progName i
bar :: String -> Int -> Either String Int
bar progName 0 = Left $ progName ++ ": zero no good"
bar progName n = Right $ n + 1
when you want to have an almost constant parameter.
I am happy to get feedback at the GitHub pull request.
This is first security bugfix release for Weblate. This has to come at some point, fortunately the issue is not really severe. But Weblate got it's first CVE ID today, so it's time to address it in a bugfix release.
Full list of changes:
demo account using demo password or register your own user. Weblate is also being used on https://hosted.weblate.org/ as official translating service for phpMyAdmin, OsmAnd, Aptoide, FreedomBox, Weblate itself and many other projects.
Should you be looking for hosting of translations for your project, I'm happy to host them for you or help with setting it up on your infrastructure.
Further development of Weblate would not be possible without people providing donations, thanks to everybody who have helped so far!
Filed under: Debian English SUSE Weblate 0 comments
There's been a sudden wave of people concerned about the Meitu selfie app's use of unique phone IDs. Here's what we know: the app will transmit your phone's IMEI (a unique per-phone identifier that can't be altered under normal circumstances) to servers in China. It's able to obtain this value because it asks for a permission called READ_PHONE_STATE, which (if granted) means that the app can obtain various bits of information about your phone including those unique IDs and whether you're currently on a call.
SOURCE_PREFIX_MAP and explored
different options for encoding a map data structure in a single environment
variable. He also continued to talk with the rustc
team on the topic.
Daniel Shahaf filed #851225 ('udd: patches: index by DEP-3 "Forwarded"
status') to make it easier to track our patches.
Chris Lamb forwarded #849972 upstream to
yard, a Ruby documentation
generator. Upstream has fixed the issue as of release
0.9.6.
Alexander Couzens (lynxis) has made mksquashfs
reproducible and is
looking for testers.
It compiles on BSD systems such as FreeBSD, OpenBSD and NetBSD.
Bugs filed
Chris Lamb:
Lucas Nussbaum:
Nicola Corna:
Reviews of unreproducible packages
13 package reviews have been added and 13 have been removed in this week,
adding to our knowledge about identified
issues.
1 issue type has been added:
Weekly QA work
During our reproducibility testing, the following FTBFS bugs have been detected
and reported by:
Many bugs were opened in
diffoscope during the
past few weeks, which probably is a good sign as it shows that diffoscope is
much more widely used than a year ago. We have been working hard to squash many
of them in time for Debian stable, though we will see how that goes in the end
/dev/shm
and /run/shm are both mounted with the correct permissions. Some of our
build machines currently still fail this test, and the problem is probably
the root cause of the
FTBFS
of some packages (which fails with issues regarding sem_open). The proper
fix is still being discussed in #851427.
With the release of Gitlab 8.15 it was announced that PostgreSQL needs to be upgraded. As I migrated from a source installation I used to have an external PostgreSQL database instead of using the one shiped with the omnibus package. $ sudo -u postgres psql -d template1
psql (9.2.18)
Type "help" for help.
gitlabhq_production=# \l
List of databases
Name Owner Encoding Collate Ctype Access privileges
-----------------------+-------------------+----------+---------+---------+---------------------------------
gitlabhq_production git UTF8 C.UTF-8 C.UTF-8
gitlab_mattermost git UTF8 C.UTF-8 C.UTF-8
gitlabhq_production=# \q
Dumping the databases and stop PostgreSQL. Maybe you need to adjust database names and users for your needs.
$ su postgres -c "pg_dump gitlabhq_production -f /tmp/gitlabhq_production.sql" && \
su postgres -c "pg_dump gitlab_mattermost -f /tmp/gitlab_mattermost.sql" && \
/etc/init.d/postgresql stop
Activate PostgreSQL shipped with Gitlab Omnibus
$ sed -i "s/^postgresql\['enable'\] = false/#postgresql\['enable'\] = false/g" /etc/gitlab/gitlab.rb && \
sed -i "s/^#mattermost\['enable'\] = true/mattermost\['enable'\] = true/" /etc/gitlab/gitlab.rb && \
gitlab-ctl reconfigure
Testing if the connection to the databases works
$ su - git -c "psql --username=gitlab --dbname=gitlabhq_production --host=/var/opt/gitlab/postgresql/"
psql (9.2.18)
Type "help" for help.
gitlabhq_production=# \q
$ su - git -c "psql --username=gitlab --dbname=mattermost_production --host=/var/opt/gitlab/postgresql/"
psql (9.2.18)
Type "help" for help.
mattermost_production=# \q
Ensure pg_trgm extension is enabled
$ sudo gitlab-psql -d gitlabhq_production -c 'CREATE EXTENSION IF NOT EXISTS "pg_trgm";'
$ sudo gitlab-psql -d mattermost_production -c 'CREATE EXTENSION IF NOT EXISTS "pg_trgm";'
Adjust permissions in the database dumps. Indeed please verify that users and databases might need to be adjusted too.
$ sed -i "s/OWNER TO git;/OWNER TO gitlab;/" /tmp/gitlabhq_production.sql && \
sed -i "s/postgres;$/gitlab-psql;/" /tmp/gitlabhq_production.sql
$ sed -i "s/OWNER TO git;/OWNER TO gitlab_mattermost;/" /tmp/gitlab_mattermost.sql && \
sed -i "s/postgres;$/gitlab-psql;/" /tmp/gitlab_mattermost.sql
(Re)import the data
$ sudo gitlab-psql -d gitlabhq_production -f /tmp/gitlabhq_production.sql
$ sudo gitlab-psql -d gitlabhq_production -c 'REVOKE ALL ON SCHEMA public FROM "gitlab-psql";' && \
sudo gitlab-psql -d gitlabhq_production -c 'GRANT ALL ON SCHEMA public TO "gitlab-psql";'
$ sudo gitlab-psql -d mattermost_production -f /tmp/gitlab_mattermost.sql
$ sudo gitlab-psql -d mattermost_production -c 'REVOKE ALL ON SCHEMA public FROM "gitlab-psql";' && \
sudo gitlab-psql -d mattermost_production -c 'GRANT ALL ON SCHEMA public TO "gitlab-psql";'
Make use of the shipped PostgreSQL
$ sed -i "s/^gitlab_rails\['db_/#gitlab_rails\['db_/" /etc/gitlab/gitlab.rb && \
sed -i "s/^mattermost\['sql_/#mattermost\['sql_/" /etc/gitlab/gitlab.rb && \
gitlab-ctl reconfigure
Now you should be able to connect to all the Gitlab services again.
Optionally remove the external database
apt-get remove postgresql postgresql-client postgresql-9.4 postgresql-client-9.4 postgresql-client-common postgresql-common
Maybe you also want to purge the old database content
apt-get purge postgresql-9.4
With the release of Gitlab 8.15 it was announced that PostgreSQL needs to be upgraded. As I migrated from a source installation I used to have an external PostgreSQL database instead of using the one shiped with the omnibus package. $ sudo -u postgres psql -d template1
psql (9.2.18)
Type "help" for help.
gitlabhq_production=# \l
List of databases
Name Owner Encoding Collate Ctype Access privileges
-----------------------+-------------------+----------+---------+---------+---------------------------------
gitlabhq_production git UTF8 C.UTF-8 C.UTF-8
gitlab_mattermost git UTF8 C.UTF-8 C.UTF-8
gitlabhq_production=# \q
Dumping the databases and stop PostgreSQL. Maybe you need to adjust database names and users for your needs.
$ su postgres -c "pg_dump gitlabhq_production -f /tmp/gitlabhq_production.sql" && \
su postgres -c "pg_dump gitlab_mattermost -f /tmp/gitlab_mattermost.sql" && \
/etc/init.d/postgresql stop
Activate PostgreSQL shipped with Gitlab Omnibus
$ sed -i "s/^postgresql\['enable'\] = false/#postgresql\['enable'\] = false/g" /etc/gitlab/gitlab.rb && \
sed -i "s/^#mattermost\['enable'\] = true/mattermost\['enable'\] = true/" /etc/gitlab/gitlab.rb && \
gitlab-ctl reconfigure
Testing if the connection to the databases works
$ su - git -c "psql --username=gitlab --dbname=gitlabhq_production --host=/var/opt/gitlab/postgresql/"
psql (9.2.18)
Type "help" for help.
gitlabhq_production=# \q
$ su - git -c "psql --username=gitlab --dbname=mattermost_production --host=/var/opt/gitlab/postgresql/"
psql (9.2.18)
Type "help" for help.
mattermost_production=# \q
Ensure pg_trgm extension is enabled
$ sudo gitlab-psql -d gitlabhq_production -c 'CREATE EXTENSION IF NOT EXISTS "pg_trgm";'
$ sudo gitlab-psql -d mattermost_production -c 'CREATE EXTENSION IF NOT EXISTS "pg_trgm";'
Adjust permissions in the database dumps. Indeed please verify that users and databases might need to be adjusted too.
$ sed -i "s/OWNER TO git;/OWNER TO gitlab;/" /tmp/gitlabhq_production.sql && \
sed -i "s/postgres;$/gitlab-psql;/" /tmp/gitlabhq_production.sql
$ sed -i "s/OWNER TO git;/OWNER TO gitlab_mattermost;/" /tmp/gitlab_mattermost.sql && \
sed -i "s/postgres;$/gitlab-psql;/" /tmp/gitlab_mattermost.sql
(Re)import the data
$ sudo gitlab-psql -d gitlabhq_production -f /tmp/gitlabhq_production.sql
$ sudo gitlab-psql -d gitlabhq_production -c 'REVOKE ALL ON SCHEMA public FROM "gitlab-psql";' && \
sudo gitlab-psql -d gitlabhq_production -c 'GRANT ALL ON SCHEMA public TO "gitlab-psql";'
$ sudo gitlab-psql -d mattermost_production -f /tmp/gitlab_mattermost.sql
$ sudo gitlab-psql -d mattermost_production -c 'REVOKE ALL ON SCHEMA public FROM "gitlab-psql";' && \
sudo gitlab-psql -d mattermost_production -c 'GRANT ALL ON SCHEMA public TO "gitlab-psql";'
Make use of the shipped PostgreSQL
$ sed -i "s/^gitlab_rails\['db_/#gitlab_rails\['db_/" /etc/gitlab/gitlab.rb && \
sed -i "s/^mattermost\['sql_/#mattermost\['sql_/" /etc/gitlab/gitlab.rb && \
gitlab-ctl reconfigure
Now you should be able to connect to all the Gitlab services again.
Optionally remove the external database
apt-get remove postgresql postgresql-client postgresql-9.4 postgresql-client-9.4 postgresql-client-common postgresql-common
Maybe you also want to purge the old database content
apt-get purge postgresql-9.4
I wanted to write a more in-depth post about
RetroPie the Retro Gaming Appliance OS for Raspberry
Pis, either technically or more positively, but unfortunately I don't have much
positive to write.
What I hoped for was a nice appliance that I could use to play old games from
the comfort of my sofa. Unfortunately, nine times out of ten, I had a
malfunctioning Linux machine and the time I'd set aside for jumping on goombas
was being spent trying to figure out why bluetooth wasn't working. I have enough
opportunities for that already, both at work and at home.
I feel a little bad complaining about an open source, volunteer project: in its
defence I can say that it is iterating fast and the two versions I tried in a
relatively short time span were rapidly different. So hopefully a lot of my woes
will eventually be fixed. I've also read a lot of other people get on with it
just fine.
Instead, I decided the Nintendo Classic NES Mini was the plug-and-play
appliance for me. Alas, it became the "must have" Christmas toy for 2016 and
impossible to obtain for the recommended retail price. I did succeed in finding
one in stock at Toys R Us online at one point, only to have the checkout
process break and my order not go through. Checking Stock
Informer
afterwards, that particular window of opportunity was only 5 minutes wide. So
no NES classic for me!
My adventures in RetroPie weren't entirely fruitless, thankfully: I discovered
two really nice pieces of hardware.
The first is Lenovo's ThinkPad Compact Bluetooth Keyboard with
TrackPoint, a very
compact but pleasant to use Bluetooth keyboard including a trackpoint. I miss
the trackpoint from my days as a Thinkpad laptop user. Having a keyboard and
mouse combo in such a small package is excellent. My only two complaints would be
the price (I was lucky to get one cheaper on eBay) and the fact it's bluetooth
only: there's a micro-USB port for charging, but it would be nice if it could be
used as a USB keyboard too. There's a separate, cheaper USB model.
The second neat device is a clone of the SNES gamepad by HK company 8bitdo called
the SFC30. This looks and feels very much like the
classic Nintendo SNES controller, albeit slightly thicker from front to back. It
can be used in a whole range of different modes, including attached USB; Bluetooth
pretending to be a keyboard; Bluetooth pretending to be a controller; and a bunch
of other special modes designed to work with iOS or Android devices in various
configurations. The manufacturer seem to be actively working on firmware updates
to further enhance the controller. The firmware is presently closed source, but it
would not be impossible to write an open source firmware for it (some people have
figured out the basis for the official firmware).
I like the SFC30 enough that I spent some time trying to get it working for
various versions of Doom. There are just enough buttons to control a 2.5D
game like Doom, whereas something like Quake or a more modern shooter would not
work so well. I added support for several 8bitdo controllers directly into
Chocolate Doom (available from 2.3.0 onwards)
and into SDL2, a popular library for game development, which
I think is used by Steam, so Steam games may all gain
SFC30 support in the future too.
Next.