buildroot: No rootfs in rootfs.iso9660 image file - buildroot

I am trying to build my own USB Bootable Linux.
As far as I have understood the buildroot documentation, buildroot should give me ready-for-use images.
My output folder contains the following images:
build#build:~/buildroot_usb/output/images$ ls * -lh
-rw-r--r-- 1 root root 45M Sep 19 18:26 bzImage
-rw-r--r-- 1 root root 102M Sep 19 18:25 rootfs.cpio
-rw-r--r-- 1 root root 512M Sep 19 18:25 rootfs.ext2
lrwxrwxrwx 1 root root 11 Sep 19 18:25 rootfs.ext4 -> rootfs.ext2
-rw-r--r-- 1 root root 46M Sep 19 18:26 rootfs.iso9660
-rw-r--r-- 1 root root 111M Sep 19 18:26 rootfs.tar
-rw-r--r-- 1 root root 37M Sep 19 18:26 rootfs.tar.gz
syslinux:
insgesamt 164K
-rwxr-xr-x 1 root root 36K Sep 19 17:42 isolinux.bin
-rwxr-xr-x 1 root root 440 Sep 19 17:42 mbr.bin
-rwxr-xr-x 1 root root 124K Sep 19 17:42 syslinux.efi
build#build:~/buildroot_usb/output/images$
The rootfs.iso9600 image should be a Bootable ISO image. But the size of the file shows that the whole root file system is missing. it's only the kernel and the bootloader inside. (i checked that).
Config:

You have enabled to have the root filesystem as an initramfs inside the kernel image, so it gets compressed. If you look at your bzImage file (the kernel image), it's 45 MB, so it's definitely the kernel + the compressed root filesystem. Your ISO image is 46 MB, so it's basically just the kernel image + the bootloader, so it's all good.
Compare that to the size of the compressed rootfs tarball (rootfs.tar.gz), which is 37 MB in size. It all matches pretty well.
So, your 46 MB ISO image definitely contains the root filesystem, compressed as an initramfs inside the kernel image.

Related

How to create a symlink to point to latest rotating log file

I've my application log file which keeps rotating and it has a pattern like below
postgresql-yyyy-mm-dd_hhmmss.log
-rw-------. 1 root root 331 Jun 1 22:04 postgresql-2022-06-01_220333.log.gz
-rw-------. 1 root root 417 Jun 1 22:04 postgresql-2022-06-01_220430.log.gz
-rw-------. 1 root root 289 Jun 2 19:28 postgresql-2022-06-02_000000.log.gz
-rw-------. 1 root root 26802 Jun 2 19:50 postgresql-2022-06-02_192809.log.gz
-rw-------. 1 root root 8440 Jun 2 23:57 postgresql-2022-06-02_195044.log.gz
-rw-------. 1 root root 15016 Jun 3 11:22 postgresql-2022-06-03_000000.log.gz
-rw-------. 1 root root 291 Jun 3 11:24 postgresql-2022-06-03_112405.log.gz
-rw-------. 1 root root 336 Jun 3 11:25 postgresql-2022-06-03_112553.log.gz
-rw-------. 1 root root 397 Jun 3 11:27 postgresql-2022-06-03_112714.log.gz
-rw-------. 1 root root 358 Jun 3 11:29 postgresql-2022-06-03_112901.log.gz
-rw-------. 1 root root 493 Jun 3 11:30 postgresql-2022-06-03_113031.log.gz
-rw-------. 1 root root 418 Jun 3 11:34 postgresql-2022-06-03_113354.log.gz
-rw-------. 1 root root 419 Jun 3 11:39 postgresql-2022-06-03_113920.log.gz
-rw-------. 1 root root 416 Jun 3 11:44 postgresql-2022-06-03_114437.log.gz
-rw-------. 1 root root 417 Jun 3 11:49 postgresql-2022-06-03_114943.log.gz
-rw-------. 1 root root 419 Jun 3 11:55 postgresql-2022-06-03_115530.log.gz
-rw-------. 1 root root 16961 Jun 3 23:56 postgresql-2022-06-03_120047.log.gz
-rw-------. 1 root root 35470 Jun 4 23:56 postgresql-2022-06-04_000000.log.gz
-rw-------. 1 root root 406059 Jun 5 17:56 postgresql-2022-06-05_000000.log
I want to run a small script(unix/linux) such that it creates a symlink in this folder which always points to the latest(current) logfile automatically for e.g
postgres.LOG -> postgresql-2022-06-05_000000.log
This way I don't have to ls and find out what is the current log file before opening, instead just open postgres.LOG.
All rotated logfiles seem gzipped so the glob postgresql-*.log will expand to the logfile of interest:
ln -sf postgresql-*.log postgres.LOG
If you want the symbolic link to be changed automatically each time a new log file is created you need inotify.
Something like this
#! /bin/bash
log_dir=/your/log/dir
inotifywait -m -e create "$log_dir" | while read -r _dir event file
do
if [[ ! -h "$log_dir/$file" && "$file" =~ \.log$ ]]
then
ln -sf "$log_dir/$file" "$log_dir/postgres.LOG"
fi
done
The format of the filename makes sure that the newest file sorts as last using ls. So this should work:
ln -sf $(ls postgresql-*.log | tail -1) postgres.LOG

