Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

2022-09-15

tmux resurrect

Why did I not know about this until now?

https://github.com/tmux-plugins/tmux-resurrect

It restores all windows, all panes, all ssh sessions.

2020-06-07

tmux black

tmux upgrade from 2.8 to 3.0...

# invisible separators
set-option -g pane-border-fg black
set-option -g pane-border-bg black
set-option -g pane-active-border-fg black
set-option -g pane-active-border-bg black

becomes

set -g pane-border-style bg=black,fg=black
set -g pane-active-border-style bg=black,fg=black

as mentioned in the changelog.

2014-09-06

Vagrantfile (this is just a bookmark)

This is my (thank you Abel) current Vagrantfile to quickly create a number of servers with two extra disks and three extra network cards:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
 config.vm.provider :virtualbox do |vb|
  vb.customize ["storagectl", :id, "--add", "sata", "--name", "SATA" , "--portcount", 2, "--hostiocache", "on"]
 end
 (1..3).each do |i|
  config.vm.define "server#{i}" do |node|
   node.vm.hostname = "server#{i}"
   node.vm.box = "hfm4/centos7"
   config.vm.box_check_update = true
   node.vm.network :public_network, ip: "10.1.1.#{i}", netmask: '255.255.255.0'
   node.vm.network :public_network, ip: "10.1.2.#{i}", netmask: '255.255.255.0'
   node.vm.network :public_network, ip: "10.1.3.#{i}", netmask: '255.255.255.0'
   config.vm.provider "virtualbox" do |v|
    v.name = "server#{i}"
    v.memory = 512
    v.cpus = 1
    v.customize ['createhd', '--filename', "server_#{i}a.vdi", '--size', 8192 ]
    v.customize ['createhd', '--filename', "server_#{i}b.vdi", '--size', 8192 ]
    v.customize ['storageattach', :id, '--storagectl', 'SATA', '--port', 1, '--device', 0, \
'--type', 'hdd', '--medium', "./server_#{i}a.vdi"]
    v.customize ['storageattach', :id, '--storagectl', 'SATA', '--port', 2, '--device', 0, \
'--type', 'hdd', '--medium', "./server_#{i}b.vdi"]
   end
  end
 end
end


2012-09-01

using bind to block domains

Is this bind usage a good way to block domains on a local network ?

root@gwen:/etc/bind# tail -2 named.conf.local
zone "facebook.com" { type master; file "/etc/bind/db.block"; };
zone "twitter.com" { type master; file "/etc/bind/db.block"; };

root@gwen:/etc/bind# cat db.block
$TTL 24h
@       IN SOA ns1.antwerp.local. paul.cobbaut.gmail.com. (
                  2012082800  86400  300  604800  3600 )
@       IN      NS   ns1.antwerp.local.
@       IN      A    127.0.0.1
*       IN      A    127.0.0.1

Or is there an obvious better solution ?

2012-07-27

Making sense of a serial connection to an ss4000 NAS


update: I consider the unit bricked and will donate it to an open source enthusiast.

I'm trying to make sense of this serial connection on my Intel ss4000 nas (a better picture can be seen here).
I found this dl10-db9 connector in an old computer, should be okay right ?
First problem is that this little cable fits in the pin header in two directions, so I have to figure out the correct way to insert it in the pin header.
The pin header has a whole in its casing on one side, and as far as I can tell from pictures on the internet the red line of this little cable should be on the right side, as in this picture:
I then connect this to a brand new serial cable into a real serial port on another Debian computer. All of the following commands give a blank screen when all cables are connected and the NAS is running(*).

cu -l /dev/ttyS0 -s 9600
cu -l /dev/ttyS0 -s 19200
cu -l /dev/ttyS0 -s 115200
cu -o -l /dev/ttyS0 -s 9600
cu -o -l /dev/ttyS0 -s 19200
cu -o -l /dev/ttyS0 -s 115200
screen -l /dev/ttyS0 9600
screen -l /dev/ttyS0 9600 8N1
screen -l /dev/ttyS0 19200
screen -l /dev/ttyS0 38400
screen -l /dev/ttyS0 115200

