Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] systemd: root partition valid root
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
fresherthanever
n00b
n00b


Joined: 11 Nov 2013
Posts: 40
Location: Houston

PostPosted: Sun Nov 17, 2013 10:22 pm    Post subject: [solved] systemd: root partition valid root Reply with quote

Sorry if this doesn't belong here as openrc is packaged with Gentoo as opposed to systemd.

I just got my brand new UEFI Gentoo box running (using rEFInd 0.5.0, upgrading after I get my box working), however I decided to migrate to systemd since I felt it was lower maintenance and more monolithic, but it doesn't start at boot (issuing "systemd" through root seems to get me something about how I didn't get it up during boot and so it won't run). Then I thought it may have been kernel command line options or possibly options in my rEFInd configuration that I was missing, but I couldn't find any documentation on it.

When I added "root=/dev/sda4 init=/usr/lib/systemd/systemd", my system thinks /dev/sda4 is not a suitable root partition, although "root=/dev/sda4" works fine as before.

TL;DR: I can't get systemd to start on boot, what kernel/rEFInd options do I need to pass?

In addition, I am having problems with wifi starting on boot as well as my WM, but I will provide corresponding links to those threads when I feel I have the appropriate time and information on them.

EDIT: READ HERE FIRST FOR THE ISSUE AT HAND:
Once again, apologies if this doesn't belong here :P

I was migrating from openrc to systemd (just for some additional feature support which I found appealing), so I purged udev and emerged systemd (also I use dbus), as I was told udev was packaged in systemd. However, after installation, I at first couldn't get systemd to start at boot, so I removed /sbin/init and symlinked /usr/lib/systemd/systemd at /sbin/init. Upon reboot, it said that "/dev/sda4 is not a valid root device" and that the filesystem doesn't reflect a / partition. OpenRC booted fine before with normal kernel options (I use pf-sources with BFQ/BFS/TuxOnIce).

I use rEFInd 0.5.0 as my EFI stub bootloader, and I use an initramfs loaded into kernel by cpio since I have a separate /usr partition. There are no dmesg messages due to it not mounting /. In addition, I've all required options for systemd and recommended options and double checked it with the Gentoo WIki.

It seems clear that it is a systemd problem as it only happens when I try to initiate systemd at boot (init=/usr/lib/systemd/systemd in kernel command line or ln -s /usr/lib/systemd/systemd /sbin/init), so I am very curious on what is breaking my system.

Thanks! :)
_________________
Specs: AMD FX-6100|ASUS M5A97 AM3+|XFX AMD Radeon HD 6870|1TB 7200RPM/500GB 7200RPM|8GB DDR3 1600MHz


Last edited by fresherthanever on Tue Nov 19, 2013 2:27 am; edited 2 times in total
Back to top
View user's profile Send private message
TomWij
Retired Dev
Retired Dev


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sun Nov 17, 2013 11:00 pm    Post subject: Reply with quote

You can alternatively symlink /sbin/init to it instead of adjusting the kernel parameter.
Back to top
View user's profile Send private message
fresherthanever
n00b
n00b


Joined: 11 Nov 2013
Posts: 40
Location: Houston

PostPosted: Sun Nov 17, 2013 11:36 pm    Post subject: Reply with quote

TomWij wrote:
You can alternatively symlink /sbin/init to it instead of adjusting the kernel parameter.


Thanks, TomWij!

I replaced the /sbin/init symlink - but it seems as though there may be something wrong with systemd and/or its udev (as I was forced to purge that one) and/or the initramfs I've installed on my computer. System still tells me: "/dev/sda4 is not a valid root device" or something like that (using UEFI and GPT partitions). Any ideas?

Currently changing kernel commands to "root=PARTUUID=blahblah" to see if that fixes the problem.
_________________
Specs: AMD FX-6100|ASUS M5A97 AM3+|XFX AMD Radeon HD 6870|1TB 7200RPM/500GB 7200RPM|8GB DDR3 1600MHz
Back to top
View user's profile Send private message
TomWij
Retired Dev
Retired Dev


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sun Nov 17, 2013 11:55 pm    Post subject: Reply with quote

That's odd. Do you have CONFIG_TMPFS, CONFIG_DEVTMPFS and CONFIG_DEVTMPFS_MOUNT enabled in the kernel as it should be?
Back to top
View user's profile Send private message
fresherthanever
n00b
n00b


Joined: 11 Nov 2013
Posts: 40
Location: Houston

PostPosted: Mon Nov 18, 2013 12:15 am    Post subject: Reply with quote

TomWij wrote:
That's odd. Do you have CONFIG_TMPFS, CONFIG_DEVTMPFS and CONFIG_DEVTMPFS_MOUNT enabled in the kernel as it should be?


