How to view the section layout info recorded in an ELF file? - ld

Suppose the following linker script is used to layout an executable file.
SECTIONS
{
. = 0x10000;
.text : { *(.text) }
.data : { *(.data) }
.bss : { *(.bss) }
}
OUTPUT_FORMAT(ELF)
My questions are:
I think such layout info must be stored in the output ELF file so the loader can load the executable based on that info. Right?
If 1 is true, how to view such layout info in a ELF? objdump?

I think such layout info must be stored in the output ELF file so the loader can load the executable based on that info. Right?
ELF stands for executable and linking format.
The .text, .data etc. are part of the linking format. While they usually are present in the fully-linked binary, they can be stripped.
The info that the loader needs to load the executable is stored as a table of segments (Elf{36,64}_Phdr[]).
If 1 is true, how to view such layout info in a ELF? objdump?
You can examine segments (and, if the optional section table is present, the mapping of sections to segments) with readelf -Wl a.out.

You can deduce the information from the linker command script by taking a look at the output of the -S option in readelf.
$ readelf -S $(which ls)
There are 28 section headers, starting at offset 0x1f6f8:
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .interp PROGBITS 0000000000400238 00000238
000000000000001c 0000000000000000 A 0 0 1
[ 2] .note.ABI-tag NOTE 0000000000400254 00000254
0000000000000020 0000000000000000 A 0 0 4
[ 3] .note.gnu.build-i NOTE 0000000000400274 00000274
0000000000000024 0000000000000000 A 0 0 4
[ 4] .gnu.hash GNU_HASH 0000000000400298 00000298
0000000000000104 0000000000000000 A 5 0 8
[ 5] .dynsym DYNSYM 00000000004003a0 000003a0
0000000000000c48 0000000000000018 A 6 1 8
[ 6] .dynstr STRTAB 0000000000400fe8 00000fe8
0000000000000582 0000000000000000 A 0 0 1
[ 7] .gnu.version VERSYM 000000000040156a 0000156a
...
If you want to know where this comes from, take a look at the default linker command scripts for your toolchain; this default is used if you did not explicitly create your own. I think there may be some inheritance between them as well, but I can't say for certain.
$ ls -l /usr/lib/ldscripts/ | grep elf
-rw-r--r-- 1 root root 9027 Mar 22 04:05 elf32_x86_64.x
-rw-r--r-- 1 root root 8880 Mar 22 04:05 elf32_x86_64.xbn
-rw-r--r-- 1 root root 8706 Mar 22 04:05 elf32_x86_64.xc
-rw-r--r-- 1 root root 9024 Mar 22 04:05 elf32_x86_64.xd
-rw-r--r-- 1 root root 8720 Mar 22 04:05 elf32_x86_64.xdc
-rw-r--r-- 1 root root 8680 Mar 22 04:05 elf32_x86_64.xdw
-rw-r--r-- 1 root root 9027 Mar 22 04:05 elf32_x86_64.xn
-rw-r--r-- 1 root root 5443 Mar 22 04:05 elf32_x86_64.xr
-rw-r--r-- 1 root root 8551 Mar 22 04:05 elf32_x86_64.xs
-rw-r--r-- 1 root root 8247 Mar 22 04:05 elf32_x86_64.xsc
-rw-r--r-- 1 root root 8207 Mar 22 04:05 elf32_x86_64.xsw
-rw-r--r-- 1 root root 5489 Mar 22 04:05 elf32_x86_64.xu
-rw-r--r-- 1 root root 8666 Mar 22 04:05 elf32_x86_64.xw
-rw-r--r-- 1 root root 8396 Mar 22 04:05 elf_i386.x
-rw-r--r-- 1 root root 8249 Mar 22 04:05 elf_i386.xbn
-rw-r--r-- 1 root root 8209 Mar 22 04:05 elf_i386.xc
-rw-r--r-- 1 root root 8389 Mar 22 04:05 elf_i386.xd
-rw-r--r-- 1 root root 8219 Mar 22 04:05 elf_i386.xdc
...

I searched a bit and found something.
For 1. According ELF format on wikipedia, there are program headers that record the address layout info.
For 2. readelf is a promising tool.

Related

My symbol column file size in partitioned table is unusually large -- why would that be?