115200 should be the correct transfer rate.

If I connect the little cable with the red line on the left side (pin 9 of the header according to this blog) like in the below picture, then all of the above commands give me lots of garbage (at different speeds...) on the screen.
How can I get this serial connection to work ? Do I have to reboot the NAS with every attempt ?

(*) The NAS does not respond to ssh or ping since the last 'aptitude update && aptitude upgrade' :(

2012-07-15

switching backup devices

The sparc backup server from 2005 was up for a replacement. It was too noisy and too power hungry to keep it running, so it was turned off most of the time anyway. I decided yesterday to replace it with a qnap TS-412, but I wanted to keep the four sata disks, and preferably also the data.

One problem is that there is no way for four RAID5 configured disks to insert them into the qnap without them being "initialized" (as in completely erased losing all data).

First I wanted to be sure all four disks where still operational, which I couldn't do as long as the adaptec controller was in the sparc computer, so I had to move everything to an (already full) x86 machine... or not ?

Being a Linux user, I am generally lazy, so I figured it also had to work if I just moved the controller to the x86, leaving the disks in the sparc... not without risks:

1. the 64-bit pci card had to work in a 32-bit pci slot. Some don't... luckily this one did! The picture below shows the Adaptec controller in the x86 on the right, with the sata cables going through the back of the sparc to the four disks.

2. What to power on first, the x86 or the sparc ? Can something break if only the controller, or if only the disks have power ? I pressed both buttons simultaneously... was I lucky that it worked, or is this normal ?

3. The fricking sparc blade 1000 cover has to be shut tight for the sparc to actually power on. Note also the lack of any cables on the x86 (the left), except for the cat5. This computer has been working without keyboard or display since 2003... why bother when ssh and ssh -X can do everything!



4. Will the x86 (running debian) still come up when I add an extra scsi controller? Note that this x86 was installed with Debian ten years ago, and since then upgraded to $currentDebianToyStoryCharacter. It did make the RAID5 appear as /dev/sda, but thanks the UUID= in /etc/fstab it all worked fine!

root@barry:~# fdisk -l 2>/dev/null | grep Disk
Disk /dev/sda: 960.0 GB, 959994396672 bytes
Disk /dev/sdb: 60.0 GB, 60022480896 bytes
Disk /dev/sdd: 200.0 GB, 200049647616 bytes
Disk /dev/sdc: 82.0 GB, 81964302336 bytes


Everything worked, data was copied, disks inserted in the qnap and reformatted and all is up and running.

2012-04-04

about Loadays, a sore throat and a book

Yes, I was at Load (for the t-shirt) or at least my zombie-self was ;-)

Thanks to airco and teaching 8 or 8+4 hours a day for six days in a row I had lost my voice and sleep. Swallowing is painful with a sore throat, and for some reason the sorer the throat, the more one needs to swallow when trying to sleep :(

Anyway, the puppet tutorial at load was excellent! I tried following the Debian packaging talk from Wouter, but missed the start... and became way too exhausted.

In other news, Load saw the world premiere of a new book, more about this later, when I have a landing page set up for orders ;-)


2011-11-08

iSCSI mini howto

Some things in life, like iSCSI, are simple!
iSCSI is a protocol that allows you to have SCSI over IP.

The iSCSI Target

The host containing the physical hardware is called the iSCSI target and is easy to setup on Linux using iscsitarget.
aptitude install iscsitarget
aptitude install iscsitarget-dkms (Debian 6)

After enabling it in /etc/default/iscsitarget you can use files, hd devices, partitions, lvm volumes or software raid mdadm devices as 'physical hardware disks'
root@debby6:/etc/iet# cat ietd.conf
Target iqn.2010-02.be.linux-training:storage.lun1
IncomingUser isuser hunter2
OutgoingUser
Lun 0 Path=/iscsi/lun1.img,Type=fileio
Alias LUN1