Yes. I also run an initramfs created by genkernel (xzcat into cpio and added into kernel EFI stub), would this affect it not detecting my root drive (/dev/sda4)? It tells me "Filesystem is not a valid root partition" or something similar to that. I have ext2/3/4 all compiled in the kernel (not as modules). Parted confirms this. It booted fine while I had openrc and udev individually installed on my system, but systemd seems to be borking on me..

Quote:
Number Start End Size File system Name Flags
1 1049kB 500MB 499MB fat32 ESI boot
2 500MB 2000MB 1499MB ext2 primary
3 2000MB 3000MB 1000MB linux-swap(v1) primary
4 3000MB 240GB 237GB ext4 primary
5 240GB 500GB 260GB ext4 primary


rEFInd shouldn't affect me booting improperly after it loads the kernel, would it? dmesg shows nothing as it couldn't mount / properly :/ Currently adding rootfstype=ext4 to command line opts...

Thanks for the help :)
_________________
Specs: AMD FX-6100|ASUS M5A97 AM3+|XFX AMD Radeon HD 6870|1TB 7200RPM/500GB 7200RPM|8GB DDR3 1600MHz
Back to top
View user's profile Send private message
TomWij
Retired Dev
Retired Dev


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Mon Nov 18, 2013 12:23 am    Post subject: Reply with quote

It could affect it maybe; I don't use these things (genkernel initramfs, cpio, EFI, ...) so, I don't know the details.
Back to top
View user's profile Send private message
fresherthanever
n00b
n00b


Joined: 11 Nov 2013
Posts: 40
Location: Houston

PostPosted: Mon Nov 18, 2013 12:57 am    Post subject: Reply with quote

Topic title changed to reflect the issue at hand. It seems to be a solely systemd issue.
_________________
Specs: AMD FX-6100|ASUS M5A97 AM3+|XFX AMD Radeon HD 6870|1TB 7200RPM/500GB 7200RPM|8GB DDR3 1600MHz
Back to top
View user's profile Send private message
Kompi
Apprentice
Apprentice


Joined: 05 Oct 2002
Posts: 252
Location: Germany

PostPosted: Mon Nov 18, 2013 1:03 am    Post subject: Reply with quote

This might be an issue with genkernel. As far a short search in the forums reveals, this is an error message from the genkernel's initramfs when attempting to mount the root device before starting the init. The initramfs seems to not recognize it as a root partition for some reason. That could either be because that block device does not exist (could be the case if the ata controller driver is missing), wrong filesystem or missing support in kernel or modules in the initrd, or it does not find an init.

I'm not sure if that is still the case as I have switched away from genkernel to dracut generated initrd's, but I remember that genkernel images used to require an additional "real_root=" kernel parameter in some cases, rather than just the "root=". You may try adding "real_root=/dev/sda4". Also, I remember that I used "real_init" with genkernel. This distinction was AFAIK introduced due to the fact that the kernel uses these to determine what to start in the initrd, while the initrd would use the real_* ones start the actual root. As I said I'm not sure, but I think this is no longer required in newer versions of genkernel, but it won't hurt to try.

If that does not help I would try to re-generate the initrd with all modules included. (genkernel --all-ramdisk-modules), just to be sure that there isn't anything compiled as module that is needed to set up the block device and filesystem etc. If that helps you might want to have a look what you need to include in the kernel, if you don't want modules in your initramfs.

Aside from that I would suggest considering to switch to dracut to generate the initrd. If you emerge it with the "systemd" USE flag you get systemd also in the initrd, which can hand off some stuff to the systemd in your root and prevent doing some things twice. Also, it has very good capabilities to debug what is going wrong if your root cannot be mounted (for example, you can get a shell at any step by providing some kernel parameters, see "man dracut.cmdline" and look for rd.shell and rd.break parameters).
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Mon Nov 18, 2013 1:12 am    Post subject: Reply with quote

If you change to a systemd profile you will see genkernel masked for use with systemd. dracut is a working alternative: dracut /boot/some-name $(uname -r)
Dracut has no real_root but root=/dev/sda4


Last edited by ulenrich on Mon Nov 18, 2013 1:17 am; edited 1 time in total
Back to top
View user's profile Send private message
Kompi
Apprentice
Apprentice


Joined: 05 Oct 2002
Posts: 252
Location: Germany

PostPosted: Mon Nov 18, 2013 1:13 am    Post subject: Reply with quote