I've just built my first proper q/kdb+ database with splayed and partitioned tables. Everything is going fine, but I just noticed that my symbol s column file size is unusually large. Here is what I can see from the OS and from inside q:
# ls -latr 2017.10.30/ngbarx
total 532
-rw-r--r-- 1 root root 24992 Apr 17 20:53 vunadj
-rw-r--r-- 1 root root 24992 Apr 17 20:53 v
-rw-r--r-- 1 root root 300664 Apr 17 20:53 s
...
q)meta ngbarx
c | t f a
------| -----
date | d
s | s p
v | e
vunadj| e
...
q)get `:2017.10.30/ngbarx/s
`p#`sym$`A`AA`AACG`AADI`AADR`AAIC`AAIC-B`AAL`AAM-A`AAMC`AAME`AAOI`AAON`AAP`AA..
q)-22!get `:2017.10.30/ngbarx/v
24990
q)-22!get `:2017.10.30/ngbarx/s
28678
q)all (get `:2017.10.30/ngbarx/s) in sym
1b
q)count sym
62136
So comparing the real-type v column with the symbol-type s column, I see from ls that the symbol column is more than 10x the size, even though the internal size in bytes is similar and everything seems properly encoded in the sym file.
Is this expected behavior? Or am I doing something wrong that could be fixed?
UPDATE: I have not used compression, and have written the files using the magical function .Q.dcfgnt, which can be viewed here. Well, a slightly modified version, I noticed that this function as is also saved a date file in the directory, even though the column should be virtual, so I did some hacking in k (I'm not very good at it) and updated the inner function .Q.dpfgnt to this ...
k){[d;p;f;g;n;t]if[~&/qm'r:+en[d]t;'`unmappable];
{[d;g;t;i;x]#[d;x;g;t[x]i]}[d:par[d;p;n];g;r;<r f]'{x#&~x=`date}(!r);
#[;f;`p#]#[d;`.d;:;f,r#&~f=r:{x#&~x=`date}(!r)];n}
Applying the parted attribute is not free and requires storage. It is usually not that costly but looking at your sample output of s, it doesn't look suitable for parting as does not contain repeating values:
q)get `:2017.10.30/ngbarx/s
`p#`sym$`A`AA`AACG`AADI`AADR`AAIC`AAIC-B`AAL`AAM-A`AAMC`AAME`AAOI`AAON`AAP`AA..
See below tables created to illustrate the issue:
/ no part - 16 distinct syms
t1:([]s:100000?`1;v:100000?2e)
/ part - 16 distinct syms
t2:update `p#s from `s xasc ([]s:100000?`1;v:100000?2e)
/ no part - 99999 distinct syms
t3:([]s:100000?`8;v:100000?2e)
/ part - 99999 distinct syms
t4:update `p#s from `s xasc ([]s:100000?`8;v:100000?2e)
The difference in size is insignificant between t1 and t2 with the parted attribute(804096 -> 804664). However, when the number of distinct syms / parts becomes very large, the storage cost is very large. (804096 -> 4749872)
ls | xargs ls -latr
t1:
total 1180
-rw-r--r-- 1 matmoore matmoore 12 Apr 19 10:28 .d
-rw-r--r-- 1 matmoore matmoore 804096 Apr 19 10:28 s
-rw-r--r-- 1 matmoore matmoore 400016 Apr 19 10:28 v
drwxr-xr-x 1 matmoore matmoore 4096 Apr 19 10:28 .
drwxr-xr-x 1 matmoore matmoore 4096 Apr 19 10:28 ..
t2:
total 1180
-rw-r--r-- 1 matmoore matmoore 12 Apr 19 10:28 .d
-rw-r--r-- 1 matmoore matmoore 804664 Apr 19 10:28 s
-rw-r--r-- 1 matmoore matmoore 400016 Apr 19 10:28 v
drwxr-xr-x 1 matmoore matmoore 4096 Apr 19 10:28 .
drwxr-xr-x 1 matmoore matmoore 4096 Apr 19 10:28 ..
t3:
total 1180
-rw-r--r-- 1 matmoore matmoore 12 Apr 19 10:28 .d
-rw-r--r-- 1 matmoore matmoore 804096 Apr 19 10:28 s
-rw-r--r-- 1 matmoore matmoore 400016 Apr 19 10:28 v
drwxr-xr-x 1 matmoore matmoore 4096 Apr 19 10:28 .
drwxr-xr-x 1 matmoore matmoore 4096 Apr 19 10:28 ..
t4:
total 5032
-rw-r--r-- 1 matmoore matmoore 12 Apr 19 10:28 .d
drwxr-xr-x 1 matmoore matmoore 4096 Apr 19 10:28 ..
-rw-r--r-- 1 matmoore matmoore 4749872 Apr 19 10:28 s
-rw-r--r-- 1 matmoore matmoore 400016 Apr 19 10:28 v
drwxr-xr-x 1 matmoore matmoore 4096 Apr 19 10:28 .
I would also question if this column should be a symbol. If 62k is the size of your sym file with just one date created then you should be careful that you are going to end up creating a bloated sym file. If you have a full history from 2017.10.30 and the sym file is still 62k, then it's fine but if you are adding that many new symbols each day, the sym file will quickly spiral out of control.

Search in MacMail

I am running OS X 10.11.6 and MacMail 9.3 can not search my emails.
I 'rebuilt' my mailboxes and rebuilt my SpotLight indexes.
MacMail always reports 'Zero matches for search'.
Spotlight is saving in 'Store-V2', while the 'Envelope' indexes are in 'V3'.
What could be wrong?
$ pwd
/Users/davidlaxer/Library/Mail/V3/MailData
(base) MacBook-Pro:MailData davidlaxer$ ls -lrt Env*
-rwxr-xr-x# 1 davidlaxer staff 86241280 May 10 10:31 Envelope Index
-rwxr-xr-x# 1 davidlaxer staff 32768 May 10 11:20 Envelope Index-shm
-rwxr-xr-x# 1 davidlaxer staff 1512072 May 10 11:46 Envelope Index-wal
$ sudo du -g /.Spotlight-V100/
Password:
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.assisted_import_post
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.assisted_import_pre
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.corespotlight
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.health_check
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live_priority
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live_system
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live_user
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.migration
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.migration_secondchance
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.scan
14 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039
14 /.Spotlight-V100//Store-V2
14 /.Spotlight-V100/
sudo ls -lRt /.Spotlight-V100/
total 8
drwx------ 3 root wheel 102 May 5 08:27 Store-V2
-rw------- 1 root wheel 4001 May 5 08:27 VolumeConfiguration.plist
/.Spotlight-V100//Store-V2:
total 0
drwx------ 119 root wheel 4046 May 10 11:50 CD1CE8CA-B264-41BC-909A-ACD3AE66F039
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039:
total 28512848
-rw------- 1 root wheel 261361664 May 10 11:51 .store.db
-rw------- 1 root wheel 6554 May 10 11:51 live.4.indexGroups
-rw------- 1 root wheel 65536 May 10 11:51 live.4.indexIds
-rw------- 1 root wheel 7452 May 10 11:51 journalAttr.153
-rw------- 1 root wheel 4614377 May 10 11:50 0.indexGroups
drwx------ 3 root wheel 102 May 10 11:50 journals.health_check
-rw------- 1 root wheel 4096 May 10 11:50 0.indexHead
-rw------- 1 root wheel 4096 May 10 11:50 tmp.spotlight.state
drwx------ 3 root wheel 102 May 10 11:46 journals.assisted_import_pre
-rw------- 1 root wheel 62 May 10 11:45 live.1.indexGroups
-rw------- 1 root wheel 616 May 10 11:45 live.1.indexIds
-rw------- 1 root wheel 4096 May 10 11:45 live.1.indexHead
-rw------- 1 root wheel 33554432 May 10 11:29 0.directoryStoreFile
-rw------- 1 root wheel 4194304 May 10 11:29 live.0.directoryStoreFile
-rw------- 1 root wheel 4096 May 10 11:29 live.0.indexHead
-rw------- 1 root wheel 65536 May 10 11:29 live.1.directoryStoreFile
-rw------- 1 root wheel 1048576 May 10 11:29 live.3.directoryStoreFile
-rw------- 1 root wheel 4096 May 10 11:29 live.3.indexHead
-rw------- 1 root wheel 65536 May 10 11:29 live.4.directoryStoreFile
-rw------- 1 root wheel 33554432 May 10 11:29 reverseDirectoryStore
-rw------- 1 root wheel 4096 May 10 11:29 live.4.indexHead
-rw------- 1 root wheel 25952256 May 10 11:29 0.directoryStoreFile.shadow
-rw------- 1 root wheel 4614377 May 10 11:29 0.shadowIndexGroups
-rw------- 1 root wheel 4096 May 10 11:29 0.shadowIndexHead
-rw------- 1 root wheel 28 May 10 11:29 indexState
drwx------ 3 root wheel 102 May 10 11:29 journals.assisted_import_post
drwx------ 3 root wheel 102 May 10 11:29 journals.live_system
drwx------ 3 root wheel 102 May 10 11:29 journals.live_user
-rw------- 1 root wheel 2752512 May 10 11:29 live.0.directoryStoreFile.shadow
-rw------- 1 root wheel 1144320 May 10 11:29 live.0.shadowIndexGroups
-rw------- 1 root wheel 4096 May 10 11:29 live.0.shadowIndexHead
-rw------- 1 root wheel 5952 May 10 11:29 live.1.directoryStoreFile.shadow
-rw------- 1 root wheel 62 May 10 11:29 live.1.shadowIndexGroups
-rw------- 1 root wheel 4096 May 10 11:29 live.1.shadowIndexHead
-rw------- 1 root wheel 786432 May 10 11:29 live.3.directoryStoreFile.shadow
-rw------- 1 root wheel 45288 May 10 11:29 live.3.shadowIndexGroups
-rw------- 1 root wheel 4096 May 10 11:29 live.3.shadowIndexHead
-rw------- 1 root wheel 17664 May 10 11:29 live.4.directoryStoreFile.shadow
-rw------- 1 root wheel 0 May 10 11:29 live.4.indexUpdates
-rw------- 1 root wheel 8388608 May 10 11:29 live.4.shadowIndexArrays
-rw------- 1 root wheel 1456 May 10 11:29 live.4.shadowIndexCompactDirectory
-rw------- 1 root wheel 19532 May 10 11:29 live.4.shadowIndexDirectory
-rw------- 1 root wheel 2932 May 10 11:29 live.4.shadowIndexGroups
-rw------- 1 root wheel 4096 May 10 11:29 live.4.shadowIndexHead
-rw------- 1 root wheel 2501400 May 10 11:29 live.4.shadowIndexPositionTable
-rw------- 1 root wheel 2501400 May 10 11:29 live.4.shadowIndexTermIds
-rw------- 1 root wheel 31719424 May 10 11:29 reverseDirectoryStore.shadow
-rw------- 1 root wheel 33 May 10 11:29 reverseStore.updates
-rw------- 1 root wheel 261361664 May 10 11:29 store.db
-rw------- 1 root wheel 3 May 10 11:29 store.updates
-rw------- 1 root wheel 8388608 May 10 11:29 live.4.indexArrays
-rw------- 1 root wheel 2048 May 10 11:29 live.4.indexCompactDirectory
-rw------- 1 root wheel 32896 May 10 11:29 live.4.indexDirectory
-rw------- 1 root wheel 4194304 May 10 11:29 live.4.indexPositionTable
-rw------- 1 root wheel 16777216 May 10 11:29 live.4.indexPositions
-rw------- 1 root wheel 8388608 May 10 11:29 live.4.indexPostings
-rw------- 1 root wheel 4194304 May 10 11:29 live.4.indexTermIds
-rw-r--r-- 1 root wheel 4 May 10 11:29 shutdown_time
-rw------- 1 root wheel 1144320 May 10 11:20 live.0.indexGroups
-rw------- 1 root wheel 11443200 May 10 11:20 live.0.indexIds
-rw------- 1 root wheel 45288 May 10 10:41 live.3.indexGroups
-rw------- 1 root wheel 452880 May 10 08:54 live.3.indexIds
-rw------- 1 root wheel 19262912 May 10 08:50 live.3.indexArrays
-rw------- 1 root wheel 4022314 May 10 08:50 live.3.indexCompactDirectory
-rw------- 1 root wheel 460544 May 10 08:50 live.3.indexDirectory
-rw------- 1 root wheel 31 May 10 08:50 live.3.indexUpdates
-rw------- 1 root wheel 35174385 May 10 08:50 live.3.indexPositions
-rw------- 1 root wheel 9377717 May 10 08:50 live.3.indexPostings
-rw------- 1 root wheel 65536 May 10 08:16 live.2.directoryStoreFile
-rw------- 1 root wheel 4096 May 10 08:16 live.2.indexHead
-rw------- 1 root wheel 1792 May 10 08:16 live.2.directoryStoreFile.shadow
-rw------- 1 root wheel 4 May 10 08:16 live.2.shadowIndexGroups
-rw------- 1 root wheel 4096 May 10 08:16 live.2.shadowIndexHead
-rw------- 1 root wheel 5937408 May 10 08:16 live.1.indexArrays
-rw------- 1 root wheel 732628 May 10 08:16 live.1.indexCompactDirectory
-rw------- 1 root wheel 722684 May 10 08:16 live.1.indexDirectory
-rw------- 1 root wheel 17 May 10 08:16 live.1.indexUpdates
-rw------- 1 root wheel 1332150 May 10 08:16 live.1.indexPositions
-rw------- 1 root wheel 381040 May 10 08:16 live.1.indexPostings
-rw------- 1 root wheel 3277 May 10 08:16 live.2.indexGroups
-rw------- 1 root wheel 2112 May 10 08:15 live.2.indexArrays
-rw------- 1 root wheel 8 May 10 08:15 live.2.indexCompactDirectory
-rw------- 1 root wheel 2056 May 10 08:15 live.2.indexDirectory
-rw------- 1 root wheel 32 May 10 08:15 live.2.indexIds
-rw------- 1 root wheel 704 May 10 08:15 live.2.indexPositionTable
-rw------- 1 root wheel 704 May 10 08:15 live.2.indexTermIds
-rw------- 1 root wheel 4096 May 10 08:15 live.2.indexPostings
-rw------- 1 root wheel 13 May 10 08:15 live.2.indexUpdates
-rw------- 1 root wheel 4096 May 10 08:15 live.2.indexPositions
-rw------- 1 root wheel 116111616 May 10 06:55 live.0.indexArrays
-rw------- 1 root wheel 16341676 May 10 06:55 live.0.indexCompactDirectory
-rw------- 1 root wheel 7297772 May 10 06:55 live.0.indexDirectory
-rw------- 1 root wheel 125 May 10 06:55 live.0.indexUpdates
-rw------- 1 root wheel 233745118 May 10 06:55 live.0.indexPositions
-rw------- 1 root wheel 92373248 May 10 06:55 live.0.indexPostings
-rw------- 1 root wheel 46143768 May 9 17:44 0.indexIds
drwx------ 3 root wheel 102 May 8 15:29 journals.live_priority
-rw------- 1 root wheel 814959 May 8 15:29 tmp.spotlight.loc
-rw------- 1 root wheel 1863674176 May 7 15:28 0.indexArrays
-rw------- 1 root wheel 421591410 May 7 15:28 0.indexCompactDirectory
-rw------- 1 root wheel 32731520 May 7 15:28 0.indexDirectory
-rw------- 1 root wheel 1815 May 7 15:28 0.indexUpdates
-rw------- 1 root wheel 9492016397 May 7 15:21 0.indexPositions
-rw------- 1 root wheel 1462613059 May 7 15:21 0.indexPostings
drwx------ 3 root wheel 102 May 7 14:10 journals.scan
-rw------- 1 root wheel 0 May 5 08:27 Cab.created
-rw------- 1 root wheel 0 May 5 08:27 Lion.created
-rw------- 1 root wheel 0 May 5 08:27 journalAttr.1
-rw------- 1 root wheel 0 May 5 08:27 journalExclusion
drwx------ 2 root wheel 68 May 5 08:27 journals.corespotlight
drwx------ 2 root wheel 68 May 5 08:27 journals.live
drwx------ 2 root wheel 68 May 5 08:27 journals.migration
drwx------ 2 root wheel 68 May 5 08:27 journals.migration_secondchance
-rw-r--r-- 1 root wheel 4 May 5 08:27 store_generation
-rw------- 1 root wheel 0 May 5 08:27 tmp.Cab
-rw------- 1 root wheel 0 May 5 08:27 tmp.Lion
-rw------- 1 root wheel 0 May 5 08:27 tmp.SnowLeopard
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.health_check:
total 0
-rw------- 1 root wheel 0 May 10 11:50 retire.10586
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.assisted_import_pre:
total 0
-rw------- 1 root wheel 0 May 10 11:46 retire.155623
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.assisted_import_post:
total 0
-rw------- 1 root wheel 0 May 10 11:29 retire.372
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live_system:
total 0
-rw------- 1 root wheel 0 May 10 11:29 retire.359623
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live_user:
total 0
-rw------- 1 root wheel 0 May 10 11:29 retire.970891
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live_priority:
total 0
-rw------- 1 root wheel 0 May 8 15:29 retire.272870
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.scan:
total 0
-rw------- 1 root wheel 0 May 7 14:10 retire.5816751
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.corespotlight:
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live:
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.migration:
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.migration_secondchance:
The directory ~/Library/Metadata/CoreSpotlight/ was missing.
/private/var/folders had directories owned by a non-existent user.
Clearly, the disk cloning had issues.
The solution was to do a clean reinstall the OS and use the migration assistant.

Using configmap make container keep creating directories

I am using configmaps to populate configuration of few services. One container though is having a weird behavior. Several directories are created upon instanciation and then new ones every 2 minutes:
0 drwxr-xr-x 4 root root 90 Feb 15 14:45 ..2982_15_02_14_45_49.335148891
0 drwxr-xr-x 4 root root 90 Feb 15 14:45 ..2982_15_02_14_45_52.091968736
0 drwxr-xr-x 4 root root 90 Feb 15 14:45 ..2982_15_02_14_45_53.797898431
0 drwxr-xr-x 4 root root 90 Feb 15 14:45 ..2982_15_02_14_45_54.421758226
0 drwxr-xr-x 4 root root 90 Feb 15 14:45 ..2982_15_02_14_45_56.209637705
0 drwxr-xr-x 4 root root 90 Feb 15 14:46 ..2982_15_02_14_46_00.970889748
0 drwxr-xr-x 4 root root 90 Feb 15 14:46 ..2982_15_02_14_46_08.301261923
[..]
0 drwxr-xr-x 4 root root 90 Feb 15 15:22 ..2982_15_02_15_22_01.877596759
0 drwxr-xr-x 4 root root 90 Feb 15 15:24 ..2982_15_02_15_24_01.626300874
0 drwxr-xr-x 4 root root 90 Feb 15 15:26 ..2982_15_02_15_26_01.042779297
0 drwxr-xr-x 4 root root 90 Feb 15 15:28 ..2982_15_02_15_28_01.708510604
0 drwxr-xr-x 4 root root 90 Feb 15 15:30 ..2982_15_02_15_30_01.032055163
0 drwxr-xr-x 4 root root 90 Feb 15 15:32 ..2982_15_02_15_32_01.089879198
0 drwxr-xr-x 4 root root 90 Feb 15 15:34 ..2982_15_02_15_34_02.798668133
0 lrwxrwxrwx 1 root root 31 Feb 15 15:34 ..data -> ..2982_15_02_15_34_02.798668133
4 drwxr-xr-x 2 root root 4096 Feb 15 14:45 apps.d
4 drwxr-xr-x 2 root root 4096 Feb 15 14:45 conf.d
0 lrwxrwxrwx 1 root root 21 Feb 15 14:45 fastcgi-params -> ..data/fastcgi-params
0 lrwxrwxrwx 1 root root 20 Feb 15 14:45 frontend.conf -> ..data/frontend.conf
0 lrwxrwxrwx 1 root root 17 Feb 15 14:45 nginx.conf -> ..data/nginx.conf
0 drwxrwxrwt 3 root root 120 Feb 15 14:45 ssl
YAML looks like this:
volumeMounts:
[..]
- name: default-nginx-config
mountPath: /etc/nginx
- name: default-nginx-slash-srv
mountPath: /srv
volumes:
[..]
- name: default-nginx-config
configMap:
name: web-frontend-default
items:
- key: fastcgi-params
path: fastcgi-params
- key: frontend.conf
path: frontend.conf
- key: nginx.conf
path: nginx.conf
- key: internal.conf
path: conf.d/internal.conf
- key: common-static-app.conf
path: conf.d/common-static-app.conf
- key: common-backends.conf
path: conf.d/common-backends.conf
- key: common-dynamic-app.conf
path: conf.d/common-dynamic-app.conf
- key: 00-generic.conf
path: apps.d/00-generic.conf
- key: default.conf
path: apps.d/default.conf
- name: default-nginx-slash-srv
configMap:
name: web-frontend-default
items:
- key: probe.html
path: probe.html
Any hint will be, of course, much appreciated :-)
Thank you
Well fixed :-)
Problem was two volumes mounted in the same target directory. k8s doesn't seem to like it.
Thank you Eric!
I was also having issues with two files being accessed before they were fully mounted. The workaround was making my ENTRYPOINT a bash script that simply moved them from the mount directory in the root level, to the actual file location they were being used, then calling the program binary.