Where /iscsi/lun1.img is a zeroed file created with
dd if=/dev/zero of=/iscsi/lun1.img count= bs=

Add the device to the allowed list:
root@debby6:/etc/iet# cat initiators.allow
iqn.2010-02.be.linux-training:storage.lun1

and start the server. You should see this:
root@debby6:/etc/iet# cat /proc/net/iet/session
tid:1 name:iqn.2010-02.be.linux-training:storage.lun1
The iSCSI Initiator

The host that connects to this target server is called the Initiator. Most Linux distros have this available as open-iscsi.
aptitude install open-iscsi

A discovery will show available devices on the target:
root@ubu1104:/etc/iscsi# iscsiadm -m discovery -t st -p debby6
192.168.1.31:3260,1 iqn.2010-02.be.linux-training:storage.lun2

Configuration with chap user and password takes a couple of commands:
root@ubu1104:/etc/iscsi# iscsiadm -m node --targetname "iqn.2010-02.be.linux-training:storage.lun1" --portal "debby6:3260" --op=update --name node.session.auth.authmethod --value=CHAP
root@ubu1104:/etc/iscsi# iscsiadm -m node --targetname "iqn.2010-02.be.linux-training:storage.lun1" --portal "debby6:3260" --op=update --name node.session.auth.username --value=isuser
root@ubu1104:/etc/iscsi# iscsiadm -m node --targetname "iqn.2010-02.be.linux-training:storage.lun1" --portal "debby6:3260" --op=update --name node.session.auth.password --value=hunter2

That's it! Now (re)start the open-iscsi service and use fdisk to see your iSCSI device.

2011-06-26

Bluetooth and NXT setup

A reminder for myself on how to configure bluetooth for NXT devices.

Turn on all devices and activate bluetooth on the Linux, then:
$ hcitool scan
Scanning ...
00:16:53:08:XX:XX Julie
00:16:53:0B:XX:XX Mercedes

Then configure /etc/bluetooth/rfcomm.conf like this:
$ cat /etc/bluetooth/rfcomm.conf
rfcomm0 {
bind yes;
device 00:16:53:0B:XX:XX;
channel 1;
comment "Mercedes";
}

rfcomm1 {
bind yes;
device 00:16:53:08:XX:XX;
channel 1;
comment "Julie";
}

Then check the binding (as root):
# rfcomm release all && rfcomm bind all && rfcomm
rfcomm0: 00:16:53:0B:XX:XX channel 1 clean
rfcomm1: 00:16:53:08:XX:XX channel 2 clean

Then create an nxt.dat file in ~ :
$ cat /home/paul/nxt.dat
BTH::JULIE=BTH::JULIE::00:16:53:08:XX:XX::5
BTH::MERCEDES=BTH::MERCEDES::00:16:53:0B:XX:XX::5

Then compile and download to the NXT:
nbc foo.nbc -O=bar.rxe
nbc -b -d -S=BTH::Julie bar.rxe

2011-06-17

post-ubuntu install

Packages installed after default ubuntu install (personal bookmark).
root@mac:~# history | grep 'aptitude install'
11 aptitude install nvidia-settings nvidia-bl-dkms \
pommed vim nfs-common wicd
45 aptitude install azureus wesnoth chromium-browser
104 aptitude install virtualbox-4.0
139 aptitude install wireshark wireshark-gnome
152 aptitude install gimp
173 aptitude install openssh-server
180 aptitude install pdfedit
201 aptitude install ttf-bitstream-vera
206 aptitude install unrar
219 aptitude install imagemagick
220 history | grep 'aptitude install'

2011-04-16

loadays talk

Some people convinced me to do a talk^Wtutorial tomorrow at loadays. It will be about bash!

Maybe I will use some slides from this downloadable pdf (50KB).

Content will come from the linux-training.be project (but that website stalled since February due to a redesign of our build-system). People that go to loadays can download the newest (1MB) pdf here.

LOAD, the Linux system administrator days

2010-07-03

Over vrije software, softwarepatenten en open standaarden

