Thursday, February 9, 2017
Hard disk full on Ubuntu
You might see that /lib/modules contains gigabytes of files related to old kernel versions. How to remove them? The answer is here:
apt install --auto-remove
Tuesday, January 31, 2017
Migrate a WordPress blog into HubSpot
The situation was that the original blog had language variants in the form of http://blog.company.com/2017/... (without any language specified) for English and http://blog.company.com/ru/2017/... for other languages (in this case, "ru" for Russian).
Therefore, we process English blog items separately:
{ xmlstarlet ed -d '//item[not(contains(link,"blog.avast.com/20"))]' all.xml; echo ""; } > all-en.xml
Other languages are processed automatically with the help of a loop:
for L in cs de es fr it ja pl pt-br ru tr uk ; do export F=all-$L.xml; { xmlstarlet ed -d '//item[not(contains(link,"blog.avast.com/'$L'/"))]' all.xml; echo ""; } > "$F"; sed -r -i "s:(<link.*blog.avast.com/)$L/:\1:g" $F; done
There are redirects to be set up in the HubSpot settings so that the old URLs are still accessible and they will point to existing articles (new locations). This helps to maintain ranking in search engines and does not break links from other sites.
# english without a cycle
L="" perl -ne 'if(/^http:\/\/blog.avast.com(.*),http:\/\/avast.hs-sites.com(.*)$/ && not ($1 eq $2)) { print "$1,$2\n"}' > redirects-languages.txt
# other languages
for L in de it fr ru pl pt-br cs es; do
perl -ne 'if(/^http:\/\/blog.avast.com(.*),http:\/\/avast.hs-sites.com(.*)$/ && not ("/'$L'$1" eq $2)) { print "/'$L'$1,$2\n"}' >> redirects-languages.txt
done
One may have to deal with CDATA:
CDATA tag replace in ViM:
:%s#\(<script.*\)// <!\[CDATA\[#\1#
:%s#// \]\]\]\]><!\[CDATA\[></script>#</script>#
TAB T=1
URL GOTO=https://app.hubspot.com/content/486579/settings/url-mappings
TAG POS=1 TYPE=SPAN ATTR=CLASS:dropdown-target
TAG POS=11 TYPE=A ATTR=TXT:Delete
TAG POS=1 TYPE=A ATTR=ID:hs-fancybox-ok
With these commands, it was possible to migrate thousands of blog posts from WordPress into HubSpot.
Wednesday, February 19, 2014
badblocks: says it is not safe to run and stops
Symptoms:
When checking for bad blocks, following error is displayed:# badblocks -nvs /dev/sdb
/dev/sdb is apparently in use by the system; it's not safe to run badblocks!
Solution:
- Check the mounts (/etc/mtab), unmount with umount
- Check the swaps (/proc/swaps), unmount with swapoff
- Check volume groups (/dev/mapper/...), deactivate with vgchange -a n
Thursday, March 1, 2012
Dual screen in Ubuntu Unity/compiz
Start+P
Tuesday, November 8, 2011
dpkg -i ibm_lotus_notes_fixpack-8.5.2.i586.debTo circumvent this error, unpack the .deb archive with:
dpkg: error processing ibm_lotus_notes_fixpack-8.5.2.i586.deb (--install):
parsing file '/var/lib/dpkg/tmp.ci/control' near line 2 package 'ibm-lotus-notes-fixpack':
error in Version string '8.5.2-20110323.0837_FP2': invalid character in revision number
- dpkg-deb --extract
which extracts the files in the package. - dpkg-deb --control
which extracts the meta-data.
Fixed!
Monday, November 7, 2011
Encrypted Ubuntu filesystem on a logical volume (without alternate install)
My setup is what is usually called full-encryption (although I would not call it full, because the /boot partition is not encrypted and thus it can be backdoored by someone who has physical access to the machine). The root filesystem is located on a logical volume and encrypted (unlike in other setups and how-tos where the whole LVM is encrypted). The boot partition is on the /dev/sda3 partition; it can boot other systems where I do not want to install LVM support.
If a newly installed system does not boot after a reboot and drops out into a busybox shell, it can be because the initramfs is unable to find root partition to mount and boot the rest of the system. This is what I have done to finalize the installation:
1. Boot another system (e.g. Ubuntu from the installation media)
2. Open the new (encrypted) target Ubuntu root filesystem
(cryptsetup luksOpen /dev/vg/new cryptroot)Of course you have not given your volume group a name like "vg" and your logical volume the name "new". (If yes... Do you like that all volume groups on your and your friend's USB drives have the same name "vg"? And do you want to have a logical volume that is old for many years but it is called "new", because you do not want to rename it?)
3. Mount it
4. Mount the /boot partition.(mount /dev/mapper/cryptroot /mnt)
Change the device number accordingly. This is the unencrypted boot partition. Kernel image and initramfs (initrd) boot files are located here.(mount /dev/sda3 /mnt/boot)
5. Chroot to it
6. Install LVM and cryptsetup(chroot /mnt)
Once you install these packages, they will update the initramfs automagically. That is why it is important to have the boot partition mounted.(apt-get install lvm2 cryptsetup)
7. Edit the file /etc/default/grub and add kernel command line options
(GRUB_CMDLINE_LINUX="root=/dev/mapper/cryptroot cryptopts=source=/dev/vg/new")
so that after propagating the changes (update-grub) the generated grub configuration file (/mnt/boot/grub.cfg) has the line
(linux..... root=/dev/mapper/cryptroot cryptopts=source=/dev/vg/new)
You can omit the first option if root= option gets added automatically. You could omit the latter one (until 12/2011 in Ubuntu 11.10), but if the boot drops you to a" busybox initramfs shell" with an error that it cannot find /dev/mapper/cryptroot, this might be the useful.
8. Edit /etc/fstab
9. Enjoy!(/dev/mapper/cryptroot / ext3 errors=remount-ro 0 1)
You can comment and ask, maybe I forgot some steps that were also needed. Consider also encrypting swap.
Monday, June 20, 2011
Skype does not ring in Ubuntu
Solution: System -> Preferences -> Sound
Pull up the Alert volume like above.
Thanks goes to http://ubuntuforums.org/showpost.php?p=10084372&postcount=4
Tuesday, May 31, 2011
OpenVAS says 'login failed'
http://lists.wald.intevation.org/pipermail/openvas-discuss/2008-August/000732.html
"openvas-adduser" probably created the user directory in a different location (e.g. /usr/local/var/lib/openvas/) than the server is looking for it. It needs to moved to /var/lib/openvas.
Saturday, April 16, 2011
VirtualBox: Could not find an open hard disk with UUID
"One or more virtual hard disks, CD/DVD or floppy media are not currently accessible."
My virtual machine becomes inaccessible. Details show this error:
Could not find an open hard disk with UUID {5bad2863-64d0-40a2-a394-7442e3a6adc7}.
Result Code: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)
This happens when a snapshot is removed, then another snapshot is made and the host computer crashes (e.g. freezes during hibernation). After this, there is a reference to a non-existing HardDisk in the configuration file "~/.VirtualBox/VirtualBox.xml". This needs to be updated with the real value. The last working situation can be found in the log file (e.g. "~/.VirtualBox/Machines/<...>/Logs/VBox.log")
00:00:01.330 [/Devices/piix3ide/0/LUN#0/AttachedDriver/Config/] (level 6)
00:00:01.330 Format
00:00:01.330 Path
00:00:01.330 Type
00:00:01.330
00:00:01.330 [/Devices/piix3ide/0/LUN#0/AttachedDriver/Config/Parent/] (level 7)
00:00:01.330 Format
00:00:01.330 Path
00:00:01.330
00:00:01.330 [/Devices/piix3ide/0/LUN#0/AttachedDriver/Config/Parent/Parent/] (level 8)
00:00:01.330 Format
00:00:01.330 Path
This shows reliably the structure (the snapshot and its parents are listed), so it can be reconstructed by editing the XML file accordingly.
Tuesday, January 18, 2011
asm/io.h: No such file or directory
#include "asm/io.h"
Solution: Make a symlink asm -> asm-i386
Thursday, January 6, 2011
Fwd: firewire_core: Unsolicited response (external HDD drive & firewire)
MyBook connected through FireWire gets offline or has problems immediately after connecting:
Wednesday, November 24, 2010
How to download and compile mutt from source in Debian
- nebo stáhnout
apt-get build-dep mutt
- nainstaluje balíčky podle závislostí,
aby šlo instalovat source balík mutt
- kdyby to nešlo (chyba "Build-dependencies for rpm could not be satisfied"):
- přidat za příkaz: -o Debug::pkgProblemResolver=true
configure-optiony se dávají do debian/rules
dpkg-buildpackage -rfakeroot -us -uc
(dělal jsem to pod rootem, nevím, proč mi druhý pokus selhal - možná jsem neaplikoval patch, už ani nevím, kde se to provádí - z rozbaleného tar.gz se druhý pokus nepovedl)
* kam som dal prepínač --with:
do debian/rules
* v gdb:
v debian/:
echo decstation-ultrix >target
Monday, February 22, 2010
Dell Latitude volume keys under Debian
First, the keys need to be recognized. One can set the right keyboard model in /etc/default/console-setup:
XKBMODEL="latitude"Other options can be set also, e.g.:
XKBLAYOUT="us,cz"That ensures that keys are mapped to names like "XF86AudioMute". Names can be used in the menu file, where you put commands for alsamixer to rise/lower the volume. Your menu file could be named .menu/volume-keys (explained in "Debian menu system"):
XKBVARIANT=",qwerty"
XKBOPTIONS="lv3:ralt_switch,grp:alt_shift_toggle,grp:rwin_switch,grp:menu_toggle,grp_led:scroll"
?package(alsa): needs="X11" section="Apps/Sound/Xmms commands" \Run update-menus and refresh your window manager. Finished.
title="Master mute" \
shortcut="XF86AudioMute" \
longtitle="X MultiMedia System" \
command="amixer set Master toggle"
?package(alsa): needs="X11" section="Apps/Sound/Xmms commands" \
title="Master up" \
shortcut="XF86AudioRaiseVolume" \
longtitle="X MultiMedia System" \
command="amixer set Master 5%+"
?package(alsa): needs="X11" section="Apps/Sound/Xmms commands" \
title="Master down" \
shortcut="XF86AudioLowerVolume" \
longtitle="X MultiMedia System" \
command="amixer set Master 5%-"
By choosing the right keyboard model, following lines are applied, which should already be present somewhere in /usr/share/X11/xkb/symbols:
key{ [ XF86AudioMute ] };
key{ [ XF86AudioLowerVolume ] };
key{ [ XF86AudioRaiseVolume ] };
Saturday, June 13, 2009
Firefox displays blank Alert and ssl is disabled
During start, there was always a blank / empty Alert box. That was probably "Could not initialize the browser's security component."
Solution: Moved cert8.db file from another profile (you can also delete it).
Friday, March 6, 2009
WindowMaker launching another instance from dockbar
I have two xterm apps in the dockbar, one for a todo-list and one for "done" (aka knowledge base):
xterm -class UXTerm -title done -u8 -g 50x40 -e vim /z/txt/txtcvs/done -c $
xterm -class UXTerm -title todo -u8 -g 50x40 -e vim -O /z/txt/txtcvs/todo -S /z/.vim/todo-macros.vim
If xterm is running, it is impossible to launch "todo" without Ctrl. Or you can run more instances of e.g. Firefox by this...
Monday, March 2, 2009
nmap script engine aborting
Workaround: Download the tarball and copy nselib/ to /usr/share/nmap, as written here:
http://www.nabble.com/Bug-495054:-module-'comm'-not-found-td18980885.html
Wednesday, February 11, 2009
cron not running commands
# crontab /etc/crontab "/etc/crontab":16: bad minute errors in crontab file, can't install.
The problem was in splitting command into more lines using backslash \ at the end of each line.
Simple workaround: Put it on one line.
Do not forget also that the minute column is right to the hour column.
Wednesday, January 28, 2009
jUnit / jMock: error in opening zip file
[junit] java.util.zip.ZipException: error in opening zip file
[junit] at java.util.zip.ZipFile.open(Native Method)
[junit] at java.util.zip.ZipFile.(ZipFile.java:114)
[junit] at java.util.zip.ZipFile.(ZipFile.java:131)
[junit] at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:1028)
[junit] at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.findNextResource(AntClassLoader.java:147)
[junit] at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.(AntClassLoader.java:109)
[junit] at org.apache.tools.ant.AntClassLoader.findResources(AntClassLoader.java:975)
[junit] at java.lang.ClassLoader.getResources(ClassLoader.java:1016)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.checkForkedPath(JUnitTask.java:1126)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(JUnitTask.java:1013)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:834)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1785)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:785)
[junit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at java.lang.reflect.Method.invoke(Method.java:597)
[junit] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[junit] at org.apache.tools.ant.Task.perform(Task.java:348)
[junit] at org.apache.tools.ant.Target.execute(Target.java:357)
[junit] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[junit] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[junit] at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[junit] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[junit] at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
[junit] at org.apache.tools.ant.Main.runBuild(Main.java:758)
[junit] at org.apache.tools.ant.Main.startAnt(Main.java:217)
[junit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
[junit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Solution:
Use
<path id="classpath.run.tests">
<pathelement location="." />
</path>
instead of
<path id="classpath.run.tests">
<fileset dir=".">
<include name="*.class" />
</fileset>
</path>
The explanation.
Monday, March 26, 2007
Splitting vim vertically
Thursday, March 22, 2007
CVS overwrites $Revision, $Id in my data
It modified my mails undesirably, where "$Revision" or "$Id" occurred.
Solution: cvs import -ko
I typed
cvs import -ko -m "Imported all files" z/rp z start, where the option -ko turns all substitions off.More in http://ximbiot.com/cvs/manual/cvs-1.12.13/cvs_12.html#SEC102