reading from sensors based on softlinks

How do I read from these sensors? I just found their location, but the folder appears to contain softlinks to another location. My goal is to monitor the gyroscope.
$ ls /sys/bus/iio/devices/iio:device*
lrwxrwxrwx 1 root root 0 Jan 31 23:18 /sys/bus/iio/devices/iio:device0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-200073.1.auto/iio:device0
lrwxrwxrwx 1 root root 0 Jan 31 23:18 /sys/bus/iio/devices/iio:device1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-200076.2.auto/iio:device1
lrwxrwxrwx 1 root root 0 Jan 31 23:18 /sys/bus/iio/devices/iio:device2 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-200083.3.auto/iio:device2
lrwxrwxrwx 1 root root 0 Jan 31 23:18 /sys/bus/iio/devices/iio:device3 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-200086.4.auto/iio:device3
lrwxrwxrwx 1 root root 0 Jan 31 23:18 /sys/bus/iio/devices/iio:device4 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-20008a.5.auto/iio:device4
lrwxrwxrwx 1 root root 0 Jan 31 23:18 /sys/bus/iio/devices/iio:device5 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-200041.6.auto/iio:device5
Using cat:
$ cat /sys/bus/iio/devices/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-200073.1.auto/iio:device0
Here is a nice presentation on IIO subsystem.