Wat is open source ?

Omdat Nederlands soms makkelijker is dan Engels, bespreken we eerst de Nederlandstalige termen vrije software, softwarepatenten en open standaarden.


Vrije Software

Vrije Software is letterlijk software die vrij is. Vrij te gebruiken, vrij te bestuderen, vrij te verspreiden en vrij aan te passen!

Vrij te gebruiken wil zeggen dat er geen beperkingen mogen zijn op het gebruik van de software. Iedereen is vrij om te kiezen waarvoor hij de software wil gebruiken. Als er beperkingen zijn op het gebruik van de software, dan is deze niet vrij.

Vrij te bestuderen wil zeggen dat iedereen de vrijheid moet hebben om naar de broncode te kijken om te begrijpen hoe de software werkt. Iedereen moet vrij kunnen spreken over de werking van de software. Als je software niet kan of mag bestuderen, dan is deze niet vrij.

Vrij te verspreiden wil zeggen dat je deze software mag doorgeven aan je buren en je vrienden. Als je software niet mag doorgeven aan anderen, dan is deze niet vrij. Als je verplicht bent een licentie te betalen, dan is de software niet vrij.

Vrij aan te passen wil zeggen dat de broncode beschikbaar moet zijn zodat je deze kan aanpassen, en wil ook zeggen dat je de software mag verspreiden met jou aanpassingen. Als je software niet kan of mag aanpassen, dan is deze niet vrij.

Voorbeelden van vrije software : Linux, Apache (de meest gebruikte webserver), Firefox, OpenOffice.org, Azureus, Battle for Wesnoth (een leuk spel!), en meer.

Bedrijven zoals Google en Facebook gebruiken bijna uitsluitend vrije software!

Opgepast: Je hebt niet zomaar het recht om een logo (Firefox bijvoorbeeld) of een trademark over te nemen en te verspreiden!
Opgepast: Heel wat vrije software eist dat je de naam van de auteurs (programmeurs) blijft vermelden! En GPL software eist dat aanpassingen die je wenst te verspreiden onder dezelfde GPL licentie vallen.




Softwarepatenten

Softwarepatenten zijn een heel gevoelig onderwerp. De strijd tegen softwarepatenten mag je vooral niet verwarren met een algemene strijd tegen patenten.

In Europa is er geen wettelijk kader voor softwarepatenten (softwarepatenten.be), maar dit weerhoudt grote bedrijven (IBM, Oracle, HP, Microsoft, ...) er niet van om massaal softwarepatenten te registreren. Sommige van deze patenten zijn verrassend triviaal; zowat elke website gebruikt tientallen softwarepatenten. Bijna alle software die er bestaat gebruikt wel enkele van de tienduizenden geregistreerde softwarepatenten.

Een van de grote nadelen van softwarepatenten is dat ze innovatie serieus tegenhouden. Je kan je als KMO immers niet verdedigen tegen een massa advokaten van de grote bedrijven die staan te zwaaien met softwarepatenten (met als gevolg dat je failliet gaat of wordt opgekocht).

Vroeger waren er geen softwarepatenten, en gelukkig maar! Stel je voor dat AT&T in 1970 in staat was geweest om software te patenteren, dan hadden we nu maar 1 besturingsysteem (Unix), en maar 1 officeapplicatie (vi) en 1 zoekmachine (find). Bedrijven als Google, Facebook of Microsoft zouden nooit kunnen bestaan hebben.

Vrije software valt niet te verzoenen met softwarepatenten (in de vorm dat ze vandaag bestaan in de USA).



Open Standaarden (en open formaten)

