tar: julia-xxx: Cannot create symlink to xxx: Operation not supported - azure

Trying to install Julia on a machine with the following specification:
Operating System: Ubuntu 18.04.6 LTS
Kernel: Linux 5.4.0-1090-azure
Architecture: x86-64
I ran:
tar -xvzf julia-1.6.7-linux-x86_64.tar.gz
and got several error messages that look like these:
julia-1.6.7/lib/libjulia.so
tar: julia-1.6.7/lib/libjulia.so: cannot create symlink to ‘libjulia.so.1.6’: operation not supported
julia-1.6.7/lib/julia/libgfortran.so
tar: julia-1.6.7/lib/julia/libgfortran.so: Cannot create symlink to ‘libgfortran.so.4.0.0’: Operation not supported
Any suggestion on how to solve these error messages are much appreciated.

The typical problem is that not all operating systems are supporting symlinks.
Try df -Th and look what is going on with the drive you are trying to install:
root#LGPSZ:~# df -Th
Filesystem Type Size Used Avail Use% Mounted on
...
/dev/sdc ext4 1007G 8.0G 948G 1% /
...
In the example above my root drive is an ext4 type which supports symlinks.
On the other hand a Windows file system could be mounted on your Linux machine which type is denoted as ntfs or vfat. Those file system do not support symbolic links and hence the tar command will fail.
P.S.
[ugly workaround for desperate cases] If you really need to use ntfs partition on a Linux system a brutal workaround could be untarring the file on an ext4 file system and then tarring it again using --deference option - in that case you would get a tar archive without symlniks (I have not tested it with Julia though but should work).

Related

How to mount NTFS in linux without fuseblk?

I need to check some data in linux kernel while mounting NTFS, but if I use
mkfs.ntfs
or
mkntfs
and then
mount -t ntfs ...
The string containing info about file system in kernel is "fuseblk", not "ntfs" that i need.
Maybe that's because of "ntfs-3g" packs that i installed, as i know it contains fuse drivers.
How to mount NTFS without fuse?
I tried to change options in "mount" or "mkfs", but nothing helped.
I just deleted ntfs-3g packages and it worked as i wanted... Stranger things.

system not booting after moving /usr directory

I run a Linux VM on VirtualBox and just made a mistake by moving the contents in /usr to a different partition mounted as /u01. My intention was to free up space for the / file system but realized I should have used cp instead of mv. It's not possible to run any command now. Is there any way I can recover the system?
Fixed by booting with iso image and mounting the root and restored the contents back to original partition.

How do I get an initrd made out of a cpio archive loaded as the root device by grub2 in a distro-agnostic way?