cannot create directory for 'local::lib'

I have installed local::lib from cpan. But the manually one more again to make bootstrap - perl Makefile.PL −−bootstrap. And although I have already a file lib.pm here /usr/share/perl5/local/lib.pm, it when trying to bootstrap it (with the command mentioned above) this error rises:
Loading internal logger. Log::Log4perl recommended for better logging
Attempting to create directory /home/shepherd/perl5
Unable to create /home/shepherd/perl5/lib/perl5/5.28.0: No such file or directory at /usr/share/perl5/local/lib.pm line 717.
So if I have installed the module, and have it may dir, why the bootstrap cannot create /home/shepherd/perl5/lib/perl5/5.28.0 ?
I have and own this files:
ls -l ~/perl5
drwxrwxr-x 2 root root 4096 Nov 18 23:03 bin
drwxrwxr-x 3 root root 4096 Oct 28 18:52 lib
drwxrwxr-x 4 root root 4096 Oct 28 18:52 man
ls -l ~/perl5/lib
drwxrwxr-x 25 root root 4096 Nov 21 08:56 perl5
ls -l ~perl5/lib/perl5
drwxrwxr-x 2 root root 4096 Nov 20 19:54 B
drwxrwxr-x 3 root root 4096 Nov 21 08:56 Business
drwxrwxr-x 3 root root 4096 Oct 28 19:08 Class
drwxrwxr-x 2 root root 4096 Nov 20 19:54 Config
drwxrwxr-x 3 root root 4096 Oct 28 19:09 Devel
drwxrwxr-x 2 root root 4096 Oct 28 19:08 Dist
drwxrwxr-x 3 root root 4096 Nov 20 19:54 File
drwxrwxr-x 2 root root 4096 Nov 20 19:54 Hook
-r--r--r-- 1 root root 42537 Feb 18 2018 Importer.pm
drwxrwxr-x 3 root root 4096 Oct 28 19:10 IPC
drwxrwxr-x 3 root root 4096 Nov 18 23:03 Log
drwxrwxr-x 3 root root 4096 Nov 20 20:48 Mac
drwxrwxr-x 3 root root 4096 Oct 28 19:09 MIME
drwxrwxr-x 3 root root 4096 Oct 28 18:52 Module
-r--r--r-- 1 root root 967 Sep 6 16:40 ok.pm
drwxrwxr-x 2 root root 4096 Nov 19 23:13 OLE
drwxrwxr-x 3 root root 4096 Oct 28 19:08 Perl
drwxrwxr-x 3 root root 4096 Oct 28 19:09 POD2
drwxrwxr-x 2 root root 4096 Oct 28 19:09 Scope
drwxrwxr-x 2 root root 4096 Nov 20 19:56 String
drwxrwxr-x 2 root root 4096 Nov 20 19:54 Task
drwxrwxr-x 3 root root 4096 Oct 28 19:09 Term
drwxrwxr-x 9 root root 4096 Nov 20 19:54 Test
drwxrwxr-x 10 root root 4096 Oct 28 19:09 Test2
-r--r--r-- 1 root root 6393 Sep 6 16:40 Test2.pm
drwxrwxr-x 7 root root 4096 Nov 20 19:55 x86_64-linux-gnu-thread-multi
local::lib misreports the error reason. In this particular case, the problem is that the user running the program (shepherd) doesn't have permission to write to /home/shepherd/perl5/lib/perl5 in order to create /home/shepherd/perl5/lib/perl5/5.28.0.
The user will need to be granted the ability to write to that directory. This should probably be done by changing the ownership of the files from root to shepherd.
chown -R shepherd:shepherd ~/perl5

Install latest android support library CLI

