úterý 3. září 2024

override ownership of mounted filesystem

 According to How can I mount a filesystem, mapping userids? :

I need to mount image file and share the content in the samba tree.

The thus, I need to remap original "user" to local user "nobody".

 

 

apt install  bindfs
root# mount -o ro /dev/loop1 /mnt/1 
root# bindfs -u nobody -g nogroup --map=user/nobody /mnt/1 /data/samba/tree/mountpoint

pátek 9. srpna 2024

Ansys 57 on 64-bit Debian 12 Bookworm

1. copy old installation tree

2. try it it runs:

 ~$ /ansys_inc/ansys57/bin/xansys57
bash: /ansys_inc/ansys57/bin/xansys57: cannot execute: required file not found

or:

 ~$ LM_LICENSE_FILE=1057@server /ansys_inc/ansys57/bin/ansys57 < inputfile.inp

If this works, change the variable definition: setenv ANSYSLIC_DIR /ansys_inc/ansys57
in /ansys_inc/ansys57/bin/anscript57.ini
and create the license file

echo SERVER=1057@server > /ansys_inc/ansys57/ansyslmd.ini 

3. add missing binaries

# apt install ncompress tcsh
# dpkg --add-architecture i386
# apt-get update
# apt install libc6-i386

ldd command lists missing libraries:

# ldd /ansys_inc/ansys57/bin/linuxia32/xans.e57
....
# apt-get install   libxi6:i386
# apt-get install   libxt6:i386
# apt-get install   libxpm4:i386
# dpkg -L  libxpm4:i386
# ln -s /usr/lib/i386-linux-gnu/libXpm.so.4.11.0 /usr/lib/i386-linux-gnu/libXp.so.6

# The Motif library libXm.so.2 is included in the original tree in a rpm file: extract libraries from

/ansys_inc/ansys57/syslib/OPENMOTIF/openmotif-2.1.30-2_ICS.i386.rpm
/ansys_inc/ansys57/syslib/MESA/Mesa-3.2-1rh61.i386.rpm

into /ansys_inc/ansys57/syslib/linuxia32 folder and create symlink:

cd /ansys_inc/ansys57/syslib/linuxia32
ln -s libXm.so.2.1 libXm.so.2

goto 2.

ansys 2024 "error while loading shared libraries: libXp.so.6: cannot open shared object file" (Debian 12 Bookworm)

ANSYS 2024R1, R2 does not start after installation due to missing libraries:

error while loading shared libraries: libXp.so.6: cannot open shared object file:

actually, the library is present in the installed tree

/ansys_inc/v242/ansys/syslib/ubuntu/libXp.so.6.2.0 

 

The ANSYS startup script anssh.ini adds the correct path to the LD_LIBRARY_PATH only when it detects Ubuntu OS. The check is done by 

grep Ubuntu /etc/os-release

So that it is sufficient to add a line to that file (yes, it is a dirty hack)

echo '# fake id to fool Ansys: Ubuntu' >> /etc/os-release

pátek 8. března 2024

add text to the first page of a PDF file

 1. crop pdf files 

pdfcrop --margins '-30 -30 -10 -20' input.pdf output.odf

margins: left, top, right, bottom


2.

string="this is a string"
tmpfile=$(mktemp) && echo $string | \
enscript -M a4 --margins=::0: -B -f Courier-Bold8 -o- | \
ps2pdf - "$tmpfile" && \
qpdf input.pdf --overlay "$tmpfile" -- output.pdf && \
rm -f  "$tmpfile" 

enscript --margins=left:right:top:bottom

úterý 7. listopadu 2023

remote logging to rsyslog

 

#enable remote access (mind also the firewall)

# provides UDP syslog reception
  module(load="imudp")
  input(type="imudp" port="514")
  
 # provides TCP syslog reception
  module(load="imtcp")
  input(type="imtcp" port="514")

#redirect all expernal traffic to dedicated file

$template remote-incoming-logs,"/var/log/remote/%HOSTNAME%.log"
  :inputname, isequal, "imudp" ?remote-incoming-logs
  :fromhost-ip , !isequal , "127.0.0.1" stop

 

Further reading: here

úterý 10. října 2023

LVM - replace 2-disk LV by a large single drive

The original LV named data/bigdata consists of two separate drives: /dev/sdc1 (6T) and /dev/sdd1 (5T) .

I would like to replace these two disks by the 12T single drive (/dev/sde).

The standard way is using the pvmove commnad. However, I opted to use mirroring approach.

  •  Create mirror:

    pvcreate /dev/sde1
    vgextend data /dev/sde1
    lvconvert --type mirror  -m 1 /dev/data/bigdata 

    lvs -a -o name,copy_percent,devices data

    lvs --all --segments -o +devices

  • remove old disks from the mirror
    lvconvert -m0 data/bigdata /dev/sdc1 /dev/sdd1

Now there is 1PE free space between two segments on /dev/sde1

[root@server ~]# pvs --segments -v
  PV         VG     Fmt  Attr PSize    PFree   Start   SSize   LV      Start   Type   PE Ranges
/dev/sdc1  data   lvm2 a--    <5.46t   <5.46t       0 1430791             0 free
/dev/sdd1  data   lvm2 a--    <4.55t   <4.55t       0 1192326             0 free
/dev/sde1  data   lvm2 a--    10.91t  <5.46t       0 1430791 bigdata      0 linear /dev/sde1:0-1430790
/dev/sde1  data   lvm2 a--    10.91t  <5.46t 1430791 1                    0 free
/dev/sde1  data   lvm2 a--    10.91t  <5.46t 1430792 1192326 bigdata      0 linear /dev/sde1:1430792-2623117


to remove the free space, move  the second segment from /dev/sde1 to the old drive, and than back to /dev/sde1

pvmove /dev/sde1:1430792-2623117 /dev/sdc1
pvmove /dev/sdc1 /dev/sde1

[root@server ~]# pvs --segments -v
  PV         VG     Fmt  Attr PSize    PFree    Start   SSize   LV      Start Type   PE Ranges
/dev/sdc1  data   lvm2 a--    <5.46t   <5.46t       0 1430791             0 free
/dev/sdd1  data   lvm2 a--    <4.55t   <4.55t       0 1192326             0 free
/dev/sde1  data   lvm2 a--    10.91t <929.45g       0 2623117 bigdata     0 linear /dev/sde1:0-2623116
/dev/sde1  data   lvm2 a--    10.91t <929.45g 2623117  237938             0 free

This way the two segments join without further conditions.

pvdisplay -m /dev/sde1
lvs --all --segments -o +devices data
lvs -a -o name,copy_percent,devices datapvs --segments -v