Thursday 12 December 2013

How to add an administrator to IPMI interface

[root@olsnba08 ~]# modprobe ipmi_devintf
[root@olsnba08 ~]# ipmitool user list 1
ID  Name      Callin  Link Auth IPMI Msg   Channel Priv Limit
1                    false   false      true       ADMINISTRATOR
2   root             false   true       true       ADMINISTRATOR
3   test1            false   false      true       ADMINISTRATOR
4   test2            false   false      true       ADMINISTRATOR
5   test3            false   false      true       ADMINISTRATOR
6   gbitzes          true    true       true       ADMINISTRATOR

[root@olsnba08 ~]# ipmitool user set name 7 admin
[root@olsnba08 ~]# ipmitool user set password 7
Password for user 7: 
Password for user 7: 
[root@olsnba08 ~]# ipmitool channel setaccess 1 7 link=on ipmi=on callin=on privilege=4
[root@olsnba08 ~]# ipmitool user enable 7

Wednesday 13 November 2013

How to see content of a package under Linux

For an rpm file not yet installed:
rpm -qlp /path/to/file.rpm
For a package that is already installed: Red Hat:
repoquery -lq package_name
Ubuntu, Debian:
dpkg-query --listfiles package_name

Thursday 31 October 2013

BMC is in FW Transfer Mode

This is a message that I get when trying to remotely update the BIOS on Jefferson Pass systems equipped with Intel S2600JF mother boards and Intel E5-2690 Sandy Bridge CPUs. The solution is to do BMC cold reset using ipmi and wait for 30 seconds:
ipmitool mc reset cold
If IPMI kernel module happens not to be loaded, then load it with this command:
modprobe ipmi_devintf

Friday 30 August 2013

How to compare two directory trees

When you want to see which files differ without further details:
diff -qr path/1/ path/2/
With a separate diff for each differing file:
diff -r path/1/ path/2/

Cheers.

Tuesday 13 August 2013

How to find out the number of global variables in a binary

nm your-binary-file | grep '[0-9A-Fa-f]* [BCDGRS]' |cut -d ' ' -f 3 | grep -ve '__.*' | grep -v @@ | wc -l

Thursday 30 May 2013

How to install a network printer at CERN under Ubuntu

Installing a driver at CERN is kind of a puzzle, unless you run Windows or SLC. Unfortunately there are no tutorials how to do that. This is why I came up with the following, somewhat hackerish, solution:
  1. Install packages libnet-ldap-perl and cups on your system using apt-get
  2. Download the lpadmincern RPM package.
  3. Unpack it.
  4. Replace inside lpadmincern.pl
    my $cupsc='/sbin/service cups reload';
    with
    my $cupsc='/usr/sbin/service cups reload';
  5. Replace
  6. $command="LC_ALL=C /usr/sbin/lpadmin -p $prt->{printerName} -L \"$prt->{location}\" -D \"$prt->{description}\" -v $uri $duplex $media -o printer-is-shared=false -E";
    with
    $command="LC_ALL=C /usr/sbin/lpadmin -p $prt->{printerName} -L \"$prt->{location}\" -P $prt->{ppdfile} -D \"$prt->{description}\" -v $uri $duplex $media -o printer-is-shared=false -E";
    Apparently this got replaced in the meanwhile.
  7. install libnet-ldap-perl
  8. Find your desired printer at CERN printing service
  9. Move the whole directory to /usr/share/lpadmincern, otherwise it would complain about a missing directory.
  10. Run
    perl lpadmincern.pl --add [your-printer-name-here]