Open Standaarden zijn standaarden (noem het gerust talen, protocols of formaten) die voor iedereen beschikbaar zijn om te gebruiken. Een bekend voorbeeld hiervan is HTML. HTML is een standaard die er sinds 1993 voor zorgt dat we documenten op internet kunnen raadplegen. Iedereen mag een programma schrijven om HTML te lezen (Internet Explorer, Firefox, Google Chrome, Opera, ...). Een ander voorbeeld is PDF, een documentformaat dat ervoor zorgt dat het document er op elke computer hetzelfde uitziet (en identiek uit elke printer rolt). Ook al is PDF ontwikkeld door Adobe, de standaard is exact beschreven door Adobe en vrij te gebruiken.
Het grote voordeel van open standaarden is dat je onafhankelijk bent van een leverancier!

Het meest gekende tegenvoorbeeld van een open standaard is het formaat gebruikt door MS Office 95/98/2000/2003 (.doc .xls ...). Dit gesloten formaat is eigendom van Microsoft en enkel te openen met producten van Microsoft. Je kan als organisatie niet zelf een product schrijven dat deze documenten perfect kan gebruiken, want Microsoft wil niet vertellen hoe het .doc formaat in elkaar steekt.

Het grote nadeel van gesloten standaarden is dat je geen keuze hebt van leverancier. Indien je bedrijfsinformatie aangemaakt hebt met MS Office 2000, dan ben je afhankelijk van Microsoft om toegang te krijgen tot jou eigen gegevens.


Open Source

Als we nu terug gaan naar de Engelse taal, dan komen we een probleem tegen. De Nederlandse woorden gratis en vrij zijn duidelijk verschillend, maar worden in het Engels beide vertaald naar 'free'. Dit zorgt voor heel wat verwarring rond 'free software', mensen interpreteren het als gratis software, of erger nog, verwarren het met freeware.
Daarom spreken heel wat mensen van open source software (of gewoon open source), terwijl ze eigenlijk vrije software bedoelen.

2010-05-05

Girls and Androids

Na het lesgeven, maar voor het schaken nog effe op het Zuid de dames (met sacochen) goeiedag gezegd.

Met dank aan Clo voor de organisatie van de 27ste girlgeekdinner. Emich de android developer gaf een boeiende presentatie (incluis porno, dildroid, my day en de Brusselse STIB app). Dank ook aan Sony Ericsson voor de sponsoring en de gratis Xpedia X10!

2010-04-11

loadays

This weekend saw the first edition of loadays, and it was good!

Puppet was nicely introduced by Dan Bode. CFEngine was not technical enough, which is imho preferred by the loadays crowd over marketing. The bacula talk was also a bit a mix of marketing and technical content, but ok.

Tom De Cooman did an excellent talk on monitoring tools, good speaker!

On Sunday we had to do without Pieter Colpaert's bash 4.0 introduction (thanks for putting the slides online!). Toshaan introduced us to SELinux with a clear presentation, maybe lacking some examples (since there was time left). Network RPM was interesting, but probably not for me. The last talk I followed was a good overview of the lsc-project by Jonathan Clarke.

Next loadays, if the organizers permit it, I'll do a bash tutorial.

2010-02-16

Java jre performance (gcj vs Sun)

Generating a pdf from docbook xml using Apache fop like this:
fop -xml $xmlfile -xsl $XSLFILE -pdf $pdffile
takes about 40 seconds on Debian on an old Pentium 4.

But it takes 12-13 minutes on Debian inside Virtualbox on a Core 2 Duo ??

This difference too big to attribute to virtualization alone!!

fop uses java...
paul@deb503:/usr/lib/jvm$ ls -l

total 4.0K
lrwxrwxrwx 1 root root 8 2010-01-15 22:51 default-java -> java-gcj
drwxr-xr-x 5 root root 4.0K 2009-10-28 14:16 java-1.5.0-gcj-4.3-1.5.0.0
lrwxrwxrwx 1 root root 26 2009-10-28 14:16 java-gcj -> java-1.5.0-gcj-4.3-1.5.0.0


Let's try Java from Sun instead of java-gcj...

