Yesterday I was working on several things, but needed to interrupt my stuff. So
I came up with this little piece of code I put in my .xinitrc. It checks
if the file remindme.txt exists and than checks, if it has any content. To
display my notes I use xmessage. The content of remindme.txt is plain
text.
if [[ -e remindme.txt ]]; then
test `wc -l remindme.txt | cut -d' ' -f1` -gt 0 && \
xmessage -geometry 320x400+1600+17 -file remindme.txt &
fi
When I now login and my window manager starts, it also displays my notes.
Short and quick!
Update #1: Forgot to enable comments…
Update #2: Made a screenshot earlier, but forgot to upload it…
It's the time of the your were I need to study for my upcoming exams. After I've noticed, that I am doing complete bullshit like 20 - 5 = 5, I decided to do something to relax. I'm pretty good in relaxing in front of my computer, and here I am and also something useful - oh my pizza arrived, brb. During the last week, my IP address changed and I where unable to access my NAS from outside. This was part one on my todo list, the second and final part was to figure out why Ubuntu doesn't ask for two passwords for my two encrypted partitions.
When you call a server your own, where you have full control of the Bind configuration and wanted to have your own dynamic DNS for your home IP address, this is might for your interest.
The easiest way is:
# dnssec-keygen -a <alg> <name> # e.g.: $ dnssec-keygen -a HMAC-MD5 home.foo-bar.com
Two file will be genereted, a
K<name>+<alg>+<id>.key
and
K<name>+<alg>+<id>.private
Open one of these files or use cat to get the output. If you opened the file
.key, you take the last column, the string often ends with ==, if you
opened the file .private you copy the string for Key:.
EXAMPLE0SEcr3tString00==
or your named.conf.local, or where ever you keep track of your different zones.
I'll demonstrate with a small example what changes you should make.
At first define the key, your client uses to authenticate:
key "home.foo-bar.com" {
algorithm hmac-md5;
secret "EXAMPLE0SEcr3tString00==";
};
After that you need to update the zone configuration for foo-bar.com. For
example the section looks something like this:
zone "foo-bar.com" {
type master;
file "db.foo-bar.com";
allow-transfer {
10.0.1.1;
common-allow-transfer;
};
};
You need to insert an update-policy1).
zone "foo-bar.com" {
type master;
file "db.foo-bar.com";
allow-transfer {
10.0.1.1;
common-allow-transfer;
};
update-policy {
grant home.foo-bar.com name home.foo-bar.com. A;
};
};
As a short conclusion for the update-policy syntax, the first parameter
grant allows use to update, if the rest of the rule matches. The second
parameter is our key we defined above, the third is a matching rule. I'm
using the full domain name to check, You should have a look at the Bind
documentation to see the other options. name is followed by the matching
name and the last one is the type, 'A', 'CNAME', or 'TXT'2).
After everything is setup you need to reload your Bind DNS server.
$ rndc reload
Your Bind is now configured.
I came up with the idea using my DNS server to manage my dynamic address, while scrolling through the OpenWRT Kamikaze package list, and so I gave it a try.
Edit your /etc/ipupdate.conf:
server "ns.foo-bar-com"
{
zone "foo-bar.com"
{
hosts "home"
keyname "home.foo-bar.com"
keydata "EXAMPLE0SEcr3tString00=="
}
}
Now, execute ipupdate
$ ipudate getconfig: loading '/etc/ipupdate.conf' Detected IP: 10.00.100.200
You also should see a success message. Sorry but I haven't copied it, but you'll
recognize, when it is successful. Otherwise you'll see some errors.
If you check in your Bind directory, (e.g.: /var/cache/bind) you should see a
file named home.foo-bar.com.jnl. After 15 minutes the changes will be merged
with your db.foo-bar.com zone file.
You can start ipupdate as daemon.
$ ipupdate start
If also installed a cronjob to check every 24h, if an update is needed.
59 23 * * * /usr/sbin/ipupdate
I've updated to Xubuntu 9.04 recently and using encrypted LVM to secure my
stuff. After I've set up a second partition encrypted with cryptsetup and hooked it
up in my LVM. Ubuntu didn't ask for two passwords
during boot. I can remember using Debian using with two encrypted partitions and
putting the entries into your /etc/crypttab and updating the initrd's was
enough to get asked twice during boot. Ubuntu seems
to fail at this point. In this chapter I'll want to show you how I've solved
this problem, for now. This solution isn't automated, yet, and using
update-initramfs overwrites the changes.
With Ubuntu it unlocks my root partition and trying
to bring up all volumes of my volume group. At this point boot will fail,
because one of the volumes is encrypted separately. After a
minute,Ubuntu will drop you to a fail-over console. At
the (initramfs) prompt I needed to unlock my second partition and hit
Ctrl+D to resume to normal boot.
Extract the initrd of your current kernel:
$ mkdir /tmp/initrd-$(uname -r) $ cd /tmp/initrd-$(uname -r) $ gzip -dc /boot/initrd.img-$(uname -r) | cpio -id
Open the file conf/conf.d/cryptroot and add a separate line with your second
device. You should know your UUIDs for this. Here is mine, after I've edited it.
target=sdc1_crypt,source=/dev/disk/by-uuid/56fc9490-4afd-484f-9574-640bec210fe1,key=none,lvm=goat-root target=sdd1_crypt,source=/dev/disk/by-uuid/f6b68c07-ad87-46a6-8602-94889c1233b8,key=none,lvm=goat-home target=sdc1_crypt,source=/dev/disk/by-uuid/56fc9490-4afd-484f-9574-640bec210fe1,key=none,lvm=goat-swap_1I've added the line starting with
sdd1_crypt.
To complete the setup we need to pack the initrd back together. Make a backup of your old initrd.img first!
$ cd /tmp/initrd-$(uname -r) $ find ./ | cpio -H newc -o | gzip -c > initrd.img-$(uname -r) $ cp initrd.img-$(uname -r) /boot/
You now should be asked twice for a password, or more, if you have more devices added.
Hi guys and girls reading this blog entry. Today I've encountered a strange problem with one of my partitions. My debian is unable to mount /boot, but it boots up normally, just /boot isn't avaible.
The strange thing is. It's still there - why I believe this?! It's simple. Grub loads my kernel and initrd image from /dev/sdd1. During boot it gets mounted into /boot. Having a look at /dev shows me:
goat:~% ls /dev/sdd* /dev/sdd /dev/sdd5
A listing of the partition table shows this:
Partition Table for /dev/sdd
First Last
# Type Sector Sector Offset Length Filesystem Type (ID) Flag
-- ------- ----------- ----------- ------ ----------- -------------------- ----
1 Primary 0 498014 63 498015 Linux (83) Boot
2 Primary 498015 976768064 0 976270050 Extended (05) None
5 Logical 498015 976768064 63 976270050 Linux (83) None
As you can see, it's real and the files should be there too:
goat:~% cat /dev/sdd | strings -n 10 head Loading stage1.5 /grub/stage2 /grub/menu.lst GRUB loading, please wait... internal error: the second sector of Stage 2 is unknown. \~t)G;wXc{E) gD9AM_:VET lost+found System.map-2.6.30-rc5g-newwk vmlinuz-2.6.30-rc5-2.6.28.8-goat.new initrd.img-2.6.28.8-goat
I really wonder what the problem is. Trying to insert the missing device through kpartx, also fails:
goat# kpartx -v -l /dev/sdd sdd1 : 0 497952 /dev/sdd 63 sdd2 : 0 976270050 /dev/sdd 498015 sdd5 : 0 976269987 sdd1 63 goat# kpartx -v -a /dev/sdd device-mapper: reload ioctl failed: Invalid argument add map sdd1 (0:0): 0 497952 linear /dev/sdd 63 device-mapper: reload ioctl failed: Invalid argument add map sdd2 (0:0): 0 976270050 linear /dev/sdd 498015 device-mapper: reload ioctl failed: Invalid argument add map sdd5 (0:0): 0 976269987 0:0 63Something goes wrong with the device-mapper
goat# dmesg|tail device-mapper: table: 253:10: mirror: Device lookup failure device-mapper: ioctl: error adding target to table device-mapper: table: 253:10: mirror: Device lookup failure device-mapper: ioctl: error adding target to table device-mapper: table: 253:10: linear: dm-linear: Device lookup failed device-mapper: ioctl: error adding target to table device-mapper: table: 253:10: linear: dm-linear: Device lookup failed device-mapper: ioctl: error adding target to table device-mapper: table: 253:10: linear: dm-linear: Device lookup failed device-mapper: ioctl: error adding target to table
During boot I recognized similar messages, but instead of dm-linear it's called dm-mirror.
If you have any ideas fixing this, please leave me a message. Thank you!
Update: The Problem seems to be resolved. Don't know what the cure was. I've just removed some packages and switched back to sysvinit:
[INSTALL] sysvinit [REMOVE] upstart [REMOVE] upstart-compat-sysv [REMOVE] upstart-logd [REMOVE] gparted [REMOVE] libdmraid1.0.0.rc15 [REMOVE] libparted1.8-10 [REMOVE] parted
When you ever tried to loop over a file listing with filenames containing SPACES, you will get into trouble, because for splits its arguments on those SPACES.
for foo in `ls -1`; do echo $foo doneThis will print a list of one word per line.
for foo in `ls -bQ1`; do echo $foo doneThis looks promising, because of the
-b and -Q switch. -b will escape non-visible characters and -Q quotes the results, but even this attempt will fail with the same problem.
Here is my solution to avoid this problem.
ls -b1 | while read filename; do echo "$filename" donePassing the ls output to a while loop through a pipe will make it possible to process files with
SPACES in its name.
Here is my example to use this and where I've encounterd this problem. I've tried to move some audio files into sub-folders named by the album-tag of the file.
ls -b1 *.flac | while read filename; do echo ">>> Processing file: $filename" album="" flac -t "$filename" 2>/dev/null [[ $? -eq 0 ]] && album=$(metaflac --show-tag=album "$filename" | cut -d'=' -f2) if [ "$album" != "" ]; then album=$(echo $album | strings) echo "[ ] Album: $album" mkdir -p "$album" mv "$filename" "$album" echo "<<< $filename moved." else echo "[!] ERROR on file: $filename" fi done
Update: demod came up with a solution for doing it with a for-loop. (Thanks)
for foo in *; do echo "$foo" doneWhich is much easier to read. For aboves usage example we replace
ls -b1 *.flac | while read filename; dowith a much shorter
for filename in *.flac; do
If some of you have tried to access my site in the past few days, may have noticed some things not working properly. I have moved to a new server. This time it is a vserver hosted by http://www.hosteurope.de. I liked my old server, but we need it for some important tasks and I don't want to interfere with my stuff. I also moved both goatpr[o0]n.de domains to this new host. In the past they were hosted at http://www.liberty-hosting.de/. I liked it, especially the support! But I wanted to have everything packed together, so I needed to move. A third domain including webspace, is also about to move. But the host isn't very friendly, didn't answer on support mails and so on, but I need to write them a email again. I cannot recommend http://www.xpservices.de. Everything should be back at normal.