Insert newline in html format using Powershell

I have the string value that has
. I want replace this with \n. and when I convert it to html format after each line comes to another line. But this not work.
$StdOut = 'total 40
drwxr-xr-x 3 root root 4096 Jun 16 14:55 .
drwxr-xr-x 5 root root 4096 Jun 16 14:54 ..
-rw------- 1 root root 0 Jun 16 14:55 cimserver_start.lock
srwxrwxrwx 1 root root 0
Jun 16 14:55 cim.socket
drwxr-xr-x 2 root root 4096 Jun 16 17:58 localauth
-rw------- 1 root root 6 Jun 16 14:55 scx-cimd.pid
'
$CResult = $StdOut -replace "
", "\n"
After using Convert-html I have the text like this :
'total 40\ndrwxr-xr-x 3 root root 4096 Jun 16 14:55 .\ndrwxr-xr-x 5 root root 4096 Jun 16 14:54 ..\n-rw------- 1 root root 0 Jun 16 14:55 cimserver_start.lock\nsrwxrwxrwx 1 root root 0 Jun 16 14:55
cim.socket\ndrwxr-xr-x 2 root root 4096 Jun 16 17:58 localauth\n-rw------- 1 root root 6 Jun 16 14:55 scx-cimd.pid\n
'
How can I do this?
The approach Mathias mentions works fine for newlines. But if you have (or could have) other entity refs then I would use the HtmlDecode method e.g.
Add-Assembly System.Web
[System.Web.HttpUtility]::HtmlDecode($StdOut)
Outputs:
total 40
drwxr-xr-x 3 root root 4096 Jun 16 14:55 .
drwxr-xr-x 5 root root 4096 Jun 16 14:54 ..
-rw------- 1 root root 0 Jun 16 14:55 cimserver_start.lock
srwxrwxrwx 1 root root 0
PS C:\WINDOWS\system32> Add-Assembly System.Web
Add-Assembly : The term 'Add-Assembly' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of
the name, or if
a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Add-Assembly System.Web
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Add-Assembly:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Try this
$null = [Reflection.Assembly]::LoadWithPartialName('System.Web')
[System.Web.HttpUtility]::HtmlDecode($StdOut)
Gives me
total 40
drwxr-xr-x 3 root root 4096 Jun 16 14:55 .
drwxr-xr-x 5 root root 4096 Jun 16 14:54 ..
-rw------- 1 root root 0 Jun 16 14:55 cimserver_start.lock
srwxrwxrwx 1 root root 0