I am trying to use ContextCompat class from the Android Support Library. I am using only CLI tools to build an app. So I figured I have to get a jar. I entered the following:
$ sdkmanager --list | grep extras
Warning: File /root/.android/repositories.cfg could not be loaded.
extras;android;m2repository | 47.0.0 | Android Support Repository | extras/android/m2repository/
extras;android;gapid;1 | 1.0.3 | GPU Debugging tools
extras;android;gapid;3 | 3.1.0 | GPU Debugging tools
extras;android;m2repository | 47.0.0 | Android Support Repository
$ sdkmanager "extras;android;m2repository"
$ ls /opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/26.0.0-alpha1/*
-rw-r--r-- 1 root root 1767 Sep 12 16:16 /opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/26.0.0-alpha1/support-v4-26.0.0-alpha1.aar
-rw-r--r-- 1 root root 32 Sep 12 16:16 /opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/26.0.0-alpha1/support-v4-26.0.0-alpha1.aar.md5
-rw-r--r-- 1 root root 40 Sep 12 16:16 /opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/26.0.0-alpha1/support-v4-26.0.0-alpha1.aar.sha1
-rw-r--r-- 1 root root 1572 Sep 12 16:16 /opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/26.0.0-alpha1/support-v4-26.0.0-alpha1.pom
-rw-r--r-- 1 root root 32 Sep 12 16:16 /opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/26.0.0-alpha1/support-v4-26.0.0-alpha1.pom.md5
-rw-r--r-- 1 root root 40 Sep 12 16:16 /opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/26.0.0-alpha1/support-v4-26.0.0-alpha1.pom.sha1
-rw-r--r-- 1 root root 261 Sep 12 16:16 /opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/26.0.0-alpha1/support-v4-26.0.0-alpha1-sources.jar
-rw-r--r-- 1 root root 32 Sep 12 16:16 /opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/26.0.0-alpha1/support-v4-26.0.0-alpha1-sources.jar.md5
-rw-r--r-- 1 root root 40 Sep 12 16:16 /opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/26.0.0-alpha1/support-v4-26.0.0-alpha1-sources.jar.sha1
The problem is, I cannot see any jar files of the latest Android Support Library. What should I do to download it?
The folder /opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/24.1.1 in my case contained about 2MB aar file, which contained classes.jar file, which I finally and ended up using. It is unclear what is the purpose of other low-size files in the other folders like 26.0.0.

Command 'scala' not found on Ubuntu 18.04

I downloaded scala,unpacked it and copied to /usr/local/share
After that,I edited ~/.bashrc
export SCALA_HOME=/usr/local/share/scala-2.12.8
export PATH=$PATH:$SCALA_HOME/bin
Anyway,it does not work.
scala -version
Command 'scala' not found, but can be installed with:
sudo apt install scala
I could go for apt install but I don't get it what is wrong.
/usr/local/share$ ll
total 48
drwxr-xr-x 12 root root 4096 јул 1 06:03 ./
drwxr-xr-x 14 root root 4096 јун 23 18:04 ../
drwxr-xr-x 2 root root 4096 апр 21 08:04 appdata/
drwxr-xr-x 2 root root 4096 јун 25 21:03 applications/
drwxr-xr-x 2 root root 4096 јул 25 2018 ca-certificates/
drwxrwsr-x 3 root staff 4096 јул 25 2018 emacs/
drwxrwsr-x 2 root staff 4096 јул 25 2018 fonts/
drwxr-xr-x 3 root root 4096 апр 19 08:44 lua/
drwxr-xr-x 2 root root 4096 јул 25 2018 man/
drwxrwxr-x 6 miki miki 4096 дец 4 2018 scala-2.12.8/
drwxrwsr-x 7 root staff 4096 мај 14 15:05 sgml/
drwxrwsr-x 6 root staff 4096 мај 14 15:05 xml/
Editing .bashrc won't affect an already open shell. You could explicitly source it (source ~/.bashrc) to have it take effect, or open a new shell to reload it.

How to create mongodb package to install with apt-get on Ubuntu?

I'm building MongoDb from the sources (https://github.com/mongodb/mongo.git) and now want to package it as a .deb package such that I can install it on other Ubuntu machines using apt-get. Building it on Ubuntu 12.04.4 x64 is not the problem, but I cannot figure out how to create a .deb package from it.
The 'debian' directory in the checkout from git contain .rules and .control files but what command(s) must I invoke to create a package for the mongodb-enterprise version? Since all control files seem to be present I'd assume it's a matter of just running a command, but I cannot find it in the documentation or on the mongodb website. Also read the documenatation that TeTeT mentioned in the comments, but then I'd need to start form scratch to create the package and all that is needed already seems to be part of the 'debian' directory... just can figure out how to use it to build the package.
I did try using the dh_builddeb command, but that reported that the .control files is not a debian format archive.
The 'debian' directory contains the following files:
root#buildmongo:/mongobuild/mongo# ls -l debian/
total 424
-rw-r--r-- 1 root root 4001 Jul 25 16:12 bsondump.1
-rw-r--r-- 1 root root 5077 Jul 25 16:12 changelog
-rw-r--r-- 1 root root 2 Jul 25 16:12 compat
-rw-r--r-- 1 root root 483 Jul 25 16:12 copyright
-rw-r--r-- 1 root root 33 Jul 25 16:12 dirs
-rw-r--r-- 1 root root 39 Jul 25 16:12 files
-rw-r--r-- 1 root root 8216 Jul 25 16:12 init.d
-rw-r--r-- 1 root root 891 Jul 25 16:12 lintian-overrides
-rw-r--r-- 1 root root 16595 Jul 25 16:12 mongo.1
-rw-r--r-- 1 root root 39099 Jul 25 16:12 mongod.1
-rw-r--r-- 1 root root 1693 Jul 25 16:12 mongod.conf
-rw-r--r-- 1 root root 1676 Jul 25 16:12 mongod.upstart
-rw-r--r-- 1 root root 154 Jul 25 16:12 mongodb-enterprise-server.docs
-rw-r--r-- 1 root root 1441 Jul 25 16:12 mongodb-enterprise-server.postinst
-rw-r--r-- 1 root root 154 Jul 25 16:12 mongodb-enterprise-unstable-server.docs
-rw-r--r-- 1 root root 1441 Jul 25 16:12 mongodb-enterprise-unstable-server.postinst
-rw-r--r-- 1 root root 14760 Jul 25 16:12 mongodb-enterprise-unstable.control
-rw-r--r-- 1 root root 4524 Jul 25 16:12 mongodb-enterprise-unstable.rules
-rw-r--r-- 1 root root 14845 Jul 25 16:12 mongodb-enterprise.control
-rw-r--r-- 1 root root 4226 Jul 25 16:12 mongodb-enterprise.rules
-rw-r--r-- 1 root root 1441 Jul 25 16:12 mongodb-org-server.postinst
-rw-r--r-- 1 root root 1441 Jul 25 16:12 mongodb-org-unstable-server.postinst
-rw-r--r-- 1 root root 14704 Jul 25 16:12 mongodb-org-unstable.control
-rw-r--r-- 1 root root 4345 Jul 25 16:12 mongodb-org-unstable.rules
-rw-r--r-- 1 root root 14839 Jul 25 16:12 mongodb-org.control
-rw-r--r-- 1 root root 4049 Jul 25 16:12 mongodb-org.rules
-rw-r--r-- 1 root root 16840 Jul 25 16:12 mongodump.1
-rw-r--r-- 1 root root 19099 Jul 25 16:12 mongoexport.1
-rw-r--r-- 1 root root 14153 Jul 25 16:12 mongofiles.1
-rw-r--r-- 1 root root 16065 Jul 25 16:12 mongoimport.1
-rw-r--r-- 1 root root 13347 Jul 25 16:12 mongooplog.1
-rw-r--r-- 1 root root 5825 Jul 25 16:12 mongoperf.1
-rw-r--r-- 1 root root 16644 Jul 25 16:12 mongorestore.1
-rw-r--r-- 1 root root 23535 Jul 25 16:12 mongos.1
-rw-r--r-- 1 root root 5388 Jul 25 16:12 mongosniff.1
-rw-r--r-- 1 root root 15941 Jul 25 16:12 mongostat.1
-rw-r--r-- 1 root root 12415 Jul 25 16:12 mongotop.1
-rw-r--r-- 1 root root 932 Jul 25 16:12 postrm
-rw-r--r-- 1 root root 692 Jul 25 16:12 preinst
-rw-r--r-- 1 root root 894 Jul 25 16:12 prerm
-rw-r--r-- 1 root root 329 Jul 25 16:12 watch
(I'm building MongoDb because I need SSL support and do not need a support contract with Mongo. If I understand it correct you can only use the enterprise version (supports SSL) downloaded from the mongodb site if you signup for a support contract. )
Regards,
Gero
Upstream packaging is rarely better than maintainer's one so I would get source package from Debian:
apt-get install devscripts
dget -ux http://http.debian.net/debian/pool/main/m/mongodb/mongodb_2.4.10-2.dsc
cd mongodb-2.4.10/
## install Build-Depends (extracted from "debian/control"):
sudo apt-get install debhelper dh-systemd libboost-date-time-dev libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libgoogle-perftools-dev libpcap-dev libpcre3-dev libreadline-dev libsnappy-dev libstemmer-dev libssl-dev libv8-dev python-pymongo scons
debuild -uc -b
I'm with Debian so I did not test the above procedure on Ubuntu (which I don't recommend).
If package did not build (due to lack of build dependencies etc.) then you may choose a different suite from the following page
https://packages.debian.org/search?searchon=sourcenames&keywords=mongodb
and try to fetch an older DSC file.
Good luck.