I'm building an LFS (Linux From Scratch) system in a VM and so far I've managed to get a workable, desktop system, booting from a known device, /dev/sda1 in my case. I'm now trying to make a live system that boots from an ISO image. Instead of using /dev/sr0 as the root, which I've already established is possible (and, since it's more likely to be used from a USB stick than an actual CD-ROM, is too inflexible) I've set my mind on booting it into an initrd root. The idea is to use that as the system's root instead of using it as a temporal root to load the "real" root, and since it's already in memory, it saves me the trouble of setting up a tmpfs root, copy all the files, and switch to it.
I had been previously been experimenting with a squashfs image as I had seen that Ubuntu seemed to use that and has what I needed: a small sized root, being faster to load, using less memory, and is fast (xz is SSLLOOWW to extract and gzip is slow to load). At first I was having trouble booting it, so i switched to the cpio based initrd. After some initial trouble due to missing files on the archive I did manage to boot it.
I left that aside for the time being (around a month ago) to do other tasks on the system. I lost the original GRUB2 settings and kernel config so went about doing it again but Ive been running into a brick wall. I'm hoping someone here might know what I'm missing.
When I boot up I never see any message about the loading of the initrd file, it goes straight into the loading, uncompressing and booting up of the kernel. And this ends up in a kernel panic with the message
VFS: cannot open root device "(null)" or unknown-block (1,0): error -6
Please append the correct "root=" boot option; here are the available partitions:
No partitions are shown and following that is the "kernel panic" message, just repeating the first line. If I use the "rootfstype=ramfs" I get:
VFS: mounted root (ramfs filesystem) readonly on device 0:15.
devtmpfs: error mounting -2
Essentially, it's mounting an EMPTY ramfs file system as root, so mounting the devtmpfs fails because the /dev entry doesn't exist. But certain I used that boot option before.
Here's my GRUB 2 config:
menuentry = "LFS (inird test)" {
linux /boot/kernel/initrd/linux ro rdinit=/etc/init
initrd /boot/kernel/initrd/root.cpio.gz
}
Yes, /boot/kernel/initrd/ directory entry exists, linux is the kernel (the bzimage file produced by compiling the kernel), and root.cpio.gz is my compressed initrd root cpio archive.
Here's my kernel's .config file (sorry can't paste it here).
If any more info is needed, don't hesitate to ask. That you.
OK, I managed to solve the problem! Apparently, it wasn't the kernel's configuration, GRUB2, or even the bootup sequence. It was the initrd archive itself. Deep in the bowels of the Linux kernel's configuration lied the answer: the archive must be built using cpio's --newc option. The one I built manually lacked this option, so the kernel was ignoring the archive and just proceeding with the normal boot procedure.
This came about because I managed to stumble across an older script I used to build them and saw all the options in it for cpio. I checked the much more recent script I hastily put together and double-checked the kernel documentation (as well as the init/do_mounts.c and init/initramfs.c files) and realized what was going on. I tried it with the corrections and the system now happily boots into the initrd with no problem! :D

"NTFS Signature is missing"

I am trying to mount two hard disks in a microserver running Centos 7.
Both disks contain large amounts of data and were previously used in a Windows machine so are NTFS format.
I have created two directories to use as mountpoints - /media/drive1 and /media/drive2. I have the EPEL repo installed and have installed ntfs-3g.
When I try mount -t ntfs-3g /dev/sda1 /media/drive1 I get the following:
NTFS signature is missing.
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a partition 9e.g. /dev/sda, not /dev/sda1)? Or the other way around?
I get the same error when trying to mount /dev/sdb1 to /media/drive2.
I am fairly new to Linux and this is the first time I have tried mounting an NTFS drive. Any help would be greatly appreciated.
Thanks

how to reset kernel while the device is booted up?

How to replace the contents of rootfs partition while the device is booted up?
I am using pine64 (1GB) with stripped debian version and struck in writing a factory reset script which will replace all files in the rootfs partition while the device is running? resident restore file could be tar or img file.
I have already tried two approaches
dd the partition from image to the partition on device.
sudo dd if=pine-debian.img skip=*start of rootfs partition* seek=*start of rootfs partition* of=/dev/mmcblk0
Extract the compressed content to the / directory.
sudo tar -C / -zxvf pine-debian.tar.gz
After both the approaches, the system can recognize any command, not even ls. Any help will be appreciated about how to solve this. how to replace fs content while the device is running?
Ideally, you should have two partitions each with a copy of the rootfs. You can write the partition that is currently not in use with dd, and then update the bootloader configuration to point to the just written partition as the root. swupdate supports such a dual-bank scenario, but it only has native support for U-Boot; if you use a different bootloader, you'll have to add a script to perform the swap.
If you really need to overwrite in-place, directly overwriting the partition is not possible because that filesystem is currently in use. Untarring will also fail because some files are currently in use - in particular libc. You could try to add the --unlink-first option to the untar command, but I'm not sure if that works.
Two other options:
Instead of overwriting the full rootfs, use Debian package upgrades. They have pre- and post-install scripts to make the upgrade safe.
Swap to a (temporary, small) in-RAM root filesystem to perform the upgrade. This root filesystem should just contain busybox and the script that performs the upgrade. You can either kill all processes and then do a pivot_root into the temporary rootfs, or you can use kexec --initrd=... to boot into the in-RAM root filesystem.

Resources