Oh, and BTW: You only need an initramfs at all if you either need to load modules or setup stuff like LVM, dm-crypt before your root is mountable. (or you have a separate /usr partition). As it does not look like you use any of these, you might go without an initramfs alltogether. Just make sure everything is compiled into the kernel that is needed to get the /dev/sda4 and the filesystem mountable (i.e. ext4 compiled in). If you already have all that, you might just try to boot without the initrd.

As with udev: Systemd is bundled with udev, that is why you had to unmerge the separate sys-apps/udev package. If you have systemd installed, you should have udev and be fine.

And one more silly idea: You do have the GPT-Partition type compiled into the kernel, right?
Back to top
View user's profile Send private message
fresherthanever
n00b
n00b


Joined: 11 Nov 2013
Posts: 40
Location: Houston

PostPosted: Tue Nov 19, 2013 12:19 am    Post subject: Reply with quote

Kompi wrote:
Oh, and BTW: You only need an initramfs at all if you either need to load modules or setup stuff like LVM, dm-crypt before your root is mountable. (or you have a separate /usr partition). As it does not look like you use any of these, you might go without an initramfs alltogether. Just make sure everything is compiled into the kernel that is needed to get the /dev/sda4 and the filesystem mountable (i.e. ext4 compiled in). If you already have all that, you might just try to boot without the initrd.

As with udev: Systemd is bundled with udev, that is why you had to unmerge the separate sys-apps/udev package. If you have systemd installed, you should have udev and be fine.

And one more silly idea: You do have the GPT-Partition type compiled into the kernel, right?



Well, I am using a separate /usr partition.

I emerged dracut and created a new initramfs. It also seems that xzcat doesn't recognize *.img files, so I switched it to gzip compression in kernel options, rebuilt and copied in place. Immediately as I booted into the system, it kernel panicked with Kernel Panic: Not syncing: VFS unable to mount root FS to block unknown block hd(8,4)". I installed dracut with all features and compressed it to initramfs.cpio which is the initramfs source directory in kernel. I'm too tired to diagnose the problem right now but I'll probably be able to solve the problem on my own later.
_________________
Specs: AMD FX-6100|ASUS M5A97 AM3+|XFX AMD Radeon HD 6870|1TB 7200RPM/500GB 7200RPM|8GB DDR3 1600MHz
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Tue Nov 19, 2013 12:40 am    Post subject: Reply with quote

Just:
dracut <name-your-initrd> <kernel-version>

To view:
lsinitrd <name-your-initrd>

I told you above ... no cpio, no real_root
Back to top
View user's profile Send private message
fresherthanever
n00b
n00b


Joined: 11 Nov 2013
Posts: 40
Location: Houston

PostPosted: Tue Nov 19, 2013 2:27 am    Post subject: Reply with quote

Well, I fixed it! Turns out I compiled USE="systemd" instead of DRACUT_MODULES="systemd" (which I find silly). Recompiled, rebuilt initramfs and it ran like a dream. Marked as solved.

ulenrich wrote:
Just:
dracut <name-your-initrd> <kernel-version>

To view:
lsinitrd <name-your-initrd>

I told you above ... no cpio, no real_root


It should be worthy to note that for those using EFI stub kernel (particularly rEFInd users) need to compile a .cpio through zcat/xzcat to /boot of the dracut initramfs because EFI doesn't support initramfs.

Thanks guys!
_________________
Specs: AMD FX-6100|ASUS M5A97 AM3+|XFX AMD Radeon HD 6870|1TB 7200RPM/500GB 7200RPM|8GB DDR3 1600MHz
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Tue Nov 19, 2013 11:43 am    Post subject: Reply with quote

fresherthanever wrote:
It should be worthy to note that for those using EFI stub kernel (particularly rEFInd users) need to compile a .cpio through zcat/xzcat to /boot of the dracut initramfs because EFI doesn't support initramfs.
Nonsense, have you tried:
/boot/efi/EFI/refind/refind.conf
Code:
menuentry Gentoo.new {
    ostype Linux
    icon    EFI/refind/icons/os_gentoo.icns
    volume  EFI
    graphics off
    loader  Gentoo.new/vmlinuz
    initrd  Gentoo.new/initrd
    options "root=/dev/sda7 rootfstype=ext4"
}
menuentry Gentoo.old {
    ostype Linux
    icon    EFI/refind/icons/os_gentoo.icns
    volume  EFI
    graphics off
    loader  Gentoo.old/vmlinuz
    initrd  Gentoo.old/initrd
    options "root=/dev/sda7 rootfstype=ext4"
}

Where the efi partition is mounted at /boot/efi
And refind installed at /boot/efi/EFI/refind/
Kernels and initrd residing at /boot/efi/Gentoo.{old,new}/

If it not works, it is a bug! Ping srs5694
(Me using gummiboot at the moment)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum