I am using the
unison in Ubuntu 14.04 (Unison 2.40) in my Windows Subsystem for Linux-supplied Ubuntu 16.04 (which updated the package to Unison 2.48) because my server is running Unison 2.40, and I forgot that an
apt upgrade will replace the
.deb I downloaded from the 14.04 repository with whatever is in 16.04.
When I tried to do a
unison sync, I got an error.
How do you put a package "on hold" in Ubuntu? It's easy.
First I removed the "new" unison:
$ sudo apt remove unison
Then I installed my "old" one (which I had previously downloaded from the Ubuntu archive):
$ sudo dpkg -i unison_2.40.102-2ubuntu1_amd64.deb
Now I put the package "on hold":
$ sudo apt-mark hold unison
Here is the output now for
sudo apt update:
$ sudo apt upgrade [sudo] password for steven: Reading package lists... Done [sudo] password for steven: Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages have been kept back: unison 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
After a Windows 10 update hosed my laptop and took the Ubuntu/Bash command line (aka the Windows Subsystem for Linux) and all of my scripts along with it, I restored Windows 10 from the laptop's backup partition, and activated the Windows Subsystem for Linux (aka WSL).
This time around I got Ubuntu 16.04 rather than 14.04, which is overall better because there are some really, really old packages in 14.04, including a super-old
nodejs. Unfortunately, the old
unison in 14.04 matched what is on my server (and
unison versions across computers must match, or they don't work).
Luckily I was able to download a 14.04 package from the Ubuntu archive and install it in the 16.04-powered WSL. I restored my scripts, including one I made that is very WSL-specific: It takes all of the files in a Windows directory (usually images, sometimes text documents, but it could be anything), copies them into a working directory in the WSL and uses
chmod to change their permissions to 644. That way I can download images while in the web browsers of the Windows world, create text files, working on all of them with Windows tools, and then transfer those files into the Linux side, where I can sync them to the server's filesystem with
Aside: It's not impossible to get a Unix-style
ssh program that works from the Windows command line, but it's not at all easy, either. That makes the Windows version of Unison less than useful for working with remote servers.
Now I have scripts in the WSL to:
unisonto sync files and then reindex the blog via Ode's Indexette
curlto bring the html down to the laptop, then copying it into the local Ode filesystem, and then syncing with the server via
I have a feeling I've written about most of these scripts before, and if/when I find those entries, I will link them here. If not (or if there have been updates), I will write them up in the near future.
Why Unison? Unison is a file-synchronization tool. While files can be synced from one system to another with
rsync, which I use for backups, the situation with this Ode blog is different. Anthor way to synchronize two filesystem is to use
git, the version-control tool.
unison enables me to do is make changes locally, or on the server, and then reconcile those changes across both systems. So if I write or edit a post on my local filesystem, or make any kind of change on the server, running
unison ensures that I have the latest files (and versions of files) on both filesystems. If I used rsync, making changes on the server but running
rsync on the client wouldn't work.
Git would be great, except that it only reconciles changes in the filesystem that have been checked in. Changes on the server are generally not checked in, and even if I scripted that on the server, Ode (through its Indexette and EditEdit addins) itself makes changes to the filesystem and doesn't check them in. So
git wouldn't work.
I came up with
unison because it's the easiest. Another alternative
csync2 looks a lot harder to figure out. But I do recommend
csync2 if you're doing something heavy-duty with more than 2 servers.
When I started looking for this kind of tool, I knew what I needed was a kind of Dropbox for servers. I'm sure there are people who have hacked
Dropbox to work on a non-GUI server. Actually that would be a pretty good solution.
The difference with
unison is that you have to "consciously" run it to sync the two filesystems. You could run it as a cron job, or somehow set it up as a daemon (which might be how Dropbox works), but for the purposes of this particular blog, syncing when needed works fine.
Using the WSL has provided me the opportunity for the first time in quite a while, to set up
unison. It's a great thing to run
unison -batch and have the entire blog filesystem copied to an empty directory on my laptop in about a minute. (And then any changes I make on either laptop or server can be synced with another
unison -batch, or just
unison for a more interactive session. Plus, never underestimate software you can install yourself, on your own computers, and use as you wish. I pay for my shared-hosting service, but otherwise I run whatever software I wish without paying any monthly fees for any of it.
Are there other ways to keep two or more filesystems in sync? I'd sure like to know if there were.
In my Linux systems over the last many years, I've gravitated toward Geany and Gedit, mostly using Geany, and using the terrific Notepad++ on Windows.
Now that I am using the Windows Subsystem for Linux (aka Bash command line supplied by Ubuntu), I have the full range of editors available in the Linux console. For whatever reason or reasons, I'm not an emacs person, and I'm not afraid of modal editing, so Vim it is.
This gives me the opportunity to really learn Vim. Already I'm figuring out things in Vim's
command mode, like
w taking you from word to word and stopping on the first letter of each word, with
e doing the same except stopping on the last letter.
command mode gets you to the top of a file, and
G (and also
L) gets you to the top of the final line.
G$ gets you to the end of the final line.
x deletes a single character,
dw deletes a word,
dd deletes an entire line and
d$ deletes from the cursor to the end of the line.
It's nothing like a "standard" GUI editor, but a lot of it falls right under the fingers. While I have used an adm3a terminal, it's been long enough that I didn't know the reason for using the
esc key to change from insert to command mode was the placement of the
esc key on the adm3a -- where the "modern" tab would be.
To make it easier to change modes, I don't want to remap
esc but could try remapping
caps lock as
esc, or using
esc alternatives. Thus far it doesn't look like remapping
caps-lock in the WSL is all that easy.
I ran Fedora from F18 through 25 and never had a problem getting my laptop to boot and run. But in my first month as a Windows 10 user, an upgrade has already hosed my laptop, causing me to restore it to its original state and reinstall my applications.
I'm not sure what the update was supposed to do, only that it was big and would require a lot of time and a number of reboots.
After a bunch of those reboots and a lot of time, I was left with a black screen and a cursor. That's it.
I could ctrl-alt-del and get a prompt to shut down, but I couldn't do anything else. I think the updates "broke" the video driver.
So since I only had a month "invested" in the OS, I could have wiped the entire thing and put Fedora on the laptop. But I decided to give Windows 10 another chance. I liked having the Ubuntu command line, even though it was the ancient 14.04 instead of 16.04. And I had my blog set up to deploy from that Bash command line.
I opted to reinstall the system and keep my user files, which is one of the options available on this HP Envy laptop. I assume it's the same (or nearly so) on most PCs. There is a "restore" partition that contains a copy of the original OS files, and that is what is used to reinstall the system software.
That operation took a long time, but at the end of it I had a working Windows 10 laptop once again. All of my user files were intact. But as promised, my applications were all gone. I did get a handy HTML list of them, mostly with links to the project web sites. However, I did have the install files for all of them in my Downloads file, and all I had to do was reinstall.
I did lose lots of configuration files.
I still have Vim and Gvim WITH configuration files because I elected to use the binaries from my Downloads file and not "install" them the usual Windows way. So when my laptop came back, the only application icons on my desktop were
In a more grim note, the Windows Subsystem for Linux, aka the Ubuntu command line, aka the Bash command line, is NOT in any user account, nor are the files I created in Bash. That means when I did the reinstall I lost the WSL and everything in it. Pro tip: Back up your WSL files!!
I can re-create what I did in the WSL, though I won't be happy about it. And I have no idea if the laptop now has the update that broke it yesterday, or if it's coming down the pike in the days or weeks ahead. I'm certainly not going to go to the Windows Update screen and click anything that reads "update now," or whatever it says.
I have heard about this black screen issue here and there, but it doesn't seem to be widespread enough to cause any kind of massive panic. And while I'm sure there is some slick way to fix what was broken, I couldn't figure that out, and doing the restore (while keeping my user files) was the quickest, easiest way to get going.
And to elaborate on what I say at the top, if you "keep your nose clean" in Linux, meaning not try to use proprietary video drivers or do anything stupid with dodgy packages, it's pretty hard to unknowingly kill a working Linux installation. I thought the same was true for Windows, but now I know otherwise.
Update: I reinstalled the Windows Subsystem for Linux, and this time I got Ubuntu 16.04 and along with it a much newer
node.js (good because 14.04's hella old) and a newer
Unison (not so good because now I have to find this same version for the CentOS server I use to host this site). The Unix gods, they giveth, they taketh.
Caveat Emptor: Windows 10 is not a beta, but the Windows Subsystem for Linux is. Back up everything. All the time.
Windows Subsystem for Linux and Unison update: My "old" WSL was Ubuntu 14.04, which has Unison 2.40.102 in its repository. I have Unison 2.40.102 on my CentOS server, so that worked out. Unison requires the same version on both "sides" (i.e both servers/computers) to work. My "new" WSL is Ubuntu 16.04, and that offers Unison 2.48.3.
My choices were to a) get Unison 2.48.3 for CentOS 6, or attempt to compile it on the server (or a CentOS 6 desktop, which I don't have) or b) find Unison 2.40.102 for Ubuntu 14.04.
I thought that it would be easier to compile on the server. I got the source of Unison 2.48.3, but I ran into problems pretty quickly because I needed a newer
ocaml. I was already getting in the weeds.
So I switched gears. Could I download a
.deb package from the Ubuntu repository into the WSL and install it?
I got the Unison 2.40.102 from the Ubuntu 14.04 repository. Then I used
apt to remove the Ubuntu 16.04 version of Unison.
Then I used
dpkg -i to install the
.deb. I ran
unison -version. It was working, and provided the output I wanted: Unison 2.40.102.
$ wget http://mirrors.kernel.org/ubuntu/pool/universe/u/unison/unison_2.40.102-2ubuntu1_amd64.deb $ sudo apt remove unison $ sudo dpkg -i unison_2.40.102-2ubuntu1_amd64.deb $ sudo apt-mark hold unison $ unison -version
I had already restored my
.prf file in the
.unison directory (I call it ode.prf to sync this blog), and I ran the command I use for the first sync when all the files are on the server and none on my laptop:
$ unison ode -batch
-batch switch lets
unison sync all of the files without asking you to OK every single one.
I love that I can get a new computer, or start a new directory and use
Unison to mirror what's on the server. More on
Unison in my next post.
As I experiment with the Windows Subsystem for Linux (aka the Bash shell provided by Ubuntu for Windows 10), I am trying to figure exactly what I can and can't do.
To that end, I created a file with Vim in the WSL. Then I tried to open it with a text editor in Windows. I get this popup that says I can't do it:
In case you're not seeing the image above (and because Google), the Error dialog reads:
Error saving file.
Error renaming temporary file: Permission denied
The file on disk may not be truncated!
I also tried to use the Windows file manager to drop the above image, created in Windows, into the WSL portion of the disk. That file "shows" in the Windows file manager, but it doesn't appear at all in the Bash shell. I had to use Bash to copy it from the Windows side to the WSL/Linux side: That's what works, in case you were wondering.
I really need an easy drag/drop between Windows and the WSL ...
Update: This issue is addressed in a very interesting bug report with a lot of links I need to explore.
Also, in the image file I copied from Windows into Bash on Windows (as Microsoft seems to like to call it), the .jpg file was too wide open on permissions. It was 777, and I wanted 644. I made the change in Bash and am syncing with the server.
Update: While it seems fairly easy and routine to create and edit files on the Windows side of the filesystem using both Windows and WSL/Linux applications, when I tried to use the WSL-based Unison to sync files onto the Windows filesystem, I got a ton of permission errors and a failed sync. So the "dream" of maintaining a Windows system with WSL utilities probably won't happen. The two solutions for this particular problem are a) use Windows utilities on the Windows side and b) use Linux utilities on the WSL side.
The original entry begins here:
Now that I have my new HP Envy 15-as133cl laptop running Windows 10 and have added the Windows Subsystem for Linux, I'm exploring just how many of my regular Linux tasks I can do in this Ubuntu-supplied Bash shell, what I can do with similar programs compiled for Windows, and what really needs a dedicated Linux partition (or full computer).
The first thing I learned about the Windows Subsystem for Linux (WSL for short) is that you can access the files you create in the WSL via the Windows file manager, but any modifications you make on the Windows side will not, I repeat WILL NOT be reflected in what you can see on the Linux side.
I'm not in Windows 8 so often (except for the past two days) that on the rare occasions when I do load it up I am at all happy to wait a half-hour or more for the machine to shut down because it's downloading and installing dozens of updates.
I turned automatic updates off. When I have time, I'll boot into Windows 8 and do the updates manually.
In an attempt to get a handle on Windows 8 performance on this hardware, I installed SpeedFan 4.49.
Quick tip. Avoid crapware and get the download here.
SpeedFan isn't pretty, but it works well. I can monitor CPU, GPU and disk temperatures. It also keeps an eye on GPU voltage, CPU frequency, battery charge state, uptime and CPU load.
SpeedFan can also manually adjust your fan speeds. I'm not interested in that so much, but I thought I'd throw it out there.
In case you're wondering, Windows 8 doesn't run any cooler on this HP Pavilion g6 than Fedora 20 with either the proprietary Catalyst driver or the open Radeon driver with Radeon DPM activated.
(I used a digital camera to capture the screen images of my Windows boot failure and subsequent 8.1 upgrade failure so you can share in my pain before reading below how I fixed what Microsoft broke)
So I figured I'd upgrade the Windows 8 portion of my Windows/Fedora dual-booting (and naturally EFI-running) system to the presumably shinier, newer Windows 8.1 with the offer of an upgrade via the Microsoft Store.
Big fucking mistake.
I go into Windows 8 and do the upgrade. It tells me at some point that "there will be several reboots."
The first reboot was the last. Windows would no longer boot. (Luckily Fedora continued to boot during this whole nightmare.) When I tried to start Windows 8, I got a blue-screen error with the code 0xc000000f.
I went into Recovery Mode via the BIOS.
The automatic repair didn't work. Then I went to Advanced Options, then to the Windows command prompt, to start trying hacks.
The easy hacks didn't work.
In the course of my day job, I use Windows 7 all day. I have really nice Lenovo desktop hardware with a nice AMD processor and lots of RAM. Windows 7 is fairly solid. It's not Linux, but when compared to Windows XP, it's a world and a half better.
So is Windows 8 better than Windows 7? I still dual-boot Windows 8 on my laptop, a newish HP Pavilion g6 with an AMD CPU and enough RAM to be comfortable.
The Metro interface is distracting, looks terrible and doesn't add to productivity. In a keyboard-mouse environment, it's hard to know what to do to make Metro (or whatever it's called now) do what I want. It's not intuitive.
The desktop portion of Windows 8 seems much like Windows 7. That is good.
I'm not saying I'm a Luddite. And I'm not saying I'm not. But there's nothing in Windows 8 that makes me say, "this is better."
There are so many things wrong with the Windows model from the perspective of a user who prefers Linux (currently Fedora, though I'm thisclose to moving to Debian or Xubuntu), but when it comes to basic functionality, I can get along fairly well in Windows 7. Windows 8? I can't believe it's gone on this long.