paul@deb503:~/lt$ ls -l /usr/lib/jvm/
total 8.0K
lrwxrwxrwx 1 root root 14 2010-02-16 12:17 default-java -> java-1.5.0-sun
drwxr-xr-x 5 root root 4.0K 2009-10-28 14:16 java-1.5.0-gcj-4.3-1.5.0.0
lrwxrwxrwx 1 root root 23 2010-02-16 12:15 java-1.5.0-sun -> java-1.5.0-sun-1.5.0.17
drwxr-xr-x 6 root root 4.0K 2010-02-16 12:15 java-1.5.0-sun-1.5.0.17
lrwxrwxrwx 1 root root 26 2009-10-28 14:16 java-gcj -> java-1.5.0-gcj-4.3-1.5.0.0


32 seconds!! What !? Yep, speed increase from 12-13 minutes to 32 seconds.

I double tested by putting the symlink back to java-gcj, it took 12'35" again!

I'm amazed ;-)

2010-02-04

Debian in a branded zone

Being in bed all day, I've been playing (just for fun, nothing serious) with Linux brandz zones on Solaris 10.

root@sol10u8 export# zoneadm -z debianzone boot
root@sol10u8 export# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
7 debianzone running /export/debianzone lx shared
- zoneldap installed /export/zoneldap native shared
- zonedns installed /export/zonedns native excl
- lx-zone installed /export/lx-zone lx shared
- zonejs configured /export/zonejs native shared
root@sol10u8 export#

Solaris 10 only supports 2.4 kernels.

debianzone:~# uname -a
Linux debianzone 2.4.21 BrandZ fake linux i686 GNU/Linux

The debianzone cannot connect to the internet. Ping to router/dns server works, with some strange (but not unexpected) messages:

debianzone:~# ping 192.168.1.1
WARNING: setsockopt(ICMP_FILTER): Protocol not available
Do you have CONFIG_SOCKET in your kernel?WARNING: your kernel is veeery old. No problems.
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=3.56 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=1.77 ms

Setting a route is not possible.

debianzone:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
debianzone:~# route add -net 127.0.0.0
SIOCADDRT: Invalid argument
debianzone:~# route add -net 192.168.1.0 dev eth0
SIOCADDRT: Invalid argument
debianzone:~# route add default gateway 192.168.1.1
SIOCADDRT: Invalid argument
debianzone:~#

On Opensolaris it seems to work, but not (yet?) on Solaris 10.

2009-11-14

teaching Linux System Administration

Yes it has been a long time since the last blogpost. Yes linux-training.be needs a lot of updates. But it has been a busy couple of months ;-)

Here's a picture of three happy students who were very eager to learn about system administration (and fundamentals). They kept me teaching from nine till six!

2009-09-11

Large Hadron Collider: take 2

Last year I was excited about the LHC, but it had an itch. It's supposed to be fixed now! Let the black holes come ;-)

(old but good pictures here)

2009-09-10

htc hero: My Tracks, cycling in Antwerp

I haven't blogged yet about my new phone running Android. I tried the My Tracks application again today, and it works flawlessly. Only the start is a bit slow, so you miss the first 100 meters of your trip. But that's normal for GPS applications I guess.

This My Tracks application can track via GPS where you go with the phone. I used it to create this Google map with my bicycle ride through Antwerp today.


View Cycling thru Antwerp in a larger map

I regularly tour the city like this. It brings back personal memories, and it proves to me again and again that Antwerp really is alive. (Check out Park Noord under the Noorderlaan for some cool live graffiti making!!)

Back to the phone... I like it! Integration with gmail and facebook works fine, battery lasts at least two days (even with lots of camera/filming and about two hours of gps usage). So I'll finish by mentioning the connectbot ssh application and the funny but useful flashlight app.

2009-08-11

resizing images for lazy people

One of my friends spent *five hours* yesterday resizing many pictures to 1280x1024. I told him to spend five *seconds* next time, running this script:

for i in *.JPG
do
convert -resize 1280x1024 $i 1280_$i
done

Five hours ? In five hours, anyone can learn to write little scripts.

Computers exist to automate things. Computers should do the repetitive work, not humans. Lazy humans take the time to learn how stuff works, so they can have fun while the computer does the work for them. I am